/usr/share/doc/libclass-multimethods-perl/examples/demo.dump.pl is in libclass-multimethods-perl 1.701-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/usr/bin/env perl -w
use strict;
use 5.005;
use Class::Multimethods;
multimethod stringify => ('ARRAY') => sub
{
'[' . join(",", map { stringify($_) } @{$_[0]}) . ']';
};
multimethod stringify => ('HASH') => sub
{
'{' . join(",", map { "$_=>".stringify($_[0]->{$_}) } keys %{$_[0]}) . '}';
};
multimethod stringify => ('CODE') => sub { 'sub {...}'; };
multimethod stringify => ('#') => sub { "+$_[0]"; };
multimethod stringify => ('$') => sub { "'$_[0]'"; };
print stringify([{a=>1,b=>[sub{0},{d=>'e'}]},2,3]), "\n";
print stringify(1), "\n";
print stringify(1.0), "\n";
print stringify(1.01), "\n";
print stringify(1.0000), "\n";
print stringify("1"), "\n";
print stringify("1s"), "\n";
|