view release on metacpan or search on metacpan
extends 'Catalyst::Controller';
sub root :At($controller/...) { }
sub endpoint :Via(root) At({id}) {
my ($self, $c, $id) = @_;
}
sub endpoin2 :Under(root) At({id}/{@}) {
my ($self, $c, @args) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Model/Bitcoin.pm view on Meta::CPAN
my ($c, $arg_ref) = @_;
croak "->config->{uri} must be set for $class\n"
unless $self->{uri};
$self->api( Finance::Bitcoin::API->new( endpoint => $self->{uri} ) );
$self->wallet( Finance::Bitcoin::Wallet->new( $self->api ) );
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Helper/Model/JabberRPC.pm view on Meta::CPAN
The same as the B<identauth> arg. passed to L<Jabber::RPC::Client>.
=item * C<jrpc.myserver.org/rpc-server>
The same as the B<endpoint> arg. passed to L<Jabber::RPC::Client>.
=back
=head1 METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/ActionPaths.pm view on Meta::CPAN
}
}
elsif (ref $dt eq 'Catalyst::DispatchType::Chained')
{
# taken from Catalyst::DispatchType::Chained
ENDPOINT: foreach my $endpoint (
sort { $a->reverse cmp $b->reverse }
@{ $dt->_endpoints }
) {
my $args = $endpoint->list_extra_info->{Args};
my @parts = (defined($endpoint->attributes->{Args}[0]) ? (("*") x $args) : '...');
my @parents = ();
my $parent = "DUMMY";
my $extra = $dt->_list_extra_http_methods($endpoint);
my $consumes = $dt->_list_extra_consumes($endpoint);
my $scheme = $dt->_list_extra_scheme($endpoint);
my $curr = $endpoint;
my $action = $endpoint;
while ($curr) {
if (my $cap = $curr->list_extra_info->{CaptureArgs}) {
unshift(@parts, (("*") x $cap));
}
if (my $pp = $curr->attributes->{PathPart}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/CSRFToken.pm view on Meta::CPAN
integrity="sha384-..."
crossorigin="anonymous"
></script>
<script>
$.ajax({
url: '/some/endpoint',
type: 'POST',
headers: {
'X-CSRF-Token': '[% c.csrf_token(form_id=>"your_form_id") %]'
},
data: {
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/TestApp/Controller/Action/Chained.pm view on Meta::CPAN
#
# Simple parent/child action test
#
sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') {
}
sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { }
#
# Parent/child test with two args each
#
sub foo2 :PathPart('chained/foo2') :CaptureArgs(2) :Chained('/') { }
sub endpoint2 :PathPart('end2') :Chained('/action/chained/foo2') :Args(2) { }
#
# three chain with concurrent endpoints
#
sub one :PathPart('chained/one') :Chained('/') :CaptureArgs(1) { }
sub two :PathPart('two') :Chained('/action/chained/one') :CaptureArgs(2) { }
sub three_end :PathPart('three') :Chained('two') :Args(3) { }
view all matches for this distribution
view release on metacpan or search on metacpan
sub midpoint :Chained('set_model_by_return') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_;
}
sub endpoint :Chained('midpoint') PathPart('') Args(0) {
my ($self, $c) = @_;
$c->res->body(ref $c->model);
}
sub set_view_by_return :Chained(/) CaptureArgs(0) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/JSONRPC.pm view on Meta::CPAN
=over 4
=item $c->json_rpc(%attrs)
Call this method from a controller action to set it up as a endpoint
for RPC methods in the same class.
Supported attributes:
=over 8
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/PrometheusTiny.pm view on Meta::CPAN
};
my ($prometheus, # instance
$ignore_path_regexp, # set from config
$include_action_labels, # set from config
$metrics_endpoint, # set from config with default
$no_default_controller, # set from config
$request_path # derived from $metrics_endpoint
);
# for testing
sub _clear_prometheus {
undef $prometheus;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Server/JSONRPC.pm view on Meta::CPAN
methodName: hello.world
path : /hello/world
From this point, it will dispatch to '/hello/world' when it exists,
like Catalyst Urls would do. What means: you will be able to set Regexes,
Paths etc on subroutines to define the endpoint.
We discuss these custom JSONRPC attributes below.
When the request is dispatched, we will return $c->stash->{jsonrpc} to the
jsonrpc client, or, when it is not available, it will return $c->stash to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Server/XMLRPC.pm view on Meta::CPAN
methodName: hello.world
path : /hello/world
From this point, it will dispatch to '/hello/world' when it exists,
like Catalyst Urls would do. What means: you will be able to set Regexes,
Paths etc on subroutines to define the endpoint.
We discuss these custom XMLRPC attributes below.
When the request is dispatched, we will return $c->stash->{xmlrpc} to the
xmlrpc client, or, when it is not available, it will return $c->stash to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Shorten.pm view on Meta::CPAN
$c->shorten_extract; # checks whether the shorten param exists if it does merges the stored params into the request
}
........
sub endpoint :Chained('base') :PathPart('ending') :Args('0') {
my ($self, $c) = @_;
my $str = $c->shorten(); # returns bijection references to an ID in the store.
my $url = $c->shorten(as_uri => 1); # return a url to the current endpoint replacing all params with localhost:300/ending?s=GH
}
-------
use Catalyst qw/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/URI.pm view on Meta::CPAN
# V2 does its own version of named actions
my %action_hash = %{$c->dispatcher->_action_hash||+{}};
foreach my $key (keys %action_hash) {
if(my ($name) = @{$action_hash{$key}->attributes->{Name}||[]}) {
croak "You can only name endpoint actions on a chain"
if defined$action_hash{$key}->attributes->{CaptureArgs};
croak "Named action '$name' is already defined"
if $c->dispatcher->_action_hash->{"/#$name"};
$c->dispatcher->_action_hash->{"/#$name"} = $action_hash{$key};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Controller.pm view on Meta::CPAN
base => { Chained => '/', PathPart => '', CaptureArgs => 0 },
},
);
In the case above every sub in the package would be made into a Chain
endpoint with a URI the same as the sub name for each sub, chained
to the sub named C<base>. Ergo dispatch to C</example> would call the
C<base> method, then the C<example> method.
=head2 action_args
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/View/JSON/PerRequest.pm view on Meta::CPAN
sub midpoint :Chained(root) CaptureArgs(0) {
my ($self, $c) = @_;
$c->view('JSON')->data->set(y=>1);
}
sub endpoint :Chained(midpoint) Args(0) {
my ($self, $c) = @_;
$c->view('JSON')->created({
a => 1,
b => 2,
c => 3,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/View/TT/Progressive.pm view on Meta::CPAN
};
...
})();
when using this approach you may want to prevent accessing of endpoints directly from a browser an easy way of achieving this is checking for a header in Root->auto and then redirecting.
unless ($c->req->header('api')) {
$c->response->redirect($c->uri_for('/invalid_url'));
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/View/Text/MicroTemplate/PerRequest.pm view on Meta::CPAN
sub midpoint :Chained(root) CaptureArgs(0) {
my ($self, $c) = @_;
$c->view('HTML')->data->set(y=>1);
}
sub endpoint :Chained(midpoint) Args(0) {
my ($self, $c) = @_;
$c->view('JSON')->created({
a => 1,
b => 2,
c => 3,
});
}
# template $HOME/root/endpoint.mt
This is my template
Here's some placeholders
a => <?= $a ?>
b => <?= $b ?>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Crudite/Util/Random.pm view on Meta::CPAN
endowed
endowing
endowment
endowments
endows
endpoint
ends
endurable
endurably
endurance
endure
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Declare/Keyword/Action.pm view on Meta::CPAN
if $what eq 'private';
return sub {
my $method = shift;
if ($what eq any qw( end endpoint final )) {
$attrs->{Args} = delete $attrs->{CaptureArgs};
}
elsif ($what eq 'private') {
$attrs->{Private} = [];
}
view all matches for this distribution