Fixed $c->req->base to be consistent in all engines, trailing slash
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request / Upload.pm
index 389f810..5891332 100644 (file)
@@ -8,7 +8,6 @@ use IO::File   ();
 
 __PACKAGE__->mk_accessors(qw/filename size tempname type/);
 
-sub new { shift->SUPER::new( ref( $_[0] ) ? $_[0] : {@_} ) }
 
 =head1 NAME
 
@@ -16,10 +15,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,15 +34,25 @@ to the upload data.
 
 =over 4
 
-=item $upload->copy( $target [, $bufferlen ] )
+=item $upload->new
+
+Constructor. Normally only for engine use.
+
+=cut 
+
+sub new { shift->SUPER::new( ref( $_[0] ) ? $_[0] : {@_} ) }
+
+=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 {
-    my ( $self, $target, $buffer ) = @_;
-    return File::Copy::copy( $self->tempname, $target, $buffer );
+sub copy_to {
+    my $self = shift;
+    return File::Copy::copy( $self->tempname, @_ );
 }
 
 =item $upload->fh
@@ -65,16 +74,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 );
 }