#!/usr/bin/perl -- ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while for " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" use strict; use warnings; use CGI; use Capture::Tiny qw/ capture /; Main( @ARGV ); exit( 0 ); sub Main { if( @_ ){ Download( @_ ); } elsif( my $ONLINE = CGI->new->query_string ){ my $url = $ONLINE; RunCGI(); } elsif( my $url = UrlFromStdin() ){ Download( $url ); } else { PrintUsage(); } } sub Download { my @cmd = ( 'wget', '--help' ); my( $stdout, $stderr, $exit ) = capture { system { $cmd[0] } @cmd; };; die "( $stdout, $stderr, $exit )"; }