[asterisk-users] carefulwrite: write() returned error:Brokenpipe
Danny Nicholas
danny at debsinc.com
Thu Oct 22 12:34:07 CDT 2009
If it was clear, I wouldn't be writing; You are suggesting something like
this?
> sub setvar {
> my ($var, $val) = @_;
> print STDOUT "SET VARIABLE $var \"$val\" \r\n";
> my $rv=<STDIN>;
> while(<STDIN>) {
> m/200 result=0/ && last;
> }
> return;
> }
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tilghman
Lesher
Sent: Thursday, October 22, 2009 11:43 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] carefulwrite: write() returned
error:Brokenpipe
On Thursday 22 October 2009 11:09:00 Danny Nicholas wrote:
> I have some simple PERL scripts that worked fine with 1.4 SVN, but
returned
> this error when I went to 1.4.26.2. It seemed easier to change the ERROR
> to a NOTIFY than try to "Fix my bad code".
>
> Here is the "failing" code
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> sub setvar {
> my ($var, $val) = @_;
> print STDOUT "SET VARIABLE $var \"$val\" \r\n";
> my $rv=<STDIN>;
> return;
> }
>
> # turn off I/O buffering
> $| = 1;
>
> # get trunk information
> $SIG{'PIPE'} = 'IGNORE';
> my $images='TRUE';
> my $checks='TRUE';
> &setvar("TEST_RETURN", "OK");
> &setvar("CHECKS", $checks);
> &setvar("IMAGES", $images);
> exit;
What is clearly wrong with your script is that you're failing to retrieve
all
of the setup information that is sent when the script first starts up. Each
"response" that you're getting is actually setup information, and you exit
early, which is why the final response is not able to be sent.
--
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list