Archived
1
0
Fork 0

Add guantanamo: a way to execute command in an unknown environnement

This commit is contained in:
Mercier Pierre-Olivier 2013-09-29 04:34:11 +02:00
commit 8ef18c4a3f
3 changed files with 307 additions and 1 deletions

View file

@ -320,6 +320,30 @@ sub getFirstChild ($)
return $self->{children}[0];
}
sub recreateNode
{
my $self = shift;
my $doc = shift;
my $parent = shift;
my $node = $doc->createElement($self->{nodeName});
for my $attkey (keys %{ $self->{attributes} })
{
$node->addChild( $doc->createAttribute($attkey, $self->{attributes}{ $attkey }) );
}
for my $child (@{ $self->{children} })
{
$child->recreateNode($doc, $node);
}
if ($self->{nodeValue}) {
$node->appendText( $self->{nodeValue} );
}
$parent->appendChild($node);
}
package ProcessHandler;
@ -399,7 +423,6 @@ sub end_element
{
my $item = pop @{ $self->{subtreeStack} };
$item->{nodeValue} .= $self->{values};
$item->{nodeValue} =~ s/\n+/ /g;
$item->{nodeValue} =~ s/ +/ /g;
if (@{ $self->{subtreeStack} } > 0) {
push @{ $self->{subtreeStack}[-1]->{children} }, $item;