Hi Again,
I am trying to make a progressbar and am stuck. I might not sure if
it my lack of understanding of the differences between the OO style
or function-oriented style (to paraphrase the Stein-monster) of
writing CGI scripts.
Script 1 uses the function style and works albeit with one javascript
error.
Script 2 is my effort at the OO style. It fills my http logs with
errors as well as causing a similar number of javascript errors.
The only think that looks relevant in the module documents is under
bugs, caveats, todo:
"Parameter passing doesn't match CGI.pm"
I not sure what that means exactly. Is it relevant?
So is my style wrong or am I changing the expected behaviour of the
module if I use an OO style or is it something else altogether.
Thanx (sorry for the long-winded post),
Dp.
======== script 1 ===========
#!/usr/bin/perl
use strict;
use warnings;
use CGI::ProgressBar qw/:standard/;
$| = 1;
my $q = new CGI::ProgressBar;
print header,
start_html(-title => "Testing",
-style => {-src => '/css/mycss.css'},
),
p('A test'),
# Define progress bar.
progress_bar(
-from => 1,
-to => 50,
-debug => 1,
-width => 30,
);
for (1..5) {
print update_progress_bar;
sleep 1;
}
print hide_progress_bar;
print end_html;
======================== enf of script 1 ========
========== script 2 ================
#!/usr/bin/perl
use strict;
use warnings;
use CGI::ProgressBar qw/:standard/;
$| = 1;
my $q = new CGI::ProgressBar;
print $q->header;
print $q->start_html(-title => "A test",
-style => {-src => '/css/mycss.css'},
);
$q->p('Sending Mail');
# Define progress bar.
$q->progress_bar(
-from => 1,
-to => 12,
-debug => 0,
-width => 30,
);
for (1..5) {
print $q->update_progress_bar;
sleep 1;
}
print $q->hide_progress_bar;
print $q->end_html;
======= end of script 2 ========
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/