Package perl-String-TT: Information

Source package: perl-String-TT
Version: 0.03-alt2
Build time:  Oct 17, 2013, 03:08 PM in the task #106576
Category: Development/Perl
Report package bug
License: perl
Summary: use TT to interpolate lexical variables
Description: 
String::TT exports a `tt' function, which takes a TT
(Template Toolkit) template as its argument.  It uses the
current lexical scope to resolve variable references.  So if you say:

  my $foo = 42;
  my $bar = 24;

  tt '[% foo %] <-> [% bar %]';

the result will be `42 <-> 24'.

TT provides a slightly less rich namespace for variables than perl, so
we have to do some mapping.  Arrays are always translated from
`@array' to `array_a' and hashes are always translated from `%hash'
to `hash_h'.  Scalars are special and retain their original name, but
they also get a `scalar_s' alias.  Here's an example:

  my $scalar = 'scalar';
  my @array  = qw/array goes here/;
  my %hash   = ( hashes => 'are fun' );

  tt '[% scalar %] [% scalar_s %] [% array_a %] [% hash_h %]';

There is one special case, and that's when you have a scalar that is
named like an existing array or hash's alias:

  my $foo_a = 'foo_a';
  my @foo   = qw/foo array/;

  tt '[% foo_a %] [% foo_a_s %]'; # foo_a is the array, foo_a_s is the scalar

In this case, the `foo_a' accessor for the `foo_a' scalar will not
be generated.  You will have to access it via `foo_a_s'.  If you
delete the array, though, then `foo_a' will refer to the scalar.

This is a very cornery case that you should never encounter unless you
are weird.  99% of the time you will just use the variable name.

List of rpms provided by this srpm:
perl-String-TT (noarch)

Maintainer: Igor Vlasenko

List of contributors:
Igor Vlasenko

    1. perl(inc/Module/Install.pm)
    2. perl(ok.pm)
    3. perl-devel
    4. perl-podlators
    5. perl(CPAN.pm)
    6. rpm-build-perl
    7. perl(Carp.pm)
    8. perl(Config.pm)
    9. perl(Cwd.pm)
    10. perl(ExtUtils/MM_Unix.pm)
    11. perl(ExtUtils/MakeMaker.pm)
    12. perl(ExtUtils/Manifest.pm)
    13. perl(File/Basename.pm)
    14. perl(File/Find.pm)
    15. perl(FileHandle.pm)
    16. perl(JSON.pm)
    17. perl(LWP/Simple.pm)
    18. perl(List/Util.pm)
    19. perl(Module/Build.pm)
    20. perl(Net/FTP.pm)
    21. perl(PadWalker.pm)
    22. perl(Parse/CPAN/Meta.pm)
    23. perl(Sub/Exporter.pm)
    24. perl(Template.pm)
    25. perl(YAML/Tiny.pm)
    26. perl(Socket.pm)
    27. perl(Test/Exception.pm)
    28. perl(Test/More.pm)
    29. perl(Test/TableDriven.pm)

Last changed


Oct. 17, 2013 Igor Vlasenko 0.03-alt2
- regenerated from template by package builder
Sept. 10, 2013 Igor Vlasenko 0.03-alt1
- initial import by package builder