Acme-Perl-VM

 view release on metacpan or  search on metacpan

inc/Module/Install.pm  view on Meta::CPAN

		open( FH, "< $_[0]"  ) or die "open($_[0]): $!";
	}
	my $string = do { local $/; <FH> };
	close FH or die "close($_[0]): $!";
	return $string;
}

sub _readperl {
	my $string = Module::Install::_read($_[0]);
	$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
	$string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
	$string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
	return $string;
}

sub _readpod {
	my $string = Module::Install::_read($_[0]);
	$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
	return $string if $_[0] =~ /\.pod\z/;
	$string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
	$string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;

lib/Acme/Perl/VM/Context.pm  view on Meta::CPAN

);
has itermax => (
    is  => 'rw',
    isa => 'Int',
);

sub type(){ 'LOOP' } # this is a LOOP

sub BUILD{
    my($cx) = @_;
    $cx->ITERDATA_SET($cx->iterdata);
    return;
}


sub ITERVAR{
    my($cx) = @_;
    if(USE_ITHREADS){
        if($cx->padvar){
            return $cx->CURPAD_SV($cx->iterdata);
        }
        else{
            return $cx->iterdata->SV;
        }
    }
    else{
        return $cx->iterdata;
    }
}
sub ITERDATA_SET{
    my($cx, $idata) = @_;
    if(USE_ITHREADS){
        $cx->CURPAD_SAVE();
    }

    $cx->itersave($cx->ITERVAR);
}

no Mouse;
__PACKAGE__->meta->make_immutable();

t/11_readline.t  view on Meta::CPAN

#!perl -w

use strict;
use Test::More tests => 11;

use Acme::Perl::VM;
use Acme::Perl::VM qw(:perl_h);

my $x = run_block{ <DATA> };
is $x, "foo\n";
$x = run_block{ <DATA> };
is $x, "bar\n";

is_deeply [run_block { <DATA> }], ["a\n", "b\n", "c\n"];
is_deeply [run_block { <DATA> }], [];

open my $in, '<', \'foo';
is scalar(run_block{ readline($in) }), 'foo';

is_deeply \@PL_stack,      [], '@PL_stack is empty';
is_deeply \@PL_markstack,  [], '@PL_markstack is empty';
is_deeply \@PL_scopestack, [], '@PL_scopestack is empty';
is_deeply \@PL_cxstack,    [], '@PL_cxstack is empty';
is_deeply \@PL_savestack,  [], '@PL_savestack is empty';
is_deeply \@PL_tmps,       [], '@PL_tmps is empty';
__DATA__
foo
bar
a
b
c

xt/01_podspell.t  view on Meta::CPAN

#!perl -w

use strict;
use Test::More;

eval q{ use Test::Spelling };

plan skip_all => q{Test::Spelling is not installed.}
	if $@;

add_stopwords(map { split /[\s\:\-]/ } <DATA>);
$ENV{LANG} = 'C';
all_pod_files_spelling_ok('lib');

__DATA__
Goro Fuji (gfx)
gfuji(at)cpan.org
Acme::Perl::VM
APVM
gfx
ppcode
ppcodes
runops



( run in 1.931 second using v1.01-cache-2.11-cpan-140bd7fdf52 )