App-ansicolumn

 view release on metacpan or  search on metacpan

lib/App/ansicolumn/Command.pm  view on Meta::CPAN

        binmode $fh, ':encoding(utf8)';
        $fh;
    };
    $stdin->seek(0, 0)  or die "seek: $!\n";
    $stdin->truncate(0) or die "truncate: $!\n";
    $stdin->print($data);
    $stdin->seek(0, 0)  or die "seek: $!\n";
    $obj;
}

sub update {
    my $obj = shift;
    my @command = $obj->command;

    # Flatten if nested array
    @command = @{$command[0]} if @command == 1 && ref $command[0] eq 'ARRAY';

    my $code = ref $command[0] eq 'CODE' ? shift @command : undef;

    if ($code) {
        $obj->_update_code($code, @command);

t/App/cdif/Command.pm  view on Meta::CPAN

sub command {
    my $obj = shift;
    if (@_) {
	$obj->{COMMAND} = [ @_ ];
	$obj;
    } else {
	@{$obj->{COMMAND}};
    }
}

sub update {
    use Time::localtime;
    my $obj = shift;
    $obj->data(join "\n", map { $obj->execute($_) } $obj->command);
    $obj->date(ctime());
    $obj;
}

sub execute {
    my $obj = shift;
    my $command = shift;



( run in 1.220 second using v1.01-cache-2.11-cpan-39bf76dae61 )