?
Solved

what does this code say it does?

Posted on 2003-03-25
3
Medium Priority
?
148 Views
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,
joesp
0
Comment
Question by:joesp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
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
0
 
LVL 5

Expert Comment

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

perl -MCPAN -e 'install Error'

0
 
LVL 1

Author Comment

by:joesp
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.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

752 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