Thomas Stanley > Logger-Simple-2.0 > Logger::Simple

Download:
Logger-Simple-2.0.tar.gz

Dependencies

Annotate this POD

Related Modules

Net::Netrc
Net::FTP
Test::More
Data::Dumper
LWP::UserAgent
HTTP::Cookies
File::Slurp
more...
By perlmonks.org

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 2.0   Source  

NAME ^

Logger::Simple - Implementation of the Simran-Log-Log and Simran-Error-Error modules

SYNOPSIS ^

  use Logger::Simple;
  my $log=Logger::Simple->new(LOG=>"/tmp/program.log");
  my $x=5;my $y=4;
  
  if($x>$y){
    $log->write("\$x is greater than \$y");
  }

DESCRIPTION ^

new

my $log=Logger::Simple->new(LOG=>"/tmp/logfile");

The new method creates the Logger::Simple object as an inside-out object. The Log parameter is a mandatory one that must be passed to the object at creation, or the object will fail. Upon creation, this method will also call the open_log method which opens the log file.

write

$log->write("This is an error message");

This method will write a message to the logfile, and will update the internal HISTORY array.

retrieve_history

my @history = $log->retrieve_history; my $msg = $log->retrieve_history;

When called in scalar context, it will return the last message written to the HISTORY array. When called in a list context, it will return the entire HISTORY array

clear_history

$log->clear_history;

This method will clear the internal HISTORY array

EXPORT ^

None by default.

ACKNOWLEDGEMENTS ^

This module is based on the Simran::Log::Log and Simran::Error::Error modules. I liked the principle behind them, but felt that the interface could be a bit better.

My thanks also goes out once again to Damian Conway for Object Oriented Perl, and also to Sam Tregar, for his book "Writing Perl Modules for CPAN". Both were invaluable references for me.

I would also like to thank Jerry Heden for his Object::InsideOut module, which I used to create this module.

AUTHOR ^

Thomas Stanley

Thomas_J_Stanley@msn.com

I can also be found on http://www.perlmonks.org as TStanley. You can also direct any questions concerning this module there as well.

COPYRIGHT ^

Copyright E 2002-2006 Thomas Stanley. All rights reserved. This program is free software; you can distribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

perl(1).

Object::InsideOut

Simran::Log::Log

Simran::Error::Error

syntax highlighting: