| 1 | package CGI::Wiki::Simple::Plugin::Static; | ||
| 2 | 0 | ▶ | use CGI::Wiki::Simple::Plugin(); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | |||
| 4 | use vars qw($VERSION); | ||
| 5 | $VERSION = 0.09; | ||
| 6 | |||
| 7 | my %static_content; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | CGI::Wiki::Simple::Plugin::Static - Supply static text as node content | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | This node supplies static text for a node. This text can't be changed. You could | ||
| 16 | use a simple HTML file instead. No provisions are made against users wanting to | ||
| 17 | edit the page. They can't save the data though. | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | =for example begin | ||
| 22 | |||
| 23 | use CGI::Wiki::Simple; | ||
| 24 | use CGI::Wiki::Simple::Plugin::Static( Welcome => "There is an <a href='entrance'>entrance</a>. Speak <a href='Friend'>Friend</a> and <a href='Enter'>Enter</a>.", | ||
| 25 | Enter => "The <a href='entrance'>entrance</a> stays closed.", | ||
| 26 | entrance => "It's a big and strong door.", | ||
| 27 | Friend => "You enter the deep dungeons of <a href='Moria'>Moria</a>.", | ||
| 28 | ); | ||
| 29 | # nothing else is needed | ||
| 30 | |||
| 31 | =for example end | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | sub import { | ||
| 36 | my ($module,%args) = @_; | ||
| 37 | for my $node (keys %args) { | ||
| 38 | $static_content{$node} = $args{$node}; | ||
| 39 | CGI::Wiki::Simple::Plugin::register_nodes(module => $module, name => $node); | ||
| 40 | }; | ||
| 41 | }; | ||
| 42 | |||
| 43 | sub retrieve_node { | ||
| 44 | my (%args) = @_; | ||
| 45 | |||
| 46 | return ($static_content{$args{name}},"0",""); | ||
| 47 | }; | ||
| 48 | |||
| 49 | 1; | ||