Data-Dumper-Interp

 view release on metacpan or  search on metacpan

lib/Data/Dumper/Interp.pm  view on Meta::CPAN

    = @$self{qw/MaxStringwidth Truncsuffix Trunctailwidth Objects Refaddr _Listform Debug/};
  $sortkeys = $self->Sortkeys;

  $maxstringwidth = 0 if ($maxstringwidth //= 0) >= INT_MAX;
  $truncsuffix //= "...";
  $trunctailwidth = min($trunctailwidth//0, $maxstringwidth);
  $ovopt = "tagged";
  if (ref($objects) eq "HASH") {
    foreach my $key (keys %$objects) {
      if ($key eq 'show_classname') { # DEPRECATED
        $ovopt = $objects->{$key} ? "tagged" : "transparent"
      }
      elsif ($key eq 'overloads') {
        if (!defined($objects->{$key})) {
          $ovopt = "tagged";
        }
        elsif ($objects->{$key} =~ /^(?:tagged|transparent|ignore)$/) {
          $ovopt = $objects->{$key}
        }
        else { confess "Invalid 'overloads' sub-opt value '$objects->{$key}'" }
      }
      elsif ($key eq 'objects') { }
      else {
        confess "Objects hashref value has unknown key '$key'\n";
      }
    }
    $objects = $objects->{objects} // (ref($Objects) ? 1 : $Objects);

lib/Data/Dumper/Interp.pm  view on Meta::CPAN


=head2 Objects(I<< {objects => VALUE, overloads => OVOPT} >>)

This form, passing a hashref,
allows passing additional options for blessed objects:

=over

B<overloads =E<gt> "tagged"> (the default): "(classname)" is prepended to the result when an overloaded operator is evaluated.

B<overloads =E<gt> "transparent"> : The overload results
will appear unadorned, i.e. they will look as if the overload result
was the original value.

B<overloads =E<gt> "ignore"> : Overloaded operators are not evaluated at all;
the original object's abbreviated refaddr is shown
(if you want to see object internals, disable I<Objects> entirely.)

Deprecated: B<show_classname =E<gt> False> : Please use S<< B<overloads =E<gt> "transparent"> instead. >>

=back

The I<objects> value indicates whether and for which classes special
object handling is enabled (false, "1", "classname" or [list of classnames]).

=head2 Refaddr(I<BOOL>)

If true, references are identified as with C<addrvis>.

t/25_importopts.t  view on Meta::CPAN

  goto &check_vars;
}

change_one(Debug => 'undef');
change_one(Debug => 0);
change_one(MaxStringwidth => 1234);
change_one(Truncsuffix => '"zzz"');
change_one(Trunctailwidth => 42);
change_one(Objects => 0);
change_one(Objects => 1);
change_one(Objects => '{overloads => "transparent"}');
change_one(Refaddr => 'undef');
change_one(Refaddr => 0);
change_one(Foldwidth => 55);
change_one(Foldwidth1 => 56);
change_one(Foldwidth => $defaults{Foldwidth});
change_one(Useqq => 1);
change_one(Useqq => "'unicode:condense'");
change_one(Useqq => '"unicode"');
change_one(Quotekeys => 0);
change_one(Quotekeys => 1);

t/56_objects.t  view on Meta::CPAN

is(vis $gobj,q!bless({},'main::GObj')! , "Gobj: Objects handling disabled");
#is(vis *{ $gobj }{ARRAY},q!["array","via","virtual","glob"]! , "*{Gobj}{ARRAY} basic test");
#is(vis *{ $gobj }{HASH},q!{hash_via_virtual_glob => 123}!, "*{Gobj}{HASH} basic test");

foreach (0,1) {
  local $Data::Dumper::Interp::Objects;
  my ($desc, $STcn, $HVcn, $Hcn, $Ccn, $Scn, $Gcn);
  if ($_ == 0) {
    $Data::Dumper::Interp::Objects
      #= {show_classname => 0, objects => 1};
      = {overloads => "transparent", objects => 1};
    $STcn = $HVcn = $Hcn = $Ccn = $Scn = $Gcn = "";
    $desc = "Objects enabled but not showing overloaded classnames";
  }
  elsif ($_ == 1) {
    $Data::Dumper::Interp::Objects = 1;
    $STcn = '(main::StrObj)';
    $HVcn = '(main::HVObj)';
    $Hcn  = '(main::HObj)';
    $Ccn  = '(main::CObj)';
    $Scn  = '(main::SObj)';



( run in 0.873 second using v1.01-cache-2.11-cpan-0a6323c29d9 )