line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sidef::Object::Convert { |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Used as parent by Sidef::Object::Object. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
393
|
use 5.014; |
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
8
|
use overload; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
60
|
use Sidef::Types::Bool::Bool; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
686
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub to_str { |
10
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
11
|
0
|
0
|
0
|
|
|
|
UNIVERSAL::isa($self, 'SCALAR') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|| UNIVERSAL::isa($self, 'REF') |
13
|
|
|
|
|
|
|
? Sidef::Types::String::String->new(overload::StrVal($self) ? "$self" : defined($$self) ? "$$self" : "") |
14
|
|
|
|
|
|
|
: $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
*to_s = \&to_str; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub to_type { |
20
|
0
|
|
|
0
|
1
|
|
my ($self, $obj) = @_; |
21
|
0
|
|
|
|
|
|
$obj->new($self); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_int { |
25
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Number::Number->new($_[0])->int; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
*to_i = \&to_int; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub to_num { |
31
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Number::Number->new($_[0]); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
*to_n = \&to_num; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub to_float { |
37
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Number::Number->new($_[0])->float; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
*to_f = \&to_float; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub to_rat { |
43
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Number::Number->new($_[0])->rat; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
*to_r = \&to_rat; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub to_array { |
49
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Array::Array->new($_[0]); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
*to_a = \&to_array; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub to_file { |
55
|
0
|
|
|
0
|
1
|
|
Sidef::Types::Glob::File->new("$_[0]"); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub to_dir { |
59
|
0
|
|
|
0
|
1
|
|
Sidef::Types::Glob::Dir->new("$_[0]"); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub to_regex { |
63
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Regex::Regex->new("$_[0]"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
*to_re = \&to_regex; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub to_bool { |
69
|
0
|
|
|
0
|
0
|
|
Sidef::Types::Bool::Bool::TRUE; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
*to_b = \&to_bool; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub to_caller { |
75
|
0
|
|
|
0
|
1
|
|
Sidef::Module::OO->__NEW__("$_[0]"); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub to_fcaller { |
79
|
0
|
|
|
0
|
1
|
|
Sidef::Module::Func->__NEW__("$_[0]"); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1 |