Does your script have tests?

Before you make any changes you should
1) know what the program is supposed to do
2) know what it actually does currently
3) know the difference between what it does and what its supposed to do (a buglist)
4) have an automatic way (a programmatic way) of checking the program does what its supposed to do

I would start by writing tests :) saving all changes in version control

Then maybe use B::Xref to identify most isolated chunks to turn into good and proper subs that take arguments and return values, and take on increasingly messier stuff

Now, PadWalker can help you get at the stuff, and you an use local or even Data::Alias

get lexical via PadWalker/Lexical::Util, and globals(locals) via %package::

You might try Binding

This may be of interest Splitting a project into smaller files, general advice finding duplicate code

Good luck


In reply to Re: using eval or equivalent to automatically generate my statements by Anonymous Monk
in thread using eval or equivalent to automatically generate my statements by ISAI student

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.