Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 46 lines (34 sloc) 0.721 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
## Used in the examples to reduce LOC by declaring fucntions that are used
## over and over in this module

package ExampleHelpers;

use warnings;
use strict;

use POSIX qw(strftime);
use Exporter;
use base qw(Exporter);

our @EXPORT_OK = qw(eg_say eg_object);

sub eg_say {
my $message = join("", @_);
print strftime("%F %T", localtime()), " - ", $message, "\n";
}

sub eg_object {
my $name = shift;
return ExampleObject->new($name);
}

# An example object.

{
package ExampleObject;

use warnings;
use strict;

sub new {
my ($class, $name) = @_;
return bless {
name => $name,
}, $class;
}

sub handler_method {
my $self = shift;
ExampleHelpers::eg_say("$self->{name} handled an event");
}
}

1;
Something went wrong with that request. Please try again.