Perl assigns no special meaning to new.
bless associates a hash* with a class, allowing $o->method to work.
package Class; sub new { # Or any other name you want. my ($class) = @_; my $self = bless({}, $class); # $self->{...} = ...; return $self; } sub method { my ($self) = @_; #... } my $o = Class->new(); $o->method();
In reply to Re: OO modules
by ikegami
in thread OO modules
by BernieC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |