3
0
mirror of https://github.com/pragma-/pbot.git synced 2026-02-09 10:57:56 +01:00
pbot/PBot/NewModule.pm
Pragmatic Software f725743ccb == MAJOR NEW BETA RELEASE ==
Converted single large "amalgamate" monolithic pbot2.pl script into multiple Perl packages/modules.

Tons of refactoring and clean-ups.

Consider this version to be beta.  Use at your own risk.
2010-03-17 06:36:54 +00:00

52 lines
737 B
Perl

# File: NewModule.pm
# Authoer: pragma_
#
# Purpose: New module skeleton
package PBot::NewModule;
use warnings;
use strict;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT_OK);
$VERSION = $PBot::PBot::VERSION;
@ISA = qw(Exporter);
@EXPORT_OK = qw();
}
use vars @EXPORT_OK;
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) = @_;
my $option = delete $conf{option};
if(defined $option) {
# do something (optional)
} else {
# set default value (optional)
$option = undef;
}
my $self = {
option => $option,
};
bless $self, $class;
return $self;
}
# subs here
1;