Help language development. Donate to The Perl Foundation

Inline::Perl5 cpan:NINE last updated on 2020-05-07

t/globals.t
use Test;

use Inline::Perl5;
my $p5 = Inline::Perl5.default_perl5;

try EVAL 'die "test\n"', :lang<Perl5>;
is $p5.global('[email protected]'), "test\n";
is %*PERL5<[email protected]>, "test\n";

EVAL '@a = (1, 2)', :lang<Perl5>;
is $p5.global('@a'), [1, 2];
is %*PERL5<@a>, [1, 2];

EVAL '%a = (a => 1)', :lang<Perl5>;
is $p5.global('%a'), {a => 1};
is %*PERL5<%a>, {a => 1};

EVAL '$Foo::Bar::a = 1', :lang<Perl5>;
is $p5.global('$Foo::Bar::a'), 1;
is %*PERL5<$Foo::Bar::a>, 1;

use Data::Dumper:from<Perl5>;
EVAL '$Data::Dumper::Maxdepth = 1', :lang<Perl5>;
is $Data::Dumper::Maxdepth, 1;
$Data::Dumper::Maxdepth = 2;
is $Data::Dumper::Maxdepth, 2;
is EVAL('$Data::Dumper::Maxdepth', :lang<Perl5>), 2;

done-testing;

# vim: ft=perl6