#!/usr/bin/perl BEGIN { my $homedir = ( getpwuid($>) )[7]; my @user_include; foreach my $path (@INC) { if ( -d $homedir . '/perl' . $path ) { push @user_include, $homedir . '/perl' . $path; } } unshift @INC, @user_include; } # # This code may be freely reproduced, distributed, transmitted, used, modified, # built upon, or otherwise exploited by anyone for any purpose, commercial or non-commercial, # and in any way, including by methods that have not yet been invented or conceived. # # Purpose: Provide link/citation directly to various US Federal legislative docs and sublevels # Example URL: http://LegisLink.org/us?PL-110-234-5 # DOCUMENTATION # # CODE CONTRIBUTORS # Joe Carmel, # CHANGE HISTORY use HTTP::Lite; $http = new HTTP::Lite; # Get URL string after the ? from the URL. $posted_information=$ENV{QUERY_STRING}; print "Content-type: text/html\n\n"; ######################################## # Public Law Sections ######################################## if ($posted_information=~m|act-(\d+)-(\d+)-(\d+)|i) { $year=$1; $num=$2; $sec=$3; # Get the file from GPO $legdoc=GetPublicLawTxtDocFromGPO($congress,$plnum); # Add the HTML anchor to the text file. $legdoc=~s|\nSEC\. ($plsection)\.|\n\nSEC. \1.|; # Store the file and Display the Stored File with the Anchor. $outfn="PublicLaws/".$congress."-".$plnum.".html"; $anchor="SEC"; StoreFileandDisplayToAnchor($legdoc,$outfn,"SEC"); } ######################################## # Public Act, whole ######################################## elsif ($posted_information=~m|public-act-(\d+)-(\d+)|i) { $year=$1; $num=$2; $website=sprintf("http://www.legislation.govt.nz/act/public/%d/%04d/latest/whole.html",$year,$num); RedirectToWebsite($website); exit; } ######################################## # Private Act, whole ######################################## elsif ($posted_information=~m|private-act-(\d+)-(\d+)|i) { $year=$1; $num=$2; $website=sprintf("http://www.legislation.govt.nz/act/private/%d/%04d/latest/whole.html",$year,$num); RedirectToWebsite($website); exit; } ######################################## # Display the list of LegisLink formats ######################################## else { print ""; # When the following line is uncommented, the page disappears in IE # print "
Public Acts
\n";
print " Format: Act-[year]-[act-number]]
\n";
print " Example: http://legislink.org/nz?public-act-2009-28
";
print " Source: New Zealand Legislation: Act (HTML)
";
print " Availability: 1275 - 2009
\n";
print "
Private Acts
\n";
print " Format: Act-[year]-[act-number]]
\n";
print " Example: http://legislink.org/nz?private-act-1981-5
";
print " Source: New Zealand Legislation: Act (HTML)
";
print " Availability: 1275 - 2009
\n";
print "
";
print "This work is in the Public Domain.\n";
print "\n";
exit;
}
#######################################
# Redirect to Website
#######################################
sub RedirectToWebsite {
my $website=$_[0];
# Check for URL existence
if (!($req = $http->request($website)))
{
print "
Redirecting page to ".$website."
\n"; print "