Skip to content

Instantly share code, notes, and snippets.

@yappo
Last active December 18, 2015 08:39
Show Gist options
  • Save yappo/5755267 to your computer and use it in GitHub Desktop.
Save yappo/5755267 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
use Capture::Tiny ':all';
use Devel::Peek;
package Yappo {
sub proto () { 1 }
};
subtest 'prototype' => sub {
my(undef, $stdout, undef) = capture {
Dump(Yappo::proto);
};
unlike $stdout, qr/PV = /; # failed !
my $x = Yappo::proto . ''; # create PV value for Yappo :: proto
(undef, $stdout, undef) = capture {
Dump(Yappo::proto);
};
unlike $stdout, qr/PV = /; # failed !
};
done_testing;
__END__
$ perl -MO=Deparse
sub Yappo::proto () { 1 }
use Test::More;
use Capture::Tiny (':all');
use Devel::Peek;
package main;
use warnings;
use strict;
{;};
subtest('prototype', sub {
my(undef, $stdout, undef) = capture(sub {
Dump(1);
}
);
unlike $stdout, qr/PV = /;
my $x = '1';
(undef, $stdout, undef) = capture(sub {
Dump(1);
}
);
unlike $stdout, qr/PV = /;
}
);
done_testing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment