Thanks a lot for your help. Finally i solved it, mixing a little of everything. Maybe i should say before that i'm doing this in order to unit test a class wich will comunicate with Asterisk and get audio from EAGI interface wich writes the audio in fd=3.

use strict; use warnings; use IO::Handle; use IO::File; my $ftmp = new IO::File ("test_eagi.tmp",'r+'); unless ( defined $ftmp) { die "Couldn't open (test_eagi.tmp)\n"; } if ( fileno($ftmp) == 3 ) { print "open file with fd 3\n"; } else { die "ERROR: file opened with fd : ".fileno($ftmp)."\n"; } $| = 1; $ftmp->autoflush(1); my $fh_in = new IO::Handle; my $fh_out = new IO::Handle; my $buff; my $blen = 10; $fh_out->fdopen(3,'r') || die "No se pudo abrir fh_out\n$!\n"; #$fh_out->autoflush(1); $fh_in->autoflush(1); my $data_a = 'a'x10; my $data_b = 'b'x20; print "data a: ($data_a)\n"; print "data b: ($data_b)\n"; tswrite($data_a,10); tsread(); tswrite($data_b,20); tsread(); tswrite($data_a,10); tsread(); tsread(); tswrite($data_b,20); tsread(); tsread(); $fh_out->close(); $ftmp->close(); sub tswrite { my ($d,$s) = @_; ( my $pos = tell($ftmp) ) >= 0 or die("tell: $!\n"); my $r = $ftmp->write($d,$s); seek($ftmp, $pos, SEEK_SET) or die("seek: $!\n"); } sub tsread { $fh_out->read($buff,$blen); print "$buff\n"; }

In reply to Re^3: testing interface by asr00
in thread testing interface by asr00

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.