]> git.imager.perl.org - bse.git/blob - site/cgi-bin/modules/BSE/WebUtil.pm
fix infinite loop with empty comma
[bse.git] / site / cgi-bin / modules / BSE / WebUtil.pm
1 package BSE::WebUtil;
2 use strict;
3
4 our $VERSION = "1.000";
5
6 use vars qw(@EXPORT_OK @ISA);
7 require Exporter;
8 @ISA = qw(Exporter);
9 @EXPORT_OK = qw(refresh_to refresh_to_admin);
10
11 sub refresh_to {
12   my ($where) = @_;
13
14   #print "Content-Type: text/html\n";
15   #print qq!Refresh: 0; url=$where\n\n<html></html>\n!;
16   print "Status: 303\n";
17   print "Location: $where\n\n";
18 }
19
20 sub refresh_to_admin {
21   my ($cfg, $where) = @_;
22
23   use Carp 'confess';
24   defined $where or confess 'No url supplied';
25
26   unless ($where =~ /^\w+:/) {
27     require BSE::CfgInfo;
28     my $adminbase = BSE::CfgInfo::admin_base_url($cfg);
29     $where = $adminbase . $where;
30   }
31
32   refresh_to($where);
33 }
34
35 1;