line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Create Spec objects from strings |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Target; |
4
|
|
|
|
|
|
|
|
5
|
66
|
|
|
66
|
|
108595
|
use strict; |
|
66
|
|
|
|
|
159
|
|
|
66
|
|
|
|
|
1827
|
|
6
|
66
|
|
|
66
|
|
340
|
use warnings; |
|
66
|
|
|
|
|
122
|
|
|
66
|
|
|
|
|
2100
|
|
7
|
|
|
|
|
|
|
|
8
|
66
|
|
|
66
|
|
561
|
use Class::Load; |
|
66
|
|
|
|
|
6805
|
|
|
66
|
|
|
|
|
2331
|
|
9
|
|
|
|
|
|
|
|
10
|
66
|
|
|
66
|
|
16243
|
use Pinto::Exception; |
|
66
|
|
|
|
|
325
|
|
|
66
|
|
|
|
|
20096
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
78
|
|
|
78
|
1
|
22938
|
my ( $class, $arg ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
78
|
|
|
|
|
207
|
my $type = ref $arg; |
23
|
78
|
|
|
|
|
172
|
my $target_class; |
24
|
|
|
|
|
|
|
|
25
|
78
|
50
|
|
|
|
266
|
if ( not $type ) { |
|
|
0
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
78
|
100
|
|
|
|
461
|
$target_class = |
28
|
|
|
|
|
|
|
( $arg =~ m{/}x ) |
29
|
|
|
|
|
|
|
? 'Pinto::Target::Distribution' |
30
|
|
|
|
|
|
|
: 'Pinto::Target::Package'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
elsif ( ref $arg eq 'HASH' ) { |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$target_class = |
35
|
|
|
|
|
|
|
( exists $arg->{author} ) |
36
|
0
|
0
|
|
|
|
0
|
? 'Pinto::Target::Distribution' |
37
|
|
|
|
|
|
|
: 'Pinto::Target::Package'; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# I would just use throw() here, but I need to avoid |
42
|
|
|
|
|
|
|
# creating a circular dependency between this package, |
43
|
|
|
|
|
|
|
# Pinto::Types and Pinto::Util. |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
my $message = "Don't know how to make target from $arg"; |
46
|
0
|
|
|
|
|
0
|
Pinto::Exception->throw( message => $message ); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
78
|
|
|
|
|
374
|
Class::Load::load_class($target_class); |
51
|
78
|
|
|
|
|
5247
|
return $target_class->new($arg); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=encoding UTF-8 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Pinto::Target - Create Spec objects from strings |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 VERSION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
version 0.14 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 new( $string ) |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
[Class Method] Returns either a L<Pinto::Target::Distribution> or |
78
|
|
|
|
|
|
|
L<Pinto::Target::Package> object constructed from the given C<$string>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
89
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |