| 1 | package CPAN::Index::API::Role::HavingFilename; | ||
| 2 | |||
| 3 | 2 | our $VERSION = '0.008'; | |
| 4 | |||
| 5 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use Path::Class (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 2 | requires 'default_location'; | |
| 12 | |||
| 13 | 2 | has filename => ( | |
| 14 | is => 'ro', | ||
| 15 | isa => 'Str', | ||
| 16 | required => 1, | ||
| 17 | lazy_build => 1, | ||
| 18 | ); | ||
| 19 | |||
| 20 | 9 | ▶ | sub _build_filename { |
|
Subroutine
_build_filename: called CC=1 SCAR=0.0
| |||
| 21 | 9 | my $self = shift; | |
| 22 | 9 | return Path::Class::file($self->default_location)->basename; | |
| 23 | } | ||
| 24 | |||
| 25 | 2 | 1; | |
| 26 | |||
| 27 | =pod | ||
| 28 | |||
| 29 | =encoding UTF-8 | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | CPAN::Index::Role::HavingFilename - Provides 'filename' attribute | ||
| 34 | |||
| 35 | =head1 REQUIRES | ||
| 36 | |||
| 37 | =head2 deafult_location | ||
| 38 | |||
| 39 | Class method that returns a string specifying the path to the default location | ||
| 40 | of this file relative to the repository root. | ||
| 41 | |||
| 42 | =head1 PROVIDES | ||
| 43 | |||
| 44 | =head2 filename | ||
| 45 | |||
| 46 | Name of the current file - defaults to the basename of the path specified | ||
| 47 | in C<default_location>; | ||
| 48 | |||
| 49 | =cut | ||