I am writing a script that needs to save it's state to a file and then load it in again later. I use the convention of using the S namespace to denote that the variable should be saved.

I am actually using a very light weight custom dumper function, but I was able to replicate the problem with the standard Data::Dumper library.

I was able to boil down the problem to this script:

#!/usr/bin/perl -T use Data::Dumper; $S::taint = $ARGV[0]; while (my ($name, $glob) = each %S::) { if (defined $$glob) {print Dumper($$glob)} print Dumper("$$glob") if (defined $$glob); print Dumper($$glob) if (defined $$glob); }

In the while loop, the first and second line work just fine. However, the third line (which I happened to use) results in a fatal run-time error. Specifically Can't coerce GLOB to string in padsv at ./taint.pl line 10.

My version of Perl is: This is perl, v5.8.5 built for i386-freebsd-thread-multi-64int

Am I missing something, or if this an error somewhere with the Perl internals?

Thanks!


In reply to Strange error dumping tainted data by zealot

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.