Acme-ProgressBar
view release on metacpan or search on metacpan
lib/Acme/ProgressBar.pm view on Meta::CPAN
#pod There is only one function exported by default, C<progress>. This function
#pod takes a coderef as its lone argument. It will execute this code and display a
#pod simple progress bar indicating the time required for ten iterations through the
#pod code.
#pod
#pod =cut
sub progress(&) { ## no critic Prototype
my ($code) = @_;
local $| = 1; ## no critic
_overprint(_message(0,10,undef));
my $begun = Time::HiRes::time;
$code->();
my $total = Time::HiRes::time - $begun;
for (1 .. 9) {
_overprint(_message($_,10,$total));
Time::HiRes::sleep($total);
}
t/00-report-prereqs.t view on Meta::CPAN
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028
use Test::More tests => 1;
use ExtUtils::MakeMaker;
use File::Spec;
# from $version::LAX
my $lax_version_re =
qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
|
(?:\.[0-9]+) (?:_[0-9]+)?
) | (?:
v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
|
(?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
)
)/x;
# hide optional CPAN::Meta modules from prereq scanner
t/00-report-prereqs.t view on Meta::CPAN
for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
next if $mod eq 'perl';
next if grep { $_ eq $mod } @exclude;
my $file = $mod;
$file =~ s{::}{/}g;
$file .= ".pm";
my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
my $want = $req_hash->{$phase}{$type}{$mod};
$want = "undef" unless defined $want;
$want = "any" if !$want && $want == 0;
my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
if ($prefix) {
my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
( run in 3.869 seconds using v1.01-cache-2.11-cpan-d80b1682f3f )