1package Pod::Tree::Stream; 2use 5.006; 3use strict; 4use warnings; 5 6our $VERSION = '1.31'; 7 8sub new { 9 my ( $package, $fh ) = @_; 10 11 my $stream = { 12 fh => $fh, 13 line => '' 14 }; 15 16 bless $stream, $package; 17} 18 19sub get_paragraph { 20 my $stream = shift; 21 my $fh = $stream->{fh}; 22 my $line = $stream->{line}; 23 24 defined $line or return undef; ##no critic (ProhibitExplicitReturnUndef) 25 26 my (@lines) = ($line); 27 while ( $line = $fh->getline ) { 28 push @lines, $line; 29 $line =~ /\S/ or last; 30 } 31 32 while ( $line = $fh->getline ) { 33 $line =~ /\S/ and last; 34 push @lines, $line; 35 } 36 37 $stream->{line} = $line; 38 join '', @lines; 39} 40 411; 42 43