Dear All,
This is my first time touching Perl. Could anyone explain what does the following error means and how could i resolve it?
"Prototype mismatch: sub main::prompt ($;$) vs none at inc/Module/Install.pm line 146."
Appreciate your help on this. Thanks a million.
8 11518
Dear All,
This is my first time touching Perl. Could anyone explain what does the following error means and how could i resolve it?
"Prototype mismatch: sub main::prompt ($;$) vs none at inc/Module/Install.pm line 146."
Appreciate your help on this. Thanks a million.
Hi,
It is look like You have probably defined a function named "prompt" elsewhere in your program, the install.pm module tries to export its function "prompt",Perl
reports a clash.
KevinADC 4,059
Recognized Expert Specialist
Never seen that error before but look into what manimarank suggests. On a side note, there is practically zero reasons to use prototypes in your perl scripts, I would just drop the prototyping, which is the () after a function name:
just use a regular function:
unless you really do need a prototype for some good reason.
Hi,
It is look like You have probably defined a function named "prompt" elsewhere in your program, the install.pm module tries to export its function "prompt",Perl
reports a clash.
Hi Manimarank,
Thanks for your reply. I have extracted the code from my program and attached below: - #line 1
-
package Module::Install;
-
-
# For any maintainers:
-
# The load order for Module::Install is a bit magic.
-
# It goes something like this...
-
#
-
# IF ( host has Module::Install installed, creating author mode ) {
-
# 1. Makefile.PL calls "use inc::Module::Install"
-
# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::In
-
stall
-
# 3. The installed version of inc::Module::Install loads
-
# 4. inc::Module::Install calls "require Module::Install"
-
# 5. The ./inc/ version of Module::Install loads
-
# } ELSE {
-
# 1. Makefile.PL calls "use inc::Module::Install"
-
# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
-
# 3. The ./inc/ version of Module::Install loads
-
# }
-
-
use 5.004;
-
use strict 'vars';
-
-
use vars qw{$VERSION};
-
BEGIN {
-
# All Module::Install core packages now require synchronised versions.
-
# This will be used to ensure we don't accidentally load old or
-
# different versions of modules.
-
# This is not enforced yet, but will be some time in the next few
-
# releases once we can make sure it won't clash with custom
-
# Module::Install extensions.
-
$VERSION = '0.64';
-
}
-
-
# Whether or not inc::Module::Install is actually loaded, the
-
# $INC{inc/Module/Install.pm} is what will still get set as long as
-
# the caller loaded module this in the documented manner.
-
# If not set, the caller may NOT have loaded the bundled version, and thus
-
# they may not have a MI version that works with the Makefile.PL. This would
-
# result in false errors or unexpected behaviour. And we don't want that.
-
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
-
unless ( $INC{$file} ) {
-
die <<"END_DIE";
-
Please invoke ${\__PACKAGE__} with:
-
-
use inc::${\__PACKAGE__};
-
-
not:
-
-
use ${\__PACKAGE__};
-
-
END_DIE
-
}
-
-
# If the script that is loading Module::Install is from the future,
-
# then make will detect this and cause it to re-run over and over
-
# again. This is bad. Rather than taking action to touch it (which
-
# is unreliable on some platforms and requires write permissions)
-
# for now we should catch this and refuse to run.
-
if ( -f $0 and (stat($0))[9] > time ) {
-
die << "END_DIE";
-
Your installer $0 has a modification time in the future.
-
-
This is known to create infinite loops in make.
-
-
Please correct this, then run $0 again.
-
-
END_DIE
-
}
-
-
use Cwd ();
-
use File::Find ();
-
use File::Path ();
-
use FindBin;
-
-
*inc::Module::Install::VERSION = *VERSION;
-
@inc::Module::Install::ISA = __PACKAGE__;
-
-
sub autoload {
-
my $self = shift;
-
my $who = $self->_caller;
-
my $cwd = Cwd::cwd();
-
my $sym = "${who}::AUTOLOAD";
-
$sym->{$cwd} = sub {
-
my $pwd = Cwd::cwd();
-
if ( my $code = $sym->{$pwd} ) {
-
# delegate back to parent dirs
-
goto &$code unless $cwd eq $pwd;
-
}
-
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
-
unshift @_, ($self, $1);
-
goto &{$self->can('call')} unless uc($1) eq $1;
-
};
-
}
-
-
sub import {
-
my $class = shift;
-
my $self = $class->new(@_);
-
my $who = $self->_caller;
-
-
unless ( -f $self->{file} ) {
-
require "$self->{path}/$self->{dispatch}.pm";
-
File::Path::mkpath("$self->{prefix}/$self->{author}");
-
$self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self
-
);
-
$self->{admin}->init;
-
@_ = ($class, _self => $self);
-
goto &{"$self->{name}::import"};
-
}
-
-
*{"${who}::AUTOLOAD"} = $self->autoload;
-
$self->preload;
-
-
# Unregister loader and worker packages so subdirs can use them again
-
delete $INC{"$self->{file}"};
-
delete $INC{"$self->{path}.pm"};
-
}
-
-
sub preload {
-
my ($self) = @_;
-
-
unless ( $self->{extensions} ) {
-
$self->load_extensions(
-
"$self->{prefix}/$self->{path}", $self
-
);
-
}
-
-
my @exts = @{$self->{extensions}};
-
unless ( @exts ) {
-
my $admin = $self->{admin};
-
@exts = $admin->load_all_extensions;
-
}
-
-
my %seen;
-
foreach my $obj ( @exts ) {
-
while (my ($method, $glob) = each %{ref($obj) . '::'}) {
-
next unless $obj->can($method);
-
next if $method =~ /^_/;
-
next if $method eq uc($method);
-
$seen{$method}++;
-
}
-
}
-
-
my $who = $self->_caller;
-
foreach my $name ( sort keys %seen ) {
-
*{"${who}::$name"} = sub {
-
${"${who}::AUTOLOAD"} = "${who}::$name";
-
goto &{"${who}::AUTOLOAD"};
-
};
-
}
-
}
-
-
sub new {
-
my ($class, %args) = @_;
-
-
# ignore the prefix on extension modules built from top level.
-
my $base_path = Cwd::abs_path($FindBin::Bin);
-
unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
-
delete $args{prefix};
-
}
-
-
return $args{_self} if $args{_self};
-
-
$args{dispatch} ||= 'Admin';
-
$args{prefix} ||= 'inc';
-
$args{author} ||= ($^O eq 'VMS' ? '_author' : '.author');
-
$args{bundle} ||= 'inc/BUNDLES';
-
$args{base} ||= $base_path;
-
$class =~ s/^\Q$args{prefix}\E:://;
-
$args{name} ||= $class;
-
$args{version} ||= $class->VERSION;
-
unless ( $args{path} ) {
-
$args{path} = $args{name};
-
$args{path} =~ s!::!/!g;
-
}
-
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
-
-
bless( \%args, $class );
-
}
-
-
sub call {
-
my ($self, $method) = @_;
-
my $obj = $self->load($method) or return;
-
splice(@_, 0, 2, $obj);
-
goto &{$obj->can($method)};
-
}
-
-
sub load {
-
my ($self, $method) = @_;
-
-
$self->load_extensions(
-
"$self->{prefix}/$self->{path}", $self
-
) unless $self->{extensions};
-
-
foreach my $obj (@{$self->{extensions}}) {
-
return $obj if $obj->can($method);
-
}
-
-
my $admin = $self->{admin} or die <<"END_DIE";
-
The '$method' method does not exist in the '$self->{prefix}' path!
-
Please remove the '$self->{prefix}' directory and run $0 again to load it.
-
END_DIE
-
-
my $obj = $admin->load($method, 1);
-
push @{$self->{extensions}}, $obj;
-
-
$obj;
-
}
-
-
sub load_extensions {
-
my ($self, $path, $top) = @_;
-
-
unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
-
unshift @INC, $self->{prefix};
-
}
-
-
foreach my $rv ( $self->find_extensions($path) ) {
-
my ($file, $pkg) = @{$rv};
-
next if $self->{pathnames}{$pkg};
-
-
local $@;
-
my $new = eval { require $file; $pkg->can('new') };
-
unless ( $new ) {
-
warn $@ if $@;
-
next;
-
}
-
$self->{pathnames}{$pkg} = delete $INC{$file};
-
push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
-
}
-
-
$self->{extensions} ||= [];
-
}
-
-
sub find_extensions {
-
my ($self, $path) = @_;
-
-
my @found;
-
File::Find::find( sub {
-
my $file = $File::Find::name;
-
return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
-
my $subpath = $1;
-
return if lc($subpath) eq lc($self->{dispatch});
-
-
$file = "$self->{path}/$subpath.pm";
-
my $pkg = "$self->{name}::$subpath";
-
$pkg =~ s!/!::!g;
-
-
# If we have a mixed-case package name, assume case has been preserved
-
# correctly. Otherwise, root through the file to locate the case-preser
-
ved
-
# version of the package name.
-
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
-
open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $su
-
bpath.pm: $!";
-
my $in_pod = 0;
-
while ( <PKGFILE> ) {
-
$in_pod = 1 if /^=\w/;
-
$in_pod = 0 if /^=cut/;
-
next if ($in_pod || /^=cut/); # skip pod text
-
next if /^\s*#/; # and comments
-
if ( m/^\s*package\s+($pkg)\s*;/i ) {
-
$pkg = $1;
-
last;
-
}
-
}
-
close PKGFILE;
-
}
-
-
push @found, [ $file, $pkg ];
-
}, $path ) if -d $path;
-
-
@found;
-
}
-
-
sub _caller {
-
my $depth = 0;
-
my $call = caller($depth);
-
while ( $call eq __PACKAGE__ ) {
-
$depth++;
-
$call = caller($depth);
-
}
-
return $call;
-
}
-
-
1;
The error line :146 is the one that highlighted in bold above. I'm not sure how could i edit the error in this function. Could you please help? Many thanks again!
Never seen that error before but look into what manimarank suggests. On a side note, there is practically zero reasons to use prototypes in your perl scripts, I would just drop the prototyping, which is the () after a function name:
just use a regular function:
unless you really do need a prototype for some good reason.
Hello Kevin,
Thanks for your reply. My function seems more complicated so i really have no idea how could i edit it. I am actually trying to install a program called "Swatch". Below are the steps i have taken until i reached the error:
1. telnet into the server
2. type #bash
3. cd /usr/local/swatch-3.2.2
4. Run the following command: perl Makefile.PL
I get the error while running the above command.
Today is my first day learning Perl. Really appreciate if you could guide me how to troubleshoot the error. Thanks a bunch!
KevinADC 4,059
Recognized Expert Specialist
I seriously doubt you want to go editing that module. The error must be getting generated for a good reason, editing it to try and remove the error could have unforseen consequences. The module has a large number of bugs reported on CPAN. Not sure what to make of this error you are getting but I think editing the module code is unadvisable until you understand what is really causing the error. Personally I have no idea what is going or how to even begin to fix the problem. Contact the module author and see if he responds.
Thanks for your advices. I plan to upgrade the Perl version from v5.6.1 to v5.8.8. Do you think that is a good idea? I found the link for the steps to upgrade Perl to version 5.8.8,
http://www.cpanelconfig.com/how-to/how-to-upgrade-perl-to-v588/
Need your expertise to advice if i could follow the above steps to upgrade my Perl version. Thanks again.
KevinADC 4,059
Recognized Expert Specialist
Thanks for your advices. I plan to upgrade the Perl version from v5.6.1 to v5.8.8. Do you think that is a good idea? I found the link for the steps to upgrade Perl to version 5.8.8,
http://www.cpanelconfig.com/how-to/how-to-upgrade-perl-to-v588/
Need your expertise to advice if i could follow the above steps to upgrade my Perl version. Thanks again.
A very good idea to upgrade. Perl 5.6 is considerably old, at least 10 years. Upgrade to Perl 5.8.8 or even 5.10, which is the newest version, but perl 5.8.8 is a very good choice.
Do you have root access to the computer you are going to upgrade? If not you can't do it, someone with root acess will have to do it.
I'm off to bed now (1:00AM here). Good night.
A very good idea to upgrade. Perl 5.6 is considerably old, at least 10 years. Upgrade to Perl 5.8.8 or even 5.10, which is the newest version, but perl 5.8.8 is a very good choice.
Do you have root access to the computer you are going to upgrade? If not you can't do it, someone with root acess will have to do it.
I'm off to bed now (1:00AM here). Good night.
Yes, i have the root acccess to the remote machine. So is it advisable for me to follow the steps in the link above for performing the upgrade?
Oops, not aware of it's late at your side now. Sorry, have a good sleep! Good night :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Marcus Schneider |
last post by:
I use PythonWin on WinXP. Every time I change a module, I have to
leave PythonWin and re enter to make it notice I have made changes. I
guess this is not the normal way to do that.. do I have to...
|
by: Bob |
last post by:
Declaring a module level form object in multiple froms
within a project to show another project form causes a
stack overflow and other assorted errors. Can anyone help?
|
by: Neal |
last post by:
Hi
I am trying to use a 3rd party DLL in my app, (WebService and/or WebApp)
I set the references to it, use its public functions and properties OK in
Dev mode
but
when I run it, i get the...
|
by: Chris_147 |
last post by:
but it seems to depend on from where I start the Python shell.
so I've got a module selfservicelabels.py with some variables defined,
like this:
BtnSave = "link=label.save"...
|
by: johnny |
last post by:
I am getting the following errors:
File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 679, in
_send_output
self.send(msg)
File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 646, in...
| |
by: korean_dave |
last post by:
This allows me to see output:
---begin of try.py
print "Hello World"
--end of try.py
This DOESN'T though...
--begin of try2.py
def main():
|
by: Gabriel Genellina |
last post by:
En Sat, 12 Jul 2008 16:15:36 -0300, Akathorn Greyhat <akathorn@gmail.com>
escribi�:
Welcome!
You have to pass in the namespace of the desired module - instead of
globals. I'd use an...
|
by: John [H2O] |
last post by:
Hello,
I have a module created from a Fortran file to read in unformatted binary
fortran output. It works fine for some datasets, but crashes with others.
The strange thing is it will loop...
|
by: John [H2O] |
last post by:
There's a lot of greek for me here ... should I post to numpy-discussions as
well???
The backtrace is at the bottom.... Thanks!
GNU gdb Fedora (6.8-21.fc9)
Copyright (C) 2008 Free...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |