Koha::Plugins::Base - Base Module for plugins


store_data allows a plugin to store key value pairs in the database for future use.

usage: $self->store_data({ param1 => 'param1val', param2 => 'param2value' })


retrieve_data allows a plugin to read the values that were previously saved with store_data

usage: my $value = $self->retrieve_data( $key );


get_template returns a Template object. Eventually this will probably be calling C4:Template, but at the moment, it does not.


To avoid naming conflict, each plugins tables should use a fully qualified namespace. To avoid hardcoding and make plugins more flexible, this method will return the proper fully qualified table name.

usage: my $table = $self->get_qualified_table_name( 'myTable' );


To access a plugin's own resources ( images, js files, css files, etc... ) a plugin will need to know what path to use in the template files. This method returns that path.

usage: my $path = $self->get_plugin_http_path();


   go_home is a quick redirect to the Koha plugins home page


    $self->output_html( $data, $status, $extra_options );

Outputs $data setting the right headers for HTML content.

Note: this is a wrapper function for C4::Output::output_with_http_headers


   $self->output( $data, $content_type[, $status[, $extra_options]]);

Outputs $data with the appropriate HTTP headers, the authentication cookie and a Content-Type specified in $content_type.

$content_type is one of the following: 'html', 'js', 'json', 'xml', 'rss', or 'atom'.

$status is an HTTP status message, like '403 Authentication Required'. It defaults to '200 OK'.

$extra_options is hashref. If the key 'force_no_caching' is present and has a true value, the HTTP headers include directives to force there to be no caching whatsoever.

Note: this is a wrapper function for C4::Output::output_with_http_headers


Utility method to compare two version numbers. Returns 1 if the first argument is the higher version Returns -1 if the first argument is the lower version Returns 0 if both versions are equal

if ( _version_compare( '2.6.26', '2.6.0' ) == 1 ) { print "2.6.26 is greater than 2.6.0\n"; }


Kyle M Hall <kyle.m.hall@gmail.com>