[siesta-commit] siesta/lib/Siesta Message.pm,1.24,1.25

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

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta Message.pm,1.24,1.25
Date: 12:45 on 15 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta
In directory usw-pr-cvs1:/tmp/cvs-serv21114

Modified Files:
	Message.pm 
Log Message:
make->reply operate on a clone


Index: Message.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Message.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- Message.pm	15 Sep 2002 11:34:06 -0000	1.24
+++ Message.pm	15 Sep 2002 11:45:49 -0000	1.25
@@ -5,6 +5,7 @@
 use Email::Valid;
 use Mail::Internet;
 use base 'Mail::Internet';
+use Storable qw(dclone);
 
 use constant debug => 0;
 
@@ -36,21 +37,17 @@
 
 sub reply {
     my $self = shift;
-
     my %args = @_;
+    my $clone = dclone($self);
 
-    if ( defined $args{'body'} ) {
-        my @body = ( $args{'body'} );
-        $self->body(@body);
+    if ( exists $args{body} ) {
+        $clone->body( [ map { "$_\n" } split /\n/, $args{'body'} ] );
     }
 
-    my $to   = $args{'to'}   || $self->from();
-    my $from = $args{'from'} || $self->to();
-
-    $self->to($to);
-    $self->from($from);
+    $clone->to( $args{to} || $self->from );
+    $clone->from( $args{from} || $self->to );
 
-    return $self->send();
+    $clone->send;
 }
 
 sub send {



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