Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Use method/function signatures with Perl

by Ovid (Cardinal)
on Dec 06, 2004 at 16:15 UTC ( #412680=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub name {
        my $self = shift;
        $self->{name} = shift, return $self if @_ == 1
        croak "Unknown arguments to name" if @_;
        return $self->{name};
    }
    
  2. or download this
    sub name {
      my $self = shift;
      $self->set_name(@_) if @_; # I forgot the return!
    ...
      $self->{name} = shift;
      return $self;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2016-09-29 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (545 votes). Check out past polls.