in reply to wget not working from perl
Hi,
You have some good stuff in there, but the formatting makes
Question unreadable :) answer obvious :(
Dont despair :) clean your room ;)
Use the convenience that is CGI and Capture::Tiny and the Basic debugging checklist
#!/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 )"; }
$URL needs shell escaped when given to shell
CGI.pm needs $cgi = CGI->new; $cgi->header('text/javascript') , $cgi->query_string
... String::ShellQuote , Win32::ShellQuote, Proc::Background, system_detached , use CGI or die; , ...the checklists :) Basic debugging checklist , brian's Guide to Solving Any Perl Problem, CGI Help Guide , Troubleshooting Perl CGI scripts...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: wget not working from harangzsolt33 perl program
by Anonymous Monk on Sep 10, 2019 at 06:21 UTC |