Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^7: Unclear about 'our'

by haukex (Archbishop)
on Dec 28, 2022 at 17:36 UTC ( [id://11149169]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Unclear about 'our'
in thread Unclear about 'our'

Perl OO, at its simplest, actually doesn't involve that much boilerplate so that IMHO it's worth it to learn that - see my example below as well as perlootut and perlmod (Update: and perlobj). But when I do use a module, I typically go for Moo.

package Foo; use warnings; use strict; sub new { my ($class, $bar) = @_; my $self = { bar => $bar }; return bless $self, $class; } sub foo { my $self = shift; print "Bar=", $self->{bar}, "\n"; } 1;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-20 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found