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 studying the Monastery: (6)
As of 2015-07-06 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls