MooseX/Types/OpenModeWithLayerStr.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 26 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl -c
2  
3 package MooseX::Types::OpenModeWithLayerStr;
4  
5 =head1 NAME
6  
7 MooseX::Types::OpenModeWithLayerStr - Type for mode string with PerlIO layer
8  
9 =head1 SYNOPSIS
10  
11 package My::Class;
12 use Moose;
13 use MooseX::Types::OpenModeWithLayerStr;
14 has file => ( isa => 'Str' );
15 has mode => ( isa => 'OpenModeWithLayerStr' );
16  
17 package main;
18 my $fout = My::Class->new( file => '/tmp/pwdnew', mode => '>:crlf' );
19  
20 =head1 DESCRIPTION
21  
22 This module provides Moose type which represents Perl-style canonical open
23 mode string (i.e. "+>") with additional PerlIO layer.
24  
25 =cut
26  
27  
28 use strict;
29 use warnings;
30  
31 our $VERSION = '0.1004';
32  
33 use Moose::Util::TypeConstraints;
34  
35  
36 subtype OpenModeWithLayerStr => (
37 as 'Str',
38 where { /^\+?(<|>>?):?/ },
39 optimize_as {
40 defined $_[0] && !ref($_[0])
41 && $_[0] =~ /^\+?(<|>>?):?/
42 },
43 );
44  
45  
46 1;
47  
48  
49 __END__