From 8b30558e59d43c78394c3c3204d30752ffb1d26c Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 28 Jan 2006 11:21:58 +0000 Subject: usato Class::Std anche negli step git-svn-id: svn://luxion/repos/WebCoso/trunk@143 fcb26f47-9200-0410-b104-b98ab5b095f3 --- t/03-pipeline.t | 4 ++-- t/lib/WebCoso/Step/Step1.pm | 11 ++++++----- t/lib/WebCoso/Step/Step2.pm | 11 ++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/03-pipeline.t b/t/03-pipeline.t index 85b769c..a8fcd23 100644 --- a/t/03-pipeline.t +++ b/t/03-pipeline.t @@ -21,7 +21,7 @@ WebCoso::Driver->run(); my @resources=WebCoso::Config->get_all_resources(); -my @calls1=WebCoso::Pipeline::Test->_steps()->[0]->get_calls(); +my @calls1=@{WebCoso::Pipeline::Test->_steps()->[0]->get_calls()}; is(scalar @calls1,2,"2 chiamata a Step1"); is($calls1[0]->{resource}, $resources[0], @@ -36,7 +36,7 @@ is($calls1[1]->{stage}, 'gen', 'stage2==gen (step1)'); -my @calls2=WebCoso::Pipeline::Test->_steps()->[1]->get_calls(); +my @calls2=@{WebCoso::Pipeline::Test->_steps()->[1]->get_calls()}; is(scalar @calls2,2,"2 chiamata a Step2"); is($calls2[0]->{resource}, $calls1[0]->{out_res}, diff --git a/t/lib/WebCoso/Step/Step1.pm b/t/lib/WebCoso/Step/Step1.pm index 9b18d16..c9f2c96 100644 --- a/t/lib/WebCoso/Step/Step1.pm +++ b/t/lib/WebCoso/Step/Step1.pm @@ -1,14 +1,19 @@ package WebCoso::Step::Step1; use base 'WebCoso::Step::Base'; +use Class::Std; use strict; use warnings; +{ +my %calls_of :ATTR(:default<[]> :get); +my %p1_of :ATTR(:init_arg); + sub process { my ($self,$resource,$stage)=@_; my $out='stuff'; - push @{$self->{calls}},{ + push @{$calls_of{ident $self}},{ resource => $resource, out_res => $out, stage => $stage, @@ -17,9 +22,5 @@ sub process { return $out; } -sub get_calls { - my ($self)=@_; - return @{$self->{calls}}; } - 1; diff --git a/t/lib/WebCoso/Step/Step2.pm b/t/lib/WebCoso/Step/Step2.pm index 0a45e3c..08a32c2 100644 --- a/t/lib/WebCoso/Step/Step2.pm +++ b/t/lib/WebCoso/Step/Step2.pm @@ -1,14 +1,19 @@ package WebCoso::Step::Step2; use base 'WebCoso::Step::Base'; +use Class::Std; use strict; use warnings; +{ +my %calls_of :ATTR(:default<[]> :get); +my %p2_of :ATTR(:init_arg); + sub process { my ($self,$resource,$stage)=@_; my $out='stuff'; - push @{$self->{calls}},{ + push @{$calls_of{ident $self}},{ resource => $resource, out_res => $out, stage => $stage, @@ -17,9 +22,5 @@ sub process { return $out; } -sub get_calls { - my ($self)=@_; - return @{$self->{calls}}; } - 1; -- cgit v1.2.3