in reply to use constant and the Perl Optimizer
$ perl -MO=Deparse -e ' > package main; > use Test; > use constant DEBUG => 0; > my $t = Test->new(); > > package Test; > use constant DEBUG => 0; > sub new { > print "Test->new(@_)" if ( DEBUG || main::DEBUG() ); > # ... > } > ' use Test; use constant ('DEBUG', 0); my $t = 'Test'->new; package Test; sub BEGIN { require constant; do { 'constant'->import('DEBUG', 0) }; } sub new { 0; } -e syntax OK
|
|---|