The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Catalyst::Plugin::SimpleCAS - Plugin interface to Catalyst::Controller::SimpleCAS

SYNOPSIS

use Catalyst;
with 'Catalyst::Plugin::SimpleCAS';

Later on, in your scripts or other backend code:

my $c = 'MyApp';
my $CAS = $c->CAS; # sugar to get the Controller instance

# Add content as a string/scalar:
my $sha1 = $CAS->add("My cool text!\nbla bla bla");

# Add content from a file:
my $sha1 = $CAS->add("/path/to/regular/file");

# Add content by supplying a filehandle:
my $fh = Path::Class::File::file("/path/to/regular/file")->openr;
my $sha1 = $CAS->add($fh);


# Fetch content as a string/scalar:
my $data = $CAS->fetch($sha1);

# Fetch content as a filehandle:
my $data = $CAS->fetch_fh($sha1);

DESCRIPTION

This class provides a simple Catalyst Plugin interface to Catalyst::Controller::SimpleCAS. All it does is inject the SimpleCAS controller into the application and sets up the sugar method CAS in the main app class/context ($c).

This module was originally developed for and within RapidApp before being extracted into its own module. This module provides server-side functionality which can be used for any Catalyst application, however, it is up to the developer to write the associated front-end interfaces to consume its API (unless you are using RapidApp to begin with).

See Catalyst::Controller::SimpleCAS for more information and API documentation.

CONFIG PARAMS

controller_namespace

Namespace of the SimpleCAS controller to inject. Defaults to 'SimpleCAS'

METHODS

CAS

Convenience method to return the SimpelCAS controller. Assuming the controller_namespace is left at its default, these are equivelent:

my $CAS = $c->controller('SimpleCAS');

# same as:
my $CAS = $c->CAS;

inject_simplecas_controller

Method which gets called automatically that does the actual injection of the controller into the Catalyst application. Should never be called directly. It is being provided in case the need arises to hook at this point in the code (i.e. with an around modifier)

SEE ALSO

Catalyst::Controller::SimpleCAS

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.