Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
using 'use' for a package (.pm) file that was setup in package format and exporting ALL of the variables ... I have come to the point that I believe this solution does not work.

This solution should work; the first code sample posted by bliako above works fine for me. If you have trouble with it, please have a look at How do I post a question effectively? and post a Short, Self-Contained, Correct Example that reproduces the trouble you're having.

I don't think 'strict' was designed to work on a multi-file perl script.

That is not the case.

Once again, strict is uselessly a monkey wrench in the works, stopping the script at compile time when it hadn't even had a chance yet to find the variable declarations. This is a problem.

First: strict enforces certain rules. One of the things these rules do is help avoid certain coding mistakes that become debugging and maintenance nightmares. One reason many people here are telling you to use strict is because they speak from experience; they've had to deal with such situations themselves and it's cost them time/money. Those people with enough experience with Perl know in which rare situations it's ok turn off strict, and they can explain exactly why. But here's the thing: unfortunately, the fact that you are having the troubles you are describing in this thread is a good indicator that perhaps your Perl experience is not at that level yet, which means your time is likely better spent on learning how to code with strict turned on first.

Second: People on PerlMonks are volunteering their time to help others for free. When someone comes asking for help with a script that doesn't use strict, then one of the first debugging steps is to turn on strict and warnings to see if the aformentioned coding mistakes are present in the code. And once the code works under strict, there isn't really a good reason to turn it back off. Of course you're free to do so, but at the same time please understand that refusing to use strict also means that you are refusing to follow one of the main debugging suggestions people are giving you, which among other things could be considered disrespectful of those trying to help.

I also wanted to note that you've made 18 posts in this thread, but only one of them contains more than a single line of code. My suggestion would be that you show the issues you're having with an SSCCE, so that we have something to actually work with and help you improve.

The above are the reasons why people are being so insistent that you use strict. If you give it a chance, we'll be happy to help you learn - hence my requests for an SSCCE above.

In reply to Re^3: How to import "global" variables into sub-scripts from main script? by haukex
in thread How to import "global" variables into sub-scripts from main script? by Polyglot

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2023-03-29 10:58 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (71 votes). Check out past polls.