MIME::Tools::ToolkitLogger - a logger which uses Perl's warn()
The MIME::Tools::* modules are for MIME::Tools internal consumption only. The modules and their interfaces may change radically from version to version.
use MIME::Tools::ToolkitLogger; ### Creation: $logger = new MIME::Tools::ToolkitLogger; ### Log messages of various types: $logger->debug("about to open config file"); $logger->warning("missing config file: must create"); $logger->error("unable to create config file");
This is the standard logger used by toolkit modules.
These are printed directly to the STDERR, with a prefix of "MIME-tools: debug".
"MIME-tools: debug"
Debug message are only logged if you have turned "debugging" on in the MIME::Tools configuration.
These are logged by the standard Perl warn() mechanism to indicate an unusual situation. They all have a prefix of "MIME-tools: warning".
"MIME-tools: warning"
Warning messages are only logged if $^W is set true and MIME::Tools is not configured to be "quiet".
$^W
These are logged by the standard Perl warn() mechanism to indicate that something actually failed. They all have a prefix of "MIME-tools: error".
"MIME-tools: error"
Error messages are only logged if $^W is set true and MIME::Tools is not configured to be "quiet".
Class method, constructor. Create the logger.
The PREFIX, if given, precedes all messages; it makes it easier to filter based on the toolkit. If given, the string should end in colon and space. The default is "MIME-tools: ".
Instance method, concrete override. Output a debug message directly to STDERR. Does nothing if debugging() was set false (the default).
Instance method, concrete override. Output a warning message, using Perl's warn().
Instance method, concrete override. Output an error message, using Perl's warn().
All outgoing messages are automatically newline-terminated.
This really could be broken out into two classes: one which just logs to warn(), and a wrapper which consults MIME::Tools configuration before doing anything.
See MIME::Tools::Logger to learn about our superclass, and how loggers work.
See MIME::Tools for more information on configuring the toolkit options which affect this module, particularly debugging() and quiet().
See perlvar for details on $^W.
To install MIME::Head, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MIME::Head
CPAN shell
perl -MCPAN -e shell install MIME::Head
For more information on module installation, please visit the detailed CPAN module installation guide.