I have written a sample program using Mason and my own pm file. I am having problems with things not being found, any clues please.
The html code is;
<%init>
use strict;
# path to modules
use lib "usr/local/www/apache/htdocs/TEST";
# modules to use
use check;
</%init>
<html>
<body>
<h1>hello there</h1>
% my $test1 = check::one();
% if ($test1 eq 'yes') {
<h3>test 1 ok</h3>
% }
% my $test2 = check::two();
% if ($test2 eq 'two') {
<h3>test 2 ok</h3>
% }
% my $test3 = check::three();
% if ($test3 eq 'three') {
<h3>test 3 ok</h3>
% }
% my $test4 = check::four();
% if ($test4 eq 'four') {
<h3>test 4 ok</h3>
% }
% my $test5 = check::five();
% if ($test5 eq 'five') {
<h3>test 5 ok</h3>
% }
% my $test6 = check::six();
% if ($test6 eq 'six' ) {
<h3>test 6 ok</h3>
% }
<h4>Version is: <% $check::VERSION %>.</h4>
</body>
</html>
Perl mod code is;
package check;
use strict;
require Exporter;
our @ISA = ('Exporter');
our @EXPORT = ( 'one','two', 'three', 'four', 'five', 'six' );
our $VERSION=1.10;
sub one
{
return 'yes';
}
sub two
{
return 'two';
}
sub three
{
return 'three';
}
sub four
{
return 'four';
}
sub five
{
return 'five';
}
sub six
{
return 'six';
}
1;
Error message from browser is;
line 49: Undefined subroutine &check::six called
context:
...
45: if ($test5 eq 'five') {
46: $_out->('
test 5 ok
47: ');
48: }
49: my $test6 = check::six();
50: if ($test6 eq 'six' ) {
51: $_out->('
test 6 ok
52: ');
53: }
...
Thank you in advance.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.