~ubuntu-branches/ubuntu/trusty/libpod-simple-perl/trusty

« back to all changes in this revision

Viewing changes to lib/Pod/Simple/DumpAsXML.pm

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2012-06-02 19:46:46 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120602194646-snwch2m75wjvyua9
Tags: 3.22-1
* New upstream release.
* Remove patches, all applied upstream.
* Update years of packaging copyright.
* Add debian/NEWS mentioning a compatibility change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
require 5;
3
3
package Pod::Simple::DumpAsXML;
4
 
$VERSION = '3.20';
 
4
$VERSION = '3.22';
5
5
use Pod::Simple ();
6
6
BEGIN {@ISA = ('Pod::Simple')}
7
7
 
8
8
use strict;
9
9
 
10
10
use Carp ();
 
11
use Text::Wrap qw(wrap);
11
12
 
12
13
BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG }
13
14
 
49
50
    my $indent = '  ' x $_[0]{'indent'};
50
51
    my $text = $_[1];
51
52
    _xml_escape($text);
52
 
    $text =~  # A not-totally-brilliant wrapping algorithm:
53
 
      s/(
54
 
         [^\n]{55}         # Snare some characters from a line
55
 
         [^\n\ ]{0,50}     #  and finish any current word
56
 
        )
57
 
        \x20{1,10}(?!\n)   # capture some spaces not at line-end
58
 
       /$1\n$indent/gx     # => line-break here
59
 
    ;
60
 
    
 
53
    local $Text::Wrap::huge = 'overflow';
 
54
    $text = wrap('', $indent, $text);
61
55
    print {$_[0]{'output_fh'}} $indent, $text, "\n";
62
56
  }
63
57
  return;