/[Frey]/trunk/lib/Frey/Path.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/Path.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1133 - (hide annotations)
Tue Jun 30 15:10:55 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 537 byte(s)
make classes immutable and remove moose droppings to make Perl::Critic::Moose happy
1 dpavlin 224 package Frey::Path;
2     use Moose::Role;
3     use File::Path;
4    
5     =head1 NAME
6    
7     Frey::Path - path manipulation role
8    
9     =head2 mkbasepath
10    
11     $o->mkbasepath('/full/path/with/filename');
12    
13     =cut
14    
15     sub mkbasepath {
16     my $self = shift;
17     my $base_path = shift;
18     $base_path =~ s{/[^/]+$}{};
19     mkpath $base_path if ! -e $base_path;
20     }
21    
22 dpavlin 682 =head2 path_size
23    
24     my $path_size_bytes = $self->path_size( 'lib/path' );
25    
26     =cut
27    
28     sub path_size {
29     my ($self,$path) = @_;
30     $path .= ' ' . ( -s $path ) . ' bytes';
31 dpavlin 1088 warn "# path_size: $path\n";
32 dpavlin 682 return $path;
33     }
34    
35 dpavlin 1133 no Moose::Role;
36    
37 dpavlin 224 1;

  ViewVC Help
Powered by ViewVC 1.1.26