Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Need Some Error Help
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 23rd October 19:57
the-smtpguy
External User
 
Posts: 1
Default Need Some Error Help



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
  Reply With Quote


 


2 23rd October 19:58
michael korte
External User
 
Posts: 1
Default Need Some Error Help



"Gary Hartl" <the-smtpguy@cogeco.ca> schrieb im Newsbeitrag My error is as
follows:

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
  Reply With Quote
3 23rd October 19:59
ben morrow
External User
 
Posts: 1
Default Need Some Error Help


Euurgh!

if(ref($object) eq 'PACKAGENAME')
or, better,
if($object->isa("PACKAGENAME"))

Ben

--
Joy and Woe are woven fine,
A Clothing for the Soul divine William Blake
Under every grief and pine 'Auguries of Innocence'
Runs a joy with silken twine. ben@morrow.me.uk
  Reply With Quote
4 23rd October 19:59
anno4000
External User
 
Posts: 1
Default Need Some Error Help


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
  Reply With Quote
Reply


Thread Tools
Display Modes




666