Catalyst-View-Template-Pure

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.008   06 September 2016
        - New directive helpers Wrap and Apply to allow you to delegate some directive
          processing to another view.  Useful for code organization.

0.007   31 August 2016
        - Update Helper code

0.006   31 August 2016
        - Update version of Template::Pure to close known bugs
        - use weaken in a few places to solve circular references
        - pass the view object to the pure object so that we can use it in
          pure callbacks.
        - Start on new ::Helpers package with first Helper 'Uri' for generating
          correct URIs.

0.005   28 August 2016
        - Update version of Template::Pure to close known bugs

0.004   25 August 2016
        - Update dependencies

lib/Catalyst/View/Template/Pure.pm  view on Meta::CPAN

use strict;
use warnings;

package Catalyst::View::Template::Pure;

use Scalar::Util qw/blessed refaddr weaken/;
use Catalyst::Utils;
use HTTP::Status ();
use File::Spec;
use Mojo::DOM58;
use Template::Pure::ParseUtils;
use Template::Pure::DataContext;

use base 'Catalyst::View';

our $VERSION = '0.017';

lib/Catalyst/View/Template/Pure.pm  view on Meta::CPAN

  my ($self, $c, @args) = @_;
  die "Can't call in Application context" unless blessed $c;

  my $proto = (scalar(@args) % 2) ? shift(@args) : undef;
  my %args = @args;

  my $key = blessed($self) ? refaddr($self) : $self;
  my $stash_key = "__Pure_${key}";
  delete $c->stash->{$stash_key} if delete($args{clear_stash});

  weaken $c;
  $c->stash->{$stash_key} ||= do {

    if($proto) {
      foreach my $field (@fields) {
        if(ref $proto eq 'HASH') {
          $args{$field} = $proto->{$field} if exists $proto->{$field};
        } else {
          if(my $cb = $proto->can($field)) {
            $args{$field} = $proto->$field;
          }

lib/Catalyst/View/Template/Pure.pm  view on Meta::CPAN

      'Template::Pure';

    Catalyst::Utils::ensure_class_loaded($pure_class);

    my $view = ref($self)->new(
      %{$args},
      %{$c->stash},
      ctx => $c,
    );

    weaken(my $weak_view = $view);
    my $pure = $pure_class->new(
      template => $template,
      directives => $directives,
      filters => $filters,
      components => $self->build_comp_hash($c, $view),
      view => $weak_view,
      %$args,
    );

    $view->{pure} = $pure;



( run in 0.310 second using v1.01-cache-2.11-cpan-65fba6d93b7 )