If you've discovered something amazing about Perl that you just need to share with everyone, this is the right place.

This section is also used for non-question discussions about Perl, and for any discussions that are not specifically programming related. For example, if you want to share or discuss opinions on hacker culture, the job market, or Perl 6 development, this is the place. (Note, however, that discussions about the PerlMonks web site belong in PerlMonks Discussion.)

Meditations is sometimes used as a sounding-board — a place to post initial drafts of perl tutorials, code modules, book reviews, articles, quizzes, etc. — so that the author can benefit from the collective insight of the monks before publishing the finished item to its proper place (be it Tutorials, Cool Uses for Perl, Reviews, or whatever). If you do this, it is generally considered appropriate to prefix your node title with "RFC:" (for "request for comments").

User Meditations
My Perl-ish Neo-Gavinist Manifesto
3 direct replies — Read more / Contribute
by InfiniteSilence
on Apr 01, 2017 at 16:04

    A few people sent me messages via the Message Inbox that I could see under the 'Chatterbox' heading. More than once I admit to not using this messaging feature (even when I saw messages in there for me) because I sort of hate looking at that screen.

    Clicking on it shows what I can best describe as one of the most confounding utilities on this or any other website I frequent. And it is the reason for this meditation.

    When I normally look upon it I am immediately confronted with what appear to be checkboxes selected for me. This is not helpful. It says, 'Showing messages ' and then appears a 'From' and a 'To' checkbox immediately following. It is not obvious if I am supposed to select something else and under what circumstances I would have to do so (this feels particularly pressing when there are no messages for some reason). When I experiment and click on the 'From' checkbox it does not automatically de-select the 'To' one. After some thinking about it I realize that it would show both messages from and to me. It would have been far easier to have something that allowed me to see 'All Messages' even if offering such an option would be redundant.

    The next line has yet another checkbox next to 'not' in parenthesis with yet more options: Inbox, Archive, Deleted, all with parenthesis but some with what appear to be counts. There is yet another line that reads, 'constrain by content' which is apparently some way of saying, 'filter by,' followed by the ability to additionally filter by a user box which is not even a drop down list of user identities (minimally it could contain the users who have sent me something). This text is all in the English language which means it is to be read from left to right. When my eyes dart to the beginning of a line I should never have to guess what is going to be on that line. Think about it -- when reading a book every line you read tells you, using context clues, what you are about to read next. Webpages are no different.

    Now, I know what a few of you are thinking. The Perlmonks site doesn't use JavaScript. But that is not what I am saying. What I am saying is that this form could be improved without JavaScript. It mashes things together and makes no attempt to differentiate; it presents the user with form boxes pre-filled in; the word 'constrain' is used when filter would be more clear; the buttons appear at random; some form fields do not even have labels on them; and there is even a radio option for "Don't Send At All" selected by default which probably could be done away with entirely.

    For years I would develop forms just like this one. I would say that if the user did not understand my interface it was because they were too stupid to understand it. I was wrong.

    Gavin in Gavin-ish

    The term 'Gavin-ish' does not exist. I made it up. It is a term derived from the name Gavin, for Andy Gavin, co-creator of and developer of the successful Crash Bandicoot and Jax and Daxter video games for the old Sony Playstation 2. I do not think Andy is a Perl hacker at all. One of his posts called scripting languages 'toy' languages. Andy was a Lisp enthusiast who, in his own words, forced his game developers to use his Lisp engine to develop games. His website has an entire series on this. You might be wondering why in the world I would promote such a person here on this forum. Because I think some of the things he said about producing games are relevant for developing software as a whole. It certainly changed my outlook quite a bit. Here is the excerpt from his writing that I found most compelling:

    "...This is because games are all about gameplay, and good gameplay only comes from constant experimentation with and extensive reworking of the code that controls the game's objects."

    Take away the word 'game' and replace it with 'UI experience.'

    For years I avoided learning anything but very basic HTML/CSS/JavaScript because part of me resented the UI as a whole. I normally worked on the command line or in Emacs. I had to do a lot of figuring things out -- why should my end users not have to do the same? Well, if there are any benefits whatsoever to getting older one of them must be growing tired of wasted effort. Walking on proverbial eggshells every time you work with an interface is a sign that it is poorly designed. The whole point of a UI is to help the user avoid making mistakes. Organization of like things, spacing, grouping, color, and other tools all help make the user aware of what is to be done. None of those things require JavaScript.

    Manfest-o

    So in my quest to be a better coder I've started subscribing to this Neo-Gavin-ist philosphy (Neo because Andy is a Lisp and perhaps now a Ruby coder and not a Perl one). I now believe that UI design is about clarity and exhibiting both thoughtfulness and an assurance that a user's actions will result in proper/predictable outcomes.

    Consideration for things like spacing and grouping are not optional and must be used judiciously; size, color, emphasis, and even font choices are all relevant. Useless things should be removed (for instance, empty parenthesis...?) to enhance clarity. Rework of this type and kind Andy used to make some truly revolutionary games despite seemingly fantastic obstacles (memory constraints, unhelpful equipment vendor, etc.) and the same should be the goal for any UI.

    Granted, most of us are not making games. True, this type of rework takes time unless you have tools that do a lot of the heavy lifting for you. But doing nothing is just that and has a predictable and undesirable result. We can do better.

    Join my movement. Agree that UIs must subscribe to the philosophy of constant experimentation and rework for improvement irrespective of whether the underlying language is Perl or some other. Then develop better UIs, toolkits in Perl to make it easier to crank them out, and share your comments on this here.

    Celebrate Intellectual Diversity

