Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Class::Std, 5.6.1, and AUTOLOAD

by ikegami (Patriarch)
on Sep 22, 2005 at 16:34 UTC ( [id://494194]=note: print w/replies, xml ) Need Help??


in reply to Class::Std, 5.6.1, and AUTOLOAD

You can make something execute at compile time using BEGIN. From what you say, the following would work:

BEGIN { # this line starts in column 0, and seems like runtime assignment *ID = \&Scalar::Util::refaddr; # the same for these, later: *_extract_default = _extractor_for_pair_named('default'); *_extract_init_arg = _extractor_for_pair_named('init_arg'); *_extract_get = _extractor_for_pair_named('get'); *_extract_set = _extractor_for_pair_named('set'); } # later, in Class::Std::SCR... my %values_of : ATTR ( :init_arg<values> );

Replies are listed 'Best First'.
Re^2: Class::Std, 5.6.1, and AUTOLOAD
by rjbs (Pilgrim) on Sep 22, 2005 at 16:49 UTC
    Thanks. I understand compile time and how to cram code into it. The question isn't "how do I fix this problem" but "why isn't this a problem under my modern perl build?" Any idea?
    rjbs
      No idea. Maybe if I had something minimal I could run and debug.

        You could run the 00.load.t in Class-Std-0.0.4, heh.

        I tried using this as a test case:

        package CheckCheck; use strict; use warnings; *INSTALLED = sub { print "EVERYTHING IS OK\n"; }; sub AUTOLOAD { warn INSTALLED(); } sub GO_GO_GO { INSTALLED(); } CHECK { GO_GO_GO() } 1;

        ...but then perl -Mcheck -e1 is fine on both 5.6.1 and 5.8.7; no clue.

        rjbs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://494194]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-20 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found