--file not needed anymore, cleaned up code in lainsafecli and upload.cgi
This commit is contained in:
parent
3a54151592
commit
1b8373f03e
2 changed files with 12 additions and 8 deletions
|
@ -15,8 +15,6 @@
|
|||
# along with lainsafe. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use CGI;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
|
||||
my $q = CGI->new;
|
||||
print $q->header();
|
||||
|
|
18
lainsafecli
18
lainsafecli
|
@ -20,8 +20,6 @@
|
|||
|
||||
use Getopt::Long;
|
||||
use LWP::UserAgent;
|
||||
use Data::Dumper;
|
||||
use Try::Tiny;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -66,7 +64,7 @@ EOF
|
|||
sub help
|
||||
{
|
||||
print "lainsafecli, a command line interface for lainsafe.\n";
|
||||
print "USAGE: lainsafecli [--server] --file=FILE\n\n";
|
||||
print "USAGE: lainsafecli [--server] FILE\n\n";
|
||||
print "if --server not given, $DEFAULT_SERVER is used.\n";
|
||||
|
||||
exit;
|
||||
|
@ -75,15 +73,23 @@ sub help
|
|||
## PROGRAM
|
||||
my $ua = LWP::UserAgent->new;
|
||||
GetOptions ("server=s" => \$DEFAULT_SERVER,
|
||||
"file=s" => \$file,
|
||||
"help" => \$help);
|
||||
"help|" => \$help);
|
||||
|
||||
&help if ($help);
|
||||
if($help || not defined $ARGV[0])
|
||||
{
|
||||
&help;
|
||||
}
|
||||
|
||||
# check if file is given
|
||||
|
||||
$file = $ARGV[@ARGV-1];
|
||||
|
||||
die "File does not exist\n" if !-e $file;
|
||||
|
||||
die "Give a file\n" unless defined $file;
|
||||
|
||||
|
||||
|
||||
my $url_to_upload = $DEFAULT_SERVER . "/upload.cgi";
|
||||
my $req;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue