Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number


by Intrepid (Deacon)
on Jun 24, 2000 at 20:36 UTC ( #19724=user: print w/ replies, xml ) Need Help??

about this image:
This is a visual fingerprint (a "visprint") — an image generated using fractal maths — (not my invention) representing my GnuPG key fingerprint (postprocessed in ImageMagick). See C code file here (originally from visprint).
A great result: upon expressing our desire, This Good Monk and I have been blessed by Monk Flavio with his rewrite of visprint that will alpha-mask the background, output a PNG format file! Thank you so much, Flavio!

Midnight creeps so slowly into hearts of those
who need more than they get
Daylight deals a bad hand
to the penguin who has placed too many bets
Happy Feet

Welcome to the home node of
the Unreasonable Man!

Any links to on this node are known to be broken, sorry …

But for how much longer?

Favorite Quotes

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man."— George Bernard Shaw

“Perl is the portable distillation of the UNIX philosophy."
— Scott McMahan

“Now, as you all know, the Black Rabbit of Inlé is fear and everlasting darkness. He is a rabbit, but he is that cold bad dream from which we can only entreat the Lord Frith to save us today and tomorrow.”
— from Watership Down, by Richard Adams

"Write documentation as if whoever reads it is a violent psychopath who knows where you live."
—Steve English, as quoted by Peter Langston

"[André Malraux said] Do what you believe you must and leave the interpreting of it to others."
"[This] seemed to me to summarize his personal philosophy. How true this is. Don't be distracted by the carping of bystanders, their irresponsible attitudes, their self-serving, cowardly words and actions."
— Daisaku Ikeda on a dialog with André Malraux

a little quote about religious tolerance, which I see as pertaining to the tendency of some Christians to shout "Persecution!" rather often nowadays:

"We respect the right of everyone to believe whatever they like. ... But there are two important limits to religious tolerance. First, I have no right to legal protection against your scepticism, criticism or ridicule. Religion is too powerful a force, and is too often a cause of injustice or evil, for it to be immune from discussion and debate." David Pannick QC

You can disagree with my views about Perlmonks, surely,

but do not bitch and moan later that you didn't have those views carefully explained to you ;-]>
What's on this node? [an erratic, partial TOC]
I use multiple Operating System / Platforms and therefore several different ports of Perl. last update 28 Dec 2011
Join the gang (folks who have long been listed on this node as people being /ignored) who have declared that they wish to see that Intrepid is somehow forced to leave Perlmonks? last update 08 Oct 2006
Interesting CPAN modules: stuff I want to check out when I find the time.  
"Tricky" for me to remember how to use: An assortment of Perl topics that I need to look up excessively often. last update 02 Mar 2005
My GPG public key  
Our Solemn Intonement -- something to be mindful of.  
Some things are more important than Perl: a short rant. last update 08 Aug 2004
Who I'm /ignore -ing  
The syntax-highlighted rendition of a snippet offered in Perl Monks' Meditations. last update 04 Jul 2004
Shell s‎crip‎ting in service of Perl: download and view PM nodecode. last update 07 Aug 2003
Terribly kewl CSS scheme for Perl Monks. last update 02 Sep 2004
Last Word

Useless Biographical Trivia?

I was born a while ago (I am 47). I was named Sören Michael Andersen.
Then I learned some Perl and became a CPAN Author:


I am a User as well as a Monk. Confused yet ;-) ?

"... people who condemn others simply on the basis that the target of condemnation is "angry" or "frustrated" are using a false premise as a basis for their condemnation. Anger is not, by itself, a transgression against society, or the Monastery." — myself, here

The most reasonable of suggestions has been made in Dealing with An(?:no|on)ytroll by tirwhan. It deserves serious thought.

Please bookmark Perlmonks Haunted by the Ghost of Wassercrats and go read it sometime when you are not under time pressure.

Another identity off-site for Intrepid is "perlspinr".
More generally I am always known as somian.

Building CPAN modules my way

I've got my own approach to building CPAN modules for use on my Debian-based systems (generally a known, stable target).

  • Define this bash function in one's bash initfile somewhere:
    function mkfpl_cpanpm { declare +x _thisperl; if [[ x"$PERL" != x"" ]]; then _thisperl=$PERL; else _thisperl='perl'; fi; $_thisperl Makefile.PL -verbose \ $($_thisperl -MCPAN -e'CPAN::Config->load; print $CPAN::Config- +>{q|makepl_arg|}') }
  • [ $ cpan cpan> look <Module::Name> ]
  • (a new shell opens in the unpacked source directory for "Module::Name")
    1. mkfpl
    4. make test TEST_VERBOSE=2  # optional
    5. su -c 'make pure_site_install'  # or $ sudo make pure_site_install
    6. make clean  # optional

A short rant

One thing that I've noticed in my time spent chatting in the cb here at Perlmonks is that the level of ethical sophistication amongst a few of my fellow cb'ers can be terribly low. I make this generalization because there's one prime point of all ethical systems that I can feel any respect for, and that is:

Might does Not make Right
But it is clear that among the cb'ers are those who don't understand this. They have an enormous blind spot when it comes to issues in the workplace or the Perl (or other kind of) hacker community. Maybe it's a generational thing; I'm in my 40s and many Monks are in their 20s. I think the times are shaping young people to have much lower sensitivity to this. Most are very quick to point out the shortcomings of political leaders but very few seem able to see that abuse of privilige and power plays a big role close around them in their everyday lives.

There are two kinds of social power generally at work in our world:

  • Individual Despots
  • and
  • The Despotic Mob

Both these exert their influence generally (not always) to the detraction of good in the lives of human beings, to the enhancement of evil. People seem to regard the exercize of power by individuals like irc ops as some form of divine right, which is fine as long as such people who think this way don't try to pass themselves off as freedom-loving people. Furthermore: there seems to be a general assumption that if a person has contrary views to an irc #channel-op or a Perlmonks God, they are automatically wrong. This is childish, immature, dangerous and pathetic. People with that degree of ethical ignorance deserve what they're getting: the horrible political leadership the US nation has recently suffered with and been damaged by (see: Tom DeLay, Grover Norquist, Jack Abramoff, Ralph Reed, Karl Rove, Bob Ney, Pres. George Bush, et al).

Just as bad is the pattern wherein supposedly intelligent people automatically assume that the person saying a new thing that insults (in their view) or challenges a comfortable dogma, or other item of "social consensus," is automatically wrong.

The only positive change that has ever taken place in the world has come about because of alienated, despised malcontents who dared to speak truth to power. The only kind of human being truly worth honoring is one who can summon the personal courage to speak truth to power, on whatever level or in whatever form it takes (embodied as either the despot or the mob). No-one lives a worthwhile life without ever falling afoul of some embodiment of power, sometime during their lives. The rest of humanity live like sheep, and no society that deserves to be remembered by history erects monuments of honor to sheep.

When a person gets banned in irc or otherwise "punished" somehow in any kind of hacker social context, they fairly often deserve it because their actions have been contrary to the general good of the group. But not always. This distinction between "always" and "not always" is the difference between the destruction of the world and its salvation. It is everything. Not understanding this is the distinction between an ignorant person and a real citizen, whether of the Happy Realm of Hacking Free Software or of the World.

From the Wikipedia entry for Internet Troll we see this quote:

[Likewise,] accusers are often motivated by a desire to defend a particular Internet project, and references to an Internet user as a troll might not be based on the actual goals of the person so named. As a result, identifying the goals of Internet trolls is most often speculative.

The use of the term "Troll" on Perlmonks by a certain group of people is an example of something like what's described above. It reflects not on the accused person but on the accusers, who are misusing a type of peer group -based power (being the Despotic Mob) to exercize coercion against someone whose aims are, as many others see, not those of a troll at all. The very best that can be said of such misuse is that the accusers are engaging in reckless and irresponsible speculation. The worst is that they themselves are far more despicable than any "Internet Troll", that they are in fact aiming to give themselves the twisted pleasure of seeing their group power effectively deny another participant the option of continuing to engage in a reasonable relationship with the site, community or project in question.

One can only feel pity for people living with the kind of impoverished inner lives and distorted emotional personalities that would derive pleasure from such a thing, but unfortunately the modern world at least, with its intense pressures and demands, often gives rise to such it seems.

I don't see posts by Anonymous Monk beginning at 6:30pm on 7 Dec 2005, by using CSS to override display settings. The texts of postings of any nature by any non-existing (Anonymous) Monk are invisible for me. This is a measure that I've taken until such time as the preferred solution comes to pass (the preferred solution being: the Perlmonks site no longer allows Anonymous posting at all).

There's a general idea (apparently) held by many that a certain natural law known to many humans, one concerning cause and effect, ought to be suspended with regards to what goes on in the Perl Monks chatterbox. In reality -- and there's nothing that exists outside of reality -- nobody has the power to suspend the workings of this law. Folks mentioned below are those who I feel seem to have this idea that nothing they do in the chatterbox matters, in other words, that for them, just because they want it to, this causal law is in suspension there. This section of my home node exists as both an explanation of certain oddities in the chatterbox chatter when I am present, and a reminder that this law of causality is at work everywhere, all the time, for everybody. In plain language: Don't expect to act like a <expletive> in the cb and have it just magically disappear.

The Infamous /ignore List

The following categorized lists of users at Perlmonks is not meant as a provocation or as "pay back". It exists first and foremost so that other cb users can make greater sense out of the disjointed, damaged flow of chatter on the cb that results from users having other users on /ignore. Secondly it exists as a means of augmenting my over-stuffed wetware RAM (my human memory circuits) as to precisely why someone is not welcome in my world. That's considerably better than failing to remember anything more than a vague "Oh, it was something about XYZ that I didn't like" or some such garbage.

This is not a comprehensive listing of people I've got on /ignore. It's a subset of those. Please don't try to deliberately make your way into this "public" list. I'll sometimes just silently dump users into oblivion, as my duty to myself dictates I must. If you think you've been a BLEEPING BLEEP BLEEP and so got /ignored, but aren't really sure, try sending an innocuous message (if it is not extremely polite you will be ignored then, even if you weren't before; I do not appreciate private msgs except from my special friends). If the msg is not rejected, you were not on ignore.

A side note: The application at cb60 is the only cb history interface that is currently working (to my knowledge) at the time of this writing, and is the only one that can be configured to ignore users as the live chatterbox can.

I am currently ignoring the following people for aggravating degrees of cluelessness, ignorant behavior (including the chosing of a deliberately offensive user nickname), repeatedly asking about things without paying attention to the answers they've already been offered, etc:

Ignored for committing one of acts I find most offensive in online communities: ganging up on a user, usually with little idea of the context for the apparent "infraction" or misbehavior she's accused of. This leads to people leaving the Perlmonks site permanently. OTOH, historically it has been seen that very seldom do the critical or harsh-looking words of an individual to another individual who is even moderately established at Perlmonk result in the second leaving.

Self-avowed "trolls" on permanent /ignore:

See Who We For? for more discussion of why I think there can be some standards expected of people at Perlmonks.

Possible spammers, email-address harvesters/vendors, and similar foul beings who associate with them: (I regard this as such a serious allegation that I'll only list names if I have a trans‎crip‎t of the exchange in which I learned of this, or other evidence to explain & substantiate my inclusion of the person's name here. If the evidence is a log of the chatterbox, other persons will have their own independently captured logs as well.)

  • perlmonkey2 - trans‎crip‎t (from at ~11 PM EDT 26.09.2006)

    Update: perlmonkey2 2006-11-26 18:07:29 UTC

    He nicely didn't include the part where he had been harrassing me out of the blue and making threats against me.

    Just in case some folks might actually be inclined to believe that sort of thing, note that the "harrassing out of the blue" and the "threats" all followed the brag about the 1.4 mill email addys harvested; that is, perlmonkey2 is rearranging the facts of what happened in that exchange to suit his own imperative need to achieve blamelessness (or the plausible appearence thereof, which this being Perlmonks, might well be good enough to deflect most participants' wariness. It shouldn't be.).

Plagiarism and similar dishonest conduct have resulted in /ignore settings for:

Other forms of conduct I find unacceptable: flaming, baiting, provoking, making belligerent threats, or abusing the site /msg facility. Such have dictated that I do an "/ignore" setting for:

  • sauoq
  • m.att
  • exussum0 & sporty (same fellow, two nicknames)
  • ptum
  • jZed
  • shotgunefx
  • belg4mit
  • Roy Johnson
  • runrig
  • footpad
  • BerntB
  • szbalint
  • ChemBoy

    ChemBoy 2006-03-09 18:32:58-05 I have to admit, the thought of a vengeful DOS attack did occur to me...

    (explanation: said in cb later on the day (9 Mar 2006) on which I was borged 3 times; an incredibly amusing manifestation of an utter lack of imagination. See more context here)

  • Corion and

  • virtualsue ... sort of goes without saying:
    1. that insulting Intrepid has been a regular pastime for certain users for a long duration of time;
    2. that it isn't paranoia ;-) : there is a clique of users at Perlmonks who are absolutely convinced that the project belongs soley to them, and are working behind the scenes to force my "departure" from PM
    <iframe longdesc="Conversation on the chatterbox on 08 Oct 2006 regarding the blocking, banning, or whatever of Intrepid from perlmonks" name="telling" scrolling=yes" height="306" width="100%" src="">
    virtualsue    2006-10-08 16:48:25 UTC
    did you see me insult him in the past few days?
    Complete context of this admission by this user: here. </iframe>
  • Perhaps needless to say, other individuals who are in favor of machinations to see me gone from Perlmonks were also added this day:

  • ptum (interesting openly-pious Christian fellow who seems to regard some things as sacred, but apparently only his own feelings really count ... not those of others:)
    Intrepid 2006-05-26 13:28:03 UTC

    Intrepid as usual, displaying no regard whatsoever for barking dogs, sets himself up for B.S. from flamers.

    ptum 2006-05-26 13:28:21 UTC

    ptum barks.

    Intrepid 2006-05-26 13:28:52 UTC

    Intrepid is not surprised

    Another great advertisement for what manifests when what passes for belief in the teachings of Jesus Christ is avowed, these days ...

And there's a short list of people who have explicitly asked me to ignore them; I am willing to comply (have no choice but to be) with such requests:

And a lastly, a list of people who have implicitly asked that I ignore them (by placing my user nick on /ignore without notice or explanation):

There's a particularly annoying kind of conduct that very frequently takes place and lands users who commit it on the following list. This consists of coming into the chatterbox with a minimal but strange-sounding question - one that rings "warning bells" for some of the experienced Perl users. When it is suggested that more information is needed because the approach seems dubious (perhaps based on a mistaken understanding of how something in Perl works), such an individual committing this type of annoyance then leaves in a huff, saying something like Thanks for the kind help in a sarcastic and injured way that is intended to cause guilt feelings.

This is playing the "Newbie Victim of Mean Monks" card, and it is not only stupid, and not only pathetic, but also wrong - because the chatterbox or Perlmonks in general is a place where many give of their time to try to help less experienced Perlers. These volunteers don't need to put up with that kind of childishness, the attempted emotional manipulation and tantrums; and in my opinion, should not put up with it.

Again, it is (in my opinion), really ok to insist on minimum standards of mature behavior in order to qualify for help or attention at Perlmonks. Please see also merlyn's boilerplate disclaimer, which I believe to be another way of addressing this question (merlyn may not think this, it is soley my opinion).

Finally, I am getting a small amount of flak from Anonymous Coward (and see here for a good explanation that mirrors my views on Anonymous Monks at Perlmonks) over this public list of people who I have on the 'ignore' setting. See more about that here.

Here's an insight into what the chatterbox looks like for me with my /ignore settings. I'm obviously missing out on some of the the very highest-quality trash-talking and ought to be seriously regretful. ;-P

Please note: shortly after writing the following section, I was
inexplicably "borged" in the Chatterbox by some unknown "Power User".

20 Oct 2005 12:50pm EDT

Further abuses of the power to do "borging" have become routine. See the Borging Log.


Kind reader, there are a small number of people here at Perlmonks who are quite angry and upset with me. If you partake of the cb (the "Chatterbox"), for example, it is possible that you will notice strange things being said. Be aware that I know that some of these cb personalities will be issuing putdowns and attempting provocations. Also be aware that I know it is potentially confusing for you, a third party, to see that some people seem to be addressing Intrepid but Intrepid seems not to be able to see their words. I offer my regrets for any confusion this causes you, but am going to humbly suggest that you trust me that it is for the best, and all is as well as it can be, given the presence of these kinds of incompletely developed personalities on PM and their maladaptive social tendencies.

The root of the problem is that each one of this small group of people has expressed as an imperative that they want me to do something, and I have refused. Each of these people is in fact wrong to want what they want, and is wrong to attempt to impose their wrongheaded will on me. So it's simple, no? It really is important to stick to your principles in this world. It will make people mad! There is simply no question about that. Having people mad at you is not per se any kind of evidence that you have done anything wrong. Please remember this as you go through life. You too may sometimes face a choice between being true to yourself and the principles you hold dear, or giving in to groupthink and social coercion.

When people don't get something they want, like a change in someone else's verbal behavior, (e.g., Saying "Oh, I was wrong, you are so smart so you must be right, I'm sorry!"), they do one or more of a number of different things, depending on the state of maturity and psychological health they possess. One thing they do if childish or very neurotic is to create a distorted representation of the target's personality, attitude or character to themselves and others. Of course if they are mature and sound in mind, they deal gracefully with differences of opinion or belief, understanding that diverse kinds of persons with diverse approaches to life are all together here in the world for a reason. This kind of mature understanding and attitude is well-represented here at Perlmonks, but unfortunately, so is the other, inverse type. One such attempt at misrepresentation that you may see here is the fable that many people at Perlmonks regard me as an unpleasant and undesirable element. The numerous kind messages of support I receive belie this false portral of reality. But please form your own opinion and do not be swayed by the agendas of angry children.

I am quite immovable in the face of pressure by single or multiple individuals to cave in to 'peer' pressure and acceed to other's demands. It took a long time and hard work to become this way! But this is a bit maddening to some of the folks here at Perlmonks; they have apparently become somewhat used to having their way, and like spoiled children, really make a fuss when someone with a perfect right in the integrity of their own experiences, beliefs and conscience, refuses them.

That's all that's going on. No biggie, really ... just the same-ol'-same-ol'.

Borged Again!
24 Oct 05ca. 11:15am EDT Circumstance: suggested to jimbus that he'd have found it fruitful to have used the built-in Perl documentation to learn about perl's -i (in-place edit) switch before asking how in the chatterbox. This was ignored and so I increased the heat a little bit. I was then called a bully by jimbus for pointing out that learning to use perldoc (and at the same time mentioning which specific perldoc - 'perlrun' - it was to be found in) would benefit him. Was then borged (shut out of the chatterbox - placed in "Borg's Belly" by the NodeReaper, e.g. some Power User).

01 Nov 05ca. 12:14pm EST Circumstance: I had just said
This is an instructive example however. The (apparent) naive assumption is that the chatterbox is a help desk. I keep saying it isn't (and not because *I* say so, but because it doesn't act that way), so now this ....
and was "borged" without warning or explanation.

