Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl Inheritance & module variables

by brian_d_foy (Abbot)
on Sep 20, 2008 at 19:41 UTC ( #712765=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package Parent;
    
    ...
    sub new { bless {}, $_[0]; }
    
    sub parent_version { $_[0]->SUPER::VERSION }
    
  2. or download this
    print "Parent version is ", Parent->VERSION, "\n"; # 1.23
    
    print "Child version is ", Child->VERSION, "\n";  # 5.43
    
  3. or download this
    my $child = Child->new;
    
    print "Child version: ",  $child->VERSION, "\n";            # 5.43
    print "Parent version: ", $child->parent_version, "\n"; # 1.23
    
  4. or download this
    print "Child version: ",  $child->child_version, "\n"; # 5.43
    
  5. or download this
    print "Child version: ",  $child->VERSION, "\n";          # 5.43
    print "Child version: ",  $child->child_version, "\n"; # 5.43
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (16)
As of 2015-07-07 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls