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

Re: Get your Daily Tao Te Ching fix

by chanio (Priest)
on Nov 12, 2006 at 16:44 UTC ( #583573=note: print w/replies, xml ) Need Help??

in reply to Get your Daily Tao Te Ching fix


I made it more suitable to launch in Windows...

(more graphical)


As remembered later by radiantmatrix adding the following code will break the 'minimalistic' style required for adding it to cookies or other pieces of text that people use to do. It even makes the text longer... So, use it at your own discretion. Or add it as a second pipe like...
cat header.txt $(perl --today)
:) I'm sorry, radiantmatrix ... It wasn't my intention to change the spirit of your script. I should have noticed your purpose of leaving the output so alone :). I was only wanting to see it more friendly. And didn't imagine it inside another thing...
I changed the help's heading...
__.....-.. +-+-+-+-+-+ +-+-+-+ +-+-+ +-+-+-+-+-+ _,' `\ `-. |D|a|i|l|y| |T|a|o| |t|e| |C|h|i|n|g| / /['\ | \ +-+-+-+-+-+ +-+-+-+ +-+-+ +-+-+-+-+-+ .' `.:/ .' L O-----------------------------------O | ,' | | Tao Te Ching (TTC) from: | | ,---'' | | | | ,' | | ~phalsall/texts/taote-v4.html | `. | ,. / | | \ ` ,.' / | See the file license.txt after | '` _,' | first run for the GNL license. | '--. _..-' O-----------------------------------O
And added a --B-today option to show with a banner as heading... With tkmore!
sub daily_tao { my $banner = shift;## NEW OPTION TO ADD A HEADER WITH THE TITLE ... print <<HEAD if ($banner); __.....-.. _,' `\ `-. / /['\ | \ +-+-+-+-+-+ +-+-+-+ .' `.:/ .' . |D|a|i|l|y| |T|a|o| | ,' | +-+-+ +-+-+-+-+-+ | ,---'' | |T|e| |C|h|i|n|g| | ,' | +-+-+-+-+-+-+-+ +-+ `. | ,. / |p|r|i|n|t|e|r| |@| \ ` ,.' / +-+-+-+-+-+-+-+ +-+ '` _,' '--. _..-' HEAD printf "%s: %s\n%s", @{ $chapter[$day_index] }; ...
And the option...
... 'today' => \&daily_tao, 'B-today' => \&daily_tao(1), ## ADDS A BANNER ...
Then, I could also call it...
perl --B-today | tkmore -
Or in LINUX...
perl --B-today | perl -e'while (<>){print($_,$/) if ($_=~s/^/ +/ && $_=~s/[\r\n]//g)}'| Xdialog --rc-file ~/.ocrebox.rc --title="To +day's TAO" --textbox - 0 0 &
Thank you for your nice script!

I adjusted the ASCII-art to display well in my non monospaced screen....

Replies are listed 'Best First'.
Re^2: Get your Daily Tao Te Ching fix
by radiantmatrix (Parson) on Nov 14, 2006 at 16:29 UTC

    Hey, some cool additions... but the point of not jazzing it up like that is to follow the UNIX methodology -- that is, to create a program with output that others can easily consume.

    I'd rather see you either (a)abstract my script into a module and then create two scripts -- one that uses your enhancements, and one that doesn't; or (b)create a wrapper or pipe target for the output of my script to add your enhancements.

    Honestly, I'd prefer option (a), as it would be trivial, then, to create GUI front-ends and the like. Maybe I'll take that on, if you don't...

    Ramblings and references
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://583573]
[1nickt]: herveus is so weird. Love his reply in that SQLite thread! Much more effective warning system to have diverse monks debunk on technical merits...
[haukex]: IPC::System:: Simple does all the $? handling for you, and does it well
[erix]: weird problem btw (that SQLite question) - I asked astroboy to let us know if he finds the cause
[hippo]: The syntax is warning enough to me.
[1nickt]: hippo lately I can tell just by the fact that Anonymous posts a reply after some hours that it is more than likely That Monk.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2017-12-13 11:44 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (360 votes). Check out past polls.