Posts for the month of January 2011
Problems with Perl 5's switch
I was trying to use perl's __DATA__
subsection and was receiving the following warnings/errors:
readline() on unopened filehandle DATA main::DATA used only once
Well, after fighting with it for like 20 minutes, I did a Google search. After wandering around different mailing list archives, etc, I finally found a hint of a solution.
Apparently, using "Switch" (via "use Switch;
") does some kind of behind-the-scenes magic that breaks __DATA__
section stuff.
I didn't find anything in perldoc Switch
that indicated it was a known bug. However, it is v5.8.5 so fairly old (2004, from RHEL 4.5) and the Switch
documentation says it is from 2003.
Annoying tho.