I'm trying to use the open() pipe feature to make use of the progress bar feature of zenity and I can't seem to get it to work. I tried a shell script I found online and that worked so I know that zenity works (not surprisingly). Here is my code:

open(my $Progress, '|-', 'zenity --title "Explore" --progress --percen +tage 0 ' . '--text "Just a dumb test" --auto-close --aut +o-kill') or die "**Fatal err, open pipe writ +e failed"; #open(my $Progress, '|-', 'cat -n - >zippy.txt') or # die "**Fatal err, open pipe wri +te failed"; sleep 2; foreach my $Percent ( qw{10 20 30 40 50 60 70 80 90 100} ) { print "DBG> ", $Percent, "\n"; # print $Progress sprintf("%3d\n", $Percent); print $Progress "$Percent\n"; sleep 2; print $Progress "# Retry $Percent\n"; } close($Progress);

Notice the commented out code that I tried "cat" and it worked as expected. I also tried a different way to send the percent value and it failed as well.

When it runs, the zenity panel comes up with 0 percent with a "cancel" button and a grayed out "OK" button. The Perl program completes and the zenity panel disappears. I don't know what I'm doing wrong.

Can anyone help?

Thanks,
  EigenFunctions
  OpSys: Ubuntu 18.04; Perl: Perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi (with 67 registered patches)   OpSys: Win7 x64 Service Pack 1 Professional/Home Premium; Perl: Strawberry (v5.22.0)/ActiveState (v5.14.2)


In reply to Linux Perl with zenity progress bar by EigenFunctions

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.