Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: My first attempt to design a module

by doug (Pilgrim)
on Oct 04, 2010 at 13:38 UTC ( [id://863342]=note: print w/replies, xml ) Need Help??


in reply to My first attempt to design a module

You have the snippet

sub new { my $class = shift; my %args = @_;

which I do a bit differently.

sub new { my ($class,%args) = @_; my $package = ref($class) || $class || confess "classless construct +or";

because I like to allow for

 $something->new(...)

where $something can be a string (class name) or an existing object. The existing object bit is especially handy when creating a clone.

- doug

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found