EigenFunctions has asked for the wisdom of the Perl Monks concerning the following question:
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Linux Perl with zenity progress bar (updated)
by haukex (Archbishop) on Feb 11, 2021 at 20:32 UTC | |
by EigenFunctions (Beadle) on Feb 12, 2021 at 00:33 UTC |