Need Some Error Help

G

Gary Hartl

Greets to all Again;

ok, i'm moving along in my quest to get this script working.

I'm getting a strange error from my script and I only half know what
it means.

The script is using
POSIX and
DB_File

Both are installed, POSIX is included in the perl distro (i'm using
5.8.0), and I installed DB_File which seemed to be ok at least to me
anyway.

My error is as follows:
[Wed Nov 5 08:41:59 2003] mach10.pl: Can't call method "fields"
without a package or object reference at /usr/lib/perl5/5.8.0/SkyIm
port.pm line 1548, <INFILE> line 7.

Line 1548 is:
foreach $field ($cloneUser->fields()){
$newUser->set_attribute($field,
$cloneUser->get_attribute($field));
}

i have no clue what the <INFILE> line 7 is thou.... is this reference
to one of the Modules that i'm using ( POSIX, DB_File ),

Any suggestions would be appreciated.

Cheers and Thanks to all,

Gary
 
G

Gary Hartl

Abigail said:
Gary Hartl ([email protected]) wrote on MMMDCCXVIII September
MCMXCIII in <URL:][ Greets to all Again;
][
][ ok, i'm moving along in my quest to get this script working.
][
][ I'm getting a strange error from my script and I only half know what
][ it means.
][
][ The script is using
][ POSIX and
][ DB_File
][
][ Both are installed, POSIX is included in the perl distro (i'm using
][ 5.8.0), and I installed DB_File which seemed to be ok at least to me
][ anyway.
][
][ My error is as follows:
][ [Wed Nov 5 08:41:59 2003] mach10.pl: Can't call method "fields"
][ without a package or object reference at /usr/lib/perl5/5.8.0/SkyIm
][ port.pm line 1548, <INFILE> line 7.

What's SkyImport.pm doing in that directory? Don't you have a
site_perl directory for locally installed stuff?

Yes I do, i just copied them them as they came just as .pm's with the
script, it reads them so I guess i'm happy, does it matter or is it
just a housekeeping issue. there was no make file for those pm's but
they seem like just basic modules
][ Line 1548 is:
][ foreach $field ($cloneUser->fields()){
][ $newUser->set_attribute($field,
][ $cloneUser->get_attribute($field));

It means that $cloneUser isn't an object or a class. It's likely
to be undefined.

][ i have no clue what the <INFILE> line 7 is thou.... is this reference
][ to one of the Modules that i'm using ( POSIX, DB_File ),

It means that the last line you've read was line 7 of the file handle
called INLINE.
I think i should note that this pm is handling the importing of some
data, it writes that data to a Berkley db ( hence the DB_File ), and
then writes that data back to a mysql database. I believe the $field
variable are for the fields from the berkeley db, that got me thinking
to trying to find out if Berkeley DB is installed with RedHat 8, which
is the OS i'm using.

From what i've read, DB_File Supports BDB v1, I did some RPM queries
but to no avail.

Now db.h does reside in /usr/inlude/, and the bdb's that are geting
created are in /tmp ( i'm assuming the get deleted after a successful
import but cannot complete a successful import :(.

I'm also using Perl 5.8.0 I don't know if that matters either ( i'm so
perl noob ),

So how can i tell what if any Berkeley DB is installed,

HELP....cry, wimper,

i've been at this script for 2 days now, and I'm totally stuck :(

Thanks in advance.

Gary
 
B

Ben Morrow

Abigail said:
Gary Hartl ([email protected]) wrote on MMMDCCXVIII September
MCMXCIII in <URL:][ My error is as follows:
][ [Wed Nov 5 08:41:59 2003] mach10.pl: Can't call method "fields"
][ without a package or object reference at /usr/lib/perl5/5.8.0/SkyIm
][ port.pm line 1548, <INFILE> line 7.

What's SkyImport.pm doing in that directory? Don't you have a
site_perl directory for locally installed stuff?

Yes I do, i just copied them them as they came just as .pm's with the
script, it reads them so I guess i'm happy, does it matter or is it
just a housekeeping issue.

It's 'just' a housekeeping issue. Anything you install should be under
/usr/lib/perl5/site_perl/5.8.0
which should also be in @INC and not cause you any problems.

Ben
 
M

Michael Korte

[Wed Nov 5 08:41:59 2003] mach10.pl: Can't call >>method "fields"
without a package or object reference >>at /usr/lib/perl5/5.8.0/SkyIm
port.pm line 1548, <INFILE> line 7.
Line 1548 is:
foreach $field ($cloneUser->fields()){
$newUser->set_attribute($field,
$cloneUser->get_attribute($field));
}

It seems like you did not initialize the object $cloneUser.
just make a "print $cloneUser;" somwhere and have a look. In case it is an
Object, it might look like :
PACKAGENAME:HASH=0x1234f

somtimes I had this problem when I get object from an array. I solved this
by checking every value if it really is an Object.
eg :
if($object=~/PACKAGENAME=/){
# do something
}

HTH

Michael
 
B

Ben Morrow

Michael Korte said:
somtimes I had this problem when I get object from an array. I solved this
by checking every value if it really is an Object.
eg :
if($object=~/PACKAGENAME=/){

Euurgh!

if(ref($object) eq 'PACKAGENAME')

or, better,

if($object->isa("PACKAGENAME"))

Ben
 
A

Anno Siegel

Ben Morrow said:
Agreed.

if(ref($object) eq 'PACKAGENAME')
Yes.

or, better,

if($object->isa("PACKAGENAME"))

That "better" needs qualification. If the question is whether
$object is an object at all, as implied above, ->isa will issue a
fatal run-time error if it isn't. Not good.

If we know that $object is blessed into *something*, ->isa is indeed
the way to see whether it is directly or indirectly of the right type.
But that wasn't the question here.

Anno
 
P

Peter Stewart

Ben said:
Euurgh!

if(ref($object) eq 'PACKAGENAME')

or, better,

if($object->isa("PACKAGENAME"))

Ben

Best:

if (UNIVERSAL::isa($object, "PACKAGENAME"))

which won't give a nasty fatal error if $object is not a blessed object
reference.

Pete
 
G

Gary Hartl

Michael Korte said:
[Wed Nov 5 08:41:59 2003] mach10.pl: Can't call >>method "fields"
without a package or object reference >>at /usr/lib/perl5/5.8.0/SkyIm
port.pm line 1548, <INFILE> line 7.
Line 1548 is:
foreach $field ($cloneUser->fields()){
$newUser->set_attribute($field,
$cloneUser->get_attribute($field));
}

It seems like you did not initialize the object $cloneUser.
just make a "print $cloneUser;" somwhere and have a look. In case it is an
Object, it might look like :
PACKAGENAME:HASH=0x1234f

I belive this is initalizing object $cloneUser:
my $cloneUser = Recip->retrieve_where("1=1 limit 1");

perhaps i am wrong.... but this is the only other reference to
cloneUser I can find.

a question to anyone that knows....this SkyImport.pm needs POSIX, and
it looks like POSIX is included in my Perl Distro, how do I make sure
that Perl is actually using it? This is RedHat 8, with perl 5.8.0 that
got installed during normal redhat install.
somtimes I had this problem when I get object from an array. I solved this
by checking every value if it really is an Object.
eg :
if($object=~/PACKAGENAME=/){
# do something
}

HTH
More assumitions that I know Perl Kung-Fu, I know very little about
perl :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top