Add guantanamo: a way to execute command in an unknown environnement
This commit is contained in:
parent
b951c4dc04
commit
8ef18c4a3f
3 changed files with 307 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Reference in a new issue