Improve pipe open?
1 direct reply — Read more / Contribute
by afoken
on Apr 01, 2017 at 11:17

    A small meditation started by Ssh and qx


    Intro

    Let's face it: qx is evil, as soon as you want to reliably pass arguments to a program. And it's not necessarily perl's fault. Blame the default shell. Luckily, perl has multi-argument pipe open since 5.8.0:

    open(my $pipe,'-|','/usr/local/bin/foo','bar','baz','1&2>3') or die "C +an't start foo: $!"; my @output=<$pipe>; close $pipe or die "Broken pipe: $!";

    It's so easy. Granted, it takes two more lines than qx, but we got rid of the default shell. And that two extra lines could easily be wrapped in a function:

    my @output=safe_qx('/usr/local/bin/foo','bar','baz','1&2>3');

    But, of course, that would be too easy to be true. Why can't we have nice things?

    Three-argument pipe open gets the nasty default shell back into play:

    > perl -E 'open my $pipe,"-|","pstree --ascii --arguments --long $$ 1> +&2" or die $!;' perl -E open my $pipe,"-|","pstree --ascii --arguments --long $$ 1>&2" + or die $!; `-sh -c pstree --ascii --arguments --long 22176 1>&2 `-pstree --ascii --arguments --long 22176 >

    Now what? We could resort to my favorite part of perlipc, "Safe pipe opens". 15 to 28 lines of code just to safely start an external program, and all of that only because perl wants to be clever instead of being safe.


    How to fix it

    Let's make multi-argument pipe open clever.

    system and exec have the indirect-object-as-executable-name hack to prevent the default shell mess. Applying that to open might be possible, but still looks quite hacky:

    open $list[0] my $pipe,'-|',@list or die "Can't open pipe: $!";

    No! Just no!

    So, do we really need to specify the executable twice? We usually don't want to lie to the target program about it's name. It might be useful to make a shell think that it's a login shell, but then again, that can also be done by passing an extra argument. No, we don't want to lie to our child process. If backwards compatibility was not a problem, we could simply disable the shell logic for any pipe open with more than two arguments. But for backwards compatibility, we can't do that. We need is a flag to disable the shell logic.

    My first idea was to just double the dash in the MODE argument:

    ModeActionUsage of default shell
    -|Read from child's STDOUTenabled for three argument open,
    disabled for more than three arguments passed to open
    (legacy mode)
    |-Write to child's STDIN
    --|Read from child's STDOUTdisabled
    |--Write to child's STDIN

    But we still can do better: A single bit is sufficient for a flag. + is already used in MODE, but not in combination with the pipe symbol. So let's use + instead of - to disable the default shell:

    ModeActionUsage of default shell
    -|Read from child's STDOUTenabled for three argument open,
    disabled for more than three arguments passed to open
    (legacy mode)
    |-Write to child's STDIN
    +|Read from child's STDOUTdisabled
    |+Write to child's STDIN

    Yes, I'm aware that the difference between "+" and "-" in ASCII is two bits.


    Update:

    For a better mnemonic (ls -f uses "*" to indicate an executable file), we could use "*" instead of "-" to disable the default shell and specify the executable file in the third argument:

    ModeActionUsage of default shell
    -|Read from child's STDOUTenabled for three argument open,
    disabled for more than three arguments passed to open
    (legacy mode)
    |-Write to child's STDIN
    *|Read from child's STDOUTdisabled
    |*Write to child's STDIN

    Thanks to huck and hippo for finding two missing quotes.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
#p5p finds your lack of failing tests disturbing
3 direct replies — Read more / Contribute
by Corion
on Mar 27, 2017 at 13:42

    5.26 will come with a major change in how Perl builds and runs modules. The current directory will not be in @INC when running Perl programs.

    This affects all programs that call require or use and expect files relative to the current directory to be available. Besides plugin systems, any Makefile.PL using for example Module::Install is a likely offender. So far very little has been caught in the net of CPAN testers.

    As an example, one of my tests loads Makefile.PL:

    use lib '.'; use vars '%module'; require 'Makefile.PL'; # Loaded from Makefile.PL %module = get_module_info(); my $module = $module{NAME};

    This will fail under 5.26+ without the use lib '.'; statement at the top.

    I've altered @INC, pray I do not alter it further

    If you want to check whether your modules should still work and test OK under the upcoming 5.26 release, I think that the following oneliner should give you a good indication:

    perl -M-lib=. Makefile.PL && make && make test

    If you run author tests or prefer your tests to be run using prove, you have to take care of prove invoking a fresh Perl:

    # Windows syntax: set PERL5OPT=-M-lib=. perl Makefile.PL && dmake && prove -bl xt t
    @rem Shell syntax: export PERL5OPT=-M-lib=. perl Makefile.PL && make && prove -bl xt t

    Please test your distributions and release new versions if they need . in @INC. Thanks!

    Update: Added call to action and noted where use lib '.' helps.

[OT] Thoughts on Ruby's new absent operator?
5 direct replies — Read more / Contribute
by perlancar
on Mar 24, 2017 at 07:22
    Dear monks,

    Any thoughts on Ruby's new absent operator in its regular expressions (Hacker News thread)? Looks nifty to me and lets one specify more succinctly in some cases, although the things that it do can be done via other means.

