Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: CGI::Buildform

by Brovnik (Hermit)
on Aug 30, 2001 at 14:36 UTC ( #109038=note: print w/replies, xml ) Need Help??

in reply to CGI::Buildform

One brief comment - Always use the 2 argument form of bless,
so that the class can be subclassed. You may need to check the $class, depending on how it is called, so
my $proto = shift; my $class = ref($proto) || $proto; # stuff to create self bless($self,$class);
is good practice. bless returns the item as well, so you could write your new() method as
sub new { my ($proto,$name,$type,$end) = @_; my $class = ref($proto) || $proto; return bless { name => $name, type => $type, end => $end, attributes => {}, }, $class; }


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://109038]
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)
[karlgoethebier]: thanks ;-
[karlgoethebier]: all for reading the manuals

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-07-21 09:09 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (320 votes). Check out past polls.