Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Use method/function signatures with Perl

by Juerd (Abbot)
on Dec 06, 2004 at 12:03 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://412628]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-28 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found