MPMinus::Util - Utility functions
Version 1.12
use base qw/ MPMinus::Util /;
The module works with the fundamental tools for the configuration mod_perl level
my $excstat = exception( $message );
Write exception information to file and sending e-mail messages if its text contains the substring "[SENDMAIL]" and on the flag _errorsendmail_
$message - Log (exception) message
my $debugstat = debug( $message, $verbose, $file );
Write debugging information to file
$message - Log (debug) message $verbose - System information flag. 1 - verbose mode, on / 0 - regular mode, off $file - Log file (absolute). Default as: <modperl_root>/mpminus-<prefix>_debug.log. If the flag _syslog_ the value is ignored - the message is written to the Apache logfile.
It should be noted that if the flag is omitted then the output information _debug_ be ignored.
my $logstat = $m->log( $message, $level, $file, $separator );
Main logging method
$message - Log message $level - logging level. It may be either a numeric or string value of the form: debug -- 0 (default) info -- 1 notice -- 2 warning -- 3 error -- 4 crit -- 5 alert -- 6 emerg -- 7 fatal -- 8 except -- 9 $file - Log File (absolute). Default as: <modperl_root>/mpminus-<prefix>_error.log. If the flag _syslog_ the value is ignored - the message is written to the Apache logfile $separator - Log-record separator char's string. Default as char(32): ' '
Alias for call: $m->log( $message, 'debug' )
Alias for call: $m->log( $message, 'info' )
Alias for call: $m->log( $message, 'notice' )
Alias for call: $m->log( $message, 'warning' )
Alias for call: $m->log( $message, 'error' )
Alias for call: $m->log( $message, 'crit' )
Alias for call: $m->log( $message, 'alert' )
Alias for call: $m->log( $message, 'emerg' )
Alias for call: $m->log( $message, 'fatal' )
Alias for call: $m->log( $message, 'except' )
my $sendstatus = $m->sendmail( -to => $m->conf('server_admin'), -cc => 'foo@example.com', ### OPTIONAL -from => sprintf('"%s" <%s>',$m->conf('server_name'),$m->conf('server_admin')), -subject => 'Subject', -message => 'Message', # Encoding/Types -type => 'text/plain', ### OPTIONAL -charset => 'windows-1251', ### OPTIONAL # Program sendmail -sendmail => '/usr/sbin/sendmail',### OPTIONAL -flags => '-t', ### OPTIONAL # SMTP -smtp => ($m->conf('smtp_host') || ''), ### OPTIONAL -smtpuser => ($m->conf('smtp_user') || ''), ### OPTIONAL -smtppass => ($m->conf('smtp_password') || ''),### OPTIONAL # Attaches -attach => [ ### OPTIONAL { Type=>'text/plain', Data=>'document 1 content', Filename=>'doc1.txt', Disposition=>'attachment', }, { Type=>'text/plain', Data=>'document 2 content', Filename=>'doc2.txt', Disposition=>'attachment', }, ### ... ### ], );
If you need to send a letter with only one attachment:
-attach => { Type=>'text/html', Data=>$att, Filename=>'response.htm', Disposition=>'attachment', },
or
-attach => { Type=>'image/gif', Path=>'aaa000123.gif', Filename=>'logo.gif', Disposition=>'attachment', },
Sending mail via "sendmail" in CTK::Util
my $logstat = $m->syslog( $message, $level );
Apache logging to the Apache logfile (ErrorLog of your virtualhost)
$level can take the following values:
debug (default), info, notice, warning, error, crit, alert, emerg, fatal, except
The function returns work status
Init version on base mod_main 1.00.0002
Module is merged into the global module level
General refactoring
Serz Minus (Lepenkov Sergey) http://serzik.ru <minus@mail333.com>
Copyright (C) 1998-2013 D&D Corporation. All Rights Reserved
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See LICENSE file
LICENSE
To install MPMinus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MPMinus
CPAN shell
perl -MCPAN -e shell install MPMinus
For more information on module installation, please visit the detailed CPAN module installation guide.