HackaMol/Roles/PathRole.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 26 / 26 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« HackaMol/Roles/NameRole.pm ↑ Summary HackaMol/Roles/QmAtomRole.pm »
1 package HackaMol::Roles::PathRole;
2 11 $HackaMol::Roles::PathRole::VERSION = '0.051';
3 #ABSTRACT:
4 11 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use MooseX::Types::Path::Tiny qw/Path Paths AbsPath AbsPaths/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 has 'in_fn' => (
9 is => 'rw',
10 isa => Path,
11 coerce => 1,
12 predicate => 'has_in_fn',
13 );
14
15 11 has 'out_fn' => (
16 is => 'rw',
17 isa => Path,
18 coerce => 1,
19 predicate => 'has_out_fn',
20 );
21  
22 11 has 'err_fn' => (
23 is => 'rw',
24 isa => Path,
25 coerce => 1,
26 predicate => 'has_err_fn',
27 );
28  
29 11 has 'log_fn' => (
30 is => 'rw',
31 isa => Path,
32 coerce => 1,
33 predicate => 'has_log_fn',
34 );
35  
36 11 has 'forts' => (
37 is => 'ro',
38 isa => Paths,
39 coerce => 1,
40 predicate => 'has_forts',
41 );
42  
43 11 has 'homedir' => (
44 is => 'ro',
45 isa => AbsPath,
46 coerce => 1,
47 default => '.',
48 );
49
50 11 has 'scratch' => (
51 is => 'ro',
52 isa => AbsPath,
53 coerce => 1,
54 predicate => 'has_scratch',
55 );
56  
57 11 has 'data' => (
58 is => 'ro',
59 isa => AbsPath,
60 coerce => 1,
61 predicate => 'has_data',
62 );
63  
64 11 has 'dirs' => (
65 is => 'ro',
66 isa => AbsPaths,
67 coerce => 1,
68 predicate => 'has_dirs',
69 );
70  
71 11 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 11 1;
74  
75 __END__
76  
77 =pod
78  
79 =head1 NAME
80  
81 HackaMol::Roles::PathRole -
82  
83 =head1 VERSION
84  
85 version 0.051
86  
87 =head1 DESCRIPTION
88  
89 This role adds some file and directory attributes to a class. This is still
90 a work in progress, and it will probably change (suggestions welcome). The
91 goal is to reduce the amount code required for manipulating file and directory
92 paths used for work, and to allow scripts to be more platform independent.
93 MooseX::Types::Path::Tiny is used to coerce the attributes into Path::Tiny
94 objects. See Path::Tiny for associated methods. The actual construction of
95 directories is left to scripts and extensions.
96  
97 =head1 ATTRIBUTES
98  
99 =head2 scratch homedir data
100  
101 isa Path::Tiny coerced via AbsPath that is 'ro'
102  
103 the absolute path to the directory is constructed
104  
105 =head2 log_fn in_fn out_fn err_fn
106  
107 isa Path::Tiny coerced via Path that is 'rw'
108  
109 =head2 dirs
110  
111 isa ArrayRef[Path::Tiny] coerced via AbsPaths that is 'ro'
112  
113 fill your object with all the directories you wish
114  
115 my $obj = SomeClass->new(dirs = [qw/. .. data tmp \/var ~\/bin/]
116  
117 =head2 forts
118  
119 isa ArrayRef[Path::Tiny] coerced via Paths that is 'ro'
120  
121 a place for those extra files
122  
123 =head1 AUTHOR
124  
125 Demian Riccardi <demianriccardi@gmail.com>
126  
127 =head1 COPYRIGHT AND LICENSE
128  
129 This software is copyright (c) 2017 by Demian Riccardi.
130  
131 This is free software; you can redistribute it and/or modify it under
132 the same terms as the Perl 5 programming language system itself.
133  
134 =cut
« HackaMol/Roles/NameRole.pm ↑ Summary HackaMol/Roles/QmAtomRole.pm »