[Templates] Patch for Template::Plugin::Datafile

Kenneth Ekdahl sensei@triton.tripnet.se
Thu, 16 Jan 2003 23:25:24 +0100


Hi all!

I just solved a problem i had with Template::Plugin::Datafile.
I wanted a list of all field names, and how many. I didn't find a way to
to it easily from within my template, so I added the methods 'cols' and
'count' to the plugin instead.

I just thought I'd post my patch here in case it could be of any help to
someone else!

=== Begin patch Template::Plugin::Datafile Version 2.18 ===
82a83,93
> sub cols {
>       my $self = shift;
>       my $h = %$self->[0];
>       keys %$h;
> }
> 
> sub count {
>       my $self = shift;
>       my $h = %$self->[0];
>       scalar keys %$h;
> }
166a178
> Patch for cols and count by: Kenneth Ekdahl > L<sensei@sensei.nu|mailto:sensei@s ensei.nu>
===  End patch  ===

-- 
/*************************************/
/* Kenneth Ekdahl (sensei@sensei.nu) */   
/*************************************/