Jump to content


perl API: Connect() displaying unexpected output

p4perl connect errors

  • Please log in to reply
5 replies to this topic

#1 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 04 September 2018 - 07:45 PM

I get the usual (but unexpected in this case) P4 error message if p4perl cannot connect.

Code:
p4->Connect or die("Cannot connect");

Result on error:
Connect to server failed; check $P4PORT.
TCP connect to xyzzy:nnnn failed.
connect: xxx.yyy.zzz.yyy:nnnn: Connection refused

Cannot connect

This occurs with both 2014.1/842847 (2014.1/821990 API) and 2016.1/1388481 (2018.1/1388481 API).
Setting the debug level with p4->Debug(0) makes no difference.

How can I best suppress the extraneous error messages?

#2 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 04 September 2018 - 11:04 PM

I currently have STDERR redirected to /dev/null, but I shouldn't have to.

#3 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 637 posts

Posted 05 September 2018 - 12:10 AM

Did you set an OutputHandler to handle the output or are you using the default one that blurts everything to the console?

#4 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 05 September 2018 - 02:46 PM

I'm using the default.

#5 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 637 posts

Posted 05 September 2018 - 05:12 PM

That's why everything's getting dumped to the console.  :)  Create your own output handler and if you want it to be silent just have all the methods return without doing anything.

#6 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 05 September 2018 - 08:46 PM

Ugh. OK, thanks.





Also tagged with one or more of these keywords: p4perl, connect, errors

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users