Can't call method X without a package or object reference

2003-11-11 Thread Chris Masters
Hi All,

I'm getting this problem intermittenly i.e. it works
for the first few runs, then it fails.

Getting this error:

Can't call method "entry" (or count etc) without a
package or object reference at ... (the first entry
call in the if test)

with the following code (I'm calling a function
containing this code many times with the same
connection handle):

undef $mesg;

eval
{
 $mesg = $ldap->search (
   base => "ou=my,dc=domain,dc=com",
   filter => "(mail=$recipient)",
   attrs  => ['l']
   ) || undef $mesg;

 if(defined($mesg) && $mesg->entry(0))
 {
   $My_Location =
$mesg->entry(0)->get_value('l');
 }
 else
 {
   $Unknown = 1;
 }
};

if($@)
{
 print "LDAP Error: [EMAIL PROTECTED]";
}

Why is this happening intermittently?

What am I doing wrong?

Is this a problem with the module itself?

My program is running as a daemon, and I need to
restart to get it to work.

TIA, rotis23

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Fwd: Can't call method X without a package or object reference

2003-11-11 Thread Graham Barr
Begin forwarded message:
From:   Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 11:13:12 GMT
To: [EMAIL PROTECTED]
Subject: Can't call method X without a package or object reference
Message-Id: <[EMAIL PROTECTED]>
Hi All,

I'm getting this problem intermittenly i.e. it works
for the first few runs, then it fails.
Getting this error:

Can't call method "entry" (or count etc) without a
package or object reference at ... (the first entry
call in the if test)
with the following code (I'm calling a function
containing this code many times with the same
connection handle):
undef $mesg;

eval
{
 $mesg = $ldap->search (
   base => "ou=my,dc=domain,dc=com",
   filter => "(mail=$recipient)",
   attrs  => ['l']
   ) || undef $mesg;
 if(defined($mesg) && $mesg->entry(0))
 {
   $My_Location =
$mesg->entry(0)->get_value('l');
 }
 else
 {
   $Unknown = 1;
 }
};
if($@)
{
 print "LDAP Error: [EMAIL PROTECTED]";
}
Why is this happening intermittently?

What am I doing wrong?

Is this a problem with the module itself?

My program is running as a daemon, and I need to
restart to get it to work.
TIA, rotis23

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



Re: Fwd: Can't call method X without a package or object reference

2003-11-11 Thread Chris Masters
Hi Graham,

Did you forget to add your comment?

Thanks, Chris

--- Graham Barr <[EMAIL PROTECTED]> wrote:
> Begin forwarded message:
> > From:   Chris Masters <[EMAIL PROTECTED]>
> > Date: November 11, 2003 11:13:12 GMT
> > To: [EMAIL PROTECTED]
> > Subject: Can't call method X without a package or
> object reference
> > Message-Id:
> <[EMAIL PROTECTED]>
> >
> > Hi All,
> >
> > I'm getting this problem intermittenly i.e. it
> works
> > for the first few runs, then it fails.
> >
> > Getting this error:
> >
> > Can't call method "entry" (or count etc) without a
> > package or object reference at ... (the first
> entry
> > call in the if test)
> >
> > with the following code (I'm calling a function
> > containing this code many times with the same
> > connection handle):
> >
> > undef $mesg;
> >
> > eval
> > {
> >  $mesg = $ldap->search (
> >base => "ou=my,dc=domain,dc=com",
> >filter => "(mail=$recipient)",
> >attrs  => ['l']
> >) || undef $mesg;
> >
> >  if(defined($mesg) && $mesg->entry(0))
> >  {
> >$My_Location =
> > $mesg->entry(0)->get_value('l');
> >  }
> >  else
> >  {
> >$Unknown = 1;
> >  }
> > };
> >
> > if($@)
> > {
> >  print "LDAP Error: [EMAIL PROTECTED]";
> > }
> >
> > Why is this happening intermittently?
> >
> > What am I doing wrong?
> >
> > Is this a problem with the module itself?
> >
> > My program is running as a daemon, and I need to
> > restart to get it to work.
> >
> > TIA, rotis23
> >
> > __
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail
> AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> >
> 


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Re: Can't call method X without a package or object reference

2003-11-11 Thread Graham Barr
On Nov 11, 2003, at 11:58, Chris Masters wrote:

Hi Graham,

Did you forget to add your comment?
No, I should not have sent it.

Many people email me directly and I just forward them to the list. I 
was not thinking and just forwarded your mail to the list when I should 
not have.

Graham.

Thanks, Chris

--- Graham Barr <[EMAIL PROTECTED]> wrote:
Begin forwarded message:
From:   Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 11:13:12 GMT
To: [EMAIL PROTECTED]
Subject: Can't call method X without a package or
object reference
Message-Id:
<[EMAIL PROTECTED]>
Hi All,

