Skip Menu |

This queue is for tickets about the Pipeline CPAN distribution.

Report information
The Basics
Id: 2496
Status: resolved
Priority: 0/
Queue: Pipeline

People
Owner: Nobody in particular
Requestors: steve [...] purkis.ca
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] $pipe->debug_all( $val )
This patch adds the method: $pipe->debug_all( $val ); which recursively sets the debug value of all contained segments. very handy for debugging complex pipes that have already been created. -Steve
diff -ruN Pipeline-3.01.methods/lib/Pipeline.pm Pipeline-3.01/lib/Pipeline.pm --- Pipeline-3.01.methods/lib/Pipeline.pm Mon May 5 21:02:28 2003 +++ Pipeline-3.01/lib/Pipeline.pm Mon May 5 20:58:44 2003 @@ -118,6 +118,21 @@ $self->{ cleanup_pipeline } ||= ref($self)->new(); } +sub debug_all { + my $self = shift; + my $debug = shift; + + foreach my $segment (@{ $self->segments }) { + $segment->isa( 'Pipeline' ) + ? $segment->debug_all( $debug ) + : $segment->debug( $debug ); + } + + $self->debug( $debug ); +} + + + 1; @@ -217,6 +232,10 @@ C<segments> gets and sets the value of the pipeline list. At initialization this is set to an array reference. + +=item debug_all( value ) + +sets debug( value ) recursively for each segment in this pipeline. =back diff -ruN Pipeline-3.01.methods/t/01simple.t Pipeline-3.01/t/01simple.t --- Pipeline-3.01.methods/t/01simple.t Mon May 5 21:02:28 2003 +++ Pipeline-3.01/t/01simple.t Mon May 5 20:54:24 2003 @@ -12,7 +12,7 @@ use MyPipeCleanup; use Pipeline; use Data::Dumper; -use Test::More tests => 6; +use Test::More tests => 8; my $pipeline = Pipeline->new(); my $subpipeline = Pipeline->new(); @@ -36,27 +36,10 @@ is( $pipe->del_segment( 0 ), $seg, 'del_segment' ); is( $pipe->init, $pipe, 'init' ); +my $pipe2 = Pipeline->new(); +my $seg2 = MyPipe->new(); +$pipe->add_segment( $pipe2->add_segment( $seg2 ) ); - - - - - - - - - - - - - - - - - - - - - - +is( $pipe->debug_all(1), $pipe, 'debug_all' ); +is( $seg2->debug, 1, 'debug set' );