Mailing List Archive

Accessing EmbPerl variables from another package
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

From my web page I call a routine in a library. I would like that
routine to be able to access (and set) some variables (%udat in
particular). I need to experiment to be sure, but
HTML::Embperl::udat didn't seem to work, and caller() returned
HTML::Embperl, not the custom package that I expected. Am I missing
something obvious? In the meantime I'm passing in %udat by
reference, which works (and one might even argue is cleaner), but I'd
still like to know if what I want is possible.
- --

Kee Hinckley - Somewhere Consulting Group - Cyberspace Architects(rm)

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>

iQA/AwUBOP8oNiZsPfdw+r2CEQKV/gCg+0ADFqJLeVUs/ZUl+6mzGjjLcbkAn1Qe
tZbWDDmemFNXrVMRy7rsUKov
=3CLO
-----END PGP SIGNATURE-----
RE: Accessing EmbPerl variables from another package [ In reply to ]
> From my web page I call a routine in a library. I would like that
> routine to be able to access (and set) some variables (%udat in
> particular). I need to experiment to be sure, but
> HTML::Embperl::udat didn't seem to work,

Accessing %HTML::Embperl::udat should work in the current version, but is
not guaranteed to work in future version.

> and caller() returned
> HTML::Embperl, not the custom package that I expected.

That's strange, but I didn't tried it for a long time...

> Am I missing
> something obvious? In the meantime I'm passing in %udat by
> reference, which works (and one might even argue is cleaner), but I'd
> still like to know if what I want is possible.

Currently passing a ref to %udat is the best thing you could do. On the todo
list is, to add a function to Embperl, that allows you to access %udat from
outside a Embperl page.

Gerald