Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re (tilly) 1: Morse::Code

by tilly (Archbishop)
on Apr 16, 2001 at 07:35 UTC ( [id://72760]=note: print w/replies, xml ) Need Help??


in reply to Morse::Code

On the BEGIN block issue. tye and I disagree quite emphatically on that, see the discussion starting at Re (tilly) 1: Supersplit for details. Suffice it to say that I would drop that block, and move strict to after the initial declarations.

On a more important note, my does not do what vars does. Things like @ISA, @EXPORT_OK, etc need to be global, not lexical. Either move strict to after them, or else declare with vars. my simply will not work.

Thirdly your method/no method code has a lot of repeated logic in it. I would recommend replacing it by something that looks like this:

my $self = ref($_[0]) ? shift : $default_self;
This also allows you to move the my declarations to the first use of the variables. Stylistically I prefer this for lexicals.

For more of my philosophy on scoping see RE (tilly) 3: redeclaring variables with 'my'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-26 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found