line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4604
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
2
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
72
|
|
3
|
|
|
|
|
|
|
package Search::GIN::Extract::Attributes; |
4
|
|
|
|
|
|
|
BEGIN { |
5
|
1
|
|
|
1
|
|
28
|
$Search::GIN::Extract::Attributes::AUTHORITY = 'cpan:NUFFIN'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: |
8
|
|
|
|
|
|
|
$Search::GIN::Extract::Attributes::VERSION = '0.09'; |
9
|
1
|
|
|
1
|
|
599
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with qw( |
13
|
|
|
|
|
|
|
Search::GIN::Extract |
14
|
|
|
|
|
|
|
Search::GIN::Keys::Deep |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has attributes => ( |
18
|
|
|
|
|
|
|
isa => "ArrayRef[Str]", |
19
|
|
|
|
|
|
|
is => "rw", |
20
|
|
|
|
|
|
|
predicate => "has_attributes", |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub extract_values { |
24
|
|
|
|
|
|
|
my ( $self, $obj, @args ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @meta_attrs = $self->get_meta_attrs($obj, @args); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return $self->process_keys({ map { |
29
|
|
|
|
|
|
|
my $val = $_->get_value($obj); |
30
|
|
|
|
|
|
|
$_->name => (defined($val) ? $val : undef); |
31
|
|
|
|
|
|
|
} @meta_attrs }); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_meta_attrs { |
35
|
|
|
|
|
|
|
my ( $self, $obj, @args ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $class = ref $obj; |
38
|
|
|
|
|
|
|
my $meta = Class::MOP::get_metaclass_by_name($class); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
if ( $self->has_attributes ) { |
41
|
|
|
|
|
|
|
return grep { defined } map { $meta->find_attribute_by_name($_) } @{ $self->attributes }; |
42
|
|
|
|
|
|
|
} else { |
43
|
|
|
|
|
|
|
return $meta->get_all_attributes; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding UTF-8 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Search::GIN::Extract::Attributes - $Search::GIN::Extract::Attributes::VERSION = '0.09'; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.09 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use Search::GIN::Extract::Attributes; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This software is copyright (c) 2008 by ×××× ×§××'×× (Yuval Kogman), Infinity Interactive. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
78
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |