[Bps-public-commit] r10157 - bpsbuilder/BPB/lib/BPB

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Dec 27 12:17:37 EST 2007


Author: sunnavy
Date: Thu Dec 27 12:17:34 2007
New Revision: 10157

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

Log:
added list method

Modified: bpsbuilder/BPB/lib/BPB/Config.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Config.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Config.pm	Thu Dec 27 12:17:34 2007
@@ -12,14 +12,14 @@
     eval { require YAML::Syck; };
     if ($@) {
         require YAML;
-        *Load = *YAML::Load;
-        *Dump = *YAML::Dump;
+        *Load     = *YAML::Load;
+        *Dump     = *YAML::Dump;
         *LoadFile = *YAML::LoadFile;
         *DumpFile = *YAML::DumpFile;
     }
     else {
-        *Load = *YAML::Syck::Load;
-        *Dump = *YAML::Syck::Dump;
+        *Load     = *YAML::Syck::Load;
+        *Dump     = *YAML::Syck::Dump;
         *LoadFile = *YAML::Syck::LoadFile;
         *DumpFile = *YAML::Syck::DumpFile;
     }
@@ -56,6 +56,33 @@
     $self->stash( LoadFile(shift) );
 }
 
+sub list {
+    my $self = shift;
+    my %args = @_;
+    if ( $args{name} && $self->stash->{ $args{name} } ) {
+        if ( $args{verbose} ) {
+            require Data::Dumper;
+            print Data::Dumper->Dump( [ $self->stash->{ $args{name} } ],
+                [ $args{name} ] );
+        }
+        else {
+            print $args{name}, "\t",
+              $self->stash->{ $args{name} }{backend}{repository}, "\n";
+        }
+    }
+    else {
+        if ( $args{verbose} ) {
+            require Data::Dumper;
+            print Data::Dumper->Dump( [ $self->stash ], ['config'] );
+        }
+        else {
+            for ( sort keys %{ $self->stash } ) {
+                print $_, "\t", $self->stash->{$_}{backend}{repository}, "\n";
+            }
+        }
+    }
+}
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list