NAME
MPMinus::Util - Utility functions
VERSION
Version 1.12
SYNOPSIS
use base qw/ MPMinus::Util /;
DESCRIPTION
The module works with the fundamental tools for the configuration mod_perl level
- exception
-
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
- debug
-
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.
- log
-
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): ' '
- log_debug
-
Alias for call: $m->log( $message, 'debug' )
- log_info
-
Alias for call: $m->log( $message, 'info' )
- log_notice
-
Alias for call: $m->log( $message, 'notice' )
- log_warning
-
Alias for call: $m->log( $message, 'warning' )
- log_warn
-
Alias for call: $m->log( $message, 'warning' )
- log_error
-
Alias for call: $m->log( $message, 'error' )
- log_err
-
Alias for call: $m->log( $message, 'error' )
- log_crit
-
Alias for call: $m->log( $message, 'crit' )
- log_alert
-
Alias for call: $m->log( $message, 'alert' )
- log_emerg
-
Alias for call: $m->log( $message, 'emerg' )
- log_fatal
-
Alias for call: $m->log( $message, 'fatal' )
- log_except
-
Alias for call: $m->log( $message, 'except' )
- log_exception
-
Alias for call: $m->log( $message, 'except' )
- sendmail, send_mail
-
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
- syslog, logsys
-
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
HISTORY
- 1.00 / 27.02.2008
-
Init version on base mod_main 1.00.0002
- 1.10 / 01.04.2008
-
Module is merged into the global module level
- 1.11 / Wed Apr 24 14:53:38 2013 MSK
-
General refactoring
AUTHOR
Serz Minus (Lepenkov Sergey) http://serzik.ru <minus@mail333.com>
COPYRIGHT
Copyright (C) 1998-2013 D&D Corporation. All Rights Reserved
LICENSE
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