This file is indexed.

/usr/share/perl5/XML/Writer/String.pm is in libxml-writer-string-perl 0.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
=head1 NAME

XML::Writer::String - Capture output from XML::Writer.

=cut

package XML::Writer::String;
require 5.004;
use warnings;
use strict;

$XML::Writer::String::VERSION = 0.1;

sub new {
	my $class = shift;
	my $scalar = '';
	my $self = bless \$scalar, $class;
	$self->value(@_) if @_;
	return $self;
}

sub print {
	my $self = shift;
	${$self} .= join '', @_;
	return scalar(@_);
}

sub value {
	my $self = shift;
	@_ ? ${$self} = join('', @_)
	   : ${$self};
}

1;

__END__

=head1 SYNOPSIS

  use XML::Writer;
  use XML::Writer::String;

  my $s = XML::Writer::String->new();
  my $writer = new XML::Writer( OUTPUT => $s );

  $writer->xmlDecl();
  $writer->startTag('root');
  $writer->endTag();
  $writer->end();

  print $s->value();

=head1 DESCRIPTION

This module implements a bare-bones class specifically for the purpose 
of capturing data from the XML::Writer module.  XML::Writer expects an 
IO::Handle object and writes XML data to the specified object (or STDOUT) 
via it's print() method.  This module simulates such an object for the 
specific purpose of providing the required print() method.

It is recommended that $writer->end() is called prior to calling $s->value() 
to check for well-formedness.

=head1 METHODS

XML::Writer::String provides three methods, C<new()>, C<print()> and 
C<value()>:

=over

=item C<$s = XML::Writer::String->new([list]);>

new() returns a new String handle.

=item C<$count = $s->print([list]);>

print() appends concatenated list data and returns number of items in list.

=item C<$val = $s->value([list]);>

value() returns the current content of the object as a scalar.  It can also be used to 
initialize/overwrite the current content with concatenated list data.

=back

=head1 NOTES

This module is designed for the specific purpose of capturing the output of XML::Writer 
objects, as described in this document.  It does not inherit form IO::Handle.  For an 
alternative solution look at IO::Scalar, IO::Lines, IO::String or Tie::Handle::Scalar.

=head1 AUTHOR

Simon Oliver <simon.oliver@umist.ac.uk>

=head1 COPYRIGHT

Copyright (C) 2002 Simon Oliver

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=head1 SEE ALSO

L<XML::Writer>, L<IO::Handle>, L<IO::Scalar>

=cut