Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: wget not working from harangzsolt33 perl program

by Anonymous Monk
on Sep 10, 2019 at 03:50 UTC ( [id://11105924]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105924]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found