[Bps-public-commit] r10374 - in bpsbuilder/BPB/lib/BPB: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 17 02:50:25 EST 2008


Author: sunnavy
Date: Thu Jan 17 02:50:18 2008
New Revision: 10374

Modified:
   bpsbuilder/BPB/lib/BPB/Config.pm
   bpsbuilder/BPB/lib/BPB/Script/List.pm

Log:
leave the print work to script, not in lib

Modified: bpsbuilder/BPB/lib/BPB/Config.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Config.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Config.pm	Thu Jan 17 02:50:18 2008
@@ -62,23 +62,26 @@
     if ( $args{name} && $self->stash->{ $args{name} } ) {
         if ( $args{verbose} ) {
             require Data::Dumper;
-            print Data::Dumper->Dump( [ $self->stash->{ $args{name} } ],
+            return Data::Dumper->Dump( [ $self->stash->{ $args{name} } ],
                 [ $args{name} ] );
         }
         else {
-            print $args{name}, "\t",
-              $self->stash->{ $args{name} }{backend}{repository}, "\n";
+            return join "\t", $args{name},
+              $self->stash->{ $args{name} }{backend}{repository};
         }
     }
     else {
         if ( $args{verbose} ) {
             require Data::Dumper;
-            print Data::Dumper->Dump( [ $self->stash ], ['config'] );
+            return Data::Dumper->Dump( [ $self->stash ], ['config'] );
         }
         else {
+            my $output = [];
             for ( sort keys %{ $self->stash } ) {
-                print $_, "\t", $self->stash->{$_}{backend}{repository}, "\n";
+                push @$output, join "\t", $_,
+                  $self->stash->{$_}{backend}{repository};
             }
+            return $output;
         }
     }
 }

Modified: bpsbuilder/BPB/lib/BPB/Script/List.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/List.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/List.pm	Thu Jan 17 02:50:18 2008
@@ -24,7 +24,14 @@
     my $name = shift;
     $self->name( $name ) if $name;
     my $bpb = BPB->new( config => $self->config, name => $self->name );
-    $bpb->config->list( name => $self->name, verbose => $self->verbose );
+    my $list =
+      $bpb->config->list( name => $self->name, verbose => $self->verbose );
+    if ( ref $list eq 'ARRAY' ) {
+        print $_, "\n" for @$list;
+    }
+    else {
+        print $list, "\n";
+    }
 }
 
 



More information about the Bps-public-commit mailing list