Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Using can With Inheritance

by btrott (Parson)
on Apr 18, 2000 at 22:07 UTC ( [id://7940]=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        can(METHOD)
    
        can checks to see if its object has a method called METHOD. If it 
    +does
        then a reference to the sub is returned; if it does not then undef
    + is
        returned.
    
  2. or download this
        package A;
    
    ...
            my $self = shift;
            return $self->can("_write_file");
        }
    
  3. or download this
        package A::B;
        use A;
    ...
            my($path, $val, $start) = @_;
            # ...
        }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://7940]
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: (8)
As of 2024-04-16 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found