| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::Critique::Session::File; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 12909 | use strict; | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 71 |  | 
| 4 | 3 |  |  | 3 |  | 9 | use warnings; | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 114 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION   = '0.03'; | 
| 7 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:STEVAN'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 3 |  |  | 3 |  | 10 | use Scalar::Util (); | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 29 |  | 
| 10 | 3 |  |  | 3 |  | 8 | use Carp         (); | 
|  | 3 |  |  |  |  | 2 |  | 
|  | 3 |  |  |  |  | 30 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 3 |  |  | 3 |  | 646 | use Path::Tiny   (); | 
|  | 3 |  |  |  |  | 8852 |  | 
|  | 3 |  |  |  |  | 811 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub new { | 
| 15 | 2 |  |  | 2 | 0 | 647 | my ($class, %args) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 2 |  |  |  |  | 4 | my $path = $args{path}; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 2 | 50 |  |  |  | 9 | Carp::confess('You must supply a `path` argument') | 
| 20 |  |  |  |  |  |  | unless defined $path; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 | 50 | 33 |  |  | 17 | $path = Path::Tiny::path( $path ) | 
| 23 |  |  |  |  |  |  | unless Scalar::Util::blessed( $path ) | 
| 24 |  |  |  |  |  |  | && $path->isa('Path::Tiny'); | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | return bless { | 
| 27 |  |  |  |  |  |  | path => $path, | 
| 28 |  |  |  |  |  |  | meta => $args{meta} || {}, | 
| 29 | 2 |  | 100 |  |  | 61 | } => $class; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | # accessors | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 2 |  |  | 2 | 0 | 339 | sub path { $_[0]->{path} } | 
| 35 | 0 |  |  | 0 | 0 | 0 | sub meta { $_[0]->{meta} } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | sub remember { | 
| 38 | 2 |  |  | 2 | 0 | 535 | my ($self, $key, $value) = @_; | 
| 39 | 2 |  |  |  |  | 3 | $self->{meta}->{ $key } = $value; | 
| 40 | 2 |  |  |  |  | 2 | return; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub recall { | 
| 44 | 3 |  |  | 3 | 0 | 7 | my ($self, $key) = @_; | 
| 45 | 3 |  |  |  |  | 9 | return $self->{meta}->{ $key }; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub forget { | 
| 49 | 1 |  |  | 1 | 0 | 500 | my ($self, $key) = @_; | 
| 50 | 1 |  |  |  |  | 3 | return delete $self->{meta}->{ $key }; | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub forget_all { | 
| 54 | 0 |  |  | 0 | 0 | 0 | my ($self) = @_; | 
| 55 |  |  |  |  |  |  | $self->{meta} = {} | 
| 56 | 0 |  |  |  |  | 0 | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | # ... | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | sub relative_path { | 
| 61 | 0 |  |  | 0 | 0 | 0 | my ($self, $path) = @_; | 
| 62 | 0 |  |  |  |  | 0 | return $self->{path}->relative( $path ); | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | # ... | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | sub pack { | 
| 68 | 4 |  |  | 4 | 0 | 691 | my ($self) = @_; | 
| 69 |  |  |  |  |  |  | return { | 
| 70 |  |  |  |  |  |  | path => $self->{path}->stringify, | 
| 71 |  |  |  |  |  |  | meta => $self->{meta}, | 
| 72 | 4 |  |  |  |  | 10 | }; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | sub unpack { | 
| 76 | 1 |  |  | 1 | 0 | 1448 | my ($class, $data) = @_; | 
| 77 | 1 |  |  |  |  | 5 | return $class->new( %$data ); | 
| 78 |  |  |  |  |  |  | } | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | 1; | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =pod | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 NAME | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | App::Critique::Session::File - Information about file processed by App::Critique | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head1 VERSION | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | version 0.03 | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | This class holds information about files that have been processed | 
| 96 |  |  |  |  |  |  | by L<App::Critique> and contains no real user serviceable parts. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =head1 AUTHOR | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | Stevan Little <stevan@cpan.org> | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | This software is copyright (c) 2016 by Stevan Little. | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 107 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =cut | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | __END__ | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | # ABSTRACT: Information about file processed by App::Critique | 
| 114 |  |  |  |  |  |  |  |