=head1 NAME Spoon::Base - Generic Spoon Base Class =head1 SYNOPSIS use Spoon::Base '-Base'; =head1 DESCRIPTION Base class for application plugins. Provides basic functionality to all modules inheriting from this class. =head1 SUBROUTINES These subroutines are meant to be called bare, not as an object-method call. =head2 trace See Spoon::Trace::trace(). =head2 conf(name, default) Returns the configuration value for "name", if it can be found in the config ($self->hub->config). Returns $default, otherwise. =head1 METHODS =head2 hub Return the application's hub object. See Spoon::Hub. =head2 init Inherited by all subclasses. Put your class initialization stuff here. =head2 assert(boolean) Die if the supplied argument is false. =head2 t([label]) Calls Spoon::Trace::mark(). See Spoon::Trace. =head2 clone Copies a class instance. The copy is only a shallow one. =head2 is_in_cgi Returns a boolean, indicating whether we were called from a CGI interface. =head2 is_in_test Returns a boolean, indicating whether we were called from a test suite. =head2 have_plugin(class_id) Tries to load a plugin. See Spoon::Hub::load_class(). =head2 plugin_directory Returns your plugin's directory. You can use this directory to store state. =head2 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. =head2 dumper_to_file(filepath, variable1 [, variable2...]) Uses Data::Dumper to save a dump of one or more variables to the specified file. =head2 has_utf8 Returns a boolean, indicating whether utf8 is available on this platform and version of perl. =head2 utf8_encode(string) Encodes the string in utf8, if utf8 is available. Otherwise, returns $string unmodified. See Encode::encode(). =head2 utf8_decode(string) Decodes the string from utf8, if utf8 is available. Otherwise, returns $string unmodified. See Encode::decode(). =head2 uri_escape(string) Escapes all invalid URI characters. See CGI::Util::escape(). =head2 uri_unescape(string) Unescapes all invalid URI characters. See CGI::Util::unescape(). =head2 html_escape(string) Escapes all reserved characters. The result is suitable for including verbatim in an HTML document. See CGI::escapeHTML(). =head2 html_unescape(string) Escapes all reserved characters. The result is suitable for including verbatim in an HTML document. See CGI::unescapeHTML(). =head2 base64_encode(string) Encodes the specified string into Base64. See MIME::Base64::encode_base64(). =head2 base64_encode(base64_data) Decodes the specified data from Base64. See MIME::Base64::decode_base64(). =head1 TODO * Document what Spoon::Base->debug() does. =head1 AUTHOR Ingy döt Net =head1 COPYRIGHT Copyright (c) 2006. Ingy döt Net. All rights reserved. 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