line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id$ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Google::Chart::Types; |
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
7
|
1
|
|
|
1
|
|
6
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
|
|
13
|
use Sub::Exporter -setup => { |
9
|
|
|
|
|
|
|
exports => [ qw(hash_coercion) ] |
10
|
1
|
|
|
1
|
|
1913
|
}; |
|
1
|
|
|
|
|
3
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub hash_coercion { |
13
|
2
|
|
|
2
|
1
|
8
|
my (%args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
7
|
my $default = $args{default}; |
16
|
2
|
|
|
|
|
5
|
my $prefix = $args{prefix}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
return sub { |
19
|
0
|
|
|
0
|
|
|
my $h = $_; |
20
|
0
|
|
0
|
|
|
|
my $module = $h->{module} || $default || |
21
|
|
|
|
|
|
|
Carp::confess("No module name provided for coercion"); |
22
|
0
|
0
|
|
|
|
|
if ($module !~ s/^\+//) { |
23
|
0
|
|
|
|
|
|
$module = join('::', $prefix, $module); |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
Class::MOP::load_class( $module ); |
26
|
0
|
|
|
|
|
|
return $module->new(%{ $h->{args} }); |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
28
|
2
|
|
|
|
|
15
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
role_type 'Google::Chart::Type'; |
32
|
|
|
|
|
|
|
coerce 'Google::Chart::Type' |
33
|
|
|
|
|
|
|
=> from 'Str' |
34
|
|
|
|
|
|
|
=> via { |
35
|
|
|
|
|
|
|
my $class = sprintf( 'Google::Chart::Type::%s', ucfirst $_ ); |
36
|
|
|
|
|
|
|
Class::MOP::load_class($class); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return $class->new(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
; |
41
|
|
|
|
|
|
|
coerce 'Google::Chart::Type' |
42
|
|
|
|
|
|
|
=> from 'HashRef' |
43
|
|
|
|
|
|
|
=> hash_coercion(prefix => "Google::Chart::Type") |
44
|
|
|
|
|
|
|
; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
role_type 'Google::Chart::Fill'; |
49
|
|
|
|
|
|
|
coerce 'Google::Chart::Fill' |
50
|
|
|
|
|
|
|
=> from 'Str' |
51
|
|
|
|
|
|
|
=> via { |
52
|
|
|
|
|
|
|
my $class = sprintf( 'Google::Chart::Fill::%s', ucfirst $_ ); |
53
|
|
|
|
|
|
|
Class::MOP::load_class($class); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
return $class->new(); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
; |
58
|
|
|
|
|
|
|
coerce 'Google::Chart::Fill' |
59
|
|
|
|
|
|
|
=> from 'HashRef' |
60
|
|
|
|
|
|
|
=> hash_coercion(prefix => "Google::Chart::Fill") |
61
|
|
|
|
|
|
|
; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
65
|
|
|
|
|
|
|
role_type 'Google::Chart::Data'; |
66
|
|
|
|
|
|
|
coerce 'Google::Chart::Data' |
67
|
|
|
|
|
|
|
=> from 'ArrayRef' |
68
|
|
|
|
|
|
|
=> via { |
69
|
|
|
|
|
|
|
my $class = 'Google::Chart::Data::Text'; |
70
|
|
|
|
|
|
|
Class::MOP::load_class($class); |
71
|
|
|
|
|
|
|
$class->new(dataset => $_); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
; |
74
|
|
|
|
|
|
|
coerce 'Google::Chart::Data' |
75
|
|
|
|
|
|
|
=> from 'HashRef' |
76
|
|
|
|
|
|
|
=> via { |
77
|
|
|
|
|
|
|
my $class = $_->{module}; |
78
|
|
|
|
|
|
|
if ($class !~ s/^\+//) { |
79
|
|
|
|
|
|
|
$class = "Google::Chart::Data::$class"; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
Class::MOP::load_class($class); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$class->new(%{$_->{args}}); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
1
|
|
909
|
no Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Google::Chart::Types - Google::Chart Miscellaneous Types |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 FUNCTIONS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 hash_coercion |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |