On Jun 12, Brennan, Corey said:
>I am trying to convert a script to Perl/Tk and I am having trouble. I have
>some formats defined
I've no clue how you'd get formats to write() to a Tk widget... you'd have
to use formline() and the $^A variable, methinks.
But have no fear -- I'm in the process of writing a format-to-sprintf
module that will allow you to convert your use of formats (which are
becoming more and more ancient) to more understandable (?) and
maintainable (!) sprintf() calls.
>format DATA_OUT_TOP =
>col1 col2 col3
>---------------------------
>.
This would look like:
sprintf << "END";
col1 col2 col3
---------------------------
END
>format DATA_OUT =
>@||||| @||||| @||||||
>$text $text1 $text2
>.
This would look like
sprintf << "END",
%6.6s %6.6s %7.7s
END
center($text,6), center($text1,6), center($text2,7);
Like so. The center() call is only needed because there is no
sprintf() means for centering, but there are for left and right aligning.
I might even make it so that you can make the sprintf() which is called
internally, not by the user, to know centering, via something like
%|6.6s
Default string alignment is to the right, and to get left-alignment, you'd
use -6 (or whatever number).
More news as the module develops.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **