line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Sah::Coerce::perl::str::str_to_cryptocurrency_code; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2019-07-25'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2115
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
190
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub meta { |
11
|
|
|
|
|
|
|
+{ |
12
|
1
|
|
|
1
|
0
|
13
|
v => 4, |
13
|
|
|
|
|
|
|
might_fail => 1, |
14
|
|
|
|
|
|
|
prio => 50, |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub coerce { |
19
|
1
|
|
|
1
|
0
|
16
|
my %args = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
3
|
my $dt = $args{data_term}; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
my $res = {}; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
4
|
$res->{expr_match} = "!ref($dt)"; |
26
|
1
|
|
50
|
|
|
9
|
$res->{modules}{"CryptoCurrency::Catalog"} //= 0; |
27
|
1
|
|
|
|
|
6
|
$res->{expr_coerce} = join( |
28
|
|
|
|
|
|
|
"", |
29
|
|
|
|
|
|
|
"do { my \$cat = CryptoCurrency::Catalog->new; ", |
30
|
|
|
|
|
|
|
"my \$rec; eval { \$rec = \$cat->by_code($dt) }; if (\$@) { eval { \$rec = \$cat->by_name($dt) } } if (\$@) { eval { \$rec = \$cat->by_safename($dt) } } ", |
31
|
|
|
|
|
|
|
"if (\$@) { ['Unknown cryptocurrency code/name/safename: ' . $dt] } else { [undef, \$rec->{code}] } ", |
32
|
|
|
|
|
|
|
"}", |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
4
|
$res; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
# ABSTRACT: Coerce string containing cryptocurrency code/name/safename to code |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=encoding UTF-8 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Data::Sah::Coerce::perl::str::str_to_cryptocurrency_code - Coerce string containing cryptocurrency code/name/safename to code |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 VERSION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This document describes version 0.004 of Data::Sah::Coerce::perl::str::str_to_cryptocurrency_code (from Perl distribution Data-Sah-Coerce-perl-str-str_to_cryptocurrency_code), released on 2019-07-25. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The rule is not enabled by default. You can enable it in a schema using e.g.: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
["str", "x.perl.coerce_rules"=>["str_to_cryptocurrency_code"]] |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=for Pod::Coverage ^(meta|coerce)$ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 HOMEPAGE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah-Coerce-perl-str-str_to_cryptocurrency_code>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SOURCE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah-Coerce-perl-str-str_to_cryptocurrency_code>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 BUGS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Coerce-perl-str-str_to_cryptocurrency_code> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
76
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
77
|
|
|
|
|
|
|
feature. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This software is copyright (c) 2019, 2018 by perlancar@cpan.org. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
88
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |