---
name: "Badger"
section: "3pm"
platform: "linux"
package: "libbadger-perl"
version: "0.16-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Badger"
---

# Badger(3pm)

Perl Application Programming Toolkit

## NAME

Badger - Perl Application Programming Toolkit

## SYNOPSIS

```
    use Badger
        lib        => '../lib',     # like 'use lib' but relative to $Bin
        Filesystem => 'File Dir',   # import from Badger::Filesystem
    use Badger
        Filesystem => 'Dir File',
        Utils      => 'numlike textlike',
        Constants  => 'ARRAY HASH',
        Codecs     => [codec => 'base64'];
```

This is equivalent to:

```
    use Badger;
    use Badger::Filesystem 'Dir File';
    use Badger::Utils      'numlike textlike',
    use Badger::Constants  'ARRAY HASH',
    use Badger::Codecs      codec => 'base64';
```

## DESCRIPTION

The Badger toolkit is a collection of Perl modules designed to simplify the process of building object-oriented Perl applications. It provides a set of *foundation classes* upon which you can quickly build robust and reliable systems that are simple, sexy and scalable.  See `"Badger::Intro"` for further information.

The `"Badger"` module is a front-end to other `"Badger"` modules.  You can use it to import any of the exportable items from any other `"Badger"` module. Simply specify the module name, minus the `"Badger::"` prefix as a load option.

For example:

```
    use Badger
        Filesystem => 'Dir File',
        Utils      => 'numlike textlike',
        Constants  => 'ARRAY HASH',
        Codecs     => [codec => 'base64'];
```

This is equivalent to:

```
    use Badger;
    use Badger::Filesystem 'Dir File';
    use Badger::Utils      'numlike textlike',
    use Badger::Constants  'ARRAY HASH',
    use Badger::Codecs      codec => 'base64';
```

Note that multiple arguments for a module should be defined as a list reference.

```
    use Badger
        ...etc...
        Codecs => [codec => 'base64'];
```

This is equivalent to:

```
    use Badger::Codecs [codec => 'base64'];
```

Which is also equivalent to:

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

## EXPORT HOOKS

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

### lib

This performs the same task as `"use lib"` in adding a directory to your `@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 *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 *my\_project/perl/lib* to the include path so that the `"My::Module"` module can be correctly located.  It is equivalent to the following code using the FindBin module.

```
    #!/usr/bin/perl
    use FindBin '$Bin';
    use lib "$Bin/../perl/lib";
    use My::Module;
```

## METHODS

### hub()

Returns a Badger::Hub object.

### codec()

Delegates to the Badger::Hub **codec()** method to return a Badger::Codec object.

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

### config()

Delegates to the Badger::Hub **codec()** method to return a Badger::Config object.  This is still experimental.

## TODO

Other methods like **codec()** to access different `"Badger"` modules. These should be generated dynamically on demand.

## BUGS

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

## AUTHOR

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

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

## 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.

## SEE ALSO

\<http://badgerpower.com/\>

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