R
RA Jones
This is a question about packages and lexical variables.
I am using a very useful $SIG{__DIE__} handler module (CGI::HTMLError),
and want to extend it's functionality by adding an e-mail alert
function. Clearly I don't want to have to re-write the module to do
this, so in my apps I 'use' my extended mod Local::HTMLError, which
itself uses CGI::HTMLError as base. All works fine, except for the fact
that the CGI errors are captured within lexical variables inside a C::H
sub. I assume I cannot access these as they are not present in the
symtable (they are declared with 'my'), and indeed
$CGI::HTMLError::sub_routine::variable does not work.
Except that I read that Perl does not necessarily recycle variables if
it detects they are referenced elsewhere. So is there any way I can
achieve what I want here - to retrieve lexical variables from another
package's sub-routines?
I am using a very useful $SIG{__DIE__} handler module (CGI::HTMLError),
and want to extend it's functionality by adding an e-mail alert
function. Clearly I don't want to have to re-write the module to do
this, so in my apps I 'use' my extended mod Local::HTMLError, which
itself uses CGI::HTMLError as base. All works fine, except for the fact
that the CGI errors are captured within lexical variables inside a C::H
sub. I assume I cannot access these as they are not present in the
symtable (they are declared with 'my'), and indeed
$CGI::HTMLError::sub_routine::variable does not work.
Except that I read that Perl does not necessarily recycle variables if
it detects they are referenced elsewhere. So is there any way I can
achieve what I want here - to retrieve lexical variables from another
package's sub-routines?