Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 musing on the Monastery: (5)
As of 2022-06-29 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (96 votes). Check out past polls.

    Notices?