Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $indent = 0;
- sub increment_indent () { $indent + 2; }
- multi sub p (Hash $value) {
- my @keys = $value.keys.sort;
- return print '{}'
- if @keys.elems == 0;
- return print '{ ', @keys[0], ' => :', p($value{@keys[0]}), ' }'
- if @keys.elems == 1
- && !$value{@keys[0]}.isa( Iterable )
- ;
- my $max = max @keys.map({.chars});
- {
- temp $indent = increment_indent;
- print "\{\n";
- for @keys -> $key {
- printf '%*s%-*s => ', $indent, '', $max, $key;
- p $value{$key};
- print ",\n";
- }
- }
- print ' ' x $indent, '}';
- print "\n" unless $indent;
- }
- multi sub p (Array $value) {
- return print '[]'
- if $value.elems == 0;
- return print '[ ', p($value[0]), ' ]'
- if $value.elems == 1
- && !$value[0].isa( Iterable )
- ;
- {
- temp $indent = increment_indent;
- print "[\n";
- for $value.kv -> $index, $key {
- printf '%*s[%d] = ', $indent, '', $index;
- p $value[$index];
- print ",\n";
- }
- }
- print ' ' x $indent, ']';
- print "\n" unless $indent;
- }
- multi sub p (Any $value) {
- print $value.perl;
- }
- p {
- statements => $[{:create-table(${:create("CREATE"), :table("TABLE"), :table-body(${:relational-table(${:relational-properties($[{:column-definition(${:column-name("sCompId"), :column-type(${:datatype("VARCHAR2"), :datatype-size("16")}), :not-null("not-null")})}, {:column-definition(${:column-name("sRoleCompId"), :column-type(${:datatype("VARCHAR2"), :datatype-size("16")})})}])})}), :table-name("AllRoleInactive")})},]
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement