Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 29th, 2000, 03:33 PM
cdpruden cdpruden is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 1 cdpruden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm working on a cgi script, in which I call a program. My predecessor had it setup as:

$result = `command 2> error_log`;

Ok, all well enough. stdout goes to the variable $result, stderr to the file error_log.

I've been making some major modifications to this script, though, and would like to set it up in such a way that I could send stderr to a variable as well. I really don't want to deal with creating a bunch of 0 length files, and I don't really need to keep the data around, so there isn't much point in me using a file. Also, it would be easier to say:
if($errors) do_error_stuff

then to say:
if($errror_file_name size >0) do_error_stuff

So, is there an easy way to send both stdout and stderr to variables? (I'd even settle for a not-so-easy-way, as it would make the rest of my job easier

Reply With Quote
  #2  
Old July 7th, 2000, 01:18 PM
ledjon
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I'm asuming that standard out put is what you mean by "stout" and same for "stderr". If that's the case, just do this:

$var = <STDOUT>;
$error = <STDERR>;

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > stderr, stdout in a CGI script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway