CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Saving STDERR of a perforce command to a variable



Dec 24, 2010, 2:01 PM

Post #1 of 2 (3344 views)
Saving STDERR of a perforce command to a variable Can't Post

Hi,I really need help here.I have been trying to save STDERR output of a p4 command for a while.I tried using "2>&1" and "open3" command but havent been successful.Can the perl gurus pls advise?Any help truly appreciated.

#!/usr/bin/perl -w  
use strict;
use warnings;
use diagnostics;
#use diagnostics;
use IPC::Open3;
my @changed_paths;
my @changed_files=("//depot/perl/tools/scripts/files/data.c");
foreach my $file (@changed_files)

my($wtr, $rdr, $err);
use Symbol 'gensym'; $err = gensym;
my $pid = open3($wtr, $rdr, $err,'p4 where $file');
print "$err\n"; #prints as GLOB(0x183f108),why is it so?
#waitpid( $pid, 0 ); //Why do we need this?Program never halts if th
+is is present
my $child_exit_status = $? >> 8;
if ($err eq 'file(s) not in client view')
push @changed_paths,$file;
print @changed_paths;


Dec 27, 2010, 10:24 AM

Post #2 of 2 (3237 views)
Re: [Jeff29] Saving STDERR of a perforce command to a variable [In reply to] Can't Post

Your path looks like an UNC path. Do you try this on Windows? If yes, have a look at

Also I don't understand why you work with gensym here. I think you *can* use gensym, but I've never tried, so I can't judge whether your approach makes sense or not. Any reason why not naming the file handle explicitly?


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives