Skip to content

Instantly share code, notes, and snippets.

@gfx
Created October 21, 2009 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfx/214862 to your computer and use it in GitHub Desktop.
Save gfx/214862 to your computer and use it in GitHub Desktop.
#!perl -w
use strict;
use Test::More tests => 3;
{
package T;
use Tie::Hash();
use base qw(Tie::StdHash);
sub FETCH{
my($self, $key) = @_;
# XXX: "require $key" is okey
eval "use $key(); 1";
}
}
tie my(%t), 'T';
ok $t{Cwd}, 'existing module';
ok!$t{'No::Such::Module'}, 'non-existing module';
ok $t{strict}, 'existing module';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment