On Tue, Mar 02, 2004 at 05:42:07AM -0500, Rodent of Unusual Size wrote:
> non-integer, or an unopened filehandle.  i've tried things
> like having mkconst() do
> 
> my $name = caller() . "::$_[0]";
> eval("\*$name = sub () { $_[1]; }");

Look at constant.pm for a cleaner way to do this, using a closure.

> evidently the usage of DOH in the caller has already been fetched
> from the symbol table (and found wanting) before the method has
> been called.  is there any way to defeat that?

Sure, just pre-declare the sub, which happens at compile time:

  sub DOH();

Then you can define it at run time, however you like.  Here's how to use
constant.pm for what it's good at:

  use constant;  # require would also work
  import constant DOH => 25;


-- 
             Frederic Briere    <*>    [EMAIL PROTECTED]

 =>  <[EMAIL PROTECTED]> IS NO MORE:  <http://www.abacomsucks.com>  <=

Reply via email to