# LOGO ⢀⣀⡤ ⢀⣤⣿⡗ ⣀⣀⣀ ⢀⣤⣤⣤⣄⡀ ⣠⡶⠿⠛⣹⡾⠛⢁⡼⠟⢛⠉⠉⠉⣉⣣⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡄ ⢉⠻⣯⣉⡛⠒⠻⡷⢮⡙⠳⣤⡐⣾⠟⣀⣴⠋⠁⣀⡴⠋ ⣠⡟ ⠐⠚⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⢩⠛ ⠘⣧ ⠹⣿⡳⡀⠙⢦⡈⠳⠈⢱⡟ ⠋⣼⣿⣿⢿⠁⠰⣶⠏⢐⡆⢠ ⣠⣖⣢⠤⠶⠶⠂ ⡽⢃ ⣀ ⠈⢗⣲⠞⠓⠛⢦⡌⡿ ⡾⠃ ⣿⣿⡾ ⣿ ⣼⣠⠏⢀⡾⣿⠟⣂⣠⡤⠤⠴⠶⠛⠛⠛⢋⡿ ⢀⡴⡲⠹⠍⠁ ⠐⢶⡂⠈⣓⠱⣆⡼⠃ ⢰⣿⡟⢳ ⢀⣾⢇⡜⠋⠁⣰⣯⠾⠷⠚⠉ ⢀⣴⠎ ⢸⡇ ⠘⠙⠳⠤⣕ ⠳⣄ ⠉⠓⢴⣱⣿⡅⣀⣤⠾⣟⣯⣤⣶⡶⢿⣿⣯⠆ ⢈⣽⠃⣀⣀⣠⣴⣾⣯⠄ ⣴⠇ ⢀⣹⣶⡀⢈⣷⣶⣤⣼⣿⡿⢗⡋⣩⣶⡟⣛⣿⣿⣷⣾⣛⣉⣀⡤⠾⠛⠒⠋⠉⠛⣿⡿⠋ ⢠⡏ ⠙⠛⣲⡶⣤⣤⣿⡿⠋⠁⠻⠿⠛⠛⠙⠛⠛⠋⠉⠹⠿⠿⢿⣿⣏⣠⡖⣀⢀⣠⠤⢀⣈⣳⣄ ⢨⣶⣦⡤⣄⣀ ⠉⢁⣴⣋⣸⠟ ⣰⣶⠴⠒ ⠈⠛⠻⢿⣿⣿⡛⠋⠉⠙⣿ ⣠⡶⣫⣭⠶⣭⡀ ⢀⣴⠟⠉⢡⡏⡼ ⢠⡞ ⠉ ⢸⣿⡿⢿⡒⠒⠲⠿⠶⠶⠶⠟⠋⠁⣀⣀⣀⠉⠳⣄ ⠲⣿⠷⠃⢀⣾⠷⠿⠦⢤⣤⡟ ⢀⣀⣤⣶⣯⣥⣤⣤⡞⠁ ⠈⣼⣿⣷⣝⡳⠤⣤⣀⣀ ⠉ ⠙⠻⢦⣈⢳⡄ ⢀⡼⢋⣤⠴⠋⠁ ⣴⠿⠿⢶⣶⣿⣿⠟⠛⢻⣿⣿⠟⠁ ⠈⠻⣿⡍⠛⠷⣦⣄⡀⠳⢤⡀ ⠙⠧⣄ ⣠⣿⠟⠉ ⣀⣀⡀ ⣤⣤⣼⣿⣿⣷⣂⣴⣿⡿⠋ ⠰⡆ ⢻⣿⣿⣶⣄⡈⠻⣝ ⠈⠙⠲⣤⣀⡀ ⠑⢦⣌⡙⠒ ⢰⡟⠁ ⠛⢩⠶⠖⠛⣀⡏⠉⠙⠿⣿⣿⡟⠉ ⣷ ⣿⣿⣧⡙⢷⣄⡈⠂ ⠉⠉⠙⢷⡄⠈⠛⢦ ⣠⡿⠛⢶⣦⣤⣤⣴⣶ ⠈⡿⠟⠛⠉⠁⢀⣀⣀ ⠉⠙⠛⠒⠂ ⡿ ⣽⣿⠘⢻⣷⡀⠈⠉⠉ ⠹⣆ ⠁ ⡏ ⢸⣿⡿⠉⠙⠋ ⠈ ⠈⠉⣉⠅ ⠓⠲⢤⣄⡀ ⣼⠃ ⢿⣿ ⣿⠇⢠⡀ ⠠⣄⣄ ⢹⡆ ⣷⡀ ⡿ ⣀⠔ ⣠⣞⣁⣀⣠⣤⣤⣷⣌⠙⢦⡀⢀⡾⠃ ⢸⣿⡆⣻⠇ ⢹⣄ ⢹⡌⢳⣜⡟ ⢻⣧⣠⣸⡇ ⣠⡾⠟⠛⠉⣥⡾⢿⣿⣿⣿⣆ ⠙⠃ ⣿⢏⣿⡿⡀ ⠻⣷⢤⡀ ⢸⡇ ⢿⡇ ⠉⢻⢿⣿⣶⣤⣤⣀⣀⣀⣀⣤⣴⡿⠋⠁⣠⡴⠟⢁⣴⣿⣿⣿⣿⣿⡆ ⣼⡟⣼⣿⣷⢻⡜⣆ ⠘⢷⡙ ⣠⣤⡿ ⠈⠛⠁ ⠘⠦⢿⣍⠉⠉⠉⠙⢿⠩⢻⣿⣾⠞⠛⠁ ⣾⠏⠈⢻⣿⣿⣿⣿⡀⡀ ⢻⣰⠟⠁⠘⢦⡻⣿⡆ ⢸⣷ ⣿⡟⠁ ⠙⠋⠛⠳⣶⣶⠷⢾⣿⣿ ⢀⣿ ⢻⣿⣿⣿⡧ ⢀⣴⠋ ⠁⠈⢳ ⣸⠙⣦⢰⡟ ⠘⣿⣄⢼⣿⣿⣇⠒⢢⣿⣼⣧⡀ ⢤⡀⣿⣿⣿⡧ ⢀⣾⠃ ⢀⢠⡆ ⡞⢀⡴⣃⣸⡟⠳⣇ ⠹⡽⣾⣿⠹⣿⣆⣾⢯⣿⣿ ⡞ ⠻⣿⣿⣿⠁ ⢠⣿⢏ ⡀ ⡟ ⢀⣴⣿⠃⢁⡼⠁ ⠈ ⠈⠛ ⢻⣿⣧⢸⢟⠶⢾⡇ ⣸⡿⠁ ⢠⣾⡟⢼ ⣷ ⡇ ⣰⠋⠙⠁ ⠈⣿⣻⣾⣦⣇⢸⣇⣀⣶⡿⠁⣀⣀⣾⢿⡇⢸ ⣟⡦⣧⣶⠏ unleashed ⠸⢿⡍⠛⠻⠿⠿⠿⠋⣠⡾⢋⣾⣏⣸⣷⡸⣇⢰⠟⠛⠻⡄ v1.22 ⢻⡄ ⠐⠚⠋⣠⡾⣧⣿⠁⠙⢳⣽⡟ ⠈⠳⢦⣤⣤⣀⣤⡶⠛ ⠈⢿⡆ ⢿⡇ ⠈ ⠈⠓ ⠈ # NAME e - beast mode unleashed # SYNOPSIS Add a trace marker: $ perl -Me -e 'sub f1 { trace } sub f2 { f1 } f2' Watch a reference for changes: $ perl -Me -e 'my $v = {}; sub f1 { watch( $v ) } sub f2 { f1; $v->{a} = 1 } f2' $ perl -Me -e ' package A { use e; my %h = ( aaa => 111 ); watch(\%h); sub f1 { $h{b} = 1; } sub f2 { f1(); delete $h{aaa}; } } A::f2(); ' Benchmark two snippets of code: $ perl -Me -e 'n { slow => sub{ ... }, fast => sub{ ... }}, 10000' Launch the Runtime::Debugger: $ perl -Me -e 'repl' Invoke the Tiny::Prof: $ perl -Me -e 'prof' Convert a data structure to json: $ perl -Me -e 'say j { a => [ 1..3] }' Convert a data structure to yaml: $ perl -Me -e 'say yml { a => [ 1..3] }' Pretty print a data structure: $ perl -Me -e 'p { a => [ 1..3] }' Data dump a data structure: $ perl -Me -e 'd { a => [ 1..3] }' Devel::Peek dump a data structure: $ perl -Me -e 'dd { a => [ 1..3] }' Print data as a table: $ perl -Me -e 'table( [qw(key value)], [qw(red 111)], [qw(blue 222)] )' +------+-------+ | key | value | +------+-------+ | red | 111 | | blue | 222 | +------+-------+ Encode/decode UTF-8: $ perl -Me -e 'printf "%#X\n", ord for split //, enc "\x{5D0}"' 0XD7 0X90 $ perl -C -Me -e 'say dec "\xD7\x90"' $ perl -Me -e 'utf8; say dec "\xD7\x90"' א # DESCRIPTION This module imports many features that make one-liners and script debugging much faster. It has been optimized for performance to not import all features right away: thereby making its startup cost quite low. # SUBROUTINES ## Investigation ### repl Add a breakpoint to code. Basically inserts a Read Evaluate Print Loop. Enable to analyze code in the process. CODE ... # Breakpoint repl CODE ... Simple debugger on the command line: $ perl -Me -e 'repl' ### trace Show a stack trace. trace( $depth=1 ) ### watch Watch a reference for changes. watch( $ref, OPTIONS ) OPTIONS: -clone => 0, # Will not watch cloned objects. -methods => "fetch", # Monitor just this method. -methods => [ "fetch" ], # Same. -levels => NUM, # How many scope levels to show. NUM, # Same. -raw => 1, # Include internal calls. -NUM, # Same. -message => STR, # Message to display. STR, # Same. ### prof Profile the code from this point on. my $obj = prof; ... # $obj goes out of scope and builds results. ### n Benchmark and compare different pieces of code. Time single block of code. n sub{ ... }; n sub{ ... }, 100000; # Compare blocks of code. n { slow => sub{ ... }, fast => sub{ ... }, }; n { slow => sub{ ... }, fast => sub{ ... }, }, 10000; ## Format Conversions ### j JSON Parser. my $bytes = j([1, 2, 3]); my $bytes = j({foo => 'bar'}); my $value = j($bytes); Encode Perl data structure or decode JSON with ["j" in Mojo::JSON](https://metacpan.org/pod/Mojo%3A%3AJSON#j). Convert Perl object to JSON string: $ perl -Me -e 'say j { a => [1..3]}' Convert JSON string to Perl object: $ perl -Me -e 'p j q({"a":[1,2,3]})' ### x XML parser. my $dom = x('