Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by RMGir (8873) on 2008.10.14 9:55 (#65420)

    Ah, I missed that these were generated blocks.

    Goto's are evil. But this might be a place to use them, perhaps...

    Why not put them at the bottom of the file? Then stick a

    # GENERATED GOTO - Localize important perl vars

    at the top, and generate this at the bottom:

    goto PAST_LOCALIZERS; # so we don't change return
                                                # value of code...
    no warnings 'uninitialized'; # I ALWAYS misspell this
    local %ENV = %ENV;
    local $/ = $/;
    local @INC = @INC;
    local %INC = %INC;
    local $_ = $_;
    local $| = $|;
    local %SIG = %SIG;
    use warnings 'uninitialized';
    goto VARS_LOCALIZED; # jump back to top of code

      at the bottom of the localizer block...

    This way, the localizers aren't in your face as you're looking at the important part -- the tests.

    In fact, any amount of scaffolding could be moved down into that block, if there's any other prologue stuff your framework generates...