Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 scrutinizing the Monastery: (12)
As of 2014-08-20 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (118 votes), past polls