File: 12_in_attr_handler.t

package info (click to toggle)
libdata-util-perl 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: perl: 2,958; ansic: 416; makefile: 8
file content (26 lines) | stat: -rw-r--r-- 518 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!perl -w

use strict;
use if ($] >= 5.011), 'Test::More', 'skip_all' => 'This test is for old perls';
use Test::More tests => 4;
use Test::Exception;

use Data::Util qw(get_code_info install_subroutine);

use Attribute::Handlers;
sub UNIVERSAL::Foo :ATTR(CODE, BEGIN){
	my($pkg, $sym, $subr) = @_;

	lives_ok{
        scalar get_code_info($subr);
	} 'get_code_info()';

	lives_ok{
		no warnings 'redefine';
		install_subroutine 'main', 'foo', $subr;
	} 'install_subroutine()';
}

sub f :Foo;

my $anon = sub :Foo {};