Using PerlPod Creatively
4 direct replies — Read more / Contribute
by samijoseph
on Mar 24, 2017 at 03:21

    Hi,

    I am interested to understand what this guy did, but i am unable to, can someone please break it down to a newbie

    I've spent the last several days at work, trying to "take over" some work left behind by a departing colleague. I realized we didn't have some of his bash scripting in ansible or in a repo, so I decided this would be a good opportunity to fix all of those problems. After a little while it became clear his script was a set of functions, run in a loop-within-a-loop to iterate through a bunch of things. In the middle, between these two loops, is a pile of inline *PERL* that runs as a bash function and passes data back and forth in all directions. This Perl generates some dynamic SQL commands each loop.

    I hate SQL.

    Okay... read the Perl. Now, it's been a long time and a long way since my last string of PERLs, so i didn't really grok 100% what I was reading, but I got the gist of it. Finally figured out the SQL wasn't the problem.

    Another day goes by, and I finally figure out his code is self documenting! That was what all the little bits were in the perl I didnt get. PerlPod. So now I can figure this out easy . Run it, read the code, make a change, run it... *boom* what?

    Nope.

    It took me several more hours and a few beer, and it finally clicked. He was using PerlPod to document out the code he didn't want to run, and commented out the documenting code to run the code he wanted. What looked commented out, wasn't, and what looked like a pile of variables being set, was just a bunch of commentary. He was using a documentation module for *flow control*.

    What a Hacker. Holy shit. Blew. My. Mind.

    I just got schooled very seriously. It's nice to know I can still improve *that much*, even from where I am.

    When PerlPod is used to document something, anything between control codes is not interpreted but treated as commented text. He would comment out the control codes (thus rendering the text interpretable) on the parts meant to run, which would differ between machines.

OT: Got fired this week
15 direct replies — Read more / Contribute
by karlgoethebier
on Mar 23, 2017 at 05:43

    As i'm aged 60 + i guess i'll never get a new job. I think i need to face retirement. I first thought to delete my account on PM and through away all the code i ever wrote as well as my hand library and forget about everything related to programming. But it isn't so easy. I spent the last 20 years with this stuff. I'll stay a bit here - for fun. And perhaps i'll learn a new programming language ;-)

    Update: What should i say? I'm deeply moved. Thank you very much to all for encouragement and good advice.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    Furthermore I consider that Donald Trump must be impeached as soon as possible

What is a troll?
7 direct replies — Read more / Contribute
by trippledubs
on Mar 21, 2017 at 05:57

    Trolling is very powerful. It does not fool many here, but it CAN fool the unwary. Information is becoming consumed as such a fast pace that it becomes scary. Ideas are very powerful, but elders and young people must learn to build their character, use logic to question their own bias, work very hard to embrace change peacefully. Violence scares me because I'm a veteran and have seen what it can do. I will not take for granted that it can not happen here, but I will also not let fear rule my life. When it is used, must be used morally for self defense only. Many may question if to use this tool for selfish purposes during the coming years. The answer is no.

    I can not know if our leaders are moral, but people lose faith in their credibility anyways because they can not question them for themselves. Social contract is very important idea, but the future is here and social contracts are made with web sites, gives people a sense of belonging, and COMMUNITY is very important concept. But one must choose to belong in online communities that promote moral behavior.

    Question the rules, especially demagougery, embrace change peacefully. I think how stupid this game is, agree that it is just a list on the internet, but what if the desire to become on this list could show one 5 year old terrorists mind to learn perl instead of bomb making? Or show someone who was just fired; do this in the mean time and not worry too much. Your quality of life may suffer, but you can still belong to a community that values you. What certainly is true is that information can trigger a fight or flight mechanism in people. This scared me but, easily harnessed, just go exercise. Learn value of this game in US Military Monastery.

    A troll is someone who spreads fear, has no character to resist impulses, does not vote on evaluation of content, uses bias to marginalize others ideas instead of defeating them through reflection using logic, not ignore, this is bad way to defeat. There are many demagogues in the world that teach stupid ideas, people embrace them because they are scared, have little hope.

    I have studied in this school for 5 years, and it is my favorite online community! I would keep it sharp, use my talents to make it grow, make sure value is recognized. I think this xp game will be taken more seriously by millennials than you think. I also think pm will survive many efforts at marginalization, and I think perl will too. Because it is a great tool and there are years of evidence in the Monastery so people can judge for themselves. It is not which tool that is important as long as the tool you pick up is not used for violence|hacking.

Anyone using the new Test2 framework?
No replies — Read more | Post response
by stevieb
on Mar 19, 2017 at 16:56

    Quick opinion-related question on a slow, test-writing Sunday afternoon.

    Has anyone dabbled with the new Test2 framework at all? Are you using it in your CPAN and/or production projects?

    If so, what are your thoughts about it, and what are the pros/cons you've found so far?

Ayn Rand vs. Stewart Brand
5 direct replies — Read more / Contribute
by nysus
on Mar 13, 2017 at 17:48

    Let the flame wars begin! Everything is political, even programming languages. So why not discuss it?

    I came of computing age in the early 90s in the Bay Area when the WELL was still a big thing (granted I never got on the [I|i]nternet proper until '95 and stuck only to BBS networks). Back then there was still a strong whiff of hippie counter-culture around. Though I never met the man and know next to nothing about him personally, it's fairly obvious that Larry Wall is a product of that culture and the guiding light behind Perl culture in general. I could be wrong (and I'm not well versed on this topic so I may very well be), but my impression is that his guiding philosophy is part of the same mindset spawned by Stewart Brand and the WELL network Brand helped to found.

    As younger coders come along, I get the strong sense there is a distinct shift away from these roots and toward a more Ayn Randian philosophy, largely adopted by younger Silicon Valley venture capitalists which appears to be trickling down to its workforce. This adoption of Randian politics has been noted in the press such as this article.

    This post is not meant to be a criticism of this change, but more of an observation (with a disclaimer that being a very early 70s born gen-xer, I definitely have more sympathies with the hippie culture). Being a lone wolf, I don't come into any contact at all with other programmers so I don't get to see any of this firsthand. So I'm wondering how others more steeped in Perl culture worry–or not worry–about this change and I also wonder just how large of a change there is, especially within the Perl community. How much do you think Perl's success is owed its founding culture and what happens to Perl as the older programmers fade away? Does Perl stand a chance in a culture where only alpha dogs matter?

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Yet Another Appeal for Civility
8 direct replies — Read more / Contribute
by perldigious
on Mar 10, 2017 at 10:45

    Can't we all just get along?

    Apparently not, but can't we at least all make a more concerted effort? I've always seen the monastery as pretty good at this, especially relatively speaking in regard to the internet in general, but that doesn't mean it can't be better. Note my intention isn't to call out any specific monk here, the linked example is just that, an example of what I mean. Tone matters... a lot. Comments shouldn't be discouraged, that's not what I'm saying, but a comment with the exact same message and a different tone can be changed from a perceived personal attack to a helpful suggestion. That's inherently more productive. My favorite node put it far more clearly, succinctly, elegantly, and humorously than I ever could.

    I'm quick to make a joke, probably because I'm one of those psychologically damaged people who uses humor as a defense mechanism and attempted means of validation to the group... guilty. :-) But even when I'm inclined to do so, I always try to stop and ask myself if I'm just going to end up being this guy. You'll all have to take my word for it when I say I decide not to post a potentially offending quip far more often than I decide to post one. That's especially true if I feel someone is going to take it as a personal attack, though I admit I'm far from perfect in my execution. Oh great Saint Erudil give me strength and guidance.

    This is just food for thought, and yet another such post for appeal to civility to be read and quickly forgotten. Remember, "What should it profit a man, if he should win a flame war, yet lose his cool?" :-)

    UPDATE: TL;DR - An overly idealistic perldigious sings for peace in to the microphone. Some more experienced and realistic Monks quietly pull him aside and remind him that you can't expect all people to play nice. Oh, and please forgive me if I insist on futilely preaching to mental patients, criminals, terrorists, or even just the wind every now and then if it makes me feel better. :-)

    Just another Perl hooker - And definitely not the kind with any $class whatsoever.
Testing from vim
No replies — Read more | Post response
by Anonymous Monk
on Mar 08, 2017 at 15:25
    For some reason a few people here think that you need more than
    !prove -lr
    
    This is all you need to run your test suite from vim.

    The -l option is used to include your lib/

    The -r option is used to find all tests in any children directories inside t/.

    It really is just that simple. Furthermore, this is Universal, unlike using a wrapper and mapping actions to some vim command.

