what does this code say it does?

Posted on 2003-03-25
Medium Priority
Last Modified: 2010-03-05
what is in this code the line $self->error->throw($p) saying it does?  there is no error function in the self itself (that is defined in the package which is the file)... tehre are other subroutines to be sure, but nothing called 'error'; so is it calling the throw member of another class and the class is called error?  

# A shortcut, but we put the caller info in there so every error
# thrown doesn't appear to be coming from this location :)

sub throw {
    my ( $self, $p ) = @_;
    ( $p->{package}, $p->{filename}, $p->{line} ) = caller;
    $p->{action} = $self->{current_context}{action};
   return $self->error->throw( $p );

the error I get running this piece of code is teh following:

Can't locate object method "error" via package "OpenInteract::Request" at /usr/lib/perl5/site_perl/5.8.0//OpenInteract/Request.pm line 123.

anybody know what's going on here? I am looking for an interpretation of what the code is supposed to be accessing.  

god bless,
Question by:joesp

Accepted Solution

arhuman earned 100 total points
ID: 8209119
What I read in your code is ;

$p is a an object (blessed ref) of type A

A->error produce an object of type B

then B->throw is called.

If there's no 'error' method in namespace A, there must be one in the base classes of A (what do @ISA contains?)

to know what is A : print ref $self # print $self is a little bit less readable...

Is it normal that A is 'OpenInteract::Request' ?
is error defined somewhere in the 'OpenInteract' (sub)-namespace ?

Is it of any help ? If no could you precise your needs or
ask for other explanations

Expert Comment

ID: 8213867
You need the Error package installed(for exception handling).  Simply type the following command to install it.

perl -MCPAN -e 'install Error'


Author Comment

ID: 8472537
I found out that this is a very generic error message.  There is an error package (Error.pm) that comes with the distribution, and nothing with Error was the problem.  When some error happened anywhere else (normally following a faulty installation of something or other) the error was triggered.  thanks for all your help.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question