0

I'm trying to test out the Perl module CGI::ProgressBar latest version 0.05 on CentOS 7, perl 5.26. After installing it and run the sample script from metacpan.org (ref: https://metacpan.org/pod/release/LGODDARD/CGI-ProgressBar-0.05/lib/CGI/ProgressBar.pm ), Firefox's web console debugger throws a syntax error on ProgressBar.pm, line 343: "missing } after function body". I then added the closing bracket to line 352, and re-run. Error went away , but there's no progress bar shown. So, questions:

  1. Why this Perl module exists on metacpan even when it has syntax error and does not run?

  2. How to get at least the sample synopsis example to run and display the progress bar properly?

  3. If this module's no longer maintained, could Cpan admins remove or mark it as obsolete to prevent any confusion. And recommendation of any other libraries that shows progress bar for Perl's CGI script is greatly appreciated!

Bug report from 2014

Sample code from metacpan:

use strict;
use warnings;
use CGI::ProgressBar qw/:standard/;
$| = 1; # Do not buffer output
print header,
        start_html(
                -title=>'A Simple Example',
                -style=>{
                        -src  => '', # You can override the bar style here
                        -code => '', # or inline, here.
                }
        ),
        h1('A Simple Example'),
        p('This example will update a JS/CSS progress bar.'),
        progress_bar( -from=>1, -to=>100 );
# We're set to go.
for (1..10){
        print update_progress_bar;
        # Simulate being busy:
        sleep 1;
}
# Now we're done, get rid of the bar:
print hide_progress_bar;
print p('All done.');
print end_html;
exit;
toolic
  • 57,801
  • 17
  • 75
  • 117
santa100
  • 255
  • 1
  • 5
  • 1
    Most of the code on CPAN is written by people that volunteer their time and efforts, for free. Many are professional developers that spend their personal time building things like this. For some it's a hobby. Sometimes, life happens. People change careers, priorities change, or sadly sometimes people pass away. This particular module hasn't seen an update for over 10 years. You can try to reach out to the author, maybe you can pinpoint their github account somehow. They might still be around. You can ask if they could merge your fix, or volunteer to take over the module... 1/2 – simbabque Dec 02 '20 at 16:17
  • 1
    ... and release the fix yourself. Taking over maintenance or becoming a co-maintainer is a common thing within CPAN. If you cannot get hold of the author, you can write to the CPAN admins and request to take over the module. There is a set time limit that has to pass, and contact attempts have to be made before they will hand it over, but eventually you can become the maintainer and fix the issue. Or you can fork the code, fix it and release it under a different name. Or you can write your own module. But complaining that free stuff doesn't get fixed is not helpful I'm afraid. 2/2 – simbabque Dec 02 '20 at 16:19
  • 1
    @santa100 After fixing the error on line 350, the CGI script works fine here [Ubuntu 20.04, perl version 5.30, Google Chrome version 87.0]. – Håkon Hægland Dec 02 '20 at 18:59
  • Hi @HåkonHægland, thanks very much for testing it out. I was googling around and saw someone said Perl's autoflush $| will not work if output buffering is set at the web server level. If this is the case, is there and way to "force" turn off buffering from the CGI script itself? – santa100 Dec 02 '20 at 19:13
  • @santa100 I don't think the Perl script can change the way the server behaves. According to [this](https://stackoverflow.com/a/4176941/2173773) answer you could do it from `.htacess` file. Another alternative is to modify the Perl module to include a new method, e.g. `pb_sleep()` that does the sleep from JavaScript instead, see [this](https://stackoverflow.com/a/10597275/2173773) answer. – Håkon Hægland Dec 02 '20 at 19:26
  • Thanks @HåkonHægland, I'll explore those 2 options: the .htacess server-side approach OR the javascript client-side approach. Thanks! – santa100 Dec 02 '20 at 19:39

0 Answers0