File Coverage

blib/lib/CGI/Wiki/Simple/Plugin/Static.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package CGI::Wiki::Simple::Plugin::Static;
2 1     1   5843 use CGI::Wiki::Simple::Plugin();
  0            
  0            
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 entrance. Speak Friend and Enter.",
25             Enter => "The entrance stays closed.",
26             entrance => "It's a big and strong door.",
27             Friend => "You enter the deep dungeons of Moria.",
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;