[Chicago-talk] Net::FTP

Steven Lembark lembark at wrkhors.com
Tue Dec 23 14:23:34 CST 2003



-- Ed Summers <ehs at pobox.com>

> On Tue, Dec 23, 2003 at 07:02:21AM -0800, Dooley, Michael wrote:
>> $ftp->get( $ftp_file, $ftp_file.$$.time() );
>
> I think this is the way to go...specify a unique name in the get() call.
> If you are mirroring the contents of the FTP server, then perhaps
> overwriting what you have locally is the way to go. If you're not
> mirroring, then perhaps you should use a temporary directory where the
> files are staged.

	use File::Temp;

	my ( $fh, $path ) = tempname basename $remote . '-XXX';

	$ftp->get( $remote, $fh ) or die 'feh...';


Avoids all kinds of collisions.



--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list