summaryrefslogtreecommitdiff
path: root/lib/Devel/TypeTiny/Perl58Compat.pm
blob: e623164633d947669421ccba96943e9fe82b637d (plain)
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
27
# INTERNAL MODULE: Perl 5.8 compatibility for Type::Tiny.

package Devel::TypeTiny::Perl58Compat;

use 5.008;
use strict;
use warnings;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '2.000000';

$VERSION =~ tr/_//d;

#### re doesn't provide is_regexp in Perl < 5.10

eval 'require re';

unless ( exists &re::is_regexp ) {
	require B;
	*re::is_regexp = sub {
		eval { B::svref_2object( $_[0] )->MAGIC->TYPE eq 'r' };
	};
}

#### Done!

5.8;