Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Use method/function signatures with Perl

by Juerd (Abbot)
on Dec 06, 2004 at 12:03 UTC ( #412628=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub name {
        my $self = shift;
    ...
            croak "Unknown arguments to name()";
        }
    }
    
  2. or download this
    sub name {
        my $self = shift;
    ...
        croak "Unknown arguments to name" if @_;
        return $self->{name};
    }
    
  3. or download this
    sub name {
        my $self = shift;
    ...
        croak "Unknown arguments to name" if @_;
        return $self->{name};
    }
    
  4. or download this
    sub name {
        @_ > 1 and croak "Too many arguments for name";
        my $self = shift;
        return @_ ? $self->{name} = shift : $self->{name};
    }
    
  5. or download this
    sub name : lvalue { shift->{name} }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-07-31 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (245 votes), past polls