Home > Community > Forums > Custom IC SKILL > pass data between perl and skill

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 pass data between perl and skill 

Last post Mon, Feb 25 2013 3:59 AM by Meny Lea. 3 replies.
Started by Meny Lea 21 Feb 2013 06:56 AM. Topic has 3 replies and 982 views
Page 1 of 1 (4 items)
Sort Posts:
  • Thu, Feb 21 2013 6:56 AM

    • Meny Lea
    • Not Ranked
    • Joined on Sun, Sep 4 2011
    • Posts 12
    • Points 165
    pass data between perl and skill Reply

    Hello all,

     

    Im trying to use the ipcbeginprocess command to pass data between skill and perl. it works , but I do get some issues.

    Im doing the next :

    procedure( MLultraSimPerlGui() 

    lunching the perl script from a button in my schematic with  the next skill script :

     msgHandler = lambda( (cid data) printf("\n[CCSbla bla: %s]\n%s" cid data))

    errHandler = lambda( (cid data) printf("\n[CCSbla1 bla2: %s]\n%s" cid data))

    PinList = nil

    cid= ipcBeginProcess( "/home/menyl/UltraSimPerl.pl" "" msgHandler errHandler)

    ipcWaitForProcess(cid 5 )

    )

    MLultraSimPerlGui()

     

     than the perl script pop up a gui with buttons, and a press on one of the buttosn shoud print to the CIW the data from the perl 

    script, along with the ipc id ( should be ipc:xx \n  hello meny)  . the thing is that  it doesnt happen , no matter how many times I press

    on the button. i tried to ipcReadProcess the cid. I got: " ".  the only I get the data on the CIW is when I close the perl GUI - than I see exactly the string Im expecting , and in the same number of times I press the button - so the work get done, but from some reason the data transfer get blocked . or maybe I just dont use the ipc protocol right.

    thx

     

    Meny 

     

    • Post Points: 20
  • Thu, Feb 21 2013 8:20 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,587
    • Points 15,915
    Re: pass data between perl and skill Reply
    Hi Meny,

    Presumably the button press in the Perl GUI causes the line to be
    printed right away?
    My guess is that the script output is stuck in a buffer...
    Does your output string from the Perl script have a carriage return
    (\n) after it?
    Does the Perl GUI buffer the output data as in file I/O buffering?
    (In Tcl, for example there is a line buffering mode, I would guess
    that Perl has the same? Or you can
    forcibly flush the buffer perhaps?)

    Hope this helps,

    Lawrence.
    • Post Points: 20
  • Thu, Feb 21 2013 9:12 PM

    Re: pass data between perl and skill Reply

     Meny,

    The easiest way to do this in perl is to set the $| variable:

    $|=1;
    print "now you see it...\n";
    sleep 10;
    print "now you don't...\n";

    If you run this perl script as "perl example.pl > test.out" and do a "tail -f test.out" you'll see the two lines appear, one at a time. Without the $| setting, you'll only see both lines appear as the program finishes, because of output buffering.

    Regards,

    Andrew.

    • Post Points: 20
  • Mon, Feb 25 2013 3:59 AM

    • Meny Lea
    • Not Ranked
    • Joined on Sun, Sep 4 2011
    • Posts 12
    • Points 165
    Re: pass data between perl and skill Reply

    Lawrence, Anderw,

    Thank you. that was the case indeed. it works fine now.

    I do have one more question. if the perl script ( that was launced from skill with ipcbeginProcess)  should launce a skill script, instaed of just print "hello meny", ( for example a script that read all schematic pins/terminals), should it be also launced with ipcbeginprocess that contain data handler and err handler ? assuming the the pin list needs to be delevier back to perl.

     thx

    meny

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by Meny Lea at 21 Feb 2013 06:56 AM. Topic has 3 replies.