---
name: "Logger::Simple"
section: "3pm"
platform: "linux"
package: "liblogger-simple-perl"
version: "2.0-1.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Logger::Simple"
---

# Logger::Simple(3pm)

Implementation of the Simran-Log-Log and Simran-Error-Error modules

## 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

## SEE ALSO

[**perl**(1)](/perl/1.md).

Object::InsideOut

Simran::Log::Log

Simran::Error::Error
