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( $$$ )
In reply to Modules, Prototypes, and References by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |