Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery


by jdporter (Chancellor)
on May 30, 2002 at 16:48 UTC ( #170442=user: print w/replies, xml ) Need Help??

Just FYI... I am not the jdporter who is aka boo_radley. (Indeed, he and I have been striving over the "jdporter" alias for many years. :-)

It's hardly debatable that we are indeed both (intolerant and capricious).
These are the consequences of having not rigorously defined policies and rules
and rather letting the community decide for itself what it tolerates or not,
and the makeup of the community being in a constant state of flux over time.

I'm not sure when I joined SiteDocClan, but my first edit to a group wiki was on 2003-08-27.

I'm not sure when I joined pmdev, but my first edit to a group wiki was on 2005-12-28 and I submitted my first patch on 2006-01-26.

I joined gods on 2015-06-21 (in the ineffably resplendent form called erzuuli).

Rooms in my treehouse:
Popular links on homenodes
Tutorials digest
Survey of POOP Modules
Some cb snippets
Restyling PerlMonks
Sitedoclet usage analysis
Scratchpads & Blogs:
pad for admin-related stuff
pad for pmdev-related stuff
pad for other stuff
User Posts
CPAN contribs

Some of my root (and root-like) posts you may find interesting:

PerlMonks for the Absolute Beginner
New Service: Thread Watcher
New Snippets Index
XY Problem
Where should I post Y?
jdporter's place in the name space
test of ancient magic
test this
Nodes 1 .. 1000
There is no Perl Illuminati
PerlMonks Memorial Garden

Also check out my Free Nodelet Hacks
Also check out  
(RFC) Arrays: A Tutorial/Reference
Tk Photo Slideshow, with scrolling and scaling
Simple Console Menuing System
Control and Query Win32 Services at the command line
Strategy Handles
Linked Lists With No Memory Leak
There's Only One Way To Do It
Read and write Windows "shortcut" links
Create and Pop Up Outlook Notes from Perl
IO::MultiHandle - Operate on multiple file handles as one
map-like hash iterator

Here are some links I keep handy in my Free Nodelet:

Free Nodelet Settings
User Settings
Display Settings
Nodelet Settings
log out
PerlMonks statistics
Message Inbox
last hour of cb
Full-Page Chat
Chatterbox statistics

Monks I've met in meatspace:

PerlMonks Quine:

perl -MLWP::Simple -e "getprint '; +displaytype=displaycode'"


Previously, I used this:

Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.
This is a line (my own translation) from the classic movie Metropolis. Incidentally, my homenode pic above is a frame cap from this movie as well.

In the movie, the building of the mega-city Metropolis is likened to the legendary tower of Babel. This was intended as a warning: Knowing the fate which befell Babel, the builders of the present age should take care to avoid the same sins, and thus the same fate. Specifically, the builders of Babel lacked "heart" (a spirit of compassion and a willingness to compromise), and this resulted in a cataclysmic conflict between management and labor.

Most languages are like StackOverflow: I have a question, I want the best answer.
Perl is like PerlMonks: I have a doubt, I want to read an interesting discussion about it that is likely to go on a tangent. q-:

tye, in Re: What is PerlMonks? (why Perl)

A classic gem by eyepopslikeamosquito: I eagerly await the invention of a time machine so I can feast my eyes upon your majestic code. I estimate the probability of you having actually written such code is about the same as the probability of the invention of a time machine that allows us to view it.

<input type=submit value="border-width=d" " />

Posts by jdporter
Detect whether a writeable filehandle has closed? in Seekers of Perl Wisdom
10 direct replies — Read more / Contribute
by jdporter
on Jan 13, 2021 at 12:26

    In my perl program I open a subprocess for writing via a pipe. It appears that this child process can decide to exit at times I don't expect. Is it possible to detect that the filehandle to the pipe is no longer usable? As it is, I now get SIGPIPE occasionally, but it seems to happen later, after I've possibly already written (tried to write) additional lines to the pipe. I want something synchronous.

    I've seen Scalar::Util's openhandle function. Does it work on pipe handles, opened for writing?


    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Export (extract) Mozilla Firefox Bookmarks in Cool Uses for Perl
1 direct reply — Read more / Contribute
by jdporter
on Mar 05, 2020 at 12:52

    Probably reinventing the wheel, but...

    (NB: You may need to cpan install DBD::SQLite first.)

    use DBD::SQLite; use strict; use warnings; =pod This program reads a file named places.sqlite which is found somewhere under your folder named Mozilla/Firefox/Profiles You pass the pathname of this file as a command-line argument. This program outputs html. =cut my $dbfile = shift; $dbfile or die "Usage: $0 <path>/places.sqlite \n"; -r $dbfile or die "Unreadable $dbfile\n"; $dbfile =~ /\bplaces\.sqlite$/ or die "File should be places.sqlite\n" +; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","") or die "Erro +r opening db $dbfile\n"; my $bookmarks = $dbh->selectall_hashref("select * from moz_bookmarks", +'id'); my $places = $dbh->selectall_hashref("select * from moz_places",'id +'); # construct the tree: my $root; for my $b ( values %$bookmarks ) { if ( $b->{parent} ) { my $p = $bookmarks->{ $b->{parent} }; push @{ $p->{children} }, $b; } else # yep, there's exactly one. { $root = $b; } } # produce the html: local($,,$\)=("\t","\n"); sub walk; # because it recurses. sub walk { my $depth = shift; my $n = shift; my $indent = "\t" x $depth; if ( $n->{type} == 2 ) # folder { print $indent . ($depth?"<li>":'') . "<h4>$n->{title}</h4>"; if ( $n->{children} ) { print $indent . "<ol>"; for my $c ( sort { $a->{position} <=> $b->{position} } @{ +$n->{children} } ) { walk($depth+1,$c); } print $indent . "</ol>"; } $depth and print $indent . "</li>"; } else # leaf bookmark { my $link = $n->{title}; if ( $n->{fk} and $places->{$n->{fk}} and $places->{$n->{fk}}{ +url} ) { my $url = $places->{$n->{fk}}{url}; $link =~ /\S/ or $link = $url; $link = qq(<a href="$url">$link</a>); } else { $link =~ /\S/ or $link = "$n->{type}:$n->{id}"; } print $indent . "<li>$link</li>"; } } walk(0,$root);
The Perl Foundation responds to the Raku rename in Perl News
2 direct replies — Read more / Contribute
by jdporter
on Jan 10, 2020 at 13:30

    The Perl Foundation (TPF) exists to support the Perl community and all the people within our community, including the newly renamed Raku; the name change doesn’t alter the nature of our involvement or support with Raku.

    The Grants Committee will continue to accept grant proposals for Perl 5, Raku, and other Perl-family projects work as before.

    TPF will continue to encourage development of Perl and Raku events, workshops and hackathons and generally support the global communities.

    The Perl Conference (TPC) will also continue to accept presentation proposals for all Perl-family languages, including Perl 5 and Raku.

    Read the full press release.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Complex file manipulation challenge in Seekers of Perl Wisdom
4 direct replies — Read more / Contribute
by jdporter
on Aug 13, 2019 at 12:53

    One of the packages in Scaladex (Scala's equivalent of CPAN, I guess) states its motivation in the form of the following problem:

    1. List all .csv files in a directory by increasing order of file size
    2. Drop the first line of each file and concat the rest into a single output file
    3. Split the above output file into n smaller files without breaking up the lines in the input files
    4. gzip each of the smaller output files

    How would you do this in Perl?

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
New Feature: Usergroup-Private Threaded Discussions in Perl Monks Discussion
No replies — Read more | Post response
by jdporter
on Jul 01, 2019 at 13:44

    We have a new feature: usergroup-private discussion threads.

    This lets members of groups (such as pmdev) have threaded discussions, just like in the regular sections, but completely unvisible to anyone not in that user group (aside from gods, of course).

    Up until now, user groups have always used wiki nodes for intra-group discussion; but wikis are pretty suboptimal for this purpose. (They remain useful for other purposes, such as collaboratively maintained documentation.) The esteemed chromatic made such as observation way back when the concept of the wiki nodetype was first proposed:

    IMHO wikis are best suited to accumulating community resources and keeping them relevant. I do not think that for general discussion that a wiki makes more sense than the usual noding. But if a topic comes up often, summarizing it in a wiki would make sense.

    So this new feature is intended to replace the use of wikis for discussion.

    If you're a member of a user group, try going to the group's page (janitors, pmdev, breathers of fire, etc.) and see what's at the bottom.

    One main way in which these threaded discussions are different from the regular sections is that nodes are not votable and will always have reputation zero — the idea being that it wouldn't be fair for a monk to be able benefit monetarily from posts which are not accessible to the general public.

    Consequent to that, replies are always shown newest first.

    Whenever someone posts a direct reply to a group — which is essentially a top-level post under a group — it sends a message to all members of the group, something like this:

    There is a new comment on pmdev by jdporter...

    This idea was initially floated and developed in Create new [pmdev]-only section "Pmdev Discussion" and Create new [gods]-only section "Gods Forum". But note that the final implementation of the feature did not adhere to the designs suggested in those threads.

    If you're in pmdev, you can see a technical description of the implementation by visiting the new nodetype usergroupnote; scroll to the bottom to the documentation.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
    [abbr://] tests:
    • whipuptitude
    • some 'title' text
    • some 'suffix' (no 'title')
    • some 'title' (no 'suffix')
RFC: Better Best Answers Gets Real in Perl Monks Discussion
4 direct replies — Read more / Contribute
by jdporter
on May 16, 2019 at 16:50

    This is a followup to RFC: Better Best Answers

    The fundamental objective of my proposal is to eliminate the Categorized Questions and Answers section — its machinery is odd, gratuitously different from the other sections; difficult to maintain, and nobody uses it, despite its promise — and replace it with something better.

    So I have implemented part of the proposal, up to a basic level of functionality, as follows:

    It is now possible to mark root posts in the Seekers of Perl Wisdom section (hereinafter called questions) as "good", and to mark as "good" any replies (hereinafter called answers) to questions marked as "good". (To be very clear: a question can be 'good'; and a 'good' question can have 'good' answers. An answer cannot be 'good' unless its root post is 'good'.)

    Furthermore, it is possible to associate one or more tags (aka keywords) to a 'good' question.

    In most views (such as the SoPW section and threaded node views), questions and answers marked as 'good' will be displayed with a nice gold star next to the title, as well as the tags.

    There is a new section-like page, Illuminations, which lists all the tags currently in use; this view is analogous to the main page of the Q&A section. If you click on one of the tags, you get a page listing the individual questions having that tag.

    Marking a node as 'good' (which I have internally called "blessing"), and setting the keywords of a blessed node, are features accessible to the QandAEditors via their nodelet.

    Also of interest to the QandAEditors is the enhancement whereby 'SoPWify'ing a Categorized Question not only converts it to a SoPW post but marks it as 'good' and gives it a tag corresponding to the QA section it was in. An example of this effect can be seen in this post. You can see that it is 'blessed' (it has a gold star), and its tags consist of "numbers"; that's because, before conversion, it was a Categorized Question under the QandASection: numbers section.

    So that's the basic workings we have so far. There's a bit more to do before we can consider this major task done:

    • Implement tag search functionality. This should be a tweak to the extant title search functionality, so that it searches tags at the same time it searches titles.
    • Bulk-convert the extant CatQ's. (QandAEditors can do these one by one today, using the 'SoPWify!' button.)
      • When that's done, take whatever succeeding steps are necessary to "shut the section down", e.g. disabling the submission form.
    • Implement the resounding effects of blessing. Possibilities are discussed in the RFC. Don't trigger these effects for nodes converted from CatQ, however.
    • Update the QandAEditors documentation.
    • Indicate Good Questions and Answers in RAT. Or maybe not.
    • Add a nice GUI around setting and modifying blessings and tags.
    • Announce the new feature in Tidings.
    • Figure out how we'll increase the ranks of QandAEditors. Maybe import all current active Janitors and Pedagogues?

    Now my question for you, fellow monk, is:

    What do you think of this? Is it a good idea? What more could we do with this capability to make PerlMonks better?

    Further thoughts...

    I would also be concerned that QandAEditors (or whatever group is given this power) might be tempted, however subconsciously, to treat this award as a special upvote for themselves. We do not want these deputies to go casting stars on every question they like.
    Therefore, I think we should establish some requirements for a question to be eligible for the star. How about:

    • Must have at least $NORM reputation; and
    • Must be at least 3 days old.
    As I explained in the original RFC, the idea is to acknowledge and collect those questions (and answers) which have been esteemed exceptional by popular concensus.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
RFC: Hide Very Bad Answers From Visitors in Perl Monks Discussion
16 direct replies — Read more / Contribute
by jdporter
on Jul 24, 2018 at 17:10

    Following on from previous discussion on this topic...


    In the eye of the public (that is, not-logged-in visitors), the apparent quality of the site can be significantly dragged down by answers (or other replies) which are esteemed by the voting population to be notoriously poor.

    Proposed Solution:

    Within threaded views of discussions, hide from Anonymous Monk any replies with a sufficiently low negative reputation.


    In the threaded view of a post within a section such as SoPW, and within the threaded outlines displayed by RAT, any reply with a reputation below a given threshold will not be displayed. (This has the effect of hiding the entire sub-thread rooted at such reply as well.) This feature would only affect Anonymous Monk. Proposed threshold: -7.

    This would not affect any node being viewed "directly", only replies under it -- regardless of that node's type or reputation. It also would not affect root posts being shown in RAT.


    Q. I want to see every reply, even low-rep ones. Does this affect me?
    A. No, as long as you're logged in.
    Q. Ok, suppose I'm Anonymous Monk. Can I opt out of this "feature"?
    A. No, as long as you're not logged in.
    Q. Ok, then are these "very bad" replies completely inaccessible to me?
    A. No; you can still get to them via other normal means, such as Search and Super Search, and direct links.
    Q. What about in Newest Nodes? Will these "very bad" replies be hidden there as well?
    A. Not under the current plan. That's a more "raw" interface, and isn't particularly useful for visitors trying to get a view of a "question" along with its "answers".
    Q. I think a node would have to be much worse than -7 to merit this kind of treatment.
    A. That's not a question. Here's a question: What threshold value would you suggest?
    Q. This sounds like reaping but without the process. Why don't we just let the reaping process handle this problem?
    A. The criteria for reaping are fairly strict. Simply having abominable technical merit (for example) is not sufficient grounds for reaping. Yet these are not strangers to our land it may still be desirable to shield the eyes of innocent visitors from such content. That's all we're trying to do here. Once you've signed in at the front gate and picked up your meal chit, all content is laid bare, just as always, no matter how bad.

    Other thoughts on this idea? Alternative proposals?

    See my update below.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
RFC: Better Best Answers in Perl Monks Discussion
5 direct replies — Read more / Contribute
by jdporter
on Sep 12, 2016 at 17:50

    It has long been understood, and I have long felt, that the Categorized Questions and Answers section is fundamentally suboptimal in how it works from the users' perspective; and I can tell you that it would be essentially impossible to improve by a sequence of minor tweaks. What we need is a fresh start. And whatever that looks like, it should reduce the complexity of the site, not add to it. I would suggest that the QA section should be eliminated entirely, and instead have some means to identify and indicate "good questions" and "best answers" among the nodes in the Seekers of Perl Wisdom section. Here are my thoughts; please share yours.

    QandAEditors would have a way to attach a "good" flag to nodes in SoPW.

    A root post (question) so flagged would be analogous to our current "approved questions", and a reply so flagged would be a "good/best answer".

    (By procedure, but without enforcement, QandAEditors would generally only mark first-level replies as "good".)

    Monks of sufficient venerability would be given special bonus votes to help raise the reputation of worthy replies.

    Monks of Level 11 (Chaplain) and above would receive, each day, bonus votes equal to their level minus 10.
    These bonus votes can only be spent according to the following restrictions:

    • Only on replies in SoPW, not on root posts and not in any other section;
    • Only to upvote, not to downvote; and
    • Only on nodes which the monk has already upvoted.
    In effect, a Level 11 monk would get a chance, once per day, to give +=2 to a SoPW reply of hir choice.

    Ancillary to all the above, there would of course be a way visually to indicate which replies to a question were deemed "best". There may even be a reply sorting option to put best answers at the top. An option could be added to Super Search to let the user get only "best answers", if desired.

    If this proposal is enacted, then we could theatrically theoretically create a batch process to convert all of the existing Categorized Questions to SoPW posts with the "good" flag set, and their answers to replies similarly. That would fairly trivial.

    Credit goes to the author of Re^2: Threaded Monks Yodeling Modeling, for stimulating me to think more about this problem and try to come up with a potential solution.

    Why Level 11? Because any time we come up with an idea for a new "level power", I like to try to assign it to a level which currently has none. Ideally, each level would offer some new prize as an enticement. And looking at Number of Monks by Level, I see the numbers jump at level 11. For this arrangement to be worthwhile, we'd need a goodly number of monks to participate.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Gray Code in Cool Uses for Perl
2 direct replies — Read more / Contribute
by jdporter
on Jul 12, 2016 at 16:39

    I needed a quick Gray code (specifically, a binary reflected Gray code), so I whipped this up. The one CPAN module which seems to implement Gray code, Math-PlanePath is wayy too heavy for my needs.

    # returns a list of vectors of numbers in (0,1) sub gray2; sub gray2 { my($i) = @_; $i <= 1 and return([0],[1]); my @a = gray2($i-1); ( ( map { [ 0, @$_ ] } @a ), map { [ 1, @$_ ] } reverse @a ) } my @a = gray2(3); print "@$_\n" for @a;
    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Editing your writeup is now a separate action from viewing a thread and voting on replies in Perl Monks Discussion
5 direct replies — Read more / Contribute
by jdporter
on Jun 13, 2016 at 16:12

    Historically, when you view one of your writeups (e.g. a CUFP post), you are given a form right there in which to edit your post if you wish. The form fields for that were in the same form as the node voting buttons. This enabled surprising behavior, described here. Therefore, I have removed the "edit" form from the main display view of your posts and pushed it off into a separate edit page. So now, if you visit one of your writeups, you won't see an edit form right there, but you will see an 'Edit' link in the upper right.

    This change has already been in effect for about three months (as I mentioned) for certain sections — Obfuscated Code, Perl Poetry, Meditations, maybe others — and is now in effect for all sections: CUFP, PMD, Obfu, Meditations, News, SoPW, Tutorials, Inner Scriptorium, Poetry, Snippets, Code Catacombs, even Craft, as well as your replies in any section, and any posts of yours which have been thrown into the Off Topic bin.

    Update: Based on feedback from users such as BrowserUK below, I have added a user display option to have the writeup edit form directly on the display page, below the writeup, as previously. However, it is now enclosed in a separate form from the voting buttons, so that the "surprising behavior" can no longer occur.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-11-28 22:55 GMT
Find Nodes?
    Voting Booth?