From user.perl at gmail.com Tue Jan 17 17:36:58 2006 From: user.perl at gmail.com (user perl) Date: Tue, 17 Jan 2006 19:36:58 -0600 Subject: [Kc] Executing third party tools using CGI/Perl Message-ID: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> Hi, I'm currently writing a CGI script which involves the execution of a tool called "SVM Light" in Linux/Apache. The typical command for executing SVM Light in Linux is svm_classify input-file model-file output-file. I'm using the "system" option of executing commands in CGI but it isn't working because SVM Light is not a system command (IMHO). Has anyone tried executing third party tools within CGI scripts? Thanks, MP. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20060118/dea9451f/attachment.html From frank at wiles.org Tue Jan 17 17:44:46 2006 From: frank at wiles.org (Frank Wiles) Date: Tue, 17 Jan 2006 19:44:46 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> Message-ID: <20060117194446.33fdb452.frank@wiles.org> On Tue, 17 Jan 2006 19:36:58 -0600 user perl wrote: > Hi, > > I'm currently writing a CGI script which involves the execution of > a tool called "SVM Light" in Linux/Apache. The typical command for > executing SVM Light in Linux is svm_classify input-file model-file > output-file. I'm using the "system" option of executing commands in > CGI but it isn't working because SVM Light is not a system command > (IMHO). Has anyone tried executing third party tools within CGI > scripts? Yeah this shouldn't be a big deal. Try using backticks instead of system like: `/full/path/to/svn_classify $input $model $output`; --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From user.perl at gmail.com Tue Jan 17 18:06:29 2006 From: user.perl at gmail.com (user perl) Date: Tue, 17 Jan 2006 20:06:29 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <20060117194446.33fdb452.frank@wiles.org> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> Message-ID: <99553ea30601171806m3cf8eb12n97a16cf4e72f256d@mail.gmail.com> Thanks for the reply. However I've installed the svm_classify in the same 'cgi-bin' directory. I'm enclosing my code snippet as below. I'd appreciate if you could suggest me how to modify the line to execute svm_classify. system "svm_classify input-file model-file output-file"; Thanks, MP. On 1/17/06, Frank Wiles wrote: > > On Tue, 17 Jan 2006 19:36:58 -0600 > user perl wrote: > > > Hi, > > > > I'm currently writing a CGI script which involves the execution of > > a tool called "SVM Light" in Linux/Apache. The typical command for > > executing SVM Light in Linux is svm_classify input-file model-file > > output-file. I'm using the "system" option of executing commands in > > CGI but it isn't working because SVM Light is not a system command > > (IMHO). Has anyone tried executing third party tools within CGI > > scripts? > > Yeah this shouldn't be a big deal. Try using backticks instead of > system like: > > `/full/path/to/svn_classify $input $model $output`; > > --------------------------------- > Frank Wiles > http://www.wiles.org > --------------------------------- > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20060118/5acc0395/attachment.html From frank at wiles.org Tue Jan 17 18:10:22 2006 From: frank at wiles.org (Frank Wiles) Date: Tue, 17 Jan 2006 20:10:22 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <99553ea30601171806m3cf8eb12n97a16cf4e72f256d@mail.gmail.com> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> <99553ea30601171806m3cf8eb12n97a16cf4e72f256d@mail.gmail.com> Message-ID: <20060117201022.7c127565.frank@wiles.org> On Tue, 17 Jan 2006 20:06:29 -0600 user perl wrote: > Thanks for the reply. However I've installed the svm_classify in the > same 'cgi-bin' directory. I'm enclosing my code snippet as below. I'd > appreciate if you could suggest me how to modify the line to execute > svm_classify. > > system "svm_classify input-file model-file output-file"; Right, but you still need to give it the full path so instead of that use: `/path/to/cgi-bin/svm_classify $input_file $model_file $output_file` As Im' assuming those were placeholders and not the real file names. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From scratchcomputing at gmail.com Tue Jan 17 18:10:29 2006 From: scratchcomputing at gmail.com (Eric Wilhelm) Date: Tue, 17 Jan 2006 18:10:29 -0800 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <20060117194446.33fdb452.frank@wiles.org> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> Message-ID: <200601171810.29991.ewilhelm@cpan.org> # from Frank Wiles # on Tuesday 17 January 2006 05:44 pm: > Yeah this shouldn't be a big deal. ?Try using backticks instead of >? system like: >? >? `/full/path/to/svn_classify $input $model $output`; Then cross your fingers and wish real hard that $output doesn't contain the string "; rm -rf /" :-) Try IPC::Run, which allows you to capture output, but also make sure that you exec the command in the less promiscuous list context. use IPC::Run qw(run); my ($in, $out, $err); run(['/full/path/to/svn_classify', $input, $model, $output], \$in, \$out, \$err); --Eric -- Minus 1 million points for not setting your clock forward and trying the code. --Michael Schwern --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From frank at wiles.org Tue Jan 17 18:16:58 2006 From: frank at wiles.org (Frank Wiles) Date: Tue, 17 Jan 2006 20:16:58 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <200601171810.29991.ewilhelm@cpan.org> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> <200601171810.29991.ewilhelm@cpan.org> Message-ID: <20060117201658.7f09f052.frank@wiles.org> On Tue, 17 Jan 2006 18:10:29 -0800 Eric Wilhelm wrote: > # from Frank Wiles > # on Tuesday 17 January 2006 05:44 pm: > > > Yeah this shouldn't be a big deal. ?Try using backticks instead of > >? system like: > >? > >? `/full/path/to/svn_classify $input $model $output`; > > Then cross your fingers and wish real hard that $output doesn't > contain the string "; rm -rf /" :-) Well yeah, I was assuming some error checking :) --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From user.perl at gmail.com Tue Jan 17 18:25:59 2006 From: user.perl at gmail.com (user perl) Date: Tue, 17 Jan 2006 20:25:59 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <20060117201022.7c127565.frank@wiles.org> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> <99553ea30601171806m3cf8eb12n97a16cf4e72f256d@mail.gmail.com> <20060117201022.7c127565.frank@wiles.org> Message-ID: <99553ea30601171825hf02e68fy54ab936979dadb63@mail.gmail.com> No, they are real filenames. Let me explain what I'm writing this CGI script for. I'm taking an input file and making it into a format that is suitable for running svm_classify on it. So, I parse the given file and store the formatted data in "input-file.dat". I already have a model file called " model-file.dat". Now, "svm_classify" takes these two files as inputs and generates the output file whose name I have to provide as the third argument, (say) output-file.dat. How do I execute svm_classify now? By the way, I'm writing this script on a file server, so do I have to give the actual path which is something like "/.automount/..." instead of "/home/..." ? Thanks, MP. On 1/17/06, Frank Wiles wrote: > > On Tue, 17 Jan 2006 20:06:29 -0600 > user perl wrote: > > > Thanks for the reply. However I've installed the svm_classify in the > > same 'cgi-bin' directory. I'm enclosing my code snippet as below. I'd > > appreciate if you could suggest me how to modify the line to execute > > svm_classify. > > > > system "svm_classify input-file model-file output-file"; > > Right, but you still need to give it the full path so instead of that > use: > > `/path/to/cgi-bin/svm_classify $input_file $model_file $output_file` > > As Im' assuming those were placeholders and not the real file names. > > --------------------------------- > Frank Wiles < frank at wiles.org> > http://www.wiles.org > --------------------------------- > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20060118/70187f07/attachment.html From amoore at mooresystems.com Tue Jan 17 18:42:28 2006 From: amoore at mooresystems.com (Andrew Moore) Date: Tue, 17 Jan 2006 20:42:28 -0600 Subject: [Kc] Executing third party tools using CGI/Perl In-Reply-To: <99553ea30601171825hf02e68fy54ab936979dadb63@mail.gmail.com> References: <99553ea30601171736j170fca1fy95b45898585c4be5@mail.gmail.com> <20060117194446.33fdb452.frank@wiles.org> <99553ea30601171806m3cf8eb12n97a16cf4e72f256d@mail.gmail.com> <20060117201022.7c127565.frank@wiles.org> <99553ea30601171825hf02e68fy54ab936979dadb63@mail.gmail.com> Message-ID: <20060118024224.GC5449@mooresystems.com> On Tue, Jan 17, 2006 at 08:25:59PM -0600, user perl wrote: > How do I execute svm_classify now? By the > way, I'm writing this script on a file server, so do I have to give the > actual path which is something like "/.automount/..." instead of "/home/..." > ? Your approach seems right. You should be able to execute other things with "system" or qx() or backticks. You may find some benefit from testing for the existance of the files (both executables and data files) before you try to use them. Be verbose in your script, and don't forget to check the apache error logs. Finally, I bet that if you post a code example that you'll get some help on it. I'll hop on IRC with you if it would help. -Andy From davidnicol at gmail.com Mon Jan 30 12:52:53 2006 From: davidnicol at gmail.com (David Nicol) Date: Mon, 30 Jan 2006 14:52:53 -0600 Subject: [Kc] more hot gossip to distract you from your real work Message-ID: <934f64a20601301252r2669b00bgd749ac29fd05724a@mail.gmail.com> ---------- Forwarded message ---------- From: Marsee Henon Date: Jan 30, 2006 10:11 AM Subject: O'Reilly Podcast Includes NSA Wiretapping News Scoop To: kcpm-moderate at davidnicol.com Hello-- "Distributing the Future" this week features a scoop we thought was worth sharing: Wiretapping doesn't require someone lurking in the bushes with a directional antenna and headphones, or a pair of aligator clips and a tape recorder, or someone sneaking into your room while you're out to place a transmitter on your phone. In the U.S., if it's the government doing the wiretapping, it's technically simple. At the O'Reilly Emerging Telephony Conference Jack Herrington, author of "Podcasting Hacks" interviewed Electronic Frontier Foundation Chairman of the Board Brad Templeton about the technical, social, and political aspects of wiretapping. At the end there's a nice juicy hint about upcoming action from the EFF with regards to the recent NSA wiretapping case. http://www.oreillynet.com/future --Marsee ================================================================ O'Reilly 1005 Gravenstein Highway North Sebastopol, CA 95472 http://ug.oreilly.com/ http://www.oreilly.com ================================================================ -- David L Nicol "It is pointless to give advice and sometimes dangerous to take it." -- Gore Vidal