Template-Toolkit

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    Also changed ttree to do the same, so that 'ttree -f C:/test.cfg'
    is treated as an absolute path and it doesn't try and prefix it
    with the ttree configuration file directory.  Note that ttree
    does this regardless of OS.

  - Fixed stringification problem identified by SAM.  Objects that have
    auto-stringification sometimes didn't get properly stringified at the
    right time.  e.g. [% a = "$an_obj" %].

  - Fixed File and Directory plugins to gracefully ignore Perl dying with
    "getpwuid() not supported on this platform" errors on Win32.  The
    'uid' and 'user' attributes of File and Directory plugin objects
    are left undefined.

  - Then, hacked t/file.t and t/directry.t test to not be run under
    Win32.  There are a couple of outstanding minor problems with these
    test scripts caused by differences in '/' and '\' as path
    separators.  Need to fix these at some point.

  - Makefile.PL now saves configuration options in '.defaults.cfg'
    file, using these values as defaults when run again.

lib/Template/Plugin/File.pm  view on Meta::CPAN

        map { ($_ => '') } @STAT_KEYS,
    };

    if ($self->{ stat }) {
        (@stat = stat( $abs ))
            || return $class->throw("$abs: $!");

        @$self{ @STAT_KEYS } = @stat;

        unless ($config->{ noid }) {
            $self->{ user  } = eval { getpwuid( $self->{ uid }) || $self->{ uid } };
            $self->{ group } = eval { getgrgid( $self->{ gid }) || $self->{ gid } };
        }
        $self->{ isdir } = -d $abs;
    }

    bless $self, $class;
}


#-------------------------------------------------------------------------

lib/Template/Plugin/File.pm  view on Meta::CPAN


e.g.

    [% USE File('/foo/bar/baz.html') %]

    [% File.mtime %]
    [% File.mode %]
    ...

In addition, the C<user> and C<group> items are set to contain the user
and group names as returned by calls to C<getpwuid()> and C<getgrgid()> for
the file C<uid> and C<gid> elements, respectively.  On Win32 platforms
on which C<getpwuid()> and C<getgrid()> are not available, these values are
undefined.

    [% USE File('/tmp/foo.html') %]
    [% File.uid %]      # e.g. 500
    [% File.user %]     # e.g. abw

This user/group lookup can be disabled by setting the C<noid> option.

    [% USE File('/tmp/foo.html', noid=1) %]
    [% File.uid %]      # e.g. 500



( run in 0.881 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )