aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LXRng/Context.pm
diff options
context:
space:
mode:
authorArne Georg Gleditsch <argggh@lxr.linpro.no>2007-11-15 21:51:00 +0100
committerArne Georg Gleditsch <argggh@lxr.linpro.no>2007-11-15 21:51:00 +0100
commit8c978d76179b4f573c1eb9b9bb9db966c81330bb (patch)
treeade066d6c36105de19e2a826188d0f1c14818f59 /lib/LXRng/Context.pm
parente9fa4c98bb5f084739d3418ade3f0c51e34a0aa1 (diff)
Too many changes...
Diffstat (limited to 'lib/LXRng/Context.pm')
-rw-r--r--lib/LXRng/Context.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/LXRng/Context.pm b/lib/LXRng/Context.pm
index 46faa21..caaa473 100644
--- a/lib/LXRng/Context.pm
+++ b/lib/LXRng/Context.pm
@@ -9,7 +9,10 @@ sub new {
$self = bless({}, $self);
if ($args{'query'}) {
- $$self{'req_url'} = $args{'query'}->url();
+ # CGI::Simple appears to confuse '' with undef for SCRIPT_NAME.
+ # $$self{'req_url'} = $args{'query'}->url();
+ $$self{'req_url'} =
+ $args{'query'}->url(-base => 1).'/'.$ENV{'SCRIPT_NAME'};
foreach my $p ($args{'query'}->param) {
$$self{'params'}{$p} = [$args{'query'}->param($p)];
@@ -28,7 +31,7 @@ sub new {
}
if ($$self{'tree'} =~ s/[+](.*)$//) {
- $$self{'release'} = $1;
+ $$self{'release'} = $1 if $1 ne '*';
}
if ($$self{'tree'}) {
@@ -137,7 +140,7 @@ sub path_elements {
sub config {
my ($self) = @_;
- return $$self{'config'};
+ return $$self{'config'} || {};
}
sub prefs {
@@ -147,7 +150,7 @@ sub prefs {
}
sub base_url {
- my ($self) = @_;
+ my ($self, $notree) = @_;
my $base = $self->config->{'base_url'};
unless ($base) {
@@ -156,7 +159,10 @@ sub base_url {
}
$base =~ s,/+$,,;
- $base .= '/lxr/'.$self->vtree.'/';
+
+ return $base if $notree;
+
+ $base .= '/'.$self->vtree.'/';
$base =~ s,//+$,/,;
return $base;