I'm getting this problem intermittenly i.e. it
works
for the first few runs, then it fails.

Getting this error:

Can't call method "entry" (or count etc) without a
package or object reference at ... (the first
entry
call in the if test)

with the following code (I'm calling a function
containing this code many times with the same
connection handle):
undef $mesg;

eval
{
 $mesg = $ldap->search (
   base => "ou=my,dc=domain,dc=com",
   filter => "(mail=$recipient)",
   attrs  => ['l']
   ) || undef $mesg;
 if(defined($mesg) && $mesg->entry(0))
 {
   $My_Location =
$mesg->entry(0)->get_value('l');
 }
 else
 {
   $Unknown = 1;
 }
};
if($@)
{
 print "LDAP Error: [EMAIL PROTECTED]";
}
Why is this happening intermittently?

What am I doing wrong?

Is this a problem with the module itself?

My program is running as a daemon, and I need to
restart to get it to work.
TIA, rotis23

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail
AddressGuard
http://antispam.yahoo.com/whatsnewfree




__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



Re: Can't call method X without a package or object reference

2003-11-11 Thread Graham Barr
On Nov 11, 2003, at 11:13, Chris Masters wrote:
I'm getting this problem intermittenly i.e. it works
for the first few runs, then it fails.
Getting this error:

Can't call method "entry" (or count etc) without a
package or object reference at ... (the first entry
call in the if test)
Odd.

eval
{
 $mesg = $ldap->search (
   base => "ou=my,dc=domain,dc=com",
   filter => "(mail=$recipient)",
   attrs  => ['l']
   ) || undef $mesg;
You should not need that || undef $mesg

 if(defined($mesg) && $mesg->entry(0))
$mesg will always be defined. You need to look at $mesg->code to 
determine if there was a problem.

But $mesg should always be an object reference, so calling ->entry 
should not fail.

I would suggest you add some more checking code to try to determine 
what $mesg holds when it does not hold an object reference.

Graham.

 {
   $My_Location = $mesg->entry(0)->get_value('l');
 }
 else
 {
   $Unknown = 1;
 }
};
if($@)
{
 print "LDAP Error: [EMAIL PROTECTED]";
}
Why is this happening intermittently?

What am I doing wrong?

Is this a problem with the module itself?

My program is running as a daemon, and I need to
restart to get it to work.
TIA, rotis23

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



Re: Can't call method X without a package or object reference

2003-11-11 Thread Graham Barr
On Nov 11, 2003, at 13:01, Chris Masters wrote:

Please keep it on list

$mesg will always be defined. You need to look at
$mesg->code to
determine if there was a problem.
Can't call method "code" without a package or object
reference at blah!
with the following code after calling search:

if($mesg->code)
{
   my $error = $mesg->code;
   print "LDAP Error: $error");
   return;
}
It seems to work for a while, then if there is no
activity (for 30 mins say), I run it again and I get
the error above!
What is going on?

What is happening to $mesg?
I have no idea.

What can I do if it's not undef and it's not a
Net::LDAP::Search object?
Find out what it is. If we don't know what it contains we cannot help

I'm using version 0.29 on a redhat 8.0 box in a mimedefang-filter.
Ah, try 0.30 from CPAN. There was a bug fixed in 0.30 where a number 
could be returned instead of an object.

Graham.

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



CAUSE: Can't call method X without a package or object

2003-11-11 Thread Chris Masters
Hi Graham,

Managed to get this before it failed:

LDAP Error: Server encountered an internal error

Is this really server side?

Thanks for any help on this,

Chris

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Fwd: CAUSE: Can't call method X without a package or object

2003-11-11 Thread Chris Masters
Hi Again,

I'm handling this error by using the code below and to
catch an error and establish a new connection. The
problem is that the root error seems to be 'I/O Error'
rather than a 'lost connection' error. I can't find
this in the Net::LDAP::Constant list. 

It seems to happen after the server disconnects the
LDAP connection after inactivity. This is fine, but
after I've made the reconnection, I get the error on
each query and it binds each time.

