Public Scratchpad
Download
,
Select Code To D/L
Nodes of mine that I like to reference:
Running external commands
File::Temp examples
Return values of regular expressions
/m
and
/s
(includes visualization of regex matching)
"open" Best Practices
To glob or not to glob
Building Regex Alternations Dynamically
Truth and Falsehood
(includes links to info on Perl's concept of Context)
Parsing HTML/XML with Regular Expressions
and
Why a regex *really* isn't good enough for HTML and XML, even for "simple" tasks
only
perl
can parse Perl
(
a few examples of simple static parsers
)
hash key autoquoting
"alias"
Threads about module versioning:
Re: $VERSION in module files
,
Re: What basic things should I know about versioning modules?
loading a module or an alternative
(other conditional module loading threads:
1228945
,
11109882
,
1203288
,
1165148
,
1228300
)
Equivalencies of
use ...
MySQL+DBI SSCCE with Docker
,
Mojo::Pg SSCCE with Docker
State machine pattern
(
an example
)
Re: Curious about Perl's strengths in 2018
(a list of "modern" modules)
Debugging Unicode issues
a Regexp::Grammars example
along with multiple other approaches in the same node
Posting binary data on PerlMonks
(Windows hexdump:
https://github.com/hollasch/hex
)
Links to threads about Unicode in Windows filenames
Maximum values for integers
How to Bisect Perl
Fun with Prototypes
and
using prototypes to replace builtins
various ways to do inplace editing
(slurp/spew, File::Replace, etc.),
equivalent of
-i
via
$^I
,
slurping variants
looks_like_number
is (almost) the exact same function Perl uses for "not numeric" warnings
Generate XML from Perl data structure
(fairly generic)
Various
XML::Rules
examples:
bare minimum
,
simple
,
another
,
slightly more complex
,
with namespaces
Data::Diver
type code:
here
,
here
,
here
,
here
,
here
,
here
(see also
Data::DPath
,
Data::Path
,
untested
)
Dump
sub
s including closed over lexicals
(and
an attempt
at dumping package variables used in
sub
s)
Tie::File adds significant overhead
prompting examples
various multiline string examples
(for tests)
how strict knows a variable was imported
by
tye
alternatives to CGI.pm
hippo
's post on
perl-core
/ RHEL:
Re: Why not include version.pm
My
Mojolicious
posts:
a Login example
(see also
RFC / Audit: Mojo Login Example
)
Mojo::IOLoop based TCP server and client
a Mojo::SQLite query example
and
another simple example
Logging Serial Ports with Mojolicious
(inlcudes Mojo::SQLite in-memory database and an EventSource example)
a simple example
of
Mojo::IOLoop::Subprocess
a more complex example
of
Mojo::IOLoop::Subprocess
with progress via a EventSource
basic form submission
content negotiation
AJAX form submission
(more of a jQuery example)
dynamic refresh of a page
(more of a jQuery example)
a bit of redirects, routing, and tests
a request handler calling another HTTP API
(getting the response asynchronously)
url_for
vs.
url_with
a WebSocket multiplexer
a comparison with old style CGI
Apache Pulsar WebSocket client
notes on Hypnotoad behind nginx
a hackish HTML editor
Mojo::DOM::Role::TreeWalker
Quite a few Mojo::DOM examples