[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Pulling in a hash via "exec"...FAIL



Dan Linder wrote:
The code I'm working on has had an unknown number of programmers over the
last five years (most field engineers who hacked the code and submitted an
enhancment, not necessiaraly any full-time programmers) so some of the code
in it was probably put in and left there because it worked at the time and
the permissiveness of Perl allowed for the abuse of variable type casting.
:-)

Damn you, perl. Why do you give us so much rope when we're hell bent on hanging ourselves? :)

Yes, wonderful additions - unfortunatly I know that Perl will not execute
this piece of code due to failures the "use strict" finds so working through
them is probably the best solution.  (And if not, I can always wrapper
portions of code I can't fix with "no use strict"...sigh)

Perhaps you can delete the stuff that use strict; bitches about? At least the scoping errors? Making the source a touch more readable? Care to post it on http://pastebin.com/ (or other) so we can see?

Hmmm, this must be a pretty evil program by your measure - it uses eval
quite a bit. :-)

Yikes. IMHO anyone who uses eval is honor-bound to support that code for life. They are not allowed to quit that job, or die. Eval is fine when I write it, or when you wrote it AND support it, but it's evil incarnate when you write it and I have to support it...

Storable looks like a good solution, but the saved files need to be human
readable like the Data::Dump output - I searched for a flag in the Storable
perldoc but couldn't find one.   (And I don't think that is the intention of
Storable anyway - just provide the ability to store a MACHINE readable
variable not HUMAN readable...)

Ya. Agreed. So two files? The humans can read the dead-end .txt files if they want to, but the machine always restores the .storable file?

  store $fields, 'myfile.storable';
  open(OUT, ">myfile.txt");
  print OUT Data::Dumper->Dump( $fields );

Good luck! Sounds like a fun week!  :)

j