I counted 15 globals just at the top of cgi.pl, where it says "# >>>>> Here are some globals that you might want to adjust <<<<<<" which makes sense because you would want all the user-configurable stuff together, at the top of the script, no matter what subroutine they get used in. Whoever wrote CGI.pm surely knew how my variables work because he used them, but he didn't think it was practical to make the user defined variables local. Everyone's programming habits are different, and there are some much longer programs than cgi.pm, even though it's one of the longest modules. I don't think it would be too difficult to find a script with much more than 15 globals.

Everyone seems to be picking on the cosmetic things or the things they wouldn't need. Remember, along with the values, you get the variable names, which someone decided is useful since they're provided by Xref.

It's impossible for anyone to say that a script is a maintenance nightmare just because it uses all globals, no warnings and no strict. My script requires fewer hops to different subroutines, which could make it an easier read. Thinking up unique variable names is easy, and searching the script just in case is easy too. Well written comments within the script and on top are a big help. I have well defined "blocks" of code, but I don't have to bother passing local variables around. They're always exactly where I want them. I don't have the problems described here either.

Not only is my 3400 line script not a maintenance nightmare, but it has fewer bugs and works better than many production scripts I've seen, including its future competition.

EDIT... Forgot to mention another benefit of VarStructor. It could help you be sure that your variables are "my" variables. If it shows a value, you know you forgot "my."


In reply to Re: Re^7: VarStructor 1.0 by Wassercrats
in thread VarStructor 1.0 by Wassercrats

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.