danidin has asked for the wisdom of the Perl Monks concerning the following question:

Hi All ! I'm running a script with the perl command. >perl script_name.pl The script runs a request (using UserAgent module). sometimes the request completes ok but in some other times I get an error in my apache error log. The error looks like this: ModPerl::Registry: Mon Jan 22 08:47:14 2007 -e: Can't call method "is_attribute" on unblessed reference at .... Does anyone can assist me with this issue? Thanks in advance, Daniel.

Replies are listed 'Best First'.
Re: ModPerl::Registry error
by quester (Vicar) on Jan 22, 2007 at 07:08 UTC
    Daniel,

    It would help immensely if you posted your code, at least the section where the error occurs.

      Hi,

      Thanks for the quick response.

      That is the call:

      my $response = $ua->post('http://il-sxd/abs',$request);

      $request has an XML value.

      This is where the program fails:

      sub AUTOLOAD { my ($this,$val) = @_; my $program = $AUTOLOAD; if ($program =~ /::DESTROY$/){ return; } $program =~ /ContextObject::Generic::(.*)/; my $attribute = $1; my $key=$this->is_attribute($attribute);

      Thanks,
      Daniel.

      20070126 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

        I'm not clear about the context in which the AUTOLOAD is getting called. The immediate cause of the error is that $this is not a reference to an object.

        You might want to run your script under the debugger (perl -d...), and run the script up to the line number where the error occurs (c nnn). Then you can do a stack trace (T) and also look at the variables involved (x $this; x $val; and so on).

        Most likely you will find that the call to an undefined sub which triggered AUTOLOAD wasn't intended to go to this particular AUTOLOAD routine.

        Hi Daniel,

        I hope you have managed to move forward with your problem.

        You may have noticed that the code in your post was not formatted but all jumbled together on the same line and difficult to read. You might want to refer to Writeup Formatting Tips, in particlar the use of <code> and </code> tags around your code and the use of <p> tags between paragraphs. There is a useful table of special characters and how to represent them when posting.

        I hope you find this useful.

        Cheers,

        JohnGG