autoload_method.pl

Perlマスター

Explorer

C40
C++40
C#40
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl
初級10
中級10
上級10
エキスパート5
マスター5
moose_class.pl
tie_hash.pl
closure_factory.pl
overload_ops.pl
autoload_method.pl
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript40
autoload_method.pl
Click to focus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package Dynamic;
our $AUTOLOAD;
sub AUTOLOAD {
   my $self = shift;
   my $method = $AUTOLOAD;
   $method =~ s/.*:://;
   return if $method eq 'DESTROY';
   if ($method =~ /^get_(.+)$/) {
       return $self->{$1};
   }
   die "Unknown method: $method";
}
0WPM0%0:000/257(0%)|Ln 1, Col 1
UTF-8Perl

関連する練習問題