Gene Dascher ([EMAIL PROTECTED]) said something to this effect on 03/15/2001:
> Well, with the subprocess_env(), I can see the key that I set in my cgi now,
> but the value that I set the key to is a Hash reference that I need to use
> in my cgi.  Unfortunately, all I get now is ENV{'TEST_VAR'} =
> HASH(0x860a278), and I can't pull my values out.

I'm running into this as well, but with a different Apache::Table
object. It seems that Apache::Table stringifies its values, which
makes it useless for applications like this.

The only Apache piece that doesn't stringify is pnotes, which is
only available to Perl handlers.

Another option is:

    my $value_to_save = {
        a => 1,
        b => 2,
        c => [ 3, 4, 5 ],
    };

    my $d = Data::Dumper->new([ $value_to_save ]);
    $d->Indent(0)->Purity(1)->Terse(1)->Deepcopy(1);

    $r->subprocess_env('TEST_VAR' => $d->Dump);

And then in whatever you use the value in:

    my $restored_value = eval $r->subprocess_env('TEST_VAL');

$r->subprocess_env('TEST_VAL') looks something like (as a string):

    {"a" => 1,"b" => 2,"c" => [3,4,5]}

You could also use Storable, but that is not a part of the
default install like Data::Dumper is, so I avoid it if I can.

(darren)

-- 
Make no laws whatever concerning speech, and speech will be free; so soon
as you make a declaration on paper that speech shall be free, you will have
a hundred lawyers proving that "freedom does not mean abuse, nor liberty
license"; and they will define and define freedom out of existence.  
    -- Voltarine de Cleyre (19th Century French anarchist)

Reply via email to