YaRness
12-07-2000, 07:48 PM
i have these two files:
(as always, forgive me for working in winderz, at work it's more convenient unfortunately, but i shall work in linux again soon enough after i get my box back up. just not tonight.)
c:\scripts\test.pl
#!c:\perl\bin\perl.pl
use strict;
use range;
$myyar= range->new();
$myyar->rangelist(2);
my $myrange = $myyar->rangelist;
print "\$myrange $myrange\n";
c:\perl\lib\range.pm
#!c:\perl\bin\perl.exe -w
package range;
use strict;
use warnings;
sub new
{
my $self = {};
$self->{RANGELIST} = undef;
bless($self);
return $self;
}
sub rangelist
{
my $self = shift;
if (@_) {$self->{RANGELIST} = shift;}
return $self->{RANGELIST};
}
1;
nothing fancy, and it works fine. my question is, if i had range.pm in my c:\scripts directory, what would i have to change in either file to make it work the same. i was having problems getting it to work like that earlier. obviously it'd be better to keep pm files in a standard place, i'm just mostly curious as to what i was doing wrong. i think at one point i had the line in test.pl as "::scripts::range", but it returned the error "Can't call method "import" without a package or object reference at test.pl line 5." and i couldn't figure out what the fsck that meant.
------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
------------------
(as always, forgive me for working in winderz, at work it's more convenient unfortunately, but i shall work in linux again soon enough after i get my box back up. just not tonight.)
c:\scripts\test.pl
#!c:\perl\bin\perl.pl
use strict;
use range;
$myyar= range->new();
$myyar->rangelist(2);
my $myrange = $myyar->rangelist;
print "\$myrange $myrange\n";
c:\perl\lib\range.pm
#!c:\perl\bin\perl.exe -w
package range;
use strict;
use warnings;
sub new
{
my $self = {};
$self->{RANGELIST} = undef;
bless($self);
return $self;
}
sub rangelist
{
my $self = shift;
if (@_) {$self->{RANGELIST} = shift;}
return $self->{RANGELIST};
}
1;
nothing fancy, and it works fine. my question is, if i had range.pm in my c:\scripts directory, what would i have to change in either file to make it work the same. i was having problems getting it to work like that earlier. obviously it'd be better to keep pm files in a standard place, i'm just mostly curious as to what i was doing wrong. i think at one point i had the line in test.pl as "::scripts::range", but it returned the error "Can't call method "import" without a package or object reference at test.pl line 5." and i couldn't figure out what the fsck that meant.
------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
------------------