rename $upload->link to $upload->link_to and $upload->copy to $upload->copy_to
Christian Hansen [Mon, 11 Apr 2005 07:50:27 +0000 (07:50 +0000)]
lib/Catalyst/Manual/Cookbook.pod
lib/Catalyst/Request/Upload.pm

index aa38da5..568f156 100644 (file)
@@ -95,7 +95,7 @@ Catalyst Controller module 'upload' action:
                 my $filename = $upload->filename;
                 my $target   = "/tmp/upload/$filename";
                 
-                unless ( $upload->link($target) || $upload->copy($target) ) {
+                unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
                     die( "Failed to copy '$filename' to '$target': $!" );
                 }
             }
@@ -131,7 +131,7 @@ Controller:
                 my $filename = $upload->filename;
                 my $target   = "/tmp/upload/$filename";
                 
-                unless ( $upload->link($target) || $upload->copy($target) ) {
+                unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
                     die( "Failed to copy '$filename' to '$target': $!" );
                 }
             }
index 389f810..867c098 100644 (file)
@@ -16,10 +16,10 @@ Catalyst::Request::Upload - Catalyst Request Upload Class
 
 =head1 SYNOPSIS
 
-    $upload->copy
+    $upload->copy_to
     $upload->fh
     $upload->filename;
-    $upload->link;
+    $upload->link_to;
     $upload->size;
     $upload->tempname;
     $upload->type;
@@ -35,13 +35,15 @@ to the upload data.
 
 =over 4
 
-=item $upload->copy( $target [, $bufferlen ] )
+=item $upload->copy_to
 
 Copies tempname using C<File::Copy>. Returns true for success, false otherwise.
 
+     $upload->copy_to('/path/to/target');
+
 =cut
 
-sub copy {
+sub copy_to {
     my ( $self, $target, $buffer ) = @_;
     return File::Copy::copy( $self->tempname, $target, $buffer );
 }
@@ -65,16 +67,16 @@ sub fh {
 
 Contains client supplied filename.
 
-=item $upload->link
+=item $upload->link_to
 
-Creates a new filename linked to the old filename.  Returns true for
-success, false otherwise.
+Creates a hard link to the tempname.  Returns true for success, 
+false otherwise.
 
-    $upload->link('/my/path');
+    $upload->link_to('/path/to/target');
 
 =cut
 
-sub link {
+sub link_to {
     my ( $self, $target ) = @_;
     return CORE::link( $self->tempname, $target );
 }