Last active
August 29, 2015 13:58
-
-
Save leejo/9971435 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have bigballofmud.pl that calls (requires) many littleballsofmud.pl, | |
none of which use strict and have many globals (there is no way i can | |
add use strict to any of these... yet). I want to add a new littleballofmud.pl, | |
but of course want to use strict. I still need to access the global | |
vars from bigballofmud.pl (and again, can't modify it to pass args) | |
but want littleballofmud.pl to be testable outside of bigballofmud.pl | |
under full strict *not* using globals. | |
My solution is this in littleballofmud.pl: | |
sub foo { | |
# if globals are defined use them, otherwise unpack args | |
our ( $first,$second,$third ); | |
$first // do { ( $first,$second,$third ) = @_ }; | |
} | |
This seems reasonable, but also potentially a WTF. Thoughts? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment