473,498 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: Prototype mismatch: sub main::prompt ($;$) vs none at inc/Module/Install.pm

6 New Member
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.
Feb 29 '08 #1
8 11518
manimarank
23 New Member
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.
Feb 29 '08 #2
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:

Expand|Select|Wrap|Line Numbers
  1. sub foo ($$) {
just use a regular function:

Expand|Select|Wrap|Line Numbers
  1. sub foo {
unless you really do need a prototype for some good reason.
Feb 29 '08 #3
vyona
6 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. #line 1
  2. package Module::Install;
  3.  
  4. # For any maintainers:
  5. # The load order for Module::Install is a bit magic.
  6. # It goes something like this...
  7. #
  8. # IF ( host has Module::Install installed, creating author mode ) {
  9. #     1. Makefile.PL calls "use inc::Module::Install"
  10. #     2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::In
  11. stall
  12. #     3. The installed version of inc::Module::Install loads
  13. #     4. inc::Module::Install calls "require Module::Install"
  14. #     5. The ./inc/ version of Module::Install loads
  15. # } ELSE {
  16. #     1. Makefile.PL calls "use inc::Module::Install"
  17. #     2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
  18. #     3. The ./inc/ version of Module::Install loads
  19. # }
  20.  
  21. use 5.004;
  22. use strict 'vars';
  23.  
  24. use vars qw{$VERSION};
  25. BEGIN {
  26.     # All Module::Install core packages now require synchronised versions.
  27.     # This will be used to ensure we don't accidentally load old or
  28.     # different versions of modules.
  29.     # This is not enforced yet, but will be some time in the next few
  30.     # releases once we can make sure it won't clash with custom
  31.     # Module::Install extensions.
  32.     $VERSION = '0.64';
  33. }
  34.  
  35. # Whether or not inc::Module::Install is actually loaded, the
  36. # $INC{inc/Module/Install.pm} is what will still get set as long as
  37. # the caller loaded module this in the documented manner.
  38. # If not set, the caller may NOT have loaded the bundled version, and thus
  39. # they may not have a MI version that works with the Makefile.PL. This would
  40. # result in false errors or unexpected behaviour. And we don't want that.
  41. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
  42. unless ( $INC{$file} ) {
  43.     die <<"END_DIE";
  44. Please invoke ${\__PACKAGE__} with:
  45.  
  46.     use inc::${\__PACKAGE__};
  47.  
  48. not:
  49.  
  50.     use ${\__PACKAGE__};
  51.  
  52. END_DIE
  53. }
  54.  
  55. # If the script that is loading Module::Install is from the future,
  56. # then make will detect this and cause it to re-run over and over
  57. # again. This is bad. Rather than taking action to touch it (which
  58. # is unreliable on some platforms and requires write permissions)
  59. # for now we should catch this and refuse to run.
  60. if ( -f $0 and (stat($0))[9] > time ) {
  61.         die << "END_DIE";
  62. Your installer $0 has a modification time in the future.
  63.  
  64. This is known to create infinite loops in make.
  65.  
  66. Please correct this, then run $0 again.
  67.  
  68. END_DIE
  69. }
  70.  
  71. use Cwd        ();
  72. use File::Find ();
  73. use File::Path ();
  74. use FindBin;
  75.  
  76. *inc::Module::Install::VERSION = *VERSION;
  77. @inc::Module::Install::ISA     = __PACKAGE__;
  78.  
  79. sub autoload {
  80.     my $self = shift;
  81.     my $who  = $self->_caller;
  82.     my $cwd  = Cwd::cwd();
  83.     my $sym  = "${who}::AUTOLOAD";
  84.     $sym->{$cwd} = sub {
  85.         my $pwd = Cwd::cwd();
  86.         if ( my $code = $sym->{$pwd} ) {
  87.             # delegate back to parent dirs
  88.             goto &$code unless $cwd eq $pwd;
  89.         }
  90.         $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
  91.         unshift @_, ($self, $1);
  92.         goto &{$self->can('call')} unless uc($1) eq $1;
  93.     };
  94. }
  95.  
  96. sub import {
  97.     my $class = shift;
  98.     my $self  = $class->new(@_);
  99.     my $who   = $self->_caller;
  100.  
  101.     unless ( -f $self->{file} ) {
  102.         require "$self->{path}/$self->{dispatch}.pm";
  103.         File::Path::mkpath("$self->{prefix}/$self->{author}");
  104.         $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self
  105. );
  106.         $self->{admin}->init;
  107.         @_ = ($class, _self => $self);
  108.         goto &{"$self->{name}::import"};
  109.     }
  110.  
  111.     *{"${who}::AUTOLOAD"} = $self->autoload;
  112.     $self->preload;
  113.  
  114.     # Unregister loader and worker packages so subdirs can use them again
  115.     delete $INC{"$self->{file}"};
  116.     delete $INC{"$self->{path}.pm"};
  117. }
  118.  
  119. sub preload {
  120.     my ($self) = @_;
  121.  
  122.     unless ( $self->{extensions} ) {
  123.         $self->load_extensions(
  124.             "$self->{prefix}/$self->{path}", $self
  125.         );
  126.     }
  127.  
  128.     my @exts = @{$self->{extensions}};
  129.     unless ( @exts ) {
  130.         my $admin = $self->{admin};
  131.         @exts = $admin->load_all_extensions;
  132.     }
  133.  
  134.     my %seen;
  135.     foreach my $obj ( @exts ) {
  136.         while (my ($method, $glob) = each %{ref($obj) . '::'}) {
  137.             next unless $obj->can($method);
  138.             next if $method =~ /^_/;
  139.             next if $method eq uc($method);
  140.             $seen{$method}++;
  141.         }
  142.     }
  143.  
  144.     my $who = $self->_caller;
  145.     foreach my $name ( sort keys %seen ) {
  146.         *{"${who}::$name"} = sub {
  147.             ${"${who}::AUTOLOAD"} = "${who}::$name";
  148.             goto &{"${who}::AUTOLOAD"};
  149.         };
  150.     }
  151. }
  152.  
  153. sub new {
  154.     my ($class, %args) = @_;
  155.  
  156.     # ignore the prefix on extension modules built from top level.
  157.     my $base_path = Cwd::abs_path($FindBin::Bin);
  158.     unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
  159.         delete $args{prefix};
  160.     }
  161.  
  162.     return $args{_self} if $args{_self};
  163.  
  164.     $args{dispatch} ||= 'Admin';
  165.     $args{prefix}   ||= 'inc';
  166.     $args{author}   ||= ($^O eq 'VMS' ? '_author' : '.author');
  167.     $args{bundle}   ||= 'inc/BUNDLES';
  168.     $args{base}     ||= $base_path;
  169.     $class =~ s/^\Q$args{prefix}\E:://;
  170.     $args{name}     ||= $class;
  171.     $args{version}  ||= $class->VERSION;
  172.     unless ( $args{path} ) {
  173.         $args{path}  = $args{name};
  174.         $args{path}  =~ s!::!/!g;
  175.     }
  176.     $args{file}     ||= "$args{base}/$args{prefix}/$args{path}.pm";
  177.  
  178.     bless( \%args, $class );
  179. }
  180.  
  181. sub call {
  182.         my ($self, $method) = @_;
  183.         my $obj = $self->load($method) or return;
  184.         splice(@_, 0, 2, $obj);
  185.         goto &{$obj->can($method)};
  186. }
  187.  
  188. sub load {
  189.     my ($self, $method) = @_;
  190.  
  191.     $self->load_extensions(
  192.         "$self->{prefix}/$self->{path}", $self
  193.     ) unless $self->{extensions};
  194.  
  195.     foreach my $obj (@{$self->{extensions}}) {
  196.         return $obj if $obj->can($method);
  197.     }
  198.  
  199.     my $admin = $self->{admin} or die <<"END_DIE";
  200. The '$method' method does not exist in the '$self->{prefix}' path!
  201. Please remove the '$self->{prefix}' directory and run $0 again to load it.
  202. END_DIE
  203.  
  204.     my $obj = $admin->load($method, 1);
  205.     push @{$self->{extensions}}, $obj;
  206.  
  207.     $obj;
  208. }
  209.  
  210. sub load_extensions {
  211.     my ($self, $path, $top) = @_;
  212.  
  213.     unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
  214.         unshift @INC, $self->{prefix};
  215.     }
  216.  
  217.     foreach my $rv ( $self->find_extensions($path) ) {
  218.         my ($file, $pkg) = @{$rv};
  219.         next if $self->{pathnames}{$pkg};
  220.  
  221.         local $@;
  222.         my $new = eval { require $file; $pkg->can('new') };
  223.         unless ( $new ) {
  224.             warn $@ if $@;
  225.             next;
  226.         }
  227.         $self->{pathnames}{$pkg} = delete $INC{$file};
  228.         push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
  229.     }
  230.  
  231.     $self->{extensions} ||= [];
  232. }
  233.  
  234. sub find_extensions {
  235.     my ($self, $path) = @_;
  236.  
  237.     my @found;
  238.     File::Find::find( sub {
  239.         my $file = $File::Find::name;
  240.         return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
  241.         my $subpath = $1;
  242.         return if lc($subpath) eq lc($self->{dispatch});
  243.  
  244.         $file = "$self->{path}/$subpath.pm";
  245.         my $pkg = "$self->{name}::$subpath";
  246.         $pkg =~ s!/!::!g;
  247.  
  248.         # If we have a mixed-case package name, assume case has been preserved
  249.         # correctly.  Otherwise, root through the file to locate the case-preser
  250. ved
  251.         # version of the package name.
  252.         if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
  253.             open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $su
  254. bpath.pm: $!";
  255.             my $in_pod = 0;
  256.             while ( <PKGFILE> ) {
  257.                 $in_pod = 1 if /^=\w/;
  258.                 $in_pod = 0 if /^=cut/;
  259.                 next if ($in_pod || /^=cut/);  # skip pod text
  260.                 next if /^\s*#/;               # and comments
  261.                 if ( m/^\s*package\s+($pkg)\s*;/i ) {
  262.                     $pkg = $1;
  263.                     last;
  264.                 }
  265.             }
  266.             close PKGFILE;
  267.         }
  268.  
  269.         push @found, [ $file, $pkg ];
  270.     }, $path ) if -d $path;
  271.  
  272.     @found;
  273. }
  274.  
  275. sub _caller {
  276.     my $depth = 0;
  277.     my $call  = caller($depth);
  278.     while ( $call eq __PACKAGE__ ) {
  279.         $depth++;
  280.         $call = caller($depth);
  281.     }
  282.     return $call;
  283. }
  284.  
  285. 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!
Feb 29 '08 #4
vyona
6 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. sub foo ($$) {
just use a regular function:

Expand|Select|Wrap|Line Numbers
  1. sub foo {
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!
Feb 29 '08 #5
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.
Feb 29 '08 #6
vyona
6 New Member
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.
Feb 29 '08 #7
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.
Feb 29 '08 #8
vyona
6 New Member
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 :)
Feb 29 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1724
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...
6
1887
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?
0
1433
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...
3
1721
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"...
5
9514
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...
3
919
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():
0
1036
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...
0
1340
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...
0
1796
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...
0
7126
marktang
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,...
0
7005
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...
0
7210
jinu1996
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...
1
6891
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...
0
7381
tracyyun
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...
0
5465
agi2029
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,...
0
4595
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...
0
3096
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...
0
293
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.