X-Git-Url: https://git.donarmstrong.com/?p=term-progressbar.git;a=blobdiff_plain;f=lib%2FTerm%2FProgressBar.pm;h=eecbaa35daa6162c9cfd67875f871be5abc88fd6;hp=708aab00969973138f0cc9827cc0485d4e092078;hb=a2127d52b1fb103d429fcd4f1d6d2984549a6f18;hpb=ce993e7fe8ecb319c0bf3e625f9f909127b01308 diff --git a/lib/Term/ProgressBar.pm b/lib/Term/ProgressBar.pm index 708aab0..eecbaa3 100644 --- a/lib/Term/ProgressBar.pm +++ b/lib/Term/ProgressBar.pm @@ -1,5 +1,3 @@ -# (X)Emacs mode: -*- cperl -*- - package Term::ProgressBar; #XXX TODO Redo original test with count=20 @@ -13,18 +11,18 @@ package Term::ProgressBar; # If name is wider than term, trim name # Don't update progress bar on new? -=head1 NAME +=head1 NAME Term::ProgressBar - provide a progress meter on a standard terminal -=head1 SYNOPSIS +=head1 SYNOPSIS use Term::ProgressBar; $progress = Term::ProgressBar->new ({count => $count}); $progress->update ($so_far); -=head1 DESCRIPTION +=head1 DESCRIPTION Term::ProgressBar provides a simple progress bar on the terminal, to let the user know that something is happening, roughly how much stuff has been done, @@ -149,7 +147,7 @@ distribution set (it is not installed as part of the module. my $progress = Term::ProgressBar->new({name => 'Powers', count => $max, - ETA => linear, }); + ETA => 'linear', }); $progress->max_update_rate(1); my $next_update = 0; @@ -254,7 +252,7 @@ use constant DEBUG => 0; use vars qw($PACKAGE $VERSION); $PACKAGE = 'Term-ProgressBar'; -$VERSION = '2.11'; +$VERSION = '2.14'; # ---------------------------------- # CLASS CONSTRUCTION @@ -360,6 +358,12 @@ The filehandle to output to. Defaults to stderr. Do not try to use *foo{THING} syntax if you want Term capabilities; it does not work. Pass in a globref instead. +=item term_width + +Sometimes we can't correctly determine the terminal width. You can use this +parameter to force a term width of a particular size. Use a positive integer, +please :) + =item ETA A total time estimation to use. If enabled, a time finished estimation is @@ -496,7 +500,7 @@ sub init { } else { $config{bar_width} = $target; die "configured bar_width $config{bar_width} < 1" - if $config{bar_width} < 1; + if $config{bar_width} < 1; } } @@ -585,6 +589,24 @@ action, and not in action, respectively. =back +=head2 Configuration + +=over 4 + +=item lbrack + +Left bracket ( defaults to [ ) + + $progress->lbrack('<'); + +=item rbrack + +Right bracket ( defaults to ] ) + + $progress->rbrack('>'); + +=back + =cut # Private Scalar Components @@ -820,10 +842,10 @@ sub update { } } for ($self->{last_printed}) { - unless (defined and $_ eq $to_print) { - print $fh $to_print; - } - $_ = $to_print; + unless (defined and $_ eq $to_print) { + print $fh $to_print; + } + $_ = $to_print; } $next -= $self->offset; @@ -924,13 +946,9 @@ sub message { # ---------------------------------------------------------------------- -=head1 BUGS - -Z<> - =head1 REPORTING BUGS -Email the author. +via RT: L =head1 COMPATIBILITY @@ -940,22 +958,22 @@ Various other defaults are set to emulate version one (e.g., the major output character is '#', the bar width is set to 50 characters and the output filehandle is not treated as a terminal). This mode is deprecated. -=head1 AUTHOR +=head1 AUTHOR Martyn J. Pearce fluffy@cpan.org Significant contributions from Ed Avis, amongst others. +=head1 MAINTAINER + +Gabor Szabo L + =head1 COPYRIGHT Copyright (c) 2001, 2002, 2003, 2004, 2005 Martyn J. Pearce. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=head1 SEE ALSO - -Z<> - =cut 1; # keep require happy.