ocehb: (Default)
[personal profile] ocehb
Фунцкция main::dumpValue(), первый параметр -- переменная, второй -- глубина показа (для вложенных переменных).


  DB<1> $a = "test"
  DB<2> sub main::dumpValue { use YAML; print $DB::OUT YAML::Dump $_[0] }
  DB<3> x $a               
---                     
- тест                   
  DB<4> $b = \$a
  DB<5> x $b
---
- !!perl/ref
  =: тест
  DB<6> %a = qw( aa 1 bb 2 cc 3 )

  DB<7> x \%a
---
- aa: 1
  bb: 2
  cc: 3
  DB<8> $a{'eee'} = [ qw( 11 12 13 14 ) ]
  DB<9> x \%a          
---
- aa: 1               
  bb: 2               
  cc: 3               
  eee:                   
    - 11               
    - 12               
    - 13               
    - 14


Заодно исправление DB::eval:

# perl -d t.pl
main::(t.pl:5): my $test = 'тест';
  DB<1> binmode $DB::OUT, ":utf8"
  DB<2> n
main::(t.pl:6): say $test;
  DB<2> p $test
тест
  DB<3> x $test
0  '\x{0442}\x{0435}\x{0441}\x{0442}'
  DB<6> sub main::dumpValue { print $DB::OUT $_[0]->[0], "\n" }
  DB<7> x $test
тест
  DB<8> 

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 6th, 2026 02:35 pm
Powered by Dreamwidth Studios