package WebGUI::Macro::RootUrl; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2006 Plain Black Corporation. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- # # Contributed by Diona Kidd @ Knowmad Technologies # http://www.knowmad.com use strict; use URI; =head1 NAME Package WebGUI::Macro::RootUrl =head1 DESCRIPTION Macro for displaying the url for the current asset. =head2 process ( $session, $url ) process is really a wrapper around $session->url->page(); =head3 $session The current WebGUI session object. =cut #------------------------------------------------------------------- sub process { my $session = shift; my $url = shift; my $pageUrl = $session->url->page(); $pageUrl =~ tr{/}{/}s; ##Remove duplicate slashes. $pageUrl =~ s/^\///g; ## Remove first / my @url = split('/', $pageUrl); return $url[0]; } 1;