keen2learn has asked for the wisdom of the Perl Monks concerning the following question:
Here's the module#!/usr/bin/perl -w use strict; use warnings; use CGI; use Data::Dumper; my $cgi = new CGI; # add the library dir to @INC; use lib do { use Cwd 'realpath'; my ($dir) = __FILE__ =~ m{^(.*)/}; realpath("$dir/library"); }; use feature 'say'; use FindBin '$RealBin'; use lib $RealBin; use lib "$RealBin/library"; print $cgi->header; use HtmlHeader; my %doctypeAndTitle = header(); say $doctypeAndTitle{doctypeAndTitle}; #output inconsistent 1;
package HtmlHeader; use strict; use warnings; use parent 'Exporter'; our @EXPORT_OK = qw[ header ]; sub header { my $doctypeAndTitle = getDoctypeAndTitle(); my %doctypeAndTitle = ( doctypeAndTitle => $doctypeAndTitle ); return %doctypeAndTitle; } sub getDoctypeAndTitle{ my $doctype = "<!doctype html> <html> <head> <title>My Page Title</title> "; return $doctype; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module inconsitency
by tobyink (Canon) on Oct 18, 2020 at 20:49 UTC | |
|
Re: Module inconsitency
by keen2learn (Novice) on Oct 19, 2020 at 03:01 UTC | |
by karlgoethebier (Abbot) on Oct 19, 2020 at 18:36 UTC | |
|
Re: Module inconsitency
by Anonymous Monk on Oct 18, 2020 at 19:46 UTC | |
|
Re: Module inconsitency
by perlfan (Parson) on Oct 19, 2020 at 18:21 UTC | |
by keen2learn (Novice) on Oct 19, 2020 at 22:17 UTC |