From: Robert 'phaylon' Sedlacek Date: Fri, 11 May 2012 17:33:00 +0000 (+0000) Subject: allow yaml output X-Git-Tag: v0.001_001~74 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f3044c6b7565c30e0ff706a2649c23caa110783;hp=1eff200cebf817d92a49e0e645c359aa18a1ec83;p=scpubgit%2FSystem-Introspector.git allow yaml output --- diff --git a/dev-gather.pl b/dev-gather.pl index 3c9657d..f7116d9 100755 --- a/dev-gather.pl +++ b/dev-gather.pl @@ -3,8 +3,23 @@ use strictures 1; use lib qw( lib ); use Data::Dump qw( pp ); use Module::Runtime qw( use_module ); +use Getopt::Long; +use Data::YAML::Writer; + +GetOptions( + 'yaml' => \(my $opt_yaml), +); my $intro = shift(@ARGV) or die "Probe argument required\n"; -pp(use_module("System::Introspector::$intro")->new(@ARGV)->gather); +my $data = use_module("System::Introspector::$intro")->new(@ARGV)->gather; +if ($opt_yaml) { + my $writer = Data::YAML::Writer->new; + my $output = ''; + $writer->write($data, \$output); + print $output; +} +else { + pp $data; +}