A recipe for testing and debugging with vim
2 direct replies — Read more / Contribute
by nysus
on Mar 07, 2017 at 21:10

    I've patched together some vim scripts, a vim plugin, tmux, perl modules, and a three-line bash script to create an efficient way of running and debugging my code with minimal effort. I thought I'd share and get some feedback and maybe others will find this useful, too. As easy as this is to get set up, it took me a lot of trial and error to get right so hopefully I will save some of you out there looking to do something similar a lot of pain and aggravation. And, yes, I realize there are other vim plugins for this task but none of them satisfied my exact needs (especially the syntax highlighting) or they came with lots of other baggage I didn't want or need. Plus, I wanted to get more familiar with vim so I decided to roll my own.

    Note: I don't believe this will work with gvim because this solution relies on tmux, a terminal-based program.

    Synopsis

    With a *.t test file open in vim, hit <F7> (without even having to save first!) to run a prove command on your test. The output of the test gets opened in a new tmux pane (Pane B) to the right of my vim window. As the test runs, you can still edit your file since output of the test is in a tmux pane. The other advantage to seeing the live output of prove is that it gives your peace of mind that your script is actually working while also getting a rough gauge on which parts of the code are slow or if your script is stuck in some infinite loop. Mixed in with prove's output are messages generated by the Log4perl module (trace, debug, info, etc. statements). Once the script finishes running, prove's raw output in Pane B gets replaced with a new vim session which pulls in prove's output that was saved using prove's --archive option. The reason for re-displaying prove's output in vim is so you can have it syntax highlighted to a high degree to help you pick out the relevant files and line numbers where errors occurred, as well as easily pick out debug information and other useful output. After the test script's output gets loaded into vim, focus is automatically returned back to your test file in the pane on the left. Once errors and warnings are fixed up, you can code some more and then hit <F7> again to start the process over.

    Ingredients needed

    • vim text editor
    • tmux terminal multiplexer
    • log4perl module (optional)
    • Test::More module plus other test modules you may desire
    • A simple bash script
    • simple vim scripts that go into the .vimrc file
    • tmuxify vim plugin
    • vim file for syntax highlighting of test output
    • A wide monitor to accommodate a wide terminal window (optional)

    I won't go into any detail on getting any of these components installed or how they work. Google is your friend.

    vim config

    Here are the needed lines to get your vim files working with the tmuxify plugin once it's installed. Replace <your_home_directory> in the last line with something suitable for your machine. If you don't have a wide terminal, or want your output to appear along the bottom of the your test script instead of next to it, change the -h in the third line to a -d.

    nmap <F7> :w<CR>\mk:q!\ms<CR>\mq\mr imap <F7> <ESC>:w<CR>\mk:q!\ms<CR>\mq\mr let g:tmuxify_custom_command = 'tmux split-window -h' let g:rel_file_name = @% let g:tmuxify_run = { 'perl': '<your_home_directory>/run_tests.sh ' . +g:rel_file_name }

    vim syntax highlighting file

    This is what makes the output of your test code super readable. In your .vim directory, create a new directory called syntax (if it doesn't already exist) and place the following code into a file called test.vim. You can, of course, tweak and improve this to your liking. I am not an expert at vim syntax highlighting so this can probably be improved and definitely shortened a great deal.

    syn match Good "^ok " syn region okline contains=Good start="^ok" end="\n" syn match builder_line "Builder\.pm line \d\+\." syn match lineno "line \d\+\.*\n" syn match line_no "Line \d\+\:" syn match error_msg "^# \t.*at"hs=s+3 syn match perl_lib "perl_lib\/.*\.pm"hs=s+9 syn match file " at [^\/]\+\.p[ml] "hs=s+3 syn match subtest_file "^\s\+#\s\+.*at .*line \d\+\.\n"hs=s+5 syn match test_file "\/[^\/]\+\/t\/.*\.t "hs=s+1 syn match my_error "^[^(ok |not ok |#)].*line \d\+\.\n" syn region not_ok_subtest contains=subtest_file start="^\s\+not ok \d\ ++" end="^\s\+#.*expected.*\n" " end="^\s\+#.*line \d\+\.\n" syn region Bad contains=warning start="^not ok " end="^\ze[^#]"re=e-1, +he=e-1 syn region warning contains=test_file,file,lineno,perl_lib,error_msg,b +uilder_line start="^#\s\+Failed" end="^\ze[^#]"re=e-1,he=e-1 syn match comment "^#.*\n" syn match premature "^# Looks like.*\n" syn region dump start="$VAR\d\+\s=\s"rs=s-1 end=";\n" syn match divider "----*" syn match warn 'WARN\|ERROR' syn match script contains=warn '[A-Z]\{4,5}.*> ' hi Good cterm=bold ctermfg=Green hi divider cterm=bold ctermfg=yellow ctermbg=black hi dump ctermfg=LightBlue hi okline ctermfg=Green hi warning cterm=none ctermfg=Red hi my_error cterm=none ctermfg=Red hi premature cterm=none ctermfg=Red hi failed cterm=none ctermfg=Red hi Bad cterm=bold,underline ctermfg=Red&#9251; hi comment ctermfg=Cyan hi lineno ctermfg=White hi line_no ctermfg=White hi file ctermfg=White hi test_file ctermfg=White hi perl_lib ctermfg=White hi error_msg ctermfg=Green hi builder_line cterm=none ctermfg=Red hi not_ok_subtest ctermfg=Red hi warn ctermfg=Red hi subtest_file ctermfg=White hi script ctermfg=White

    Bash script

    This simple script gets run by tmuxify when you hit the <F7> key. Call the file run_tests.sh and place it into the home directory on your machine (the same directory referenced in the .vimrc file above.

    prove --merge --normalize -v $1 -a test.tgz vim -nR -c ":silent 0read ! tar xfO test.tgz $1" -c ':set nonumber' -c + ':syntax sync fromstart' -c ':set syntax=test' -c ':silent !tmux se +lect-pane -L' !!! PUT A BLANK LINE HERE !!!!

    Note that the 3rd line should be a blank line. For some reason, it seems to be needed to avoid having to hit the return key after the last command is run. And don't forget to chmod the bash file to make it executable.

    Other good stuff

    You will of course need to make sure your test file has use Test::More at the top of the file. Also, I highly recommend the log4perl module to help sprinkle your output with helpful debug output and other useful information that will help you keep track of what your code is doing and how it is behaving.

    That's it. Happy testing and debugging!

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

RFC: My first GitHub contribution
1 direct reply — Read more / Contribute
by dollar_sign
on Mar 05, 2017 at 17:34

    Hi there everyone, I made my first contribution to an open source project today. Well, to be honest, the project was just a list of links and the contribution was just a script that most of you could have hacked together in 10 minutes... But I felt really good about it :D.

    Why did I make this script?

    I am a frequent visitor of the programmer discord server, which is a discord server for programmers (surprise, surprise). This server was started by a couple of programming enthusiasts over at reddit. It has grown out to a huge community of 5000+ programmers, with at least 1000 programmers concurrently online at any time of the day to discuss programming with and to get real time support from when you get stuck. One of the channels on this server is titled Collaborations-and-projects, and someone posted there that he had made a list of resources for people who want to learn about programming/computer science. The only problem was that now that he had made this list, it was going to be a huge pain to sort all of the resources by name in alphabetic order per category. To which my response was, of course, "THIS IS A TASK FOR PERL". So I asked for the link to his GitHub repo, put this script together, and let it run through all of the files in the repo, after which I committed all the changes.

    links I would like to share

    • The link to join the programmer discord: https://discord.gg/9zT7NHP At the moment there is no Perl channel there yet, and when I asked why, they told me there was no interest!! So please, if you feel like it, join the server so that there is yet another place to discuss Perl in this world :)
    • The link to the GitHub repository I contributed to: https://github.com/TumblrCommunity/coding-masterpost

    Now, as I am pretty new to Perl (and just started programming this year) and I'm sure that my code is pretty clunky because of that, I figured that it might be a good idea to ask for some comments on the first 30+ line program I have ever written in Perl. Are my comments on point for example? Should I comment more/less? And could my code have been shorter? Please feel free to criticize every single character and white space in my script! It won't hurt me (much).

    First I'll give you an idea of the way the files are formatted; The <> tags are not in the real files!

    # <CATEGORY HEADER> [<name of resource>] (www.hyperlink.com) some text about the resource [<name of resource>] (www.hyperlink.com) some text about the resource [<name of resource>] (www.hyperlink.com) some text about the resource #<HEADER OF NEXT CATEGORY> [<name of resource>] (www.hyperlink.com) some text about the resource [<name of resource>] (www.hyperlink.com) some text about the resource

    Now my $code:

    Don't mind me, just another IT student wandering around the monastery in awe of its wonders.
Resolving issues while installing Net::SSH2 on Ubuntu 16.04.2
1 direct reply — Read more / Contribute
by pritesh_ugrankar
on Mar 04, 2017 at 09:28

    Hi,

    I wanted to try out plenv and install modules without "disturbing" system perl. Followed the instructions and plenv installed without any issues. While installing the Net::SSH2 modules, I kept getting errors. The steps given below are for those who might face similar issues. Hope someone here finds it helpful.

    Apologies if this is posted in wrong section. Just wanted to post this to help those who might be in a similar situation

    Before you install Net::SSH2, install the following:

    sudo apt install libssh2-1-dev sudo apt install openssh-server sudo apt install zlib1g-dev

    Once these are installed successfully, then proceed with installing the Net::SSH2 module. Since I had earlier installed plenv, it seems to have installed cpanm in my home directory as shown below.

    pritesh@thinkpad:~$ which cpanm /home/pritesh/.plenv/shims/cpanm pritesh@thinkpad:~$

    Then I simply installed Net::SSH2 using the following command

    cpanm Net::SSH2

    Then just to see if all is well, I ran the following command

    pritesh@thinkpad:~$ perl -e "Net::SSH2" pritesh@thinkpad:~$

    Updated as per the error pointed out. Thanks.

    pritesh@thinkpad:~$ perl -e "use Net::SSH2" pritesh@thinkpad:~$

    Indeed all is well.

    Note:- Big thank you to the Strawberry Perl folks. While on Windows, I was using Strawberry Perl and installing a module was trivial. Only upon trying to install the Net::SSH2 module on linux did I understand how much care the Strawberry Perl folks have taken to make things work on Windows.

    Unfortunately I will not be able to go back to Windows on this laptop. After upgrading the RAM, Windows would not boot. Reinstalling the OS also did not help and I kept getting random blue screens, both with Windows 7 and 10. Memory tests ran all fine. So tried Ubuntu 16.04.2 and it seems to have no issues.

Pie Explosion
3 direct replies — Read more / Contribute
by jmlynesjr
on Feb 28, 2017 at 13:15

    The February 2017 issue of Circuit Cellar magazine includes an interview with Eben Upton the head of the Raspberry Pi Foundation.

    The key factoid is that they are shipping 300,000 to 400,000 units per month. A possible large audience for Perl and wxPerl.

    Are there any RPi/Perl books in the works?

    James

    There's never enough time to do it right, but always enough time to do it over...


Add your Meditation
Title:
Meditation:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":


  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.