File Coverage

lib/POSIX/1003/Properties.pm
Criterion Covered Total %
statement 25 30 83.3
branch 1 6 16.6
condition 1 2 50.0
subroutine 9 11 81.8
pod 3 3 100.0
total 39 52 75.0


line stmt bran cond sub pod time code
1             # Copyrights 2011-2015 by [Mark Overmeer].
2             # For other contributors see ChangeLog.
3             # See the manual pages for details on the licensing terms.
4             # Pod stripped from pm file by OODoc 2.01.
5 3     3   14239 use warnings;
  3         4  
  3         69  
6 3     3   8 use strict;
  3         3  
  3         75  
7              
8             package POSIX::1003::Properties;
9 3     3   9 use vars '$VERSION';
  3         4  
  3         108  
10             $VERSION = '0.99_07';
11              
12 3     3   11 use base 'POSIX::1003::Module';
  3         3  
  3         345  
13              
14 3     3   12 use Carp 'croak';
  3         3  
  3         268  
15              
16             my @constants;
17             my @functions = qw/property property_names/;
18              
19             our %EXPORT_TAGS =
20             ( constants => \@constants
21             , functions => \@functions
22             , tables => [ '%property' ]
23             );
24              
25             my $property;
26             our %property;
27              
28             BEGIN {
29 3     3   192 $property = property_table;
30 3         55 push @constants, keys %$property;
31 3         19 tie %property, 'POSIX::1003::ReadOnlyTable', $property;
32             }
33              
34             sub property($);
35              
36              
37             sub exampleValue($)
38 0     0 1 0 { my ($class, $name) = @_;
39 0 0       0 $name =~ m/^_POSIX/ or return;
40 0         0 my $val = property $name;
41 0 0       0 defined $val ? $val : 'undef';
42             }
43              
44              
45             sub property($)
46 103   50 103 1 8771 { my $key = shift // return;
47 103 50       356 $key =~ /^_POSIX/
48             or croak "pass the constant name as string";
49              
50 103         178 $property->{$key};
51             }
52              
53             sub _create_constant($)
54 1     1   1 { my ($class, $name) = @_;
55 1         4 my $value = $property->{$name};
56 1     0   7 sub() {$value};
  0         0  
57             }
58              
59              
60 1     1 1 1213 sub property_names() { keys %$property }
61              
62              
63             1;