I just ran into _another_ interesting situation.  This is really strange 
as I am copying and pasting some ( working ) code and getting strange 
behaviors.

This ActiveState perl 5.8.0 on a Win2K server, TT version 2.69.

The short story is that not all the key/values pairs from the hash appear 
to be making it through to TT.

I have a sub that is used to read in some keys and values.  I'm passing it 
a reference to the hash and have addon or modify certain keys/values.

When running the script through the debugger I can print the hash after 
the sub returns and find every thing there but when I past it 
$tt->process( $filename , \%hash ) only the keys/values that were added 
_outside_ the sub are there/used.

# Here's some pretty bad pseudo/abbreviated code.

my %signup_info;

$signup_info{ HSH } = 'testing';

get_cfg ( "$signup_info{ HSH }.cfg" , \%signup_info );

$signup_info{ WTF }++;

sub get_cfg {

    my $file = shift;
    my $cfg = shift;
# This because of a perceived performance issue
    open ( CFG, "< $file" );
    my @CFG = <CFG>;
    close ( CFG );
# That was actually a routing/router issue.
    foreach ( @CFG ) {
        chomp;
        next if /^#/;
        s/^\s+//;
        s/\s+$//;
        next unless length;
        my ( $var, $value ) = split( /\s*=\s*/, $_, 2 );
        $$cfg{ $var } = $value;
   }
} # End get_cfg

# End of code

After the above if I 

        print %signup_info 

I get all the key/values but TT seems to only get HSH and WTF.  It's 
probably something stupid I did with the sub and reference passing I'm 
sure but I sure can't figure it out.

Was this discussed before and I just ignored it?  I didn't find anything 
in the alpaca book but it could be a terminology problem for me.

Points, ideas, clue-sticks.  I really don't mind which.


Rod
-- 
    "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"



_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to