X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lib%2FTerm%2FProgressBar%2FIO.pm;h=b95ab6f94bad0a0221e23f641c3eaf124227812d;hb=a05144844ce1919ec4bc70529d84a0a254600e0a;hp=0617baf3b63f5a2ecbc06cf88e7457d561d439a5;hpb=725cf58b42e1c65985fcd42c91420e22ff5815e3;p=term-progressbar-io.git diff --git a/lib/Term/ProgressBar/IO.pm b/lib/Term/ProgressBar/IO.pm index 0617baf..b95ab6f 100644 --- a/lib/Term/ProgressBar/IO.pm +++ b/lib/Term/ProgressBar/IO.pm @@ -14,6 +14,7 @@ Term::ProgressBar::IO -- Display a progress bar while reading from a seekable fi my $pb = Term::ProgressBar::IO->new($fh); while (<$fh>) { + # do something $pb->update(); } @@ -22,6 +23,9 @@ Term::ProgressBar::IO -- Display a progress bar while reading from a seekable fi Displays a progress bar using L which corresponds to reading from a filehandle. +This module inherits from L and has all of its +options. + =head1 BUGS None known. @@ -41,6 +45,33 @@ BEGIN{ $DEBUG = 0 unless defined $DEBUG; } +=head1 METHODS + +=head2 new + +Create and return a new Term::ProgressBar::IO instance. + +=over + +=item ARGUMENTS + +=over + +=item count + +A valid filehandle or item count. L filehandles are +also properly handled. + +=item OTHER ARGUMENTS + +All other arguments are documented in L + +=back + +=back + +=cut + sub init { my $self = shift; my $count; @@ -67,6 +98,28 @@ sub init { $self->SUPER::init(\%config); } +=head2 update + +Automatically update the progress bar based on the position of the +filehandle given at construction time. + +=over + +=item ARGUMENTS + +=over + +=item so_far + +Current progress point; this defaults to the current position of the +filehandle. [You probably don't actually want to ever give this.] + +=back + +=back + +=cut + sub update { my $self = shift; my $count = $self->__determine_count();