Another instance of totally unwarranted abuse of this power by persons unknown.
12 Dec 05 10:14:29 EST (GMT-05) Circumstance: I was being discussed by Corion, jeffa, belg4mit, Roy Johnson (except for belg4mit and Roy Johnson at that time, all users I've had on /ignore). I responded to the name-calling.

Something funny happened later in a day of phenomenal bad judgement and abuse of their Borging privileges in the chatterbox. Here's just a part of the comments and observations that took place while I was resting comfortably in Borg's Belly:

DigitalKitty 2006-03-09 18:24:35-05 DigitalKitty returns. PM seems to have been unreachable for awhile. Pinging resulted in 100% packet loss.
<span style="font-size:smaller;font-variant:normal"> ChemBoy 2006-03-09 18:25:29-05 interesting--I couldn't get the web pages, but packets all came back in one piece.
DigitalKitty 2006-03-09 18:28:01-05 I initially assumed a DoS attack was occuring but vroom probably has a firewall / perl based proxy to prevent such events.
ChemBoy 2006-03-09 18:32:58-05 I have to admit, the thought of a vengeful DOS attack did occur to me...
The notion that I could launch a DoS attack against Perlmonks infrastructure is hilarious to me. Not only I am not very adept at network programming, but I am pretty much clueless when it comes to Black-Hattery. This is a good example of how people who haven't the first clue who they are discussing make the kind of absurd snap judgements and guesses that don't go away.

There may be another explanation for the strange coincidence of the slowdown at Perlmonks on "bloodbath day". I'll leave it to people with some imagination to work it out for themselves, though.


Perl Tips, Observations, and Experiments

I use both Free Software Operating Systems and the proprietary Microsoft Windows OSes.

Obviously I prefer to spend more time on the former (my favorites are Ubuntu and its parent distribution, Debian). On MS Windows I use both ActivePerl and the new Win32 Perl that's being called StrawberryPerl. I often build my own Perl installations from source, as well.

The quality of the user experience one has with the MS Windwoes OSes is highly variable. Some users find little lacking in it and some are driven crazy by it. One inclination that is not well-served by Microsoft is the desire to use the CLI (Command-Line Interface, but if you are here reading, you knew that ;-) …and so I rely on the long-lived and community-supported Cygwin environment (this is important: Cygwin is supported by volunteers; do not act like a petulant spoiled brat if you go asking for support {if you happen to try Cygwin out}; if you do, you will just be ignored). Cygwin provides a port of Perl that tracks the major release cycle of mainstream Perl and "acts like" Perl running on a unix OS platform. Cygwin also provides the Bash shell and many other GNU userspace components that are common to all GNU/Linux and other free unix OSes.

Because I have acquired years of experience using Perl on MS Windwoes, I do not have the oblivious outlook about file name extentions that is customary from users who do only work on unix platforms. My decision is to name Perl programs with a .plx extention which disambiguates these files from those containing Perl library code. I use the appropriate MS Windows commands (from the CMD.exe cli) to create the right Registry settings so that the files named with .plx extentions are associated with the perl executable.

A smattering of Useful Tips for PerlMonks, especially new ones

Ripped off from busunsl's node:

Link types at PM (because I tend to forget :-):

  •  [id://] a node's id (numerical value)
  •  [cpan://] searches CPAN
  •  [kobe://] is an alternate means of searching the CPAN (contrasted with the [cpan://] tag)
  •  [jargon://] searches the Jargon file hosted at the University of Amsterdam.
  •  [doc://] searches the idea here is to provide a way of linking to more current Perl documentation than what Perlmonks can maintain.
  •  [pad://] is a shortcut to a user's scratch pad

Monks Solemn Intonement:

righteousness () { perl -e' print "The troublesome entities, irksome to Monks:\n " , ( join " and ", map{ sprintf qq{$_ is safe as }.q{&#}.qq{%d;}, ord ; } qw/[ ]/ ) , "\n"; ' }

– my PerlMonks color theme for CSS-supporting browsers – is now listed and maintained on this node.

This list is of modules that I'm not currently using for anything but that I think I might want to at some future time

A little parts bin of useful HTML entities for doing PM node markup

"["      left  sq brkt            [      &#91;
"]"      right sq brkt            ]      &amp;#93;
"<"      left  angle brkt         >      &#60; or &lt;
">"      right angle brkt         <      &#62; or &gt;

"mdash"  em-dash                  —    &#8212;
"ndash"  en-dash                  –    &#8211;
"lsquo"  left  single quotation   ‘    &#8216;
"rsquo"  right single quotation   ’    &#8217;

How I am creating ordinary paragraphs for Perlmonks node writeups these days:

sh-prompt $ perl -MText::Wrap='wrap,$columns' \ -MText::Textile=textile \ -lp000we \ 'INIT{$columns=78} s{\cM?\cJ} [ ]g; $_=wrap(q[],q[ ],textile($_)).$\;' DRAFT.TMP

This should work fine in a MS Windows CMD shell too, with the alterations that (a) all single quotes around the -e s‎crip‎t and perl flags are changed to double quotes, and (b) the line-continuation backslash/newlines are removed.

·Assorted Perl Stuff, and platform-specific notes·

Which and where is “Some::Perl::Module
(finding VERSION and location of a Perl module):


Depending on your OS and your work habits / preferences, you might want to use a Unix sh means of wrapping the Perl code implementing this technique (second thing below), or you might need a MS Windows console helper (in the form of a DOSKEY macro, shown immediately below). I've named this critter different things in different manifestations on different machines at different times ... but now I am aiming to settle on it being named PMTEST.

PMTEST=perl -le "do{$modn=$_;s!::!/!g;$_.=q[.pm];do{print qq[$modn is +not installed.];next} unless eval qq#require(\"$_\");1# && !$@;$modv= +defined(${$modn.q[::VERSION]}) ? ${$modn.q[::VERSION]}:q{[version und +efined]};$numtyp=2>$modv=~tr/.// ?'%s':'% 6d';printf qq[ %-*s $numty +p in %s\n],(length>30 ? 5+length:15+length),$modn,$modv,$INC{$_}}for +@ARGV;" $*

Sorry, those long (wrapped) ugly pieces of code are what's required for MS Windows CMD shell. The command interpreter does not offer any means (that I have discovered) of using continuing statements on multiple lines when defining a DOSKEY macro. Don't try a COPY-PASTE of the above, either, or you'll have to figure out how to remove every introduced newline inside the macro definition before the code will work. Trust me, you won't feel good about the wasted time.

To use the above code, you must place it in a *.bat or *.cmd file and then "execute" it from the MS Windows console (the commandline interface, CLI, CMD.exe).

Invoke the macro (not the .bat file it was saved in, which you execute only once per each shell session or instance) with a single arg, the Perl-style name of a module (for ex. “pmtest CGI” or “pmtest File::Find”).

Here's the Unix shell (bash/ksh etc.) rendition of the pmtest thing

# pmtest: bash reusable function authored by Soren Andersen # license/terms of use/modification/redist: same as Perl pmtest () { perl -e' my$modn = my$mod = "'$1'"; $mod =~s@::@/@g; $mod.=q[.pm]; die ("module $modn not installed.\n",$@) if ! eval {require qq[$mod];}; my $modv = defined ${$modn.q[::VERSION]} ? ${$modn.q[::VERSION]} : q{[version undefined]}; my$numtyp= (2 > $modv =~tr/.//) ? "%s" : "% 6d"; printf " %-*s $numtyp in %s\n", length($modn) > 30 ? 5+length($modn) : 15+length($modn), $modn, $modv, $INC{$mod}; '; return 0 }

This also needs to be "gotten into" the bash session somehow. Ths canonical way of doing so is to include the above in a shell initialization file like ~/.profile or ~/.bashrc.

For contemplation by people who want to write software installers, Perl installation administrators, etc.:

In contrast with Unix-like platforms, MS Windows has it's own sense of Well-known Folders (not absolute filesystem "folders" but instead pointers to locations which can reasonably be expected to exist on most Windows machines, with some divergence between the bog-ordinary Workstation and the more complex Server kind of Windows installation).

These are abstractions, meta-directories if you like, which exist above the level of the actual filesystem and happen to be represented in the typical, default Windows ENV by variables like %APPDATA% and %ProgramFiles% and %ALLUSERSPROFILE%.

We can access the values assigned to these meta-directories using the API calls wrapped in the module (not in the core namespace which is automatically built in when Perl is created for a Windows system; the user has to explicitly say use Win32; in order to make this work).

Here's a simple one-liner to demonstrate:

perl -MWin32 -le "my @ds=grep {/CSIDL_/} @{ [keys %Win32::] }; do {printf qq/%31s => %s\n/, $_, Win32::GetFolderPath(&{$Win32::{ +$_}}) } for map { $_->[0] } sort {$a->[1] <=> $b->[1]} map { [$_,&{$Win +32::{$_}}] } @ds"
Note that we did not even need to know the particular names of the metadirectories available on the specific version of Windows on which this is run, which is Kinda Cool imho.

Here's a way to get the location of the meta-directory of your choice, assuming that you choose with some clue to begin with ;-/ ... :

perl -MWin32 -le "my @ds=grep {/^CSIDL_/ && /\U$ARGV[0]/} @{ [keys %Wi +n32::] }; do {printf qq/%31s => %s\n/, substr($_,6), Win32::GetFolderPath(&{$ +Win32::{$_}}) } for @ds" profile
This should display the Special Folders that are named *PROFILE* (in globbing terms) and display the actual location(s) of such folders.

Note also that the above commandlines aren't broken up in actual use, and will have to be mended by any who wish to try it out. MS Windows CMD shell doesn't allow multi-line commands even inside quotes UPDATE: You can create multi-line Perl one-liner (console input) s‎crip‎ts in the interactive Windows CMD shell. You will escape the newline with the ^ character (caret) but this does not work to span lines inside quotes. Instead, you will use -e repeatedly, just as you may do in a *nix sh-type shell. Here's the oneline demo above, thanks to pKai who educated me on this!:

perl -MWin32 -e "my @ds=grep {/CSIDL_/} @{ [keys %Win32::] };" ^ -e "do {printf qq/%31s => %s\n/, substr($_=>6), Win32::GetFolderPath(& +{$Win32::{$_}}) }" ^ -e "for map { $_->[0] } sort {$a->[1] <=> $b->[1]} map { [$_,&{$Win32: +:{$_}}] } @ds"

Here's a DOSKEY macro-ized version of the code above. Handy for interactive CMD shell use where you need to quickly check the list of Special Folders (or a particular group of them).

:: MS Windows BAT/CMD syntax. Wraps a Perl one-liner program. DOSKEY SPECIALFOLDERS=perl -MWin32 -e "my @ds=grep {/CSIDL_/} @{ [key +s %%Win32::] }; do {printf qq/%%24s=>%%s\n/, substr($_=>6), Win32::GetFolderPath( & +{$Win32::{$_}} )} for map { $_->[0] } grep {(0+@ARGV ? $_->[0]=~m<$ARGV[0]>i : 1) +} sort {$a->[1] <=> ${b}->[1]} map { [$_,&{$Win32::{$_}}] + } @ds" $*
Remember to reformat the code above so that no linebreaks are present. The line that begins with DOSKEY needs to be one continuous line.

·For MSWin -using Monks·

  • You can emulate the Unix sh-shell user-defined function examples shown on this node to some extent by using DOSKEY macros.

    DOSKEY still exists on Windows XP, Vista, and 7. In a CMD shell you can query what macros you've defined by doing D:\ > DOSKEY /macros
    and can define new macros by saying something like this: D:\ > DOSKEY perlversion=perl -le "printf qq[%vd$/]=> $^V"
    This is a somewhat trivial and quite contrived example of course. ;-)

    Here's a less contrived example. This will make cli work easier if you find yourself working in a directory named like C:\Documents and Settings\You There...

    DOSKEY compactcwd=FOR /F "delims=*" %%N IN ("%CD%") DO CD %%~sN

    There are some DOSKEY/Perl gotchas to look out for. Note that this is not an exhaustive list.

    • The special tokens $* and $B, $G, $L and $T (case does not matter) will be interpreted by DOSKEY instead of DWYM with Perl This means that scalar variables must not be named $[Bb].* or $[Tt].*, using regexp meta-syntax to explain. You could say ${Beginning} or ${tangent}, though.
    • The % sigil in a hash variable name (or a printf format, or anywhere else) must be doubled if you are trying to set up DOSKEY macro definitions in a batch file s‎crip‎t. The first one is "eaten". (Note: I've some reason to think that escaping a % with a caret ^ might work, but I haven't had time to test this. I think that in general, quoting with the ^ in CMD doesn't work inside double quotes.)

    Batchfile as DOSKEY macro-file (thanks, Ben Burnett):
    The macros discussed above can be cleverly included in a CMD session using this as a file (say, save it as PMACROS1.bat) and starting CMD from a shortcut like this: %SYSTEMROOT%\System32\CMD.exe /E:on /F:on /V:on /K CD %USERPROFILE% & PMACROS1.bat

    ;= @echo off ;= rem Call DOSKEY and use this file as the macrofile ;= %SystemRoot%\system32\DOSKEY /listsize=1024 /macrofile=%0% ;= rem In batch mode, jump to the end of the file ;= goto end ;= rem *************************************************************** +*** ;= rem * Filename: DOSKEY-M1.cmd ;= rem * Version: 2.0 ;= rem * Author: Soren Andersen <> ;= rem * Purpose: Some useful perl 1-liners ;= rem * license/terms of use/modification/redist: same as Perl ;= rem * Last modified: Wed 28 Dec 2011 ;= rem * History: ;= rem *************************************************************** +*** ;= rem PMTEST: Test for use of a Perl module PMTEST=perl -le "do{$modn=$_;s!::!/!g;$_.=q[.pm];do{print qq[$modn is +not installed.];next} unless eval qq#require(\"$_\");1# && !$@;$modv= +defined(${$modn.q[::VERSION]}) ? ${$modn.q[::VERSION]}:q{[version und +efined]};$numtyp=2>$modv=~tr/.// ?'%s':'% 6d';printf qq[ %-*s $numty +p in %s\n],(length>30 ? 5+length:15+length),$modn,$modv,$INC{$_}}for +@ARGV;" $* ;= rem SPECIALFOLDERS: Display Well-Known Folder pathnames SPECIALFOLDERS=perl -MWin32 -e "my @ds=grep {/CSIDL_/} @{ [keys %Win32 +::] }; do {printf qq/%24s=>%s\n/, substr($_=>6),Win32::GetFolderPath( +&{$Win32::{$_}})} for map {$_->[0]} grep {(0+@ARGV ? $_->[0]=~m#$ARGV +[0]#i : 1)} sort {$a->[1] <=> ${b}->[1]} map {[$_,&{$Win32::{$_}}]} @ +ds" $* ;= :end
Documentation for the current version of PPM (3), the crufty thingy that many MSwin users rely on to install new packaged Perl modules:
ppm3 Documentation
  • You can easily break your PPM v3 unknowingly merely by updating Text::Autoformat – see Bug Listing
  • PPD file format – appears to have not been updated since the 5.6 series releases at ActiveState. Please note that it makes no mention whatsoever of a parameter or field named ARCHITECTURE NAME then go and in contrast look at some example .PPD files from the various repositories.

    Note Added:
    This seems to be explained by this brief excerpt from the ppm Mailing List, authored by Jan Dubois:

    "Since Perl 5.6 and Perl 5.8 are not binary compatible, we started appending the Perl version number to the architecture string in ActivePerl 5.8. Try this:
         <ARCHITECTURE NAME="MSWin32-x86-multi-thread-5.8" />
    Both ppm2 and ppm3 in ActivePerl 8xx have been patched to use these architecture names."
  • A (perhaps) little-known, rich PPM repository to add to your list that ppm searches.
  • For Perl5.8 you may check status of ActiveState's builds of packages (modules).

    The dmake utility:

    The recommended tool for building Perl from the source kit using a Free C/C++ compiler (MinGW), is dmake. This variant of the classic make tool is now maintained by folks ("tools" Project) and the dmake manpage is online.

    dmake on CPAN: is now maintained by Steve Hay and is no longer the extremely old code offered years ago by Gurusamy Sarathy. Steve is building it using MSVC++ from the source mentioned above.

    ·For EveryMonk· (any platform)

    Investigate the modules and libraries your Perl installation has access to:

    Tom Phoenix' s‎crip‎t "Inside" on CPAN.

    Need Help Using CPAN Effectively?

    Preflight-check for mirrors (using system `ping(1)'):

    perl -MCPAN -l \ -e 'CPAN::Config->load;' \ -e '@pcnt= $^O eq "cygwin"? qw(-n 2):qw(-c 2);' \ -e ' do{ $fn=$_; if (s#^\w+p://([^/]+).*#$1#) { print $fn; system("ping",@pcnt,$_); print "\n","-"x52 } } for @{ $CPAN::Config->{urllist} }' # code tested on cygwin and GNU/Linux

    Find your system's master list of CPAN mirror sites, maybe freshen it up:

    perl -MFile::stat -MCPAN -MLWP::Simple=mirror -le 'CPAN::Config->load; + my $fhost;' \ -e 'my $Mdat = $CPAN::Config->{keep_source_where}.q[/MIRRORED.BY];' +\ -e 'if (-e $Mdat and -M _ < 14) { print qq[$Mdat: freshness OK, last + modified: ]' \ -e ' .gmtime stat($Mdat)->mtime()' \ -e '} else { ($fhost)=grep(/^http/,@{$CPAN::Config->{urllist}});' \ -e 'die "no suitable cpan http mirror host" if !$fhost;' \ -e 'printf q[%s],qq[File $Mdat not found or stale, will d/l fresh fr +om $fhost ...];' \ -e 'mirror($fhost .q[MIRRORED.BY] , $Mdat) and print q[ ].gmtime(sta +t($Mdat)->mtime)}'

    Wrap the code above in a function in your shell initfile if you are a bash user and you like to have such conveniences at your "fingertips", as I do:

    function mirrorsrefresh { < above perl code here > }

    More tips on coping with can be found here at "dumpcpanurls" Snippet.

    Easy way to see that s‎crip‎t output gets a terminating newline automatically:

    In s‎crip‎ts:
    #! /usr/bin/perl -l # *or* $\ = "\n"; # do it once and won't have to again.
    In one-liners (s‎crip‎t is "-e"):
       $ perl [other flags] -le "[some code]"

    Filter newlines out of systems call results

    %hash = ( key => grep [ chomp ], `which ps` );
    which does the same things as: %hash = ( key => grep {chomp || 1} `which ps` );

    Attribution: seen on comp.lang.perl.misc in msgid <>.

    Slurp an entire file in

    # Previous declaration of "$filename" is assumed. my $data = do{local(@ARGV,$/) = $filename;<>}

    Attribution: here

    Another way to do this, faster and better:

    my $data = do{ open local(*FH),$filename or die "can't open: $!" ; sysread( FH, my $buf, -s FH ) ; $buf ; };

    Something that may be called "The Bartian Transposition" someday:

    (@a[0 .. ($#a = $#b)], @b) = @{[ @b, @a]} # swap two arrays

    Where's my HOME???

    my $home = $ENV{'HOME'} || $ENV{'LOGDIR'} || (getpwuid($<))[7] || die "WAAAAA! I'm HOMEless!\n"; # from `perldoc perlop'.

    Something really special:

    Opcode scanning for

    Dump a string of opcode names that can be fed to Safe::new->permit. Based on knowledge / shell elan shared by ysth.

    $ perl -MO=Concise,-exec <> \ | perl -lnaF -e '$_=$F[2]; s/\W.*//; $h{$_}=0; END{ print join " "=>k +eys %h}'

    Created 30 Jul 2003 EDT (GMT+4):
    Updated Thu Jul 31 2003
    Updated Sun Jul 04 2004
    Regarding the Meditation on List Cleanup

    [After getting helpful advice on the node above I rewrote the snippet (as a complete s‎crip‎tlet) ... several times (mostly recently on July 4 2004)]

    The goal is to eliminate duplicates without disturbing existing ordered-ness. Thus the property of mundane hash assignment such that duplicates disappear is not sufficient by itself, but in a combination demonstrated in this code below, the truth-ness of a hash value can be used to prevent duplicate array entries.

    #! /usr/bin/env perl
    # "uniqnord" - remove dups from a list of identifiers.
    use strict; use warnings;
    $, = ! -t STDOUT ? "\n" : " " ;
    my %seen = (); $\ = "\n";
    print STDOUT  join($, =>
        grep {!$seen{$_}++} map {
          if (/ +/) { $/=" " ; @_=split }
            else    { chomp ; $_ }} <>)
    The real code:
    #! /usr/bin/env perl # "uniqnord" - remove dups from a list of identifiers. use strict; use warnings; $, = ! -t STDOUT ? "\n" : " " ; my %seen = (); $\ = "\n"; print STDOUT join($, => grep {!$seen{$_}++} map { if (/ +/) { $/=" " ; @_=split } else { chomp ; $_ }} <>) __END__

    System-ology: monospaced fonts currently on my M$ box

    <TH style="text-

    Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (3)
    As of 2015-10-10 13:42 GMT
    Find Nodes?
      Voting Booth?

      Does Humor Belong in Programming?

      Results (257 votes), past polls