• 追加された行はこの色です。
  • 削除された行はこの色です。
=head1

RIGHT:&tag(クラス,更新中);

*雛型 [#le6c20a0]
Perlモジュールの雛型。

=cut

package WikiEngine::_;

use strict;
use Toolkit;
use lib 'S:\Perl\_lib';

use WikiEngine::Base; # [[WikiEngine/Base]];  

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:$class
	# 開発時アサーション
	### 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 $hander = sub {
			$e->{-object} = $self;
			throw $e;
		};
		reutrn {
			'Error::_::Err2' => $hander,
			'Error::_::Err3' => $hander,
			'Error::_::Err4' => $hander,
		};
	}
	otherwise {
		# その他のエラー処理
		my $e = shift;
		throw Error::Simple->new($e->{-text});
	}
	finally {
	};
	
	1;
}

# このクラス以下の独自エラー定義
package Error::_::Err1;
use base qw/Error::Simple/;

1;