in reply to Re: Problems getting info from .xml to display with HTML::Template
in thread Problems getting info from .xml to display with HTML::Template
Perl now:<document> <position> <departments> <department name = "Nothing Selected" /> <department name = "Pricing and Shopping Systems" /> <department name = "Commercial" /> <department name = "Operations Hardware" /> <department name = "Corporate Marketing" /> <department name = "Legal" /> <department name = "Human Resources" /> <department name = "Finance" /> </departments> </position> </document>
With strict on I get error: Global symbol "@department" requires explicit package name.#!/perl use strict; use warnings; use lib 'C:/xampp/perl/site/lib'; use HTML::Template; $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::Parser'; use XML::Simple; use Data::Dumper; my $template = HTML::Template->new(filename => 'file'); my $xml = XMLin('file', ForceArray => ['departments']); my @department = @{ $xml->{position}->{departments} }; $template->param(DEPT => \@deptartment); print $template->output;
With strict off I get no errors, but nothing shows up on my template.
Using Dumper, my xml data looks right but displays something like
I'm thinking maybe the empty curly braces have something to do with why it's not actually displaying anything?$VAR1=[ {department => { 'Finance' => {}, 'Human Resources' => {} } ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problems getting info from .xml to display with HTML::Template
by moritz (Cardinal) on Jul 16, 2008 at 15:26 UTC | |
by Anonymous Monk on Jul 16, 2008 at 15:40 UTC | |
by moritz (Cardinal) on Jul 16, 2008 at 15:55 UTC | |
by Anonymous Monk on Jul 16, 2008 at 15:57 UTC |