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 lvirden on November 9, 2007, 1:28 pm
Please log in for more thread options

Platform: sparc solaris 9, perl 5.6.1

I'm maintaining an inherited multi-thousand line legacy application
server with minimal documentation (three strikes already against
me...).

The server implements an ascii interface language that gives
applications search and update access to an internal database of
information.

As the server parses a specific command, it uses perl soft references
to determine what subroutine of what perl module should be invoked.

All of its operations are performed in this fashion.

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.

Other subroutines in that file are found without problem.

None of the subroutines are explicitly exported or imported. But for
some reason, this particular function isn't being seen.

Policy.pm and Server.pm do include a "use strict" statement.

I'm wondering if anyone has found other tools to be of use in
determining why some subroutine in a file might not be seen.

To me, at face value, this explanation doesn't make much sense - why
would perl complain about this subroutine but not others.

I'm working on adding some additional print statements to try and
verify that this is the only subroutine that is failing in this
particular statement.

Any other ideas of what could be checked would be appreciated.


Posted by Ilya Zakharevich on November 11, 2007, 8:43 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?

If yes on both counts, all you need to do is to find out when it
disappears. E.g., use 'watch' in debugger...

Hope this helps,
Ilya

Posted by lvirden on November 12, 2007, 8:21 am
Please log in for more thread options
>
> > 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.


>
> If yes on both counts, all you need to do is to find out when it
> disappears. E.g., use 'watch' in debugger...

I haven't quite figured out how to get debugger to run on this piece
of code - there are time critical parts that are likely to fail, and
there are so many lines of code that it would be pretty tough to
monitor it.

Obviously I have a LOT of perl that I need to learn. Thanks for the
idea though - I suspect that finding out how to check when the soft
references exist or not is a good place to investigate.


Posted by Claudio Calvelli on November 12, 2007, 9:03 am
Please log in for more thread options
> Obviously I have a LOT of perl that I need to learn. Thanks for the
> idea though - I suspect that finding out how to check when the soft
> references exist or not is a good place to investigate.

Just a thought, but have you triple-checked that the spelling of the
subroutine name is correct? Maybe it exists, but it's called with the
wrong name, say renove_request rather than remove_request?

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, 11:02 am
Please log in for more thread options
On Nov 12, 9:03 am, Claudio Calvelli
>
> > Obviously I have a LOT of perl that I need to learn. Thanks for the
> > idea though - I suspect that finding out how to check when the soft
> > references exist or not is a good place to investigate.
>
> Just a thought, but have you triple-checked that the spelling of the
> subroutine name is correct? Maybe it exists, but it's called with the
> wrong name, say renove_request rather than remove_request?
>

Yes, I've checked over and over on the spelling.

In Policy.pm , I have the line:
sub remove_request

which starts the piece of code in question, and in the parse table, we
have:
'=' => ['remove_request', 1],
'=' => ['remove_request', 1],
'=' => ['remove_request', 1],
'=' => ['remove_request', 1],
'=' => ['remove_request', 1],
'=' => ['remove_request', 1],

and then later:
my $what = 'Policy::' . $}[0];

and finally

eval { no strict 'refs'; &($self, @chunk[1 ..
$args]); };

which results in the error:


Undefined subroutine &Policy::remove_request called at Server.pm line
10347.


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