Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
go ahead... be a heretic
 
PerlMonks

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

by Aristotle (Chancellor)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

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/Bar.pm"; } 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.


Comment on Coderefs in @INC (was: Building a Simple Perl Module Database)
Download Code
Re: Coderefs in @INC (was: Building a Simple Perl Module Database)
by djantzen (Priest) on Aug 26, 2002 at 00:05 UTC
Login:
Password
remember me
What's my password?
Create A New User

Node Status?
node history
Node Type: note [id://192635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (20)
ikegami
Corion
GrandFather
Your Mother
toolic
holli
JavaFan
kennethk
thezip
Eyck
NodeReaper
tubaandy
dirving
ssandv
VinsWorldcom
jonasbn
elTriberium
MikeDexter
d5e5
brp4h
As of 2010-02-09 21:05 GMT
Sections?
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information?
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes?
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers?
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth?

What level of existential comfort do you require?

Palace
Executive suite at the best hotel
Regular hotel in a decent part of town
Motel
Boarding house
Sleeping Bag on Couch in Basement
Any port in a storm
Camping under the freeway overpass
Jail
Other

Results (279 votes), past polls