The following module was proposed for inclusion in the Module List:
modid: P
DSLIP: bdpfp
description: simplify formatting+printing
userid: LAWALSH (Linda A Walsh)
chapterid: 2 (Language_Extensions)
communities:
similar:
rationale:
It was intended to take the place of printf, sprintf and say in
most of my code. It just works, 99% of the time, unlike sprintf,
handles arrays, IT DOES require a comma after a file handle as the
first argument, so that's 'different'. I had to use the Pa/Pae forms
to correctly handle arrays, but it is rare I passed an array, so
that wasn't an issue, but the form P qw( %s-%s test this); correctly
prints "test-this\n";
It's runnable as a program that tests and demos it's various
formats that it handles. include array refs '["a","b","c"]', (it's
NOT intended to be Dump), but it does handle simple tasks .. hash
refs '{"a"=>"b","b"=>"c"}'. Appends NL on output, but not to a
string. Even handles a questionably useful print directly from a
file handle.
Run it and see! or do a perldoc on it... both work.
I have RSI to the point of disability, so saving typing in
programming useful... commonly used things, I want to be short.
having to remember or deal with newlines... a pain. if my a 'die'
arg evolves to a format die P "File not found %s", $_; Doesn't have
a cow on "undef" -- (that was 1st item on list). perl -e 'use P; P
"a=%s", $a;' a=undef
I realize is a top and short name, but it was available and
multiple people asked what it was and why it wasn't included in CPAN
as I use it often in my test an demo programs...
Only design flaw I know of is preventing it from printing a newline
-- which I added in (*embarrassment*), a check for the 'NO-BREAK'
character (in utf8 or latin1) at the end of a string-- if found,
then doesn't issue a new line.
Else, if something is receiving the value of 'P' like my $a=P
"string " . P "same line"; P "a=%s", $a; string same line(\n) can go
to STDERR w/either P STDERR,"a=%s,$a; or I prefer Pe "a=%s,$a";
people did ask I submit this to CPAN... (submit any work to CPAN
for that matter...).. so tried to make it something useful.
enteredby: LAWALSH (Linda A Walsh)
enteredon: Thu Feb 7 01:24:16 2013 GMT
The resulting entry would be:
P bdpfp simplify formatting+printing LAWALSH
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=7aa00000_c15dcd60ea706c21&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=7aa00000_c15dcd60ea706c21&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=P