[za-pm] Text::Format

Anne Wainwright anotheranne at fables.co.za
Thu Aug 30 06:00:52 PDT 2012


Hi, Francois,

that looks like a great one-liner!

... but that isn't the only problem, only the one problem remaining
after the others have been solved which is why I used the Text::Format
module. I have got all sorts of things cooked up in the modules options.

I get my output delimited from my postgresql database (it was you that
recommended that years back, right?) and my script processes that
and gives me near-catalogue format. I'll tweak that when I have solved
this to give me html and tex formats too.

So I don't see that I can put a one liner in the module, but I'll give
it a whirl this evening, expecting that it will wreck the neat output of
the Text::Format module :) - on the outputted file, that is.

thanks to all for all the input. if I can't get it to work then I'll
try one of the larger perl sources. will keep you posted.

Anne

On Thu, Aug 30, 2012 at 10:25:38AM +0200, François Marais wrote:
> Note: Beware! Default reply-to is to the list.
>
>
> Hi Anne
>
> If the only problem you are tackling is breaking lines between isbn and  
> following number, then surely a simple substitute will suffice?
>
> echo 'isbn 23987
> isbn
> 98777
> isbn
> 239487
> isbn 293487
> ' |perl -p0e's/isbn\s*[\x0d\x0a]*\s*(\d+)/isbn $1/gs'
> isbn 23987
> isbn 98777
> isbn 239487
> isbn 293487
>
> (to be adjusted according to relevant line feed carriage return situation)
>
> Regards
>
>
>
>
>
>
> On 29/08/2012 21:53, Anne Wainwright wrote:
>> Note: Beware! Default reply-to is to the list.
>>
>>
>> Hello,
>>
>> I am using the Text::Format module. It works well but I cannot get any
>> mileage out of one feature. I'll append the section from the pod file
>> here:
>>
>> The module will take text input from whererever and format it in various
>> ways designed to suit any conceivable need.
>>
>> This option is in this case is to  prevent breaking of a line of text at a
>> sensitive point.
>>
>> In my case i dont want to break "isbn 123456789" leaving "isbn" at the
>> end of the line and "123456789" at the start of the next.
>>
>> ------------------------------
>> noBreakRegex \%HASH || NOTHING
>>             Pass in a reference to your hash that would hold the regexes
>> on
>>             which not to break.  Without any arguments, it returns the
>> hash.
>>             eg.
>>
>>                 {'^Mrs?\.$' =>  '^\S+$','^\S+$' =>  '^(?:S|J)r\.$'}
>>
>>             don't break names such as Mr. Jones, Mrs. Jones, Jones Jr.
>> -------------------------
>>
>> this isn't really a regex query, but just to note that the above seems a
>> little weird with "Mrs" sandwiched between both start of line and finish
>> of line anchoris. Still I can make my regex to suit if that is what is
>> needed.
>>
>> So I have the following to get my regex into a hash:
>>
>>      my  %regx = ('^isbn$'=>'^[0-9]{9,13}X?$');  # my regex
>>      $text->noBreakRegex(\%regx);  # this sets the option
>>
>> Well we compile, but I have isbn breaks all over. All reasonable and
>> many unreasonable changes have no effect except to break the script.
>>
>> Any ideas welcome, please.
>>
>> Anne
>>
>> PS. I am using the Padre IDE now.
>> _______________________________________________
>> Za-pm mailing list
>> Za-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/za-pm
>>
>> posts also archived on Mail Archive
>> http://www.mail-archive.com/za-pm@pm.org/
>
> _______________________________________________
> Za-pm mailing list
> Za-pm at pm.org
> http://mail.pm.org/mailman/listinfo/za-pm
>
> posts also archived on Mail Archive
> http://www.mail-archive.com/za-pm@pm.org/


More information about the Za-pm mailing list