Click here to get back home

ISO: deep voodoo debugging tools for tracking down seriously weird module behavior.

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
ISO: deep voodoo debugging tools for tracking down seriously weird module behavior. lvirden 11-09-2007
Posted by Claudio Calvelli on November 12, 2007, 12:28 pm
Please log in for more thread options
> In Policy.pm , I have the line:
> sub remove_request
[...]
> which results in the error:
>
> Undefined subroutine &Policy::remove_request called at Server.pm line
> 10347.

Another thought is that there is a "package something" somewhere before
the sub remove_request, so it isn't in package Policy?

Yet another thought is that the "sub remove_request" may not be actually
followed by a block... but I'm sure you'd have noticed that.

You may find useful to print keys %Policy:: (not trailing :: - the package's
symbol table, or whatever is called in the documentation) and comparing the
output with the list of subroutines which should be defined by package Policy -
see if remove_request is there, and if anything else you expect to see but
is missing.

I must say this all looks weird.

C

--
The address in the "From" header won't work. Email to "usenet" at "intercal" dot
"dyn-o-saur" dot "com" may or may not reach me, depending on how far it manages
to go through the spam filter, and other conditions which I won't disclose.

Posted by Claudio Calvelli on November 12, 2007, 12:28 pm
Please log in for more thread options
> You may find useful to print keys %Policy:: (not trailing :: - the package's
That should have been "note trailing ::"...

C

--
The address in the "From" header won't work. Email to "usenet" at "intercal" dot
"dyn-o-saur" dot "com" may or may not reach me, depending on how far it manages
to go through the spam filter, and other conditions which I won't disclose.

Posted by lvirden on November 12, 2007, 12:47 pm
Please log in for more thread options
On Nov 12, 12:28 pm, Claudio Calvelli

> Another thought is that there is a "package something" somewhere before
> the sub remove_request, so it isn't in package Policy?

I really appreciate your ideas. I checked after reading your msg - the
only package something in Policy.pm is the
package Policy;
statement.


>
> Yet another thought is that the "sub remove_request" may not be actually
> followed by a block... but I'm sure you'd have noticed that.

sub remove_request
{
:
Perl code here
:
}

is there in the file, so there's a block.

>
> You may find useful to print keys %Policy:: [...] and comparing the
> output with the list of subroutines which should be defined by package Policy -
> see if remove_request is there, and if anything else you expect to see but
> is missing.

Thanks - I'll try that next.

>
> I must say this all looks weird.
>

Yea - to someone who's trying to keep this system going, it looks very
weird as well.




Posted by lvirden on November 12, 2007, 1:37 pm
Please log in for more thread options
Okay, here's what ended up being my problem - just in case someone
else comes along with the same thing.

Printing out the key %Policy:: showed me all the sub's except for the
one I was trying to get. I looked at the sub (see last msg) and there
was a block after it.

BUT

Here's the gotcha. The person who had coded the module had written

=item I<Policy::remove_request>(\Server, $comment) undef

sub remove_request
{

Perl novice that I am, I didn't notice the missing "=cut" in the file!
Sigh.
Something so simple - and I've been beating my head over this one for
a long time.

Thank you so much to Ilya Zakharevich and Claudio Calvelli for their
contributions!


Posted by Ilya Zakharevich on November 13, 2007, 10:03 pm
Please log in for more thread options
[A complimentary Cc of this posting was sent to
lvirden
> >
> > > When one particular type of command is being parsed, the error
> > > "Undefined subroutine &Policy::remove_request called at Server.pm line
> > > 10346.
> >
> > > In Policy.pm, a subroutine called remove_request does in fact exist.
> >
> > Can you *check* that it exists/defined at the beginning of execution (after
> > all the modules are loaded)? Can you explicitely check that it does
> > not exist/defined immediately before this unfortunate call?
>
> Hmm. I'm uncertain how to determine that code that is explicitly coded
> in a file exists or not.

"in a file" is absolutely irrelevant. To check whether a subroutine
foo::bar() is declared/defined, use
exists &foo::bar
defined &foo::bar

Hope this helps,
Ilya

Similar ThreadsPosted
Module for time tracking and billing? July 28, 2005, 11:45 am
Weird Module Installation Problem on Solaris 10 November 4, 2005, 8:36 am
Tips on module selection for shell and/or commandline 'subcommand' behavior January 16, 2007, 5:19 am
CPAN, packaging tools, META.yml August 17, 2005, 1:22 pm
Mail Tools 1.74 installs but get error February 19, 2007, 1:33 pm
Problem with MIME-tools 5.414 not finding encode_qp October 27, 2004, 8:00 pm
Reusing SQL data-related logic, replacing weird modules and improving Class::DBI July 2, 2005, 1:23 am
use lib -- different behavior August 13, 2004, 1:47 pm
debugging issue with Net::FTP January 1, 2005, 2:36 pm
Script debugging June 24, 2006, 12:06 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap