#!perl

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2020-07-09'; # DATE
our $DIST = 'Progress-Any-Examples'; # DIST
our $VERSION = '0.005'; # VERSION

use 5.010001;
use strict;
use warnings;

use Progress::Any '$progress';
use Progress::Any::Output 'TermProgressBarColor', freq=>0.25;
use Time::HiRes qw(sleep);

my $target = $ARGV[0] // 10;
$progress->target($target);
for (1..$target) {
    $progress->update(message => "Doing item $_/$target");
    sleep 0.3;
}
$progress->finish;

# ABSTRACT: A simple progress bar on the terminal
# PODNAME: progress-any-eg-progressbar-01-simple

__END__

=pod

=encoding UTF-8

=head1 NAME

progress-any-eg-progressbar-01-simple - A simple progress bar on the terminal

=head1 VERSION

This document describes version 0.005 of progress-any-eg-progressbar-01-simple (from Perl distribution Progress-Any-Examples), released on 2020-07-09.

=head1 SYNOPSIS

 % progress-any-eg-progressbar-01-simple [target=10]

=head1 DESCRIPTION

This example shows a simple progress bar on the terminal. The progress indicator
is updated every 0.3 second, so we set output argument C<freq> to 0.25 to be
able to reflect each update on the terminal. The default C<freq> value 0.5 would
make the progress bar miss showing some updates.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/Progress-Any-Examples>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-Progress-Any-Examples>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Progress-Any-Examples>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut