Cargando

Plantilla xml - Perl




Pulsa corazón para recibir avisos de nuevas Respuestas

  AUTOR PREGUNTA

Publicado 07 marzo 2014 - 02:34
¿Cómo puedo crear una plantilla XML en Perl?
  • ¿Tienes la misma pregunta? Yo también
  • Volver arriba

Publicado 07 marzo 2014 - 04:09
Para crear tu plantilla XML usa HTML::Template:

use strict;
use warnings;
use HTML::Template;
my $template_text = <<EO_TMPL;
<TMPL_LOOP FILES>
<file>
	 <state><TMPL_VAR STATE></state>
	 <timestamp><TMPL_VAR TIME></timestamp>
	 <location><TMPL_VAR LOCATION></location>
</file>
</TMPL_LOOP>
EO_TMPL
my $tmpl = HTML::Template->new( scalarref => \$template_text );
$tmpl->param(
    FILES => [
    { state => 'one', time => 'two', location => 'three' },
    { state => 'alpha', time => 'beta', location => 'gamma' },
]);
print $tmpl->output;


   AUTOR PREGUNTA

Publicado 07 marzo 2014 - 04:33
Muchas gracias. Me funciono sin problema.


X