some new ulti methods
John Napiorkowski [Sat, 18 Jan 2020 22:09:19 +0000 (16:09 -0600)]
Changes
lib/Catalyst.pm
lib/Catalyst/Action.pm
lib/Catalyst/Runtime.pm

diff --git a/Changes b/Changes
index ff97b33..6eb0f29 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.90125 - 2020-01-18
+  - Support samesite flag for cookies (mitchjacksontech++)
+  - utility method on Catalyst::Action 'equals'
+  - new predicate methods 'has_request' and 'has_response'. Useful in
+    plugins that might run bits before a request is finalized.
+
 5.90124 - 2019-01-18
   - Fix problem with from_psgi_response and streaming applications (
     https://github.com/perl-catalyst/catalyst-runtime/pull/168).
index 60a6e9e..5d6635d 100644 (file)
@@ -68,6 +68,7 @@ has request => (
         my $composed_request_class = $class->composed_request_class;
         return $composed_request_class->new( $self->_build_request_constructor_args);
     },
+    predicate => 'has_request',
     lazy => 1,
 );
 sub _build_request_constructor_args {
@@ -113,6 +114,7 @@ has response => (
         my $composed_response_class = $class->composed_response_class;
         return $composed_response_class->new( $self->_build_response_constructor_args);
     },
+    predicate=>'has_response',
     lazy => 1,
 );
 sub _build_response_constructor_args {
@@ -205,7 +207,7 @@ sub composed_stats_class {
 __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
 
 # Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90124';
+our $VERSION = '5.90125';
 $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
 
 sub import {
@@ -409,6 +411,10 @@ Returns the current L<Catalyst::Request> object, giving access to
 information about the current client request (including parameters,
 cookies, HTTP headers, etc.). See L<Catalyst::Request>.
 
+There is a predicate method C<has_request> that returns true if the
+request object has been created.  This is something you might need to
+check if you are writing plugins that run before a request is finalized.
+
 =head2 REQUEST FLOW HANDLING
 
 =head2 $c->forward( $action [, \@arguments ] )
@@ -557,6 +563,10 @@ sub go { my $c = shift; $c->dispatcher->go( $c, @_ ) }
 
 Returns the current L<Catalyst::Response> object, see there for details.
 
+There is a predicate method C<has_response> that returns true if the
+request object has been created.  This is something you might need to
+check if you are writing plugins that run before a request is finalized.
+
 =head2 $c->stash
 
 Returns a hashref to the stash, which may be used to store data and pass
index c0e2a43..b01c023 100644 (file)
@@ -460,6 +460,11 @@ sub compare {
     return $a1->comparable_arg_number <=> $a2->comparable_arg_number;
 }
 
+sub equals {
+  my ($self, $target) = @_;
+  return $self->private_path eq $target->private_path ? $self : 0;
+}
+
 sub scheme {
   return exists $_[0]->attributes->{Scheme} ? $_[0]->attributes->{Scheme}[0] : undef;
 }
@@ -536,6 +541,12 @@ Tries to find a type constraint if you have on on a type constrained method.
 Compares 2 actions based on the value of the C<Args> attribute, with no C<Args>
 having the highest precedence.
 
+=head2 equal
+
+    if( $action->equal($other_action) ) { ... }
+
+Returns true if the two actions are equal.
+
 =head2 namespace
 
 Returns the private namespace this action lives in.
index d5e815e..1d3c75f 100644 (file)
@@ -7,7 +7,7 @@ BEGIN { require 5.008003; }
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION = '5.90124';
+our $VERSION = '5.90125';
 $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
 
 =head1 NAME