--- bin/lwp-download 2004-11-14 07:36:25.000000000 +0100 +++ bin/lwp-download 2004-12-10 21:12:41.136510344 +0100 @@ -91,7 +91,13 @@ sub { unless($file) { my $res = $_[1]; - unless ($argfile) { + + my $directory; + if (defined $argfile && -d $argfile) { + ($directory, $argfile) = ($argfile, undef); + } + + unless (defined $argfile && length $argfile) { # must find a suitable name to use. First thing # to do is to look for the "Content-Disposition" # header defined by RFC1806. This is also supported @@ -130,6 +136,11 @@ } } + if (defined $directory) { + require File::Spec; + $file = File::Spec->catfile($directory, $file); + } + # Check if the file is already present if (-f $file && -t) { $shown = 1; @@ -292,3 +303,5 @@ { die "Usage: $progname [-a] []\n"; } + +# vi: ts=8 sw=4