me::inlined - EXPERIMENTAL - define multiple packages in one file, and reference them in any order
package Foo; package Bar; use Foo; # kaboom: "Can't locate Foo.pm in @INC"
package Foo; use me::inlined; package Bar; use Foo; # no kaboom!
If you've ever defined multiple packages in the same file, but want to
use one package in another, you'll have discovered why it's much easier to simply follow best practices and define one package per file.
However, this module will let you minimize your inode usage: simply add
use me::inlined in any package that you want to refer to in other namespaces in the same file, and you can (probably) safely define and use packages in any order.
This will also let you do
require Foo; in other code, after the .pm file containing
Foo has been loaded, without
require complaining that it cannot find Foo.pm in
This module is for demonstration purposes only, and in no way am I recommending you use this in any real code whatsoever.
There is no public API other than the
use directive itself, which takes no arguments.
There may be edge cases where this doesn't work right, or leads to infinite looping when trying to compile modules. Use at your own risk!
This module was inspired by a conversation witnessed on
email@example.com -- credit for the idea belongs to Linda Walsh.
Karen Etheridge <firstname.lastname@example.org>
This software is copyright (c) 2013 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Neil Bowers <email@example.com>