Aion-Run

 view release on metacpan or  search on metacpan

lib/Aion/Run.pm  view on Meta::CPAN

		$param{$key} = \@args;
	}

	$pkg->new(%param)
}

1;

__END__

=encoding utf-8

=head1 NAME

Aion::Run - role for console commands

=head1 VERSION

0.0.3

=head1 SYNOPSIS

lib/Aion/Run/RunRun.pm  view on Meta::CPAN

	my $x = eval $self->code;
	die if $@;

	p $x, output => 'stdout', caller_info => 0;
}

1;

__END__

=encoding utf-8

=head1 NAME

Aion::Run::RunRun - executes Perl code and prints the result to STDOUT

=head1 SYNOPSIS

	use Aion::Format qw/trappout np/;
	use Aion::Run::RunRun;
	

lib/Aion/Run/Runner.pm  view on Meta::CPAN

use List::Util qw/pairgrep/;

use config INI => 'etc/annotation/run.ann';

use Aion;

# Список команд
has runs => (is => 'ro', isa => HashRef, default => sub {
	my($self) = @_;
	my %run;
	open my $f, '<:utf8', INI or die "Can't open ${\INI}: $!";
	while (<$f>) {
		chomp;
		warn("Annotation error. Use #\@run <rubric>:<name> <remark>\n$_\n  at ${\INI} line $."), next unless /^([\w:]+)#(\w*),(\d+)=(\S+?):(\S+)[ \t]+(.+)/am;
		$run{$5} = {
			rubric => $4,
			name   => $5,
			remark => $6,
			pkg    => $1,
			sub    => $2,
		};

lib/Aion/Run/Runner.pm  view on Meta::CPAN

    $pkg->new_from_args(\@args)->$sub
}

my $singleton = __PACKAGE__->new;
*new = sub {$singleton};

1;

__END__

=encoding utf-8

=head1 NAME

Aion::Run::Runner - runs the command described by the C<#@run> annotation

=head1 SYNOPSIS

File etc/annotation/run.ann:

	Aion::Run::RunRun#run,3=run:run „Executes Perl code in the context of the current project”

lib/Aion/Run/RunsRun.pm  view on Meta::CPAN

		printcolor "#yellow%s#r\n", $rubric = $_->{rubric} if $rubric ne $_->{rubric};

		printcolor "  #green%-${len}s #{bold red}%-${len2}s #{bold black}%s#r\n", $_->{name}, $_->{args}, $_->{remark};
	}
}

1;

__END__

=encoding utf-8

=head1 NAME

Aion::Run::RunsRun - list of scripts with the annotation C<#@run>

=head1 SYNOPSIS

File etc/annotation/run.ann:

	Aion::Run::RunRun#run,3=run:run „Executes Perl code in the context of the current project”

script/act  view on Meta::CPAN

#!/usr/bin/env perl

use common::sense;
use open qw/:std :utf8/;

use Aion::Carp;
use Aion::Run::Runner;

if($ARGV[0] ~~ ['--help', '-h']) {
    print << "END";
Usage:
	
	act <run> [arguments]
	

t/aion/run.t  view on Meta::CPAN

use common::sense; use open qw/:std :utf8/;  use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//;  use Test::More 0.98;  use String::Diff q...
# # NAME
# 
# Aion::Run - роль для консольных команд
# 
# # VERSION
# 
# 0.0.2
# 
# # SYNOPSIS
# 

t/aion/run/run-run.t  view on Meta::CPAN

use common::sense; use open qw/:std :utf8/;  use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//;  use Test::More 0.98;  use String::Diff q...
# # NAME
# 
# Aion::Run::RunRun - выполняет Perl-код и распечатывает результат на STDOUT
# 
# # SYNOPSIS
# 
subtest 'SYNOPSIS' => sub { 
use Aion::Format qw/trappout np/;
use Aion::Run::RunRun;

t/aion/run/runner.t  view on Meta::CPAN

use common::sense; use open qw/:std :utf8/;  use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//;  use Test::More 0.98;  use String::Diff q...
# # NAME
# 
# Aion::Run::Runner - запускает команду описанную аннотацией `#@run`
# 
# # SYNOPSIS
# 
# Файл etc/annotation/run.ann:
#@> etc/annotation/run.ann
#>> Aion::Run::RunRun#run,3=run:run „Executes Perl code in the context of the current project”
#>> Aion::Run::RunsRun#list,5=run:runs „List of scripts”

t/aion/run/runs-run.t  view on Meta::CPAN

use common::sense; use open qw/:std :utf8/;  use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//;  use Test::More 0.98;  use String::Diff q...
# # NAME
# 
# Aion::Run::RunsRun - список скриптов с аннотацией `#@run`
# 
# # SYNOPSIS
# 
# Файл etc/annotation/run.ann:
#@> etc/annotation/run.ann
#>> Aion::Run::RunRun#run,3=run:run „Executes Perl code in the context of the current project”
#>> Aion::Run::RunsRun#list,5=run:runs „List of scripts”



( run in 1.153 second using v1.01-cache-2.11-cpan-13bb782fe5a )