- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- :i/Perlモジュールの雛型 へ行く。
- 1 (2009-11-25 (水) 21:41:20)
- 2 (2009-11-25 (水) 21:51:53)
- 3 (2009-11-25 (水) 22:04:18)
- 4 (2009-11-25 (水) 22:11:41)
- 5 (2009-11-26 (木) 22:23:30)
- 6 (2009-11-26 (木) 22:30:15)
- 7 (2009-11-26 (木) 22:47:52)
- 8 (2009-11-26 (木) 23:47:18)
- 9 (2009-11-27 (金) 01:59:45)
- 10 (2009-11-28 (土) 05:57:22)
- 11 (2009-11-29 (日) 00:35:27)
- 12 (2009-11-29 (日) 00:42:27)
- 13 (2009-12-05 (土) 16:59:11)
- 14 (2009-12-06 (日) 03:44:24)
- 15 (2013-03-20 (水) 22:33:05)
=head1
雛型 † 
Perlモジュールの雛型。
=cut
package WikiEngine::_;
use strict; use lib 'S:\Perl\_lib';
use Data::Dumper; 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:$self
# 運用中のみのアサーション
##### assert:$class
bless $self, $class;
}
sub Dump
{
my $self = shift;
### assert:Data::Compare(\@_, [])
Dumper($self);
}
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;
