/usr/share/perl5/Kwiki/Plugin.pm is in libkwiki-perl 0.39-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | package Kwiki::Plugin;
use Spoon::Plugin -Base;
stub 'class_id';
const cgi_class => '';
const config_file => '';
const css_file => '';
const javascript_file => '';
const screen_template => 'theme_screen.html';
const class_title_prefix => 'Kwiki';
const config_class => 'Kwiki::Config';
field cgi => -init => '$self->hub->cgi';
field config => -init => '$self->hub->config';
field users => -init => '$self->hub->users';
field pages => -init => '$self->hub->pages';
field template => -init => '$self->hub->template';
field preferences =>
-init => '$self->users->current->preferences';
sub new {
return $self if ref $self;
super;
}
sub init {
$self->init_cgi;
$self->config->add_file($self->config_file);
$self->hub->css->add_file($self->css_file);
$self->hub->javascript->add_file($self->javascript_file);
}
sub init_cgi {
my $class = $self->cgi_class
or return;
eval qq{require $class} unless $class->can('new');
my $package = ref($self);
field -package => $package, 'cgi';
my $object = $class->new;
$object->init;
$self->cgi($object);
}
sub render_screen {
$self->template_process($self->screen_template,
content_pane => $self->class_id . '_content.html',
@_,
);
}
sub template_process {
$self->hub->css->add_file($self->css_file)
if $self->css_file;
my $template = shift;
$self->template->process($template,
self => $self,
$self->pages->current->all,
$self->cgi->all,
@_,
);
}
sub redirect {
$self->hub->headers->redirect($self->redirect_url(@_));
return '';
}
sub redirect_url {
my $target = shift;
return $target
if $target =~ /^(https?:|\/)/i or
$target =~ /\?/;
CGI::url(-full => 1) . '?' . $target;
}
sub new_preference {
$self->hub->preferences->new_preference(scalar(caller), @_);
}
__DATA__
=head1 NAME
Kwiki::Plugin - Kwiki Plugin Base Class
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 AUTHOR
Brian Ingerson <INGY@cpan.org>
=head1 COPYRIGHT
Copyright (c) 2004. Brian Ingerson. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
=cut
|