520520 $self -> app_log-> fatal($rule_example );
521521}
522522
523-
524523=head3 template_process
525524
526525Do the actual processing of the rule->process
@@ -594,7 +593,7 @@ sub check_iterables {
594593 # First check the global for any lists
595594 my $use_iters = $self -> use_iterables;
596595
597- $self -> walk_indir_outdir($use_iters );
596+ # $self->walk_indir_outdir($use_iters);
598597
599598 if ( !$use_iters ) {
600599 $texts = $self -> in_template_process( $sample , $texts );
@@ -642,8 +641,6 @@ sub walk_attr {
642641 my $attr = dclone( $self -> local_attr );
643642 $self -> check_indir_outdir($attr );
644643
645- $DB::single = 2;
646-
647644 $attr -> walk_process_data( $self -> rule_keys );
648645
649646 return $attr ;
@@ -655,6 +652,8 @@ sub eval_process {
655652 my $attr = $self -> walk_attr;
656653 $attr -> sample( $self -> sample ) if $self -> has_sample;
657654
655+ $self -> walk_indir_outdir($attr );
656+
658657 my $process = $self -> local_rule-> { $self -> rule_name }-> {process };
659658 my $text = $attr -> interpol_directive($process );
660659 $text = clean_text($text );
@@ -701,43 +700,56 @@ sub get_keys {
701700 $self -> rule_keys( \@global_keys );
702701}
703702
704- # #TODO Clean this up and merge with the other walk_iterables
705703# #TODO Write more tests
706704sub walk_indir_outdir {
707- my $self = shift ;
708- my $use_iters = shift ;
705+ my $self = shift ;
706+ my $attr = shift ;
709707
710- # #TODO This is redundant...
711- my $attr = dclone( $self -> local_attr );
712- my $dummy_sample = $self -> dummy_sample;
713- $attr -> sample($dummy_sample );
708+ my $text = $attr -> interpol_directive( $attr -> outdir );
714709
715- if ( $attr -> outdir =~ m / \{\$ / ) {
716- $attr -> walk_process_data ( $self -> rule_keys );
717- }
710+ $DB::single = 2;
711+ $self -> walk_indir_outdir_sample ( $attr , $text );
712+ }
718713
719- my $text = $attr -> interpol_directive( $self -> local_attr-> outdir );
714+ sub walk_indir_outdir_sample {
715+ my $self = shift ;
716+ my $attr = shift ;
717+ my $text = shift ;
720718
721- if ( !$use_iters ) {
722- foreach my $sample ( $attr -> all_samples ) {
723- my $new_text = $text ;
724- $new_text =~ s / $dummy_sample/ $sample / g ;
719+ my $use_iters = $self -> use_iterables;
720+ my $dummy_sample = $self -> dummy_sample;
721+
722+ foreach my $sample ( $attr -> all_samples ) {
723+ my $new_text = $text ;
724+ $new_text =~ s / $dummy_sample/ $sample / g ;
725+ $DB::single = 2;
726+
727+ if ($use_iters ) {
728+ $self -> walk_indir_outdir_iters( $use_iters , $attr ,
729+ $new_text );
730+ }
731+ else {
725732 $new_text = path($new_text )-> absolute if $attr -> coerce_abs_dir;
726733 $new_text = path($new_text ) if !$attr -> coerce_abs_dir;
727734 $self -> decide_create_outdir( $attr , $new_text );
728735 }
729- return ;
730736 }
737+ }
738+
739+ sub walk_indir_outdir_iters {
740+ my $self = shift ;
741+ my $use_iters = shift ;
742+ my $attr = shift ;
743+ my $text = shift ;
744+
745+ return unless $use_iters ;
731746
732747 my $all = $use_iters -> [0];
733748 my $elem = $use_iters -> [1];
734749
735- # #TODO This should be a separate function
736750 my $dummy_iter = $self -> dummy_iterable;
737751 $attr -> $elem ($dummy_iter );
738752
739- # #BUG FIX - If outdirs have iterables this will be bad
740-
741753 foreach my $chunk ( $self -> local_attr-> $all ) {
742754 my $new_text = $text ;
743755 $new_text =~ s / $dummy_iter/ $chunk / g ;
0 commit comments