Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Cancel/no-op a require

by sedusedan (Monk)
on Dec 07, 2012 at 14:06 UTC ( #1007743=note: print w/replies, xml ) Need Help??


in reply to Re^2: Cancel/no-op a require
in thread Cancel/no-op a require

OK, so now the correct incantation should be:

unshift @INC, sub { my ($self, $name) = @_; # load the module first local @INC = grep { !ref($_) || $_ != $self } @INC; require $name; # add logging to the package # ignore this hook my $line = 0; return sub { unless ($line++) { $_ = "1;\n"; return 1; } return 0; } };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007743]
help
Chatterbox?
[erix]: I don't know but I think extracting that from Pg is probably not so easy (or it would be done more often, no?)
[Corion]: erix: There is somebody who has hacked up some Ruby scripts to do just that, but the Ruby scripts have some hardcoded #defines (well, reimplement those), so the extraction doesn't compile for Windows...
[Corion]: libpg_query
[Corion]: ... and I think "porting" it basically means (re)implementing a C preprocessor and feeding that one with the appropriate #defines for the platforms, and/or providing stub implementations for OS-specific functions that the query parser really wants to call
[erix]: ah, interesting. Well, sounds like a good start..
[Corion]: In the long run, obviously, the parser wouldn't need/call OS-specific stuff anyway, but we're a long way from that :D

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-07-23 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (464 votes). Check out past polls.

    Notices?