[Templates] Variables within subroutine calls

2009-11-04 Thread Dermot
Hi, I am having trouble with, what I'm sure, is a simple problem. I am executing process in this fashion $tt->process('subdir/page', { user => { id=> $userid, # some var defined earlier (EG 1234). }, subs => { makeUserLink => \&somFunc

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Dave Howorth
Dermot wrote: Can anyone offer any hints? Template variables don't start with a dollar ?! ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Felipe Gasper (cPanel)
Quoth Dermot on 11/4/2009 7:03 AM... > LID=[% userid %] # This appears correct (EG 1234) > interpolated=[% $userid %] # This is empty. > interpolated=[% ${user.id} %] # This is empty. > > > > I can't seem to get the userid variable interpolated within the call > to subs.makeUserLink() . $useri

[Templates] Using META data on the Perl side.

2009-11-04 Thread Hendrik T. Völker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi guys, I have a problem regarding data defined inside the META tag. For example I have the following at the start of a template file: - ---8<--- [%= META dest = '/etc/motd' user = 'root' group= 'root' mode = 444 revision

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Dermot
2009/11/4 Felipe Gasper (cPanel) : > Quoth Dermot on 11/4/2009 7:03 AM... > >> LID=[% userid %] # This appears correct (EG 1234) >> interpolated=[% $userid %]  # This is empty. >> interpolated=[% ${user.id} %] # This is empty. >> >> >> >> I can't seem to get the userid variable interpolated within

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Sean McAfee
On Wed, Nov 4, 2009 at 5:03 AM, Dermot wrote: > Hi, > > I am having trouble with, what I'm sure, is a simple problem. > > I am executing process in this fashion > > $tt->process('subdir/page', > { > user => { > id=> $userid, # some var defined earlier (EG 1234). > }

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Josh Rosenbaum
Dermot wrote: > I have used $ with reference to > http://template-toolkit.org/docs/manual/Variables.html#section_Variable_Interpolation > but if I mis-reading the docs please let me know. You are misreading them. Use: [% subs.makeLink(lid=>lightbox.lid, perpage=>p) %] However, if you need this

Re: [Templates] Using META data on the Perl side.

2009-11-04 Thread Sean McAfee
2009/11/4 "Hendrik T. Völker" > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi guys, > > I have a problem regarding data defined inside the META tag. > > For example I have the following at the start of a template file: > > - ---8<--- > [%= META > dest = '/etc/motd' > user = 'ro

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Dermot
2009/11/4 Josh Rosenbaum : > Dermot wrote: >> >> I have used $ with reference to >> >> http://template-toolkit.org/docs/manual/Variables.html#section_Variable_Interpolation >> but if I mis-reading the docs please let me know. > > > You are misreading them. Use: > > [% subs.makeLink(lid=>lightbox.li

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Jason Galea
> 2009/11/4 Josh Rosenbaum : > > So you may need to use this instead if your subroutine is not expecting a > > hashref: > > [% subs.makeLink('lid', lightbox.lid, 'perpage', p) %] > I think this is what you're missing. Use commas instead of '=>' then your function should get the list it is expectin

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Josh Rosenbaum
Dermot wrote: > sub someFunc { > use Data::Dumper; > print STDERR Dumper(@_); > print STDERR "Last el=". ref($_[-1])."\n"; > my $args = (ref($_[-1]) eq 'HASH') ? pop : @_; > foreach (keys %{$args}) { > print STDERR "someFunc: $args->{$_} => $_\n"; > } > } > I have a