File: 18-propagate-subname-package.t

package info (click to toggle)
libtest-warnings-perl 0.038-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 472 kB
  • sloc: perl: 375; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 443 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use strict;
use warnings;

# checks handling of a warning handler named 'MyPackage::warning_capturer'

my $code = do {
    open(my $fh, 't/14-propagate-subname.t') or die "cannot open t/14-propagate-subname.t for reading: $!";
    local $/;
    <$fh>
};

$code =~ s/(use Test::More 0.88;)/package MyPackage;\n$1/;
$code =~ s/\$SIG\{__WARN__\} = 'warning_capturer'/\$SIG\{__WARN__\} = 'MyPackage::warning_capturer'/;

eval $code;
die $@ if $@;