Re: templates Digest, Vol 50, Issue 13

veeru reddy <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <CA+JyuYVjd8eVD_4v=G=3LwRd2g3VVmDx31jKmQx9bvv7xZLg3Q@mail.gmail.com>
Hi,
thanks for your reply, I got answer its working . thanks alot.

On Fri, Nov 11, 2011 at 1:00 PM, <templates-request-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@public.gmane.org>wrote:

> Send templates mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.template-toolkit.org/mailman/listinfo/templates
> or, via email, send a message with subject or body 'help' to
>        templates-request-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@public.gmane.org
>
> You can reach the person managing the list at
>        templates-owner-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@public.gmane.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of templates digest..."
>
>
> Today's Topics:
>
>   1. Re: how to get user name from windows using       perl    template
>      (Richard Thomas)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 11 Nov 2011 16:08:21 +1100
> From: Richard Thomas <[email protected]>
> Subject: Re: [Templates] how to get user name from windows using
>  perl
>        template
> To: [email protected]
> Message-ID: <E9029899-B9DC-4D26-B2CF-F25BFA918D8E-ee4meeAH724@public.gmane.org>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> > Hi every one,
> >   sorry for small mistake,so i modified and reposteing the question in
> reply. actuvally I used perl getlogin to get username , I am getting but I
> don't how to access this variable in template toolkit process please tell me
> >
> > I have problem with getting username form windows system. I tried using
> getlogin function in perl and printing it printing my user name , but my
> problem is how can I access this username in template toolkit. I tried like
> this
>
> Hi veeru,
>
> Clearly this question is very closely related to the one I answered for
> you on Stack Overflow yesterday.
>
> You're passing all your data to your template via the $data object, and
> username is not in that. Exactly what is going on in your XML is not real
> clear, but would it be possible to add username to the XML::Simple
> structure? Then you would have it available in your template.
>
> Otherwise, a quick and dirty solution is to create a different variable on
> the perl side that is a hashref containing both the XML and any other stuff
> you will need in the template.
>
> my $template_vars = {
>        xmldata => $data,
>        username => $username,
> };
>
> <snip>
> $template->process(\*DATA, $template_vars, $filename)
>
> And tweak your template to match:
>
> \issuedby{ [% username %] }
>
> [% FOREACH comp IN xmldata.company %]
> ... and so on.
>
> Obviously since you're going to the trouble of building your XML
> structure, adding username and anything else you're going to need
> template-side into that would be more elegant.
>
> Hope that helps.
> _________________________________________________________
> If you receive an email from the Health Department, saying that if you eat
> tinned pork you will contract swine flu, delete it because it is spam.
>
> Richard Thomas
>
>
>
> ------------------------------
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
> End of templates Digest, Vol 50, Issue 13
> *****************************************
>

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.