Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Coderefs in @INC (was: Building a Simple Perl Module Database)

by Aristotle (Chancellor)
on Aug 25, 2002 at 04:23 UTC ( #192635=note: print w/replies, xml ) Need Help??

in reply to Building a Simple Perl Module Database

Did you know you can put coderefs in @INC?
#!/usr/bin/perl -wl BEGIN { unshift @INC, \&magic_inc; sub magic_inc { print $_[1]; my $i; return \&magic_load if $_[1] eq "Foo/"; } my @src = ("print q(Foo::Bar loaded!);", "1;"); sub magic_load { return defined($_ = shift @src); } } use strict; use Data::Dumper; use Foo::Bar;
The interface is somewhat obscure, but this close to the guts, you have to expect it.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Coderefs in @INC (was: Building a Simple Perl Module Database)
by djantzen (Priest) on Aug 26, 2002 at 00:05 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://192635]
[ovedpo15]: good morning and thx. I forget to mention another thing: what if I need to check that my string is "hey" and ",0" for example "hey_how,0" is good. can I check it with one regex?
[ovedpo15]: I don't know what is between "hey" and ",0"
[Discipulus]: everything is .* in regexes: it has drawbacks (can be nul, is greedy..) so /hey.*,0$/ can be a solution

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-03-20 07:55 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (248 votes). Check out past polls.