Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^6: Unclear about 'our'

by ibm1620 (Hermit)
on Dec 28, 2022 at 17:24 UTC ( [id://11149168]=note: print w/replies, xml ) Need Help??


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

I agree with your suggestion to make the module OO -- which means it's time to bite the bullet and learn how to write OO Perl. :-) I know there are various CPAN modules that support it; do you have a recommendation?

Replies are listed 'Best First'.
Re^7: Unclear about 'our'
by haukex (Archbishop) on Dec 28, 2022 at 17:36 UTC

    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;
Re^7: Unclear about 'our'
by karlgoethebier (Abbot) on Dec 30, 2022 at 18:09 UTC

Log In?
Username:
Password:

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

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

    No recent polls found