in reply to Re: endless loop in Pod::Spell?
in thread endless loop in Pod::Spell?
##!/usr/bin/perl -T package MySpell; =head1 NAME =head1 THE EMAN =head1 THENAMEISLONGANDLONGITSLONG thename =cut use Pod::Spell(); @ISA = qw' Pod::Spell '; use strict; use warnings; sub warp(@) { my( %carettable ) = ( map { chr($_) => '^'.chr(64+$_) } 0 ..31 ); my (@f) = @_; for my $f (@f) { $f =~ s/([[:cntrl:]])/$carettable{$1}/g; } print @f, sprintf qq! at %s line %d.\n!, (caller)[ 1, 2 ]; } sub _treat_words { my $p = shift; my $i = 0; my $word = ""; while ( $_[0] =~ m<(\S+)>g ) { ++$i; $word = $1; warp "i($i)word($word) 1($1)"; if( $i > 2){ warp "Bailing out i $i"; last; } } } package main; MySpell->new->parse_from_file( __FILE__ ); __END__ perl temp.pl perl -T temp.pl D:\> D:\>perl temp.pl i(1)word(NAME) 1(NAME) at temp.pl line 40. i(1)word(THE) 1(THE) at temp.pl line 40. i(2)word(EMAN) 1(EMAN) at temp.pl line 40. i(1)word(THENAMEISLONGANDLONGITSLONG) 1(THENAMEISLONGANDLONGITSLONG) a +t temp.pl line 40. i(1)word(thename) 1(thename) at temp.pl line 40. D:\>perl -T temp.pl i(1)word(=^@9^@) 1(=^@9^@) at temp.pl line 40. i(2)word(NAME) 1(NAME) at temp.pl line 40. i(3)word(NAME) 1(NAME) at temp.pl line 40. Bailing out i 3 at temp.pl line 42. i(1)word(THE) 1(THE) at temp.pl line 40. i(2)word(THE) 1(THE) at temp.pl line 40. i(3)word(THE) 1(THE) at temp.pl line 40. Bailing out i 3 at temp.pl line 42. i(1)word(THENAMEISLONGANDLONGITSLONG) 1(THENAMEISLONGANDLONGITSLONG) a +t temp.pl line 40. i(2)word(THENAMEISLONGANDLONGITSLONG) 1(THENAMEISLONGANDLONGITSLONG) a +t temp.pl line 40. i(3)word(THENAMEISLONGANDLONGITSLONG) 1(THENAMEISLONGANDLONGITSLONG) a +t temp.pl line 40. Bailing out i 3 at temp.pl line 42. i(1)word(thename) 1(thename) at temp.pl line 40. i(2)word(thename) 1(thename) at temp.pl line 40. i(3)word(thename) 1(thename) at temp.pl line 40. Bailing out i 3 at temp.pl line 42. D:\>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: endless loop in Pod::Spell?
by Anonymous Monk on Mar 17, 2009 at 10:35 UTC |