Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Prototypes allow overloading subs?

by Ovid (Cardinal)
on Dec 04, 2002 at 20:52 UTC ( #217591=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $person = People
        ->new
    ...
        ->email( 'dev@null.com' )
        ->save;
    my $id = $person->get_id;
    
  2. or download this
    my $person = People->new( $id );
    print $person->first_name, ' ', $person->last_name;
    
  3. or download this
    class People {
        // Java constructors have the same name as the class
    ...
            // we can now access an object by id
        }
    }
    
  4. or download this
    sub new {
        my ($class,$id) = @_;
    ...
        %data = $class->_initialize($id) if $id;
        bless \%data, $class;
    }
    
  5. or download this
      # no!  If this is mapping to a database, you probably don't
      # want them to be able to change the id
      $person->id( $id );
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2023-06-03 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (6 votes). Check out past polls.

    Notices?