sub simple_ldap_query_succeeds($)
{
my ($ldap) = @_;
my $version;
undef $mesg;
my $result = 0;

eval
{
$result = 1;
$mesg = $ldap->search (
base   =>
"ou=people,dc=domain,dc=com",
filter =>
"(objectclass=testconnection)",
);

if($mesg->code)
{
md_syslog('err',"Reconnecting
LDAP: simple_ldap_query_succeeds failure: $@");
$result = 0;
}
};

if($@)
{
md_syslog('err',"Reconnecting LDAP:
simple_ldap_query_succeeds failure: $@");
$result = 0;
}
return $result;
}

Any ideas?

TIA, Chris




Note: forwarded message attached.


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree--- Begin Message ---
Hi Graham,

Managed to get this before it failed:

LDAP Error: Server encountered an internal error

Is this really server side?

Thanks for any help on this,

Chris

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree--- End Message ---


Fwd: CAUSE: Can't call method X without a package or object

2003-11-11 Thread Chris Masters
Appologies.

I was not unbinding before I attempted to rebind after
I found the error.

Does 'I/O Error' refer to the socket connection being
closed by the server?


Note: forwarded message attached.


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree--- Begin Message ---
Hi Again,

I'm handling this error by using the code below and to
catch an error and establish a new connection. The
problem is that the root error seems to be 'I/O Error'
rather than a 'lost connection' error. I can't find
this in the Net::LDAP::Constant list. 

It seems to happen after the server disconnects the
LDAP connection after inactivity. This is fine, but
after I've made the reconnection, I get the error on
each query and it binds each time.

sub simple_ldap_query_succeeds($)
{
my ($ldap) = @_;
my $version;
undef $mesg;
my $result = 0;

eval
{
$result = 1;
$mesg = $ldap->search (
base   =>
"ou=people,dc=domain,dc=com",
filter =>
"(objectclass=testconnection)",
);

if($mesg->code)
{
md_syslog('err',"Reconnecting
LDAP: simple_ldap_query_succeeds failure: $@");
$result = 0;
}
};

if($@)
{
md_syslog('err',"Reconnecting LDAP:
simple_ldap_query_succeeds failure: $@");
$result = 0;
}
return $result;
}

Any ideas?

TIA, Chris




Note: forwarded message attached.


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree--- Begin Message ---
Hi Graham,

Managed to get this before it failed:

LDAP Error: Server encountered an internal error

Is this really server side?

Thanks for any help on this,

Chris

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree--- End Message ---
--- End Message ---


Re: CAUSE: Can't call method X without a package or object

2003-11-11 Thread Graham Barr
Have you tried perl-ldap-0.30 as suggested in a previous mail ?

Graham.

On Nov 11, 2003, at 17:21, Chris Masters wrote:

Appologies.

I was not unbinding before I attempted to rebind after
I found the error.
Does 'I/O Error' refer to the socket connection being
closed by the server?
Note: forwarded message attached.

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
From: Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 16:54:16 GMT
To: [EMAIL PROTECTED]
Subject: Fwd: CAUSE: Can't call method X without a package or object
Hi Again,

I'm handling this error by using the code below and to
catch an error and establish a new connection. The
problem is that the root error seems to be 'I/O Error'
rather than a 'lost connection' error. I can't find
this in the Net::LDAP::Constant list.
It seems to happen after the server disconnects the
LDAP connection after inactivity. This is fine, but
after I've made the reconnection, I get the error on
each query and it binds each time.
sub simple_ldap_query_succeeds($)
{
my ($ldap) = @_;
my $version;
undef $mesg;
my $result = 0;
eval
{
$result = 1;
$mesg = $ldap->search (
base   =>
"ou=people,dc=domain,dc=com",
filter =>
"(objectclass=testconnection)",
);
if($mesg->code)
{
md_syslog('err',"Reconnecting
LDAP: simple_ldap_query_succeeds failure: $@");
$result = 0;
}
};
if($@)
{
md_syslog('err',"Reconnecting LDAP:
simple_ldap_query_succeeds failure: $@");
$result = 0;
}
return $result;
}
Any ideas?

TIA, Chris



Note: forwarded message attached.

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
From: Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 13:16:06 GMT
To: [EMAIL PROTECTED]
Subject: CAUSE: Can't call method X without a package or object
Hi Graham,

Managed to get this before it failed:

LDAP Error: Server encountered an internal error

Is this really server side?

Thanks for any help on this,

Chris

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree





Re: CAUSE: Can't call method X without a package or object

2003-11-11 Thread Chris Masters
I upgraded to 0.30 directly after you suggested. All
mails after your suggestion were refering to a 0.30
version installation.


--- Graham Barr <[EMAIL PROTECTED]> wrote:
> Have you tried perl-ldap-0.30 as suggested in a
> previous mail ?
> 
> Graham.
> 
> On Nov 11, 2003, at 17:21, Chris Masters wrote:
> 
> > Appologies.
> >
> > I was not unbinding before I attempted to rebind
> after
> > I found the error.
> >
> > Does 'I/O Error' refer to the socket connection
> being
> > closed by the server?
> >
> >
> > Note: forwarded message attached.
> >
> >
> > __
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail
> AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> > From: Chris Masters <[EMAIL PROTECTED]>
> > Date: November 11, 2003 16:54:16 GMT
> > To: [EMAIL PROTECTED]
> > Subject: Fwd: CAUSE: Can't call method X without a
> package or object
> >
> >
> > Hi Again,
> >
> > I'm handling this error by using the code below
> and to
> > catch an error and establish a new connection. The
> > problem is that the root error seems to be 'I/O
> Error'
> > rather than a 'lost connection' error. I can't
> find
> > this in the Net::LDAP::Constant list.
> >
> > It seems to happen after the server disconnects
> the
> > LDAP connection after inactivity. This is fine,
> but
> > after I've made the reconnection, I get the error
> on
> > each query and it binds each time.
> >
> > sub simple_ldap_query_succeeds($)
> > {
> > my ($ldap) = @_;
> > my $version;
> > undef $mesg;
> > my $result = 0;
> >
> > eval
> > {
> > $result = 1;
> > $mesg = $ldap->search (
> > base   =>
> > "ou=people,dc=domain,dc=com",
> > filter =>
> > "(objectclass=testconnection)",
> > );
> >
> > if($mesg->code)
> > {
> >
> md_syslog('err',"Reconnecting
> > LDAP: simple_ldap_query_succeeds failure: $@");
> > $result = 0;
> > }
> > };
> >
> > if($@)
> > {
> > md_syslog('err',"Reconnecting
> LDAP:
> > simple_ldap_query_succeeds failure: $@");
> > $result = 0;
> > }
> > return $result;
> > }
> >
> > Any ideas?
> >
> > TIA, Chris
> >
> >
> >
> >
> > Note: forwarded message attached.
> >
> >
> > __
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail
> AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> > From: Chris Masters <[EMAIL PROTECTED]>
> > Date: November 11, 2003 13:16:06 GMT
> > To: [EMAIL PROTECTED]
> > Subject: CAUSE: Can't call method X without a
> package or object
> >
> >
> > Hi Graham,
> >
> > Managed to get this before it failed:
> >
> > LDAP Error: Server encountered an internal error
> >
> > Is this really server side?
> >
> > Thanks for any help on this,
> >
> > Chris
> >
> > __
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail
> AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> >
> >
> >
> 


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Re: CAUSE: Can't call method X without a package or object

2003-11-11 Thread Graham Barr
On Nov 11, 2003, at 17:55, Chris Masters wrote:
I upgraded to 0.30 directly after you suggested. All
mails after your suggestion were refering to a 0.30
version installation.
Then please add the following directly after your call to search and 
before you try to call any methods on $mesg

warn "'$mesg'" unless ref($mesg);

Graham.



--- Graham Barr <[EMAIL PROTECTED]> wrote:
Have you tried perl-ldap-0.30 as suggested in a
previous mail ?
Graham.

On Nov 11, 2003, at 17:21, Chris Masters wrote:

Appologies.

I was not unbinding before I attempted to rebind
after
I found the error.

Does 'I/O Error' refer to the socket connection
being
closed by the server?

Note: forwarded message attached.

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail
AddressGuard
http://antispam.yahoo.com/whatsnewfree
From: Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 16:54:16 GMT
To: [EMAIL PROTECTED]
Subject: Fwd: CAUSE: Can't call method X without a
package or object


Hi Again,

I'm handling this error by using the code below
and to
catch an error and establish a new connection. The
problem is that the root error seems to be 'I/O
Error'
rather than a 'lost connection' error. I can't
find
this in the Net::LDAP::Constant list.

It seems to happen after the server disconnects
the
LDAP connection after inactivity. This is fine,
but
after I've made the reconnection, I get the error
on
each query and it binds each time.

sub simple_ldap_query_succeeds($)
{
my ($ldap) = @_;
my $version;
undef $mesg;
my $result = 0;
eval
{
$result = 1;
$mesg = $ldap->search (
base   =>
"ou=people,dc=domain,dc=com",
filter =>
"(objectclass=testconnection)",
);
if($mesg->code)
{
md_syslog('err',"Reconnecting
LDAP: simple_ldap_query_succeeds failure: $@");
$result = 0;
}
};
if($@)
{
md_syslog('err',"Reconnecting
LDAP:
simple_ldap_query_succeeds failure: $@");
$result = 0;
}
return $result;
}
Any ideas?

TIA, Chris



Note: forwarded message attached.

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail
AddressGuard
http://antispam.yahoo.com/whatsnewfree
From: Chris Masters <[EMAIL PROTECTED]>
Date: November 11, 2003 13:16:06 GMT
To: [EMAIL PROTECTED]
Subject: CAUSE: Can't call method X without a
package or object


Hi Graham,

Managed to get this before it failed:

LDAP Error: Server encountered an internal error

Is this really server side?

Thanks for any help on this,

Chris

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail
AddressGuard
http://antispam.yahoo.com/whatsnewfree






__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree