POD Figlet titles
chanio
created: 2006-01-05 12:22:42
Perhaps, you are like me that need to see the title of the printed script in a huge format.

You don't need to have a POD written at the starting of the script. You can just have a 5-6 lines of comments after the shebang. And use it to put the script's title in figlet format.

This is what you need to do it in LINUX...

If you edit your code with SCITE, just format your comments with a monospaced font (they would read better and support figlet and ASCII-Art...)!

I made a nice example of its use while building a FREE 2006 Tree-Pad calendar. You'll need the freeware plain text editor with tabs (TreePad Lite) to use it!

  • Landlords production is only eaten by landlords...

  • [http://knopper.net/knoppix/index-en.html|Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established]
Re: POD Figlet titles
created: 2006-01-05 17:34:16

A couple minor points. First, "! -z" is more commonly known as "-n". Second, if you're running perl from the commandline anyway, use lib is usually called -I, while all other uses are called -M. And rather than dealing with lots of annoying quotes, just pass in your parameters.

figlet()
{
    local que=$1
    local fu=timesofl

    if [ -n "$2" ]
    then
        local fu=$2
    fi;

    if [ -n "$que" ]
    then
        perl -I$HOME/path/to/installed/FIGlet.pm -MText::FIGlet -e 'print Text::FIGlet->new(-f=>$ARGV[0])->figify(-A=>$ARGV[1])' "$fu" "$que"
    fi;
}
Unlike in perl where quoting a variable is a waste of time, in shell it's imperative to keep any embedded spaces unchanged. Having moved your variables from inside the perl code to purely in shell, I need to keep the quotes - but I can get rid of leaning toothpick syndrome (LTS). And then I can switch your double quotes to single quotes and now I think the whole command is much easier to look at. Personally, I would have made the whole thing just a perl script to begin with:
#!/usr/bin/perl
use lib "...";  # probably not really needed.
use Text::FIGlet;

my $figlet = Text::FIGlet->new(-f => $ARGV[1] || 'timesofl');
print $figlet->figify(-A => shift);
Of course, I'd add more comments and whatever. ;-)

perlmonks.org content © perlmonks.org and chanio, Tanktalus

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03