Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: require "shared.pl" with use strict;

by vinoth.ree (Monsignor)
on Feb 19, 2015 at 17:45 UTC ( [id://1117246]=note: print w/replies, xml ) Need Help??


in reply to require "shared.pl" with use strict;

In general, when you are working with multiple files, and importing variables between them, you will find that requiring files ends up getting a bit complicated as your project grows. This is due to everything sharing a common namespace, but with some variables declared in some files but not others.

The usual way this is resolved in Perl is to create modules, and then import from those modules.


All is well. I learn by answering your questions...
  • Comment on Re: require "shared.pl" with use strict;

Replies are listed 'Best First'.
Re^2: require "shared.pl" with use strict;
by 5plit_func (Beadle) on Feb 20, 2015 at 01:23 UTC
    From the error message posted. I believe the compiler is complaining that some variables where not created using the my() operator, Hence that error. Make sure all variables or those that need to be lexical are declared using the my() operator. I believe that would save you alot of stress because you have said (use strict) hence those errors. Also make sure there are no conflicts between your variable names and those imported from other modules or required file names. Thats my little thought base on the posted error message. Hope this helps. Should i be wrong please correct me.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2024-04-24 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found