Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and then call it assub DoSomething( $\$\$ )
everything works fine. So good so far. But, if I move the DoSomething subroutine into a module such asmy $name; my $path; my $count; DoSomething( $name, \$path, \$count );
then I get the following error:package MyModule; require Exporter; @ISA = qw( Exporter ); @EXPORT = qw( DoSomething ); sub DoSomething( $\$\$ )
Why does the prototype work in the same script but fail the moment I put it in a module? BTW, if I change the prototype in the module subroutine toType of arg 2 to MyModule::DoSomething must be scalar (not single ref +constructor) at D:\dlkusters\vsstools\ss2Sink.pl line 56, near "$path + )" Type of arg 3 to MyModule::DoSomething must be scalar (not single ref +constructor) at D:\dlkusters\vsstools\ss2Sink.pl line 56, near "$coun +t )" Execution of D:\dlkusters\vsstools\ss2Sink.pl aborted due to compilati +on errors.
then everything works again. This is not my preferred solution since I'm avoiding using prototypes correctly. Thanks, Davesub DoSomething( $$$ )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Modules, Prototypes, and References
by tye (Sage) on Feb 01, 2001 at 23:21 UTC | |
by dkusters (Initiate) on Feb 01, 2001 at 23:28 UTC | |
|
Re: Modules, Prototypes, and References
by extremely (Priest) on Feb 02, 2001 at 03:18 UTC | |
|
(jeffa) Re: Modules, Prototypes, and References
by jeffa (Bishop) on Feb 01, 2001 at 23:23 UTC |