Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    Text::Format 0.53

    Download button

    No screenshots available
    Downloads: 367  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Gabor Egressy | More programs
    Perl Artistic License / FREE
    February 12th, 2008, 12:45 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Text::Format description

    A Perl module that contains various subroutines to format text.

    Text::Format is a Perl module that contains various subroutines to format text.

    SYNOPSIS

    use Text::Format;

    $text = Text::Format->new (
    {
    text => [], # all
    columns => 72, # format, paragraphs, center
    leftMargin => 0, # format, paragraphs, center
    rightMargin => 0, # format, paragraphs, center
    firstIndent => 4, # format, paragraphs
    bodyIndent => 0, # format, paragraphs
    rightFill => 0, # format, paragraphs
    rightAlign => 0, # format, paragraphs
    justify => 0, # format, paragraphs
    extraSpace => 0, # format, paragraphs
    abbrevs => {}, # format, paragraphs
    hangingIndent => 0, # format, paragraphs
    hangingText => [], # format, paragraphs
    noBreak => 0, # format, paragraphs
    noBreakRegex => {}, # format, paragraphs
    tabstop => 8, # expand, unexpand, center
    }
    ); # these are the default values

    �br = (foo => 1, bar => 1);
    $text->abbrevs(�br);
    $text->abbrevs();
    $text->abbrevs({foo => 1,bar => 1});
    $text->abbrevs(qw/foo bar/);
    $text->text(@text);

    $text->columns(132);
    $text->tabstop(4);
    $text->extraSpace(1);
    $text->firstIndent(8);
    $text->bodyIndent(4);
    $text->config({tabstop => 4,firstIndent => 0});
    $text->rightFill(0);
    $text->rightAlign(0);


    The format routine will format under all circumstances even if the width isn't enough to contain the longest words. Text::Wrap will die under these circumstances, although I am told this is fixed.

    If columns is set to a small number and words are longer than that and the leading 'whitespace' than there will be a single word on each line. This will let you make a simple word list which could be indented or right aligned.

    There is a chance for croaking if you try to subvert the module. If you don't pass in text then the internal text is worked on, though not modfied. Text::Format is meant for more powerful text formatting than Text::Wrap allows.

    I also have a module called Text::NWrap that is meant as a direct replacement for Text::Wrap. Text::NWrap requires Text::Format since it uses Text::Format->format to do the actual wrapping but gives you the interface of Text::Wrap.

    General setup should be explained with the below graph.
    columns

    leftMargin indent text is formatted into here rightMargin

    indent is firstIndent or bodyIndent depending on where we are in the paragraph.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    format text | Perl subroutines | Perl module | format | text | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM