line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SPVM::BlessedObject::String; |
2
|
|
|
|
|
|
|
|
3
|
278
|
|
|
278
|
|
1986
|
use strict; |
|
278
|
|
|
|
|
604
|
|
|
278
|
|
|
|
|
8375
|
|
4
|
278
|
|
|
278
|
|
1411
|
use warnings; |
|
278
|
|
|
|
|
578
|
|
|
278
|
|
|
|
|
7162
|
|
5
|
|
|
|
|
|
|
|
6
|
278
|
|
|
278
|
|
1435
|
use Carp 'confess'; |
|
278
|
|
|
|
|
596
|
|
|
278
|
|
|
|
|
12378
|
|
7
|
|
|
|
|
|
|
|
8
|
278
|
|
|
278
|
|
2300
|
use base 'SPVM::BlessedObject'; |
|
278
|
|
|
|
|
825
|
|
|
278
|
|
|
|
|
40508
|
|
9
|
|
|
|
|
|
|
|
10
|
278
|
|
|
278
|
|
2130
|
use overload bool => sub {1}, '""' => sub { shift->to_string }, fallback => 1; |
|
278
|
|
|
26340
|
|
779
|
|
|
278
|
|
|
11208
|
|
3479
|
|
|
3186
|
|
|
|
|
8915
|
|
|
50466
|
|
|
|
|
241584
|
|
11
|
|
|
|
|
|
|
|
12
|
278
|
|
|
278
|
|
25126
|
use SPVM::ExchangeAPI; |
|
278
|
|
|
|
|
628
|
|
|
278
|
|
|
|
|
47863
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub to_string { |
15
|
63772
|
|
|
63772
|
1
|
93758
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
63772
|
|
|
|
|
106603
|
my $string = $self->to_bin; |
18
|
|
|
|
|
|
|
|
19
|
63772
|
|
|
|
|
199702
|
my $success = utf8::decode($string); |
20
|
|
|
|
|
|
|
|
21
|
63772
|
100
|
|
|
|
118536
|
unless ($success) { |
22
|
2
|
|
|
|
|
271
|
confess "The SPVM::BlessedObject::String object cannnot be decoded to Perl string"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
63770
|
|
|
|
|
301352
|
return $string; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
63784
|
50
|
|
63784
|
1
|
82324
|
sub to_bin { my $ret; eval { $ret = shift->_xs_to_bin(@_) }; if ($@) { confess $@ } $ret; } |
|
63784
|
|
|
|
|
91328
|
|
|
63784
|
|
|
|
|
305593
|
|
|
63784
|
|
|
|
|
139276
|
|
|
0
|
|
|
|
|
0
|
|
|
63784
|
|
|
|
|
114497
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 Name |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
SPVM::BlessedObject::String - SPVM string |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 Description |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The object of the C class holds a SPVM string. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 Usage |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $string = $blessed_object_string->to_string; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $binary = $blessed_object_string->to_bin; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 Instance Methods |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 to_string |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $string = $blessed_object_string->to_string; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns a string decoded to Perl string using L. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
If the docoding fails, an exception is thrown. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 to_bin |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $binary = $blessed_object_string->to_bin; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns a string as a binary. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 Operators |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Overloads the following operators. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 bool |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $bool = !!$blessed_object_string; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Always true. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 stringify |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $string = "$blessed_object_string"; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The alias for L"to_string">. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 Copyright & License |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Copyright (c) 2023 Yuki Kimoto |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
MIT License |