NAME
    SHARYANTO::Package::Util - Package-related utilities

VERSION
    version 0.56

SYNOPSIS
     use SHARYANTO::Package::Util qw(
         package_exists
         list_package_contents
         list_subpackages
     );

     print "Package Foo::Bar exists" if package_exists("Foo::Bar");
     my %content   = list_package_contents("Foo::Bar");
     my @subpkg    = list_subpackages("Foo::Bar");
     my @allsubpkg = list_subpackages("Foo::Bar", 1); # recursive

DESCRIPTION
  package_exists($name) => BOOL
    Return true if package "exists". By "exists", it means that the package
    has been defined by "package" statement or some entries have been
    created in the symbol table (e.g. "$Foo::var = 1;" will make the "Foo"
    package "exist").

    This function can be used e.g. for checking before aliasing one package
    to another. Or to casually check whether a module has been loaded.

  list_package_contents($name) => %res
    Return a hash containing package contents. For example:

     (
         sub1  => \&Foo::Bar::sub1,
         sub2  => \&Foo::Bar::sub2,
         '%h1' => \%Foo::Bar::h1,
         '@a1' => \@Foo::Bar::a1,
         ...
     )

    This module won't list subpackages. Use list_subpackages() for that.

  list_subpackages($name[, $recursive]) => @res
    List subpackages, e.g.:

     (
         "Foo::Bar::Baz",
         "Foo::Bar::Qux",
         ...
     )

    If $recursive is true, will also list subpackages of subpackages, and so
    on.

FAQ
  How to list all existing packages?
    You can recurse from the top, e.g.:

     list_subpackages("", 1);

SEE ALSO
    perlmod

AUTHOR
    Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2013 by Steven Haryanto.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

FUNCTIONS
    None are exported by default, but they are exportable.

