Badger

 view release on metacpan or  search on metacpan

lib/Badger.pm  view on Meta::CPAN

    use Badger::Codecs codec => 'base64';

=head1 EXPORT HOOKS

The C<Badger> module can import items from any other C<Badger::*> module,
as shown in the examples above.  The following export hook is also provided.

=head2 lib

This performs the same task as C<use lib> in adding a directory to your
C<@INC> module include path.  However, there are two differences.  First,
you can specify a directory relative to the directory in which the script
exists.

    use Badger lib => '../perl/lib';

For example, consider a directory layout like this:

    my_project/
        bin/
            example_script.pl
        perl/
            lib/
                My/
                    Module.pm
            t/
                my_module.t

The F<my_project/example_script.pl> can be written like so:

    #!/usr/bin/perl

    use Badger lib => '../perl/lib';
    use My::Module;

    # your code here...

This adds F<my_project/perl/lib> to the include path so that the
C<My::Module> module can be correctly located.  It is equivalent to
the following code using the L<FindBin> module.

    #!/usr/bin/perl

    use FindBin '$Bin';
    use lib "$Bin/../perl/lib";
    use My::Module;

=head1 METHODS

=head2 hub()

Returns a L<Badger::Hub> object.

=head2 codec()

Delegates to the L<Badger::Hub> L<codec()|Badger::Hub/codec()> method to
return a L<Badger::Codec> object.

    my $base64  = Badger->codec('base64');
    my $encoded = $base64->encode($uncoded);
    my $decoded = $base64->decode($encoded);

=head2 config()

Delegates to the L<Badger::Hub> L<codec()|Badger::Hub/codec()> method to
return a L<Badger::Config> object.  This is still experimental.

=head1 TODO

Other methods like L<codec()> to access different C<Badger> modules.
These should be generated dynamically on demand.

=head1 BUGS

Please report bugs or (preferably) send pull requests to merge bug fixes
via the github repository: L<https://github.com/abw/Badger>.

=head1 AUTHOR

Andy Wardley  L<http://wardley.org/>.

With contributions from Brad Bowman and Michael Grubb, and code, inspiration
and insight borrowed from many other module authors.

=head1 COPYRIGHT

Copyright (C) 1996-2012 Andy Wardley.  All Rights Reserved.

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

=head1 SEE ALSO

L<http://badgerpower.com/>

L<https://github.com/abw/Badger>

=cut

# Local Variables:
# mode: perl
# perl-indent-level: 4
# indent-tabs-mode: nil
# End:
#
# vim: expandtab shiftwidth=4:



( run in 1.141 second using v1.01-cache-2.11-cpan-d06a3f9ecfd )