Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Dump seems to work fine ...

[% FOREACH user = query.execute() %] [% Dumper.dump( user ) %] <tr class="tbl_3_col_ia_tr1"> <td class="tbl_3_col_ia_td tbl_3_col_i +a_td_1 tbl_3_col_ia_text"> <span> [% user.vertragsnummer %] </span> </td> <td class="tbl_3_col_ia_td tbl_3_col_i +a_td_2 tbl_3_col_ia_text"> <span class="tbl_3_col_ia_span_mid +_l"> [% user.artikelnr %] </span> <span class="tbl_3_col_ia_span_mid +_r"> </span> </td> <td class="tbl_3_col_ia_td tbl_3_col_i +a_td_3 tbl_3_col_ia_text"> <span class=""> </span> </td> </tr> [% END %]

Output (dump works fine, my output still is empty):
$VAR1 = { 'DATUM' => '09-JUL-15', 'STATUS' => 'Eingelesen', 'NR' => '1 +1000530', 'NACHRICHT' => '528', 'aNR' => '8041094A' }; $VAR1 = { 'aNR +' => '8033010E', 'NR' => '11000527', 'STATUS' => 'Eingelesen', 'NACHR +ICHT' => '1559', 'DATUM' => '09-JUL-15' }; [...]

Well, if I do user.SOMESTUFF and SOMESTUFF in Uppercase it works ...


Update: okay, I'd like to try the same now by passing values to template. Would you be so kind and help me here too? So I know both ways to do this ...
print "Content-type: text/html\n\n"; my $oTT = Template->new({ INCLUDE_PATH => '../templates', EVAL_PERL => 1, ABSOLUTE => 1, }) || die "$Template::ERROR\n"; #DB - Connect my $hDB = DBI->connect( "dbi:Oracle:xx", "xx", "xx", { AutoCommit => 0 + } ); my $hStatement = $hDB->prepare("MYSQL"); $hStatement->execute( ); while ( ( $iVertragsnummer, $sArtikelNr, $sVertragsStatus, $sVertragsD +atum, $iMsgID ) = $hStatement->fetchrow_array() ){ push (@aRows, ( $iVertragsnummer, $sArtikelNr, $sVertragsStatus, $s +VertragsDatum, $iMsgID )); } $hStatement->finish; $hDB->disconnect; my $sData = { 'result' => \@aRows }; $oTT->process("../templates/mytemplate.html", $sData) || die $oTT->err +or(), "\n";
[% FOREACH line IN result %] [% Dumper.dump( line ) %] [% line.VERTRAGSNUMMER %] [% line.ARTIKELNR %] [% END %]
I get the following output of my dump:
$VAR1 = '11000530'; $VAR1 = '8041094A'; $VAR1 = 'Eingelesen'; [...]
my line.vars are empty again. I think I'm doing something wrong with references in perl?

In reply to Re^2: Template::Toolkit - How do i access alias-based results? by Yaerox
in thread Template::Toolkit - How do i access alias-based results? by Yaerox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the monks are mute...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (8)
    As of 2017-12-17 14:48 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What programming language do you hate the most?




















      Results (464 votes). Check out past polls.

      Notices?