Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 taking refuge in the Monastery: (14)
As of 2014-12-18 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (56 votes), past polls