From: Chris Nehren Date: Thu, 19 Jul 2012 02:41:12 +0000 (-0400) Subject: Remove Method::Signatures::Simple. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a69a58420ba3b6fd821ddc168e94f5fe01f350c;p=p5sagit%2FPromulger.git Remove Method::Signatures::Simple. It has an XS dependency, which means it's a no-no here. --- diff --git a/Makefile.PL b/Makefile.PL index 2024169..48b38f3 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,7 +14,6 @@ requires 'Email::Sender'; requires 'Fcntl'; requires 'File::Slurp'; requires 'IPC::Run3'; -requires 'Method::Signatures::Simple'; requires 'Moo'; requires 'Path::Class'; requires 'Tie::File'; diff --git a/lib/Promulger/Dispatch.pm b/lib/Promulger/Dispatch.pm index b7fc749..5e59fc3 100644 --- a/lib/Promulger/Dispatch.pm +++ b/lib/Promulger/Dispatch.pm @@ -1,6 +1,5 @@ package Promulger::Dispatch; use Moo; -use Method::Signatures::Simple; use autodie ':all'; use Scalar::Util 'blessed'; @@ -37,7 +36,8 @@ has transport => ( ); # XXX no bounce parsing yet -- apeiron, 2010-03-13 -method dispatch ($message) { +sub dispatch { + my ($self, $message) = @_; my $config = Promulger::Config->config; my $email = Email::MIME->new($message); @@ -62,7 +62,8 @@ method dispatch ($message) { return; } -method handle_request ($list, $sender, $recipient, $subject) { +sub handle_request { + my ($self, $list, $sender, $recipient, $subject) = @_; my $sender_address = $self->bare_address($sender); if($subject =~ /^\s*subscribe/i) { $list->subscribe($sender_address) @@ -73,7 +74,8 @@ method handle_request ($list, $sender, $recipient, $subject) { } } -method post_message ($list, $email, $config) { +sub post_message { + my ($self, $list, $email, $config) = @_; my $sender = $email->header('From'); my $sender_address = $self->bare_address($sender); my $recipient = $email->header('To'); @@ -105,7 +107,8 @@ method post_message ($list, $email, $config) { } } -method send_message ($message) { +sub send_message { + my ($self, $message) = @_; Email::Sender::Simple::sendmail( $message, { @@ -115,7 +118,8 @@ method send_message ($message) { } # XXX make this actually not suck -- apeiron, 2010-03-13 -method reject ($recipient, $sender) { +sub reject { + my ($self, $recipient, $sender) = @_; my $email = Email::MIME->create( header => [ From => $recipient, @@ -129,7 +133,8 @@ BODY $self->send_message($email); } -method not_subscribed ($list, $recipient, $sender) { +sub not_subscribed { + my ($self, $list, $recipient, $sender) = @_; my $email = Email::MIME->create( # XXX need admin address header => [ @@ -144,7 +149,8 @@ BODY $self->send_message($email); } -method already_subscribed ($list, $recipient, $sender) { +sub already_subscribed { + my ($self, $list, $recipient, $sender) = @_; my $email = Email::MIME->create( header => [ From => $recipient, @@ -158,12 +164,14 @@ BODY $self->send_message($email); } -method bare_address ($full_addr) { +sub bare_address { + my ($self, $full_addr) = @_; my ($addr_obj) = Email::Address->parse($full_addr); return $addr_obj->address; } -method user_for_address ($full_addr) { +sub user_for_address { + my ($self, $full_addr) = @_; my ($addr_obj) = Email::Address->parse($full_addr); return $addr_obj->user; } diff --git a/lib/Promulger/Web.pm b/lib/Promulger/Web.pm index a3b7aa8..a337fdd 100644 --- a/lib/Promulger/Web.pm +++ b/lib/Promulger/Web.pm @@ -4,8 +4,6 @@ use autodie; use Promulger::List; -use Method::Signatures::Simple; - has list_home => ( is => 'ro', default => sub { 'etc/lists' }, @@ -64,7 +62,7 @@ sub dispatch_request { } } -method render_index { +sub render_index { my ($self) = @_; my @lists = Promulger::List->get_lists; my $html = <resolve($list_name); my $name = $list->listname; my $active = $list->active; @@ -101,19 +100,22 @@ HTML return $html; } -method subscribe($list_name, $email) { +sub subscribe { + my ($self, $list_name, $email) = @_; my $list = Promulger::List->resolve($list_name); $list->subscribe($email); return "

Subscribed ${email} to ${list_name}.

"; } -method unsubscribe($list_name, $email) { +sub unsubscribe { + my ($self, $list_name, $email) = @_; my $list = Promulger::List->resolve($list_name); $list->unsubscribe($email); return "

Unsubscribed ${email} from ${list_name}.

"; } -method show_subscriber($list_name, $subscriber, $extension) { +sub show_subscriber { + my ($self, $list_name, $subscriber, $extension) = @_; my $address = "${subscriber}.${extension}"; my $html = <<"HTML";

Subscriber ${address}