Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Runtime introspection: What good is it?

by stvn (Monsignor)
on Jul 06, 2008 at 18:39 UTC ( [id://695856]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub what_does_it_return () return classA | classH {
       return rand(1) > 0.5 
            ? bless( [], 'classA' )
            : bless( {}, 'classH' );
    }
    
  2. or download this
    my classA | classH $x = what_does_it_return();
    
  3. or download this
    $x->something()
    
  4. or download this
    package classA;
    sub something (classA $self) { ... }
    
  5. or download this
    sub what_does_it_return () return classX {
       return rand(1) > 0.5 
            ? bless( [], 'classA' )
            : bless( {}, 'classH' );
    }
    
  6. or download this
    my classX $x = what_does_it_return();
    $x->something() # compile-time blowup, classX doesn't have the "someth
    +ing" method!
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://695856]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-28 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found