---
name: "Spoon::Base"
section: "3pm"
platform: "linux"
package: "libspoon-perl"
version: "0.24-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/Spoon::Base"
---

# Spoon::Base(3pm)

Generic Spoon Base Class

## NAME

Spoon::Base - Generic Spoon Base Class

## SYNOPSIS

```
    use Spoon::Base '-Base';
```

## DESCRIPTION

Base class for application plugins.  Provides basic functionality to all modules inheriting from this class.

## SUBROUTINES

These subroutines are meant to be called bare, not as an object-method call.

### trace

See *Spoon::Trace::trace()*.

### conf(name, default)

Returns the configuration value for "name", if it can be found in the config ($self-\>hub-\>config).  Returns `$default`, otherwise.

## METHODS

### hub

Return the application's hub object.  See Spoon::Hub.

### init

Inherited by all subclasses.  Put your class initialization stuff here.

### assert(boolean)

Die if the supplied argument is false.

### t(\[label\])

Calls *Spoon::Trace::mark()*.  See Spoon::Trace.

### clone

Copies a class instance.  The copy is only a shallow one.

### is\_in\_cgi

Returns a boolean, indicating whether we were called from a CGI interface.

### is\_in\_test

Returns a boolean, indicating whether we were called from a test suite.

### have\_plugin(class\_id)

Tries to load a plugin.  See *Spoon::Hub::load\_class()*.

### plugin\_directory

Returns your plugin's directory.  You can use this directory to store state.

### env\_check(variable\_name)

Sanity check: ensure the specified variable exists in `%ENV`.  If the variable is not found, dies with a useful error message.

### dumper\_to\_file(filepath, variable1 \[, variable2...\])

Uses Data::Dumper to save a dump of one or more variables to the specified file.

### has\_utf8

Returns a boolean, indicating whether utf8 is available on this platform and version of perl.

### utf8\_encode(string)

Encodes the string in utf8, if utf8 is available.  Otherwise, returns `$string` unmodified.  See *Encode::encode()*.

### utf8\_decode(string)

Decodes the string from utf8, if utf8 is available.  Otherwise, returns `$string` unmodified.  See *Encode::decode()*.

### uri\_escape(string)

Escapes all invalid URI characters.  See *CGI::Util::escape()*.

### uri\_unescape(string)

Unescapes all invalid URI characters.  See *CGI::Util::unescape()*.

### html\_escape(string)

Escapes all reserved characters.  The result is suitable for including verbatim in an HTML document.  See *CGI::escapeHTML()*.

### html\_unescape(string)

Escapes all reserved characters.  The result is suitable for including verbatim in an HTML document.  See *CGI::unescapeHTML()*.

### base64\_encode(string)

Encodes the specified string into Base64.  See *MIME::Base64::encode\_base64()*.

### base64\_encode(base64\_data)

Decodes the specified data from Base64.  See *MIME::Base64::decode\_base64()*.

## TODO

\* Document what Spoon::Base-\>*debug()* does.

## AUTHOR

Brian Ingerson \<INGY@cpan.org\>

## COPYRIGHT

Copyright (c) 2004. Brian Ingerson. All rights reserved.

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

See http://www.perl.com/perl/misc/Artistic.html
