2010-03-17 07:36:54 +01:00
|
|
|
# File: NewModule.pm
|
2010-03-22 08:33:44 +01:00
|
|
|
# Author: pragma_
|
2010-03-17 07:36:54 +01:00
|
|
|
#
|
|
|
|
# Purpose: New module skeleton
|
|
|
|
|
|
|
|
package PBot::NewModule;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
2010-03-24 07:47:40 +01:00
|
|
|
use vars qw($VERSION);
|
|
|
|
$VERSION = $PBot::PBot::VERSION;
|
2010-03-17 07:36:54 +01:00
|
|
|
|
|
|
|
use Carp ();
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
if(ref($_[1]) eq 'HASH') {
|
|
|
|
Carp::croak("Options to Logger should be key/value pairs, not hash reference");
|
|
|
|
}
|
|
|
|
|
|
|
|
my ($class, %conf) = @_;
|
|
|
|
|
2010-03-22 08:33:44 +01:00
|
|
|
my $self = bless {}, $class;
|
|
|
|
$self->initialize(%conf);
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub initialize {
|
|
|
|
my ($self, %conf) = @_;
|
|
|
|
|
2010-03-17 07:36:54 +01:00
|
|
|
my $option = delete $conf{option};
|
2010-03-22 08:33:44 +01:00
|
|
|
$option = 10 unless defined $option; # set to default value unless defined
|
2010-03-17 07:36:54 +01:00
|
|
|
|
|
|
|
if(defined $option) {
|
|
|
|
# do something (optional)
|
|
|
|
}
|
|
|
|
|
2010-03-22 08:33:44 +01:00
|
|
|
$self->{option} = $option;
|
2010-03-17 07:36:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# subs here
|
|
|
|
|
|
|
|
1;
|