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

Re: Re (tilly) 3: How to call other programs

by Jonathan (Curate)
on Feb 02, 2001 at 14:01 UTC ( [id://55970]=note: print w/replies, xml ) Need Help??


in reply to Re (tilly) 3: How to call other programs
in thread How to call other programs

Thank you for the follow up.
The main cause of the sharing warning (as far as I can see) is my own scripts because I'm using Apache::Registry which means that my scripts run via a handler sub (there are no warnings when run off-line).
I think I'll have to make the sub routines anonymous to get round it.
  • Comment on Re: Re (tilly) 3: How to call other programs

Replies are listed 'Best First'.
Re (tilly) 5: How to call other programs
by tilly (Archbishop) on Feb 02, 2001 at 20:54 UTC
    If you are using lexical variables as globals, then use vars - that is what it is for.

    Also if you can you want to move the bulk of the functions in question into their own modules. When your script runs it can then load the module and call functions from there. Why?

    1. Shared warnings go away.
    2. There is less work required per invocation of your script.
    3. I believe you will consume less memory.

    OK, so it will separate code into different files, and that does tend to require more thought. The basic template I would suggest using looks something like this. If your module is MyStuff.pm, then start it like this:

    package MyStuff; @ISA = 'Exporter'; @EXPORT_OK = qw(really neat functions here); use strict; # etc, including those neat functions 1; # An unfortunately necessary annoyance
    And then you use it like this:
    use MyStuff qw(neat functions); # Whatever you actually need # Proceed to call "neat" and "functions like normal # functions. You only get the ones which you list. This # is a GOOD thing because it makes it easier to track down # which function came from where!
    This is your basic procedural module. While writing it, it is good to put some thought to how to reuse the functions elsewhere...
      O.K You've convinced me. I'll do as you suggest. Thanks for your help tilly

Log In?
Username:
Password:

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

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

    No recent polls found