[siesta-commit] siesta/lib/Siesta Message.pm,1.17,1.18

[prev] [thread] [next] [lurker] [Date index for 2002/09/14]

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta Message.pm,1.17,1.18
Date: 09:00 on 14 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta
In directory usw-pr-cvs1:/tmp/cvs-serv29065

Modified Files:
	Message.pm 
Log Message:
simplify/fix accessors


Index: Message.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Message.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Message.pm	13 Sep 2002 20:50:26 -0000	1.17
+++ Message.pm	14 Sep 2002 08:00:08 -0000	1.18
@@ -7,29 +7,22 @@
 
 use constant debug => 0;
 
-use Class::MethodMaker get_set => [qw( list user)];
+use Class::MethodMaker get_set => [qw( list user )];
 
-# TODO tests for these
 sub to {
    my $self = shift;
-   my $new  = shift;
-
-   if (defined $new) {
-	$self->head->replace('To', $new);
-   } 
-
+   if (@_) {
+       $self->head->replace('To', shift);
+   }
    Email::Valid->address($self->head->get('To') );
 }
 
 sub from {
     my $self = shift;
-    my $new  = shift;
-
-    if (defined $new) {
-        $self->head->replace('From', $new);
+    if (@_) {
+        $self->head->replace('From', shift);
     }
- 
-   Email::Valid->address( $self->head->get('From') );
+    Email::Valid->address( $self->head->get('From') );
 }
 
 sub subject {
@@ -41,38 +34,34 @@
 }
 
 sub reply {
+    my $self = shift;
+    my %args = @_;
 
-	my $self = shift;
-	my %args = @_;
-
-	if (defined $args{'body'})
-	{
-		my @body = split /\n/, $stuff{'body'};
-		$self->body(@body);
-	}
-
-	my $to   = $args{'from'} || $self->from();
-	my $from = $args{'to'}   || $self->to();
+    if (defined $args{'body'}) {
+        my @body = split /\n/, $args{'body'};
+        $self->body(@body);
+    }
 
-	$self->to($to);
-	$self->from($from);
+    my $to   = $args{'to'}   || $self->from();
+    my $from = $args{'from'} || $self->to();
 
-	return $self->send();
-	
+    $self->to($to);
+    $self->from($from);
 
+    return $self->send();
 }
 
 sub send {
-
-	return Siesta->sender->process($self, @_);
+    my $self = shift;
+    return Siesta->sender->process($self, @_);
 }
 
 sub bounce {
-	my %args = @_;
-
+    my $self = shift;
+    my %args = @_;
 
-        my $to   = $args{'from'} || $self->from();
-	$self->send(to => $to);
+    my $to   = $args{'from'} || $self->from();
+    $self->send(to => $to);
 }
 
 1;



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52