|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package SPVM::BlessedObject::Class;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
278
 | 
 
 | 
 
 | 
  
278
  
 | 
 
 | 
1950
 | 
 use strict;  | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
604
 | 
    | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8449
 | 
    | 
| 
4
 | 
278
 | 
 
 | 
 
 | 
  
278
  
 | 
 
 | 
1483
 | 
 use warnings;  | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
520
 | 
    | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6546
 | 
    | 
| 
5
 | 
278
 | 
 
 | 
 
 | 
  
278
  
 | 
 
 | 
1352
 | 
 use Carp;  | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
570
 | 
    | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16078
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
278
 | 
 
 | 
 
 | 
  
278
  
 | 
 
 | 
2169
 | 
 use base 'SPVM::BlessedObject';  | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
744
 | 
    | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
29210
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
278
 | 
 
 | 
 
 | 
  
278
  
 | 
 
 | 
1999
 | 
 use SPVM::ExchangeAPI;  | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
635
 | 
    | 
| 
 
 | 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
66944
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $AUTOLOAD;  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub AUTOLOAD {  | 
| 
13
 | 
117327
 | 
 
 | 
 
 | 
  
117327
  
 | 
 
 | 
217529
 | 
   my $self = shift;  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
15
 | 
117327
 | 
 
 | 
 
 | 
 
 | 
 
 | 
168857
 | 
   my $method_name = $AUTOLOAD;  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # If the class method is not found, AUTOLOAD is called.  | 
| 
18
 | 
117327
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
233308
 | 
   unless (ref $self) {  | 
| 
19
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
     my $basic_type_name = $self;  | 
| 
20
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
     $basic_type_name =~ s/^SPVM:://;  | 
| 
21
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     $method_name =~ s/^.*:://;  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       | 
| 
23
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
238
 | 
     Carp::confess("The \"$method_name\" method in the \"$basic_type_name\" class is not found");  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # For a static instant method call  | 
| 
27
 | 
117325
 | 
 
 | 
 
 | 
 
 | 
 
 | 
423202
 | 
   $method_name =~ s/^SPVM:://;  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # For an instance method call  | 
| 
30
 | 
117325
 | 
 
 | 
 
 | 
 
 | 
 
 | 
299532
 | 
   $method_name =~ s/^BlessedObject::Class:://;  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
32
 | 
117325
 | 
 
 | 
 
 | 
 
 | 
 
 | 
270470
 | 
   my $ret = $self->__api->call_method($self, $method_name, @_);  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
34
 | 
117319
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3600635
 | 
   return $ret;  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 Name  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 SPVM::BlessedObject::Class - SPVM Class  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 Description  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 The object of the C class holds an instance of a SPVM class.  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 Usage  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   use SPVM 'Point';  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $point = SPVM::Point->new;  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $point->set_x(4);  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $x = $point->x;  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $point->clear;  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
56
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 Instance Methods  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head2 AUTOLOAD  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # Instance method call  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $ret = $blessed_object_class->foo(@args);  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # Static instance method call  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $ret = $blessed_object_class->SPVM::MyClass::foo(@args);  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Calls a SPVM instance method using L with the arguments, and returns the return value.  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 The static instance method call is allowed.  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 If the class or the method is not found, an exception is thrown.  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 If the invocant cannnot be assigned to the class of the static method call, an exception is thrown.  | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Examples:  | 
| 
75
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
76
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   use SPVM 'Point';  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # Creates a SPVM::BlessedObject::Class object of the Point class.  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $point = Point->new;  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # Calls instance methods in the Point class.  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $point->set_x(4);  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $x = $point->x;  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $point->clear;  | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 Copyright & License  | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Copyright (c) 2023 Yuki Kimoto  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 MIT License  |