File Coverage

blib/lib/Pod/Elemental/Types.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1 1     1   17630 use strict;
  1         2  
  1         47  
2 1     1   4 use warnings;
  1         2  
  1         61  
3             package Pod::Elemental::Types;
4             # ABSTRACT: data types for Pod::Elemental
5             $Pod::Elemental::Types::VERSION = '0.103004';
6 1     1   992 use MooseX::Types -declare => [ qw(FormatName ChompedString) ];
  0            
  0            
7             use MooseX::Types::Moose qw(Str);
8              
9             #pod =head1 OVERVIEW
10             #pod
11             #pod This is a library of MooseX::Types types used by Pod::Elemental.
12             #pod
13             #pod =head1 TYPES
14             #pod
15             #pod =head2 FormatName
16             #pod
17             #pod This is a valid name for a format (a Pod5::Region). It does not expect the
18             #pod leading colon for pod-like regions.
19             #pod
20             #pod =cut
21              
22             # Probably needs refining -- rjbs, 2009-05-26
23             subtype FormatName, as Str, where { length $_ and /\A\S+\z/ };
24              
25             #pod =head2 ChompedString
26             #pod
27             #pod This is a string that does not end with newlines. It can be coerced from a
28             #pod Str ending in a single newline -- the newline is dropped.
29             #pod
30             #pod =cut
31              
32             subtype ChompedString, as Str, where { ! /\n\z/ };
33             coerce ChompedString, from Str, via { chomp; $_ };
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Pod::Elemental::Types - data types for Pod::Elemental
46              
47             =head1 VERSION
48              
49             version 0.103004
50              
51             =head1 OVERVIEW
52              
53             This is a library of MooseX::Types types used by Pod::Elemental.
54              
55             =head1 TYPES
56              
57             =head2 FormatName
58              
59             This is a valid name for a format (a Pod5::Region). It does not expect the
60             leading colon for pod-like regions.
61              
62              
63             =head2 ChompedString
64              
65             This is a string that does not end with newlines. It can be coerced from a
66             Str ending in a single newline -- the newline is dropped.
67              
68             =head1 AUTHOR
69              
70             Ricardo SIGNES <rjbs@cpan.org>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is copyright (c) 2014 by Ricardo SIGNES.
75              
76             This is free software; you can redistribute it and/or modify it under
77             the same terms as the Perl 5 programming language system itself.
78              
79             =cut