From 72748b1616d518a588fbbae67a40c05d92397152 Mon Sep 17 00:00:00 2001 From: Timofey Potapov Date: Sat, 21 Sep 2024 13:03:35 +0200 Subject: [PATCH] More pod updates. --- README.md | 35 ++++++++++++++++++++++++++++++----- lib/e.pm | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0d08650..5f43d65 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Benchmark two snippets of code: $ perl -Me -e 'n { slow => sub{ ... }, fast => sub{ ... }}, 10000' -Launch the Runtime::Debugger: +Create a breakpoint in code: $ perl -Me -e 'repl' @@ -117,6 +117,8 @@ Encode/decode UTF-8: $ perl -Me -e 'utf8; say dec "\xD7\x90"' א +And much, much more ... + # DESCRIPTION This module imports many features that make @@ -126,21 +128,44 @@ It has been optimized for performance to not import all features right away: thereby making its startup cost quite low. +## How to Import + +This module will overwrite existing methods +of the same name (which triggers a warning)! + +Should this happen and it is not desired, +simply import this module first. + +Should you prefer the methods in this module, +import this module last (if needed, at the end +of the file). + # SUBROUTINES ## Investigation ### repl -Add a breakpoint to code. +Add a breakpoint using [Runtime::Debugger](https://metacpan.org/pod/Runtime%3A%3ADebugger). Basically inserts a Read Evaluate Print Loop. +Version 0 was basically: + + while ( 1 ) { + my $input = ; + last if $input eq 'q'; + eval "$input"; + } + +(Much more powerful since then). + Enable to analyze code in the process. CODE ... # Breakpoint + use e; repl CODE ... @@ -667,10 +692,10 @@ Insert subroutines into the symbol table. Extracted from Mojo::Util for performance. -Import methods into another package +Imports method(s) into another package (as done in this module): -Take a look at import method for an example. +Take a look at the import method for an example. ### pod @@ -678,7 +703,7 @@ Work with perl pod. ### import -\[Internal\] Imports a DSL into another package. +Imports a DSL into another package. Can be used in a sub class to import this class plus its own commands like this: diff --git a/lib/e.pm b/lib/e.pm index 1e7857f..5f4e886 100644 --- a/lib/e.pm +++ b/lib/e.pm @@ -81,7 +81,7 @@ Benchmark two snippets of code: $ perl -Me -e 'n { slow => sub{ ... }, fast => sub{ ... }}, 10000' -Launch the Runtime::Debugger: +Create a breakpoint in code: $ perl -Me -e 'repl' @@ -129,6 +129,8 @@ Encode/decode UTF-8: $ perl -Me -e 'utf8; say dec "\xD7\x90"' א +And much, much more ... + =cut =head1 DESCRIPTION @@ -140,6 +142,18 @@ It has been optimized for performance to not import all features right away: thereby making its startup cost quite low. +=head2 How to Import + +This module will overwrite existing methods +of the same name (which triggers a warning)! + +Should this happen and it is not desired, +simply import this module first. + +Should you prefer the methods in this module, +import this module last (if needed, at the end +of the file). + =cut =head1 SUBROUTINES @@ -150,15 +164,26 @@ thereby making its startup cost quite low. =head3 repl -Add a breakpoint to code. +Add a breakpoint using L. Basically inserts a Read Evaluate Print Loop. +Version 0 was basically: + + while ( 1 ) { + my $input = ; + last if $input eq 'q'; + eval "$input"; + } + +(Much more powerful since then). + Enable to analyze code in the process. CODE ... # Breakpoint + use e; repl CODE ... @@ -703,10 +728,10 @@ Insert subroutines into the symbol table. Extracted from Mojo::Util for performance. -Import methods into another package +Imports method(s) into another package (as done in this module): -Take a look at import method for an example. +Take a look at the import method for an example. =head3 pod @@ -714,7 +739,7 @@ Work with perl pod. =head3 import -[Internal] Imports a DSL into another package. +Imports a DSL into another package. Can be used in a sub class to import this class plus its own commands like this: