priyaviswam has asked for the wisdom of the Perl Monks concerning the following question:

I have used the command say "system("svn checkout $svnPath $targetPath"); can you please point me out how can i get the error message thrown by svn? I tried printing it using $!, Which shows me the error message as "No such file or directory". Since the source svn path is wrong, it should give me the error message like "svn: Can't connect to host '192.168.2.5': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond." Can anyone help me on this to extract the above svn error message using the perl?

  • Comment on How to get the failure message of the svn checkout command using system(command) in perl

Replies are listed 'Best First'.
Re: How to get the failure message of the svn checkout command using system(command) in perl
by Perlbotics (Archbishop) on Aug 16, 2011 at 11:32 UTC

    Try

    my $response = qx{svn checkout $svnPath $targetPath 2>&1};
    This will return both svn's streams (STDOUT and STDERR) to $response which can be examined afterwards - at least on Unixish systems.
    Another option would be IPC::Open3 (separte access to STDOUT and STDERR) or one of the CPAN svn frontends, e.g. SVN::Agent, SVN::Friendly::Client (although I've never used one of these before).

      Thanks for your suggestion. The First option is the one i was looking for. Thanks once again. But I'm still to go through the other option suggested by you