| 1 | # App::GitFind::Entry::PathClass - App::GitFind::Entry wrapper for an App::GitFind::PathClassMicro::Entity instance | ||||||||||
| 2 | package App::GitFind::Entry::PathClass; | ||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use App::GitFind::Base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | #use Path::Class; | ||||||||||
| 9 | 1 | ▶ | use App::GitFind::PathClassMicro; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.000002'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use parent 'App::GitFind::Entry'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | # Fields. Not all have values. | ||||||||||
| 16 | use Class::Tiny | ||||||||||
| 17 | 1 | ▶ | 'obj'; # An App::GitFind::PathClassMicro::Entity instance. Required. | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use Class::Tiny::Immutable { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.7
| |||||||||||
| 19 | 0 | ▶ | '_lstat' => sub { [$_[0]->obj->lstat()] }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 20 | |||||||||||
| 21 | 0 | ▶ | isdir => sub { $_[0]->obj->is_dir }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 22 | 0 | ▶ | name => sub { $_[0]->obj->basename }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | ▶ | path => sub { $_[0]->obj->relative($_[0]->searchbase) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | |||||||||||
| 25 | 1 | }; | |||||||||
| 26 | |||||||||||
| 27 | # Docs {{{1 | ||||||||||
| 28 | |||||||||||
| 29 | =head1 NAME | ||||||||||
| 30 | |||||||||||
| 31 | # App::GitFind::Entry::PathClass - App::GitFind::Entry wrapper for an App::GitFind::PathClassMicro::Entity instance | ||||||||||
| 32 | |||||||||||
| 33 | =head1 SYNOPSIS | ||||||||||
| 34 | |||||||||||
| 35 | This represents a single file or directory being checked against an expression. | ||||||||||
| 36 | This particular concrete class represents a file or directory on disk. | ||||||||||
| 37 | It requires a L<File::Find::Object::Result> instance. Usage: | ||||||||||
| 38 | |||||||||||
| 39 | use App::GitFind::PathClassMicro; | ||||||||||
| 40 | my $obj = App::GitFind::PathClassMicro::File->new('foo.txt'); | ||||||||||
| 41 | # or ...::Dir->new('bar') | ||||||||||
| 42 | my $entry = App::GitFind::Entry::PathClass->new(-obj => $obj); | ||||||||||
| 43 | |||||||||||
| 44 | =head1 METHODS | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | # }}}1 | ||||||||||
| 49 | |||||||||||
| 50 | =head2 prune | ||||||||||
| 51 | |||||||||||
| 52 | TODO | ||||||||||
| 53 | |||||||||||
| 54 | =cut | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub prune { | ||||||||
|
Subroutine
prune: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | ... | ||||||||||
| 58 | 0 | } | |||||||||
| 59 | |||||||||||
| 60 | =head2 BUILD | ||||||||||
| 61 | |||||||||||
| 62 | Enforces the requirements on the C<-obj> argument to C<new()>. | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | 0 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 67 | 0 | my $self = shift; | |||||||||
| 68 | 0 | ▶ | die "Usage: @{[ref $self]}->new(-obj=>...)" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | unless $self->obj; | ||||||||||
| 70 | 0 | ▶ | die "-obj must be a App::GitFind::PathClassMicro::Entity" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | unless $self->obj->DOES('App::GitFind::PathClassMicro::Entity'); | ||||||||||
| 72 | } #BUILD() | ||||||||||
| 73 | |||||||||||
| 74 | 1 | 1; | |||||||||