On Thu, 4 Oct 2012 18:11:50 +0000
Mark Haney <[email protected]> wrote:
> I've got a Template Toolkit template that is driving me insane. I've
> hit the TT list, but it seems more and more like the problem may be
> more perl related than a templating issue. I've attached the
> offending files so now let me show what the problem is.
>
> I have two SQL statements that pull factory data from one and shift
> data from another. My problem is when the data gets passed to the
> template, I get the 'factories' array, but not the 'shifts' array. I
> did a data dump just after the my $vars declaration of the perl code
> and get this:
>
> markh@ubuhost:~$ cat /tmp/shifts.info
> $VAR1 = \{
> 'shifts' => \[
This may be a culprit - it seems to be a reference to a scalar that is itself
an array reference. Usually just doing:
my %hash =
(
'shifts' => \@arr,
);
is enough.
> [
> 'First'
> ],
And it contains more array references. :-S
Maybe you wish to consult one of the resources at:
http://perl-begin.org/topics/references/
Regards,
Shlomi Fish
> [
> 'Second'
> ],
> [
> 'third'
> ],
> [
> 'weekend'
> ]
> ],
> 'factories' => [
> {
> 'abbr' => 'AB',
> 'id' => '1'
> },
> {
> 'abbr' => 'EBM',
> 'id' => '2'
> },
> {
> 'abbr' => 'QEM',
> 'id' => '3'
> }
> ],
> 'cgi' => bless( {
> '.parameters' => [],
> 'use_tempfile' => 1,
> '.charset' => 'ISO-8859-1',
> '.fieldnames' => {},
> 'param' => {},
> 'escape' => 1
> }, 'CGI' )
> };
> markh@ubuhost:~$
>
> So, I KNOW that the data is there and SHOULD be passed to the
> template. However, when I do a datadump from the template I get this:
>
> $VAR1 = [
> {
> 'abbr' => 'AB',
> 'id' => '1'
> },
> {
> 'abbr' => 'EBM',
> 'id' => '2'
> },
> {
> 'abbr' => 'QEM',
> 'id' => '3'
> }
> ];
> $VAR1 = 'shift_rpt.pl';
>
> This can't really be that complicated can it? I mean, it makes no
> sense to pass PART of the data in $vars, but not all. Can someone
> offer any suggestions?
>
>
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Escape from GNU Autohell - http://www.shlomifish.org/open-source/anti/autohell/
To have bugs is human; to fix them — divine.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/