Acme-Pi
view release on metacpan or search on metacpan
inc/MyBumpVersionAfterRelease.pm view on Meta::CPAN
use warnings;
package inc::MyBumpVersionAfterRelease;
use Moose;
with 'Dist::Zilla::Role::AfterRelease';
use utf8;
use Path::Tiny 0.061;
# this is a smarter version of:
# [Run::AfterRelease]
# run = %x -p -i -e's/^version = 3\.(\d+)\s/sprintf(q(version = %0.( . (length($1)+1) . q(g), atan2(1,1)*4)/x'
sub after_release
{
my $self = shift;
# edits dist.ini to add one decimal point to the version
my $Ï = atan2(1,1) * 4;
my $original_version = $self->zilla->version;
my $length = length($original_version);
# add another digit if we added a 0, as it will be numerically identical
do {} while substr($Ï, $length++, 1) eq '0';
my $new_version = substr($Ï, 0, $length);
# munge dist.ini to edit version line
my $path = path('dist.ini');
my $content = $path->slurp_utf8;
my $delta_length = $length - length($original_version);
if ($content =~ s/^(version = )$original_version\s{$delta_length}(\s+)/$1$new_version$2/m)
{
# append+truncate to preserve file mode
$path->append_utf8({ truncate => 1 }, $content);
return 1;
}
return;
}
1;
t/00-report-prereqs.t view on Meta::CPAN
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
t/04-bignum.t view on Meta::CPAN
use strict;
use warnings;
use open ':std', ':encoding(UTF-8)'; # force stdin, stdout, stderr into utf8
use Test::More 0.88;
use utf8;
use Acme::Pi;
my $original_length = length(atan2(1,1) * 4);
my $length = length(Ï);
ok($length > 20, 'Ï has many digits of precision ('.$length.')');
ok($length > $original_length, '...which is more digits than the previous version of Ï ('.$original_length.')');
my $pi = Ï;
ok((3.14 < $pi) && ($pi < 3.15), 'local copy of Ï is between 3.14 and 3.15');
ok((0.78 < Ï/4) && (Ï/4 < 0.79), 'pi constant divided by 4 is correct value');
my $quarter_pi = $pi/4;
ok((0.78 < $quarter_pi) && ($quarter_pi < 0.79), 'local copy of Ï, divided by 4, is correct value');
ok((3.14 < $pi) && ($pi < 3.15), 'local copy of Ï is still between 3.14 and 3.15');
ok((3.14 < Ï) && (Ï < 3.15), 'constant Ï is still between 3.14 and 3.15');
( run in 0.778 second using v1.01-cache-2.11-cpan-65fba6d93b7 )