I'm trying to help someone with a script which uses a library called txt2html -- see http://www.aigeek.com/txt2html/ for details.
(Disclaimer: I am not able to use the canonical CPAN module for this. I know that's probably the right thing to do but I'd like to understand what's going on with this code more than I'd like to get it right, if you see what I mean.)
Despite the existence of this website, I've been unable to get his cgi-input example ( http://www.aigeek.com/txt2html/txt2html.cgi-source ) to work.
But more to the point, I don't really understand this way of doing Perl.
His library consists of many many subs, which are called by "&main()" at the bottom.
The cgi version of using this library is,
open( T, "|/path/to/lib -l /path/to/.txt2html.dict" );
print T $text;
where the "-l" is a switch and the other file is a dictionary.
I just don't understand how this "pipe" method works. That's supposed to print out to screen the contents of the variable $text, as munged by his program?
Also, any ideas as to why I can't make it work on my server? It doesn't die when I put an '|| die "$!"' after the "open" line, it just prints nothing to screen. And there is something in the $text variable, I checked.
So my questions are,
- this isn't a module, right? what is it?
- How does that pipe method work?
- I don't need to "require" or "use" anything to do it this way?
- Why doesn't it work for me, what can I check?
--
($_='jjjuuusssttt annootthheer
pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
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, details, 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, summary, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.