Skip to content

Instantly share code, notes, and snippets.

@three18ti
Last active August 29, 2015 13:56
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 three18ti/9206835 to your computer and use it in GitHub Desktop.
Save three18ti/9206835 to your computer and use it in GitHub Desktop.
package Foo::Bar;
use strict;
use warnings;
1;
package Foo::Baz;
use strict;
use warnings;
1;
package Foo;
use strict;
use warnings;
1;
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
# note, gists don't support subdirectories, so you will need to run the following commands
# once you have checked out your gist and cd'd to it
# mkdir -p lib/Foo
# mv Foo.pm lib/
# mv {Bar,Baz}.pm lib/Foo/
BEGIN {
say "Note the error message (can't find Foo::Bar, that's the Foo.pm package.)";
eval {
require 'lib/Foo.pm';
};
say $@;
}
say "Note this loads without issue";
use lib 'lib';
use Foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment