I'm not completely sure, but here are a couple of things I am noticing:
1) The last line of your module should be a 1 on it's own line.
2) When you declare a sub, don't put the parentheses. Try changing the
line 'sub print_test(){' to 'sub print_test{'. It's possible that Perl
thinks you're trying to prototype and define your subroutine at the same
time, in which case you're telling it that print_test() takes no parameters.
-----Original Message-----
From: Tin-Shan Chau [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 13, 2002 8:54 AM
To: Help on PERL
Subject: Help with 'use'
I have a module as follows:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
package Test;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(print_name print_test);
sub print_test() {
print "test\n";
}
sub print_name() {
my $file = shift;
print "$file\n";
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
When I tried to run the following:
use Test;
print_test();
It worked as expected. But when I tried to run this:
use Test;
file = shift;
print_name($file);
PERL complained "Too many arguments for Fred::print_name ..."
The difference seems to be the presence or absence of an argument. Can
anyone help me to get around this problem?
Thanks in advance for your help!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]