Acme-Data-Dumper-Extensions
    
    
  
  
  
view release on metacpan or search on metacpan
lib/Acme/Data/Dumper/Extensions.pm view on Meta::CPAN
=head2 C<$_new_with_defaults>
This is a prototype function for construcing a Data::Dumper instance without
being prone to leak from other people using the global values.
At the time of this writing, if you need perfect consistency from Data::Dumper
in widely used code, you by necessity have to know every version of
Data::Dumper that exists, and know what the default values are of various
arguments, in order to revert them to your "known good" state if 3rd party
code decides to locally change those values for their own purposes.
Getting an instance of a Data::Dumper object before anyone tweaks those values
would also work, but trying to bet on getting loaded and getting an instance
before anyone else does is just foolhardy
Additionally, due to how C<< ->Values >> works, having a global instance of
Data::Dumper can lend itself to a memory leak and you have to take additional
care to make sure you free values passed to it.
=head3 Syntax
lib/Acme/Data/Dumper/Extensions.pm view on Meta::CPAN
I'm still not sure how to handle what happens when somebody passes the name
of a feature which doesn't exist yet, but does in a future version.
Ideally, calling C<$_new_with_defaults()> should give you the same results in
perpetuity ( or at least, from the date this feature gets added )
For now I think the best thing to do is die fatally if a feature that is
requested can't be provided, as that will produce output other than is desired
and violate output consistency as a result.
This will just become a nightmare if somebody ever changes "The Default" for
a I<new> feature wherein, users have to I<< Opt-B<Out> >>, causing an
explosion on older versions where that feature didn't exist.
This should be a hazard to never even consider changing the default behaviour.
=head2 C<$_DumpValues>
This function is a helper that does what people who maintain a long-lived
C<Data::Dumper> instance generally desire: The ability to just set up an
instance, and then call it an arbitrary number of times with arbitrary inputs
( run in 0.970 second using v1.01-cache-2.11-cpan-5dc5da66d9d )