New to perl modules, I have the issue where, my perl script calls in a perl module.
I get one of three responses when I load that script:
1. error 500 page
2. error Undefined subroutine called
3. the correct output, though lately that isn't happening at all :(
The resultant pages seem to rotate between the three (above) and my ISP assured my last week, they had disabled caching, which at that time was identified as the cause.
What else could be stopping this module from working?
here's the calling script: login.pl
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use Data::Dumper;
my $cgi = new CGI;
BEGIN{
unshift @INC, "/var/www/vhosts/myDomain.com/secured.myDomain.com
+/cgi-bin/library";
}
print $cgi->header;
use doctypeAndHeader;
header();
And, here's the module called doctypeAndHeader.pm
package doctypeAndHeader;
use strict;
use warnings;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = ("header");
sub header{
my $doctypeAndHeader = '';
$doctypeAndHeader = getDoctypeAndHeader();
print qq($doctypeAndHeader);
}
sub getDoctypeAndHeader{
# configs
my $pageTitle = 'Bangor Town Centre';
#my $scriptUrl = $ENV{"SCRIPT_NAME"};
#my @scriptNameArray = split( '/' , $script_url);
#my $scriptName = $scriptNameArray[-1];
my $doctypeAndHeader = "<!doctype html>
<html>
<head>
<title>$pageTitle</title>
</head>
<body></body>
</html>";
return $doctypeAndHeader;
}
1;
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.