Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

RE: Named Sort Subs with Strict?

by spudzeppelin (Pilgrim)
on Sep 19, 2000 at 23:16 UTC ( [id://33182]=note: print w/replies, xml ) Need Help??


in reply to Named Sort Subs with Strict?

I knew about sort {BLOCK} already -- but what I was hoping to achieve was something recyclable -- where if I add other do_blah subs besides do_msalist, they can call the same sort routine. Hence, I like Stephen's suggestion of giving the hashes package scope with use vars.

This sort of triggers a new question -- I know package scope is a bad, bad thing under mod_perl in most cases, but can I work around it by explicitly undefing the hashes before the script returns?

Spud Zeppelin * spud@spudzeppelin.com

Replies are listed 'Best First'.
RE: RE: Named Sort Subs with Strict?
by Fastolfe (Vicar) on Sep 20, 2000 at 00:17 UTC
    Perhaps someone else can answer more authoritatively, but my understanding of global variables is that
    • a) they're slower to access than local counterparts; and
    • b) in mod_perl they are persistent and take up space while your script isn't executing, and leave the environment "dirty" for the next time the CGI is called
    Emptying the hashes will fix problem (b) but they can't help you with (a). Unless you're doing a lot of data crunching, though, this might be an acceptable loss, though in my opinion it's still slightly poor coding practice, but you could do a lot worse.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found