SVN::Dumpfile::Node::Content - Represents the content of a node in a subversion
dumpfile.
Objects of this class are used in SVN::Dumpfile::Node objects. For normal
dumpfile operations this subclass is an implementation detail. Some scripts
however might need to use methods of the class directly.
use SVN::Dumpfile; # or use SVN::Dumpfile::Node:Content;
$df = new SVN::Dumpfile ("filename");
$node = $df->read_node;
my $content = $node->content;
# Saves or loads content to file:
$content->load('filename');
$content->save('filename');
The stringification operator '""' is overloaded to call
as_string(). So the following two lines give identical results:
"text " . $content->as_string() . " text"
"text $content text"
Please note that the content can include binary elements.
- new()
- Returns a new SVN::Dumpfile::Node::Content object. A initial content can
be given as argument.
- exists()
- Returns true if there is a defined, not empty content.
- delete()
- Deletes the content of the object (but not the object itself). Don't
forget to remove the corresponding header lines by mark the node
changed().
- value()
- value("new value")
- value()= "new value"
- Returns or sets the content which is returned as lvalue.
- as_string()
- to_string()
- Returns the content as one string. Please note that the string can contain
binary elements. This is identical to call value() without an
argument and not using it as lvalue.
- read($filehandle, $length)
- Reads <length> bytes from the given filehandle and stores them as
content. Returns true if successful.
- write($filehandle)
- Writes the content to the given filehandle. Returns true if successful.
Returns true if successful.
- save($filename)
- save($filehandle)
- Saves the content in the given file which is created when given as name.
This is used to export the content and so differs from write().
Returns true if successful.
- load($filename)
- load($filehandle)
- Loads the content from a given file. The whole file is taken as content.
This is used to import content from an external file and so differs from
read(). Returns the number of bytes of the loaded content if
successful, undef otherwise.
- lines()
- Returns the number of line breaks (NL, "\012") in the content.
This can be used to keep track of the current line number of the dumpfile
for warning or error messages, etc..
- length()
- Returns the length in bytes of the content. To check if there is any
content use exists().