nope! things don't seem to be meshing nicely....
and oh no! @INC will no longer include .! That's inconvenient. But, not impossible to move my modules to a folder in @INC
Pm::Redir is claiming pre_html_header() isn't defined - this routine is found in Pm::Html
the subs
Pm::Redir::redir and
Pm::Redir::redir3 both call
Pm::Html::pre_html_header()
now granted, Pm::Html does use a bunch of other modules i've created. i haven't checked those modules to see if they include Pm::Redir, but would it matter if Pm::Html uses a module which then includes Pm::Redir??
here's the code:
just the header to ./Pm::Html
package Pm::Html;
#/
# functions for displaying HTML elements
#/
my $DEBUGGER = 0;
my $TABLE_BORDER = "0";
########################
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
use URI::Escape;
########################
use Pm::Bc_chef qw(cookie_get);
use Pm::Bc_sql qw(get_race_asWord
get_zodiacs get_themes
get_constant
get_theme_data
get_config
get_cities
get_countries
sql_execute
get_users
get_site_name
get_home_page
user_exists
get_location
get_phrase
);
use Pm::Bc_misc qw(get_param
add_numeric_suffix
shorten_str
);
use Pm::Date qw(expand_date
determine_zodiac
get_today
get_month
);
use Pm::Search qw(search_terms);
use Pm::User qw(get_user_stats
get_user_friend_requests
get_user_blocked_users
get_user_unread_messages
get_user_stat
get_user_fuck_alert_count
get_user_pic
get_user_dp
get_user_stats_asIcons
get_user_friends
);
########################
our $VERSION = 1.00;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(
_tests
pre_html_header
header
footer
table
fieldset
fieldset_constricted
div
tdata
trow
radio
checkbox
textarea
unordered_list
ordered_list
li
href
img
dropdown
input
display_404_page
display_about_page
display_chat
display_city_names
display_city_names_asDropdown
display_country_names
display_country_names_asDropdown
display_forgot_page
display_blocked
display_friends
display_fuck_me_alerts
display_homepage
display_mail
display_navbar
display_pay_page
display_photos_page
display_searchbar
display_signup_page
display_stats_page
display_theme_names
display_theme_names_asDropdown
display_titlebar
display_todays_birthdays
display_user_card
display_user_card_mini
display_user_list
display_admin_page
display_admin_ustats_editor
display_admin_uphotos_editor
display_admin_uflags_editor
display_admin_umsgs_editor
display_years_forDropdowns
display_users_forDropdowns
display_config_forDropdowns
display_zodiac_icon
display_debug_one
display_debug_many
display_debug_code
display_debug_large
get_config_forDropdowns
:debug
);
%EXPORT_TAGS = (
debug => [qw(display_debug_one display_debug_many disp
+lay_debug_code display_debug_large _tests)],
);
########################
and the Pm::Redir code:
package Pm::Redir;
#/
# Client Redirections
#/
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use URI::Escape;
use Exporter;
use vars qw($VERSION @ISA @EXPORT_OK);
use Pm::Bc_chef qw(cookie_set);
use Pm::Html qw(display_debug_one
display_debug_many
display_debug_code
display_debug_large
pre_html_header
); # i'm not using :debug cuz that don't work either!
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
_tests
redir
redir3
error_redir
notice_redir
);
##############################
sub redir($$) {
#*
# redirects a client browser to a specified URL (may include a msg)
#*
my ($url, $msg) = @_; # a url to redirect to && a msg
my $html = pre_html_header();
$html =~ s/content-type\: text\/html\n\n//i;
if ($msg)
{ $html .= "status: 302 $msg\n"; } else
{ $html .= "status: 302 redir ok\n"; }
$html .= "location: $url\n\n";
return $html; # a scalar
#usage print redir("/", "invalid page");
}
##############################
sub redir3($$$) {
#*
# redirects a client browser to a specified URL (may include a msg)
# can add a cookie to the redirect (for errors or msgs or other thin
+gs you deem necessary)
# this is NOT version 3 of the redir command. it's a 3 param comman
+d!
#*
my ($url, $msg, $type) = @_; # a url to redirect to && a msg && a ms
+g type ('e' or 'n', or whatever else you like)
my $html = "";
if ($type) { $html = cookie_set($type, $msg, 0); }
my $html .= pre_html_header();
$html =~ s/content-type\: text\/html\n\n//i;
$msg = uri_escape($msg);
$html .= "status: 302 $msg\n";
$html .= "location: $url\n\n";
return $html; # a scalar
#usage: print redir3("/", "Access Denied by redir3", 'e')
}
##############################
sub error_redir($$) {
#*
# redirects a client browser to a specified URL (may include a msg)
# adds an 'error' cookie to the redirect
#*
my ($url, $msg) = @_; # a url to redirect to && a msg
my $html = redir3($url, $msg . " by?", 'e');
return $html; # a scalar
#usage: print error_redir("/subscribe.pl", "you must subscribe to ac
+cess this area");
}
##############################
sub notice_redir($$) {
#*
# redirects a client browser to a specified URL (may include a msg)
# adds a 'notice' cookie to the redirect
#*
my ($url, $msg) = @_; # a url to redirect to && a msg
my $html = redir3($url, $msg, 'n');
return $html; # a scalar
#usage: print notice_redir("/', "file updated!");
}
##############################
sub _tests(;$) {
#*
# to test all <i>Pm::Redir</i> functions
#*
my ($extended) = @_; # show extended data (optional)
my $rv = "";
my $loggedin = cookie_get("loggedin");
my $test = "";
my $test2 = "";
my $test3 = "";
my $db = sql_connect("ns.db");
if ($db) {
$test = "/index.pl";
$test2 = "Test Redirection";
$test3 = "n";
$rv .= display_debug_code("error_redir(\"$test\", \"$test2\")", er
+ror_redir($test, $test2));
$rv .= display_debug_code("notice_redir(\"$test\", \"$test2\")", n
+otice_redir($test, $test2));
$rv .= display_debug_code("redir(\"$test\", \"$test2\")", redir($t
+est, $test2));
$rv .= display_debug_code("redir3(\"$test\", \"$test2\", \"$test3\
+")", redir3($test, $test2, $test3));
} else {
$rv .= "DB connection error!<br>\n";
}
return $rv; # a scalar of the results of all tests
#usage: print _tests();
}
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
1;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.