| 1 | package CPAN::Index::API::Role::HavingFilename; | ||
| 2 | { | ||
| 3 | 5 | $CPAN::Index::API::Role::HavingFilename::VERSION = '0.007'; | |
| 4 | } | ||
| 5 | |||
| 6 | # ABSTRACT: Provides 'filename' attribute | ||
| 7 | |||
| 8 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 5 | ▶ | use Path::Class (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 5 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 5 | requires 'default_location'; | |
| 15 | |||
| 16 | 5 | has filename => ( | |
| 17 | is => 'ro', | ||
| 18 | isa => 'Str', | ||
| 19 | required => 1, | ||
| 20 | lazy_build => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | sub _build_filename { | ||
| 24 | 9 | ▶ | my $self = shift; |
|
Subroutine
_build_filename: called CC=1 SCAR=0.0
| |||
| 25 | 9 | return Path::Class::file($self->default_location)->basename; | |
| 26 | } | ||
| 27 | |||
| 28 | 5 | 1; | |
| 29 | |||
| 30 | |||
| 31 | __END__ | ||
| 32 | =pod | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | CPAN::Index::API::Role::HavingFilename - Provides 'filename' attribute | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 0.007 | ||
| 41 | |||
| 42 | =head1 REQUIRES | ||
| 43 | |||
| 44 | =head2 deafult_location | ||
| 45 | |||
| 46 | Class method that returns a string specifying the path to the default location | ||
| 47 | of this file relative to the repository root. | ||
| 48 | |||
| 49 | =head1 PROVIDES | ||
| 50 | |||
| 51 | =head2 filename | ||
| 52 | |||
| 53 | Name of the current file - defaults to the basename of the path specified | ||
| 54 | in C<default_location>; | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Peter Shangov <pshangov@yahoo.com> | ||
| 59 | |||
| 60 | =head1 COPYRIGHT AND LICENSE | ||
| 61 | |||
| 62 | This software is copyright (c) 2012 by Venda, Inc.. | ||
| 63 | |||
| 64 | This is free software; you can redistribute it and/or modify it under | ||
| 65 | the same terms as the Perl 5 programming language system itself. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||