Re: [PATCH perl] Remove use of Data::Dumper from example programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 06, 2018 at 01:05:52PM -0500, John Ferlan wrote:
> 
> 
> On 02/06/2018 11:36 AM, Daniel P. Berrangé wrote:
> > Using Data::Dumper in examples does not help devs understand the data
> > structures that the Perl APIs are returning. Change to explicit field
> > accesses to illustrate it better
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > ---
> >  Virt.xs                 |  1 -
> >  examples/dhcp-leases.pl |  2 --
> >  examples/dom-fsinfo.pl  |  8 +++-----
> >  examples/dom-ifinfo.pl  | 14 +++++++++-----
> >  examples/dom-stats.pl   |  9 +++------
> >  examples/node-info.pl   | 26 +++++++++++++++++++-------
> >  6 files changed, 34 insertions(+), 26 deletions(-)
> > 
> > diff --git a/Virt.xs b/Virt.xs
> > index 7d2f1a7..1254df2 100644
> > --- a/Virt.xs
> > +++ b/Virt.xs
> > @@ -3358,7 +3358,6 @@ void get_all_domain_stats(con, stats, doms_sv=&PL_sv_undef, flags=0)
> >        if (SvOK(doms_sv)) {
> >  	  doms_av = (AV*)SvRV(doms_sv);
> >  	  ndoms = av_len(doms_av) + 1;
> > -	  fprintf(stderr, "Len %d\n", ndoms);
> >        } else {
> >            ndoms = 0;
> >        }
> > diff --git a/examples/dhcp-leases.pl b/examples/dhcp-leases.pl
> > index af9bd41..a2202d9 100644
> > --- a/examples/dhcp-leases.pl
> > +++ b/examples/dhcp-leases.pl
> > @@ -1,8 +1,6 @@
> >  #!/usr/bin/perl
> >  
> > -use Acme::ChuckNorris;
> >  use Sys::Virt;
> > -use Data::Dumper;
> >  
> >  my $c = Sys::Virt->new(uri => "qemu:///system",
> >  		       readonly => 1);
> 
> But doesn't this code actually use Dumper:
> 
> foreach my $lease ($n->get_dhcp_leases()) {
>     print Dumper($lease);
> }

Sigh, didn't squash the patches together properly.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux