Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I think it should be
if (UNIVERSAL::can($ref,'isa')) { ...
But I see the point now.
As UNIVERSAL is the parent of every object (blessed reference) and it implements method 'isa', every beast that know how to call isa method must be an object.

Update: No, $r->can('isa') won't work (as I mentioned in the other reply) because if $r is not blessed, it will die on 'unblessed reference' error. UNIVERSAL::can($r,'isa') is real solution.

Update2: Even if I do refcheck, situation is the same. I just cannot call any method on non-blessed reference, not even the can() method. Consider $r={}; you cannot do $r->can() because $r is not blessed. And that is what I want to know, if $r is blessed or not. I know that it is a reference. Catching a die exception with eval is TIMTOWDI, but it does not look good to me :-)


In reply to Re: Re: Is reference blessed? by gildir
in thread Is reference blessed? by gildir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found