- 追加された行はこの色です。
- 削除された行はこの色です。
RIGHT:&tag(クラス,更新中);
=head1
## 雛型
RIGHT:[[:t/X]] [[:t/実装]]
*雛型 [#le6c20a0]
Perlモジュールの雛型。
=cut
package WikiEngine::_;
use strict;
use Toolkit;
use lib 'S:\Perl\_lib';
use Data::Dumper;
# use Data::Compare;
use Data::Compare;
use Toolkit;
# use Smart::Comments qw/#####/;
#use WikiEngine::Base; # [[WikiEngine/Base]];
our($VERSION, @ISA);
$VERSION = 0.01;
@ISA = qw(WikiEngine);
sub New
{
my $self = {};
my($class, $arg) = @_;
$self->{attr} = 'value';
### assert:$class
bless $self, $class;
}
sub New
{
my $self = {};
my($class, $arg) = @_;
$self->{attr} = 'value';
# 開発時アサーション
### assert:$self
# 運用中のみのアサーション
##### assert:$class
bless $self, $class;
}
sub Dump
{
my $self = shift;
### assert:Data::Compare(\@_, [])
Dumper($self);
}
sub Dump
{
my $self = shift;
### assert:Data::Compare(\@_, [])
Dumper($self);
}
1;
sub MethodA
{
my $self = shift;
my($arg1) = @_;
# 致命的エラーのとき
open my $f, '>', 'data.file' or die $!;
close $f or die $!;
# (復帰できる)エラー別に対処するとき
try {
}
catch Error::_::Err1 with {
# 独自エラーの処理1
my $e = shift;
}
except {
# 独自エラーの処理2
my $e = shift;
my $handler = sub {
$e->{-object} = $self;
throw $e;
};
return {
'Error::_::Err2' => $handler,
'Error::_::Err3' => $handler,
'Error::_::Err4' => $handler,
};
}
otherwise {
# その他のエラー処理
my $e = shift;
throw Error::Simple->new($e->{-text});
}
finally {
};
1;
}
# このクラス以下の独自エラー定義
package Error::_::Err1;
use base qw/Error::Simple/;
# アクセサーの宣言
use AutoloadAccessor; # use [[AutoloadAccessor]];
use subs qw{
Store_Id Fetch_Id
};
sub AUTOLOAD
{
return if our $AUTOLOAD =~ /::DESTROY$/;
die unless not $AUTOLOAD =~ /::_Recompose$/;
_Recompose($_[0], $AUTOLOAD, @_[1 .. $#_]);
}
1;