PAUSEx-Log
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
a module.
To build the distribution, run this file normally:
% perl Makefile.PL
But, it's more interesting than that. You can load it with C<require>
and call C<arguments> to get the data structure it passes to
C<WriteMakefile>:
my $package = require '/path/to/Makefile.PL';
my $arguments = $package->arguments;
Note that C<require>-ing a file makes an entry in C<%INC> for exactly
that name. If you try to C<require> another file with the same name,
even from a different path, C<require> thinks it has already loaded
the file. As such, I recommend you always require the full path to the
file.
The return value of the C<require> is a package name (in this case,
the name of the main module. Use that to call the C<arguments> method.
lib/PAUSEx/Log.pm view on Meta::CPAN
=item fetch_log( PAUSE_USER, PAUSE_PASS )
Fetch the PAUSE log, using your PAUSE ID and password. You can also
set these in the C<CPAN_PASS> and C<CPAN_PASS> environment variables, which
this function will automatically pick up.
=cut
sub fetch_log ( $class, $user = $ENV{CPAN_USER}, $pass = $ENV{CPAN_PASS} ) {
state $rc = require Mojo::UserAgent;
state $ua = Mojo::UserAgent->new;
state $url_template = 'https://%s:%s@pause.perl.org/pause/authenquery?ACTION=tail_logfile&pause99_tail_logfile_1=5000&pause99_tail_logfile_sub=Tail+characters';
state $url = sprintf $url_template, $user, $pass;
my $tx = $ua->get( $url );
my $entries = $tx->res->dom
->find( 'div#logs table.table tbody.list tr td.log' )
->map( 'text' )
->map( sub { PAUSEx::Log->_parse_log_line($_) } )
script/pause-log view on Meta::CPAN
}
last FETCH if $opts->{'once'};
last FETCH if( $opts->{'stop-on-dist'} and $found_dist );
enjoy_the_interval($opts);
}
sub create_formatter () {
state $rc = require String::Sprintf;
no warnings qw(uninitialized);
# all of these ignore $value and uses the first thing in $values
# ->format( $format, $entry )
my $formatter = String::Sprintf->formatter(
'd' => sub ($width, $value, $values, $letter) {
sprintf "%${width}s", $values->[0]->distname;
},
'D' => sub ($width, $value, $values, $letter) {
sprintf "%${width}s", $values->[0]->pause_id;
script/pause-log view on Meta::CPAN
}
sub filter_types ($opts) {
return unless( defined $opts->{'types'} and keys $opts->{'types'}->%* );
sub ($e) {
return ! exists $opts->{'types'}{ $e->type };
};
}
sub process_options () {
my $rc = require Getopt::Long;
my %opts = (
dist => undef,
duration => 30 * 60,
'format' => '%T %m',
interval => 5 * 60,
once => 0,
quiet => 0,
verbose => 0,
);
( run in 0.477 second using v1.01-cache-2.11-cpan-05444aca049 )