diff --git a/Changes b/Changes index 9644a9a..d430bba 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Revision history for CGI-Info -0.80 +0.80 Fri Jan 19 08:05:29 EST 2024 Added documentroot() as a synonym to rootdir() For compatability with Apache Allow "use lib CGI::Info::script_dir() . '../lib';" diff --git a/README b/README index b87a494..aeffe05 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -CGI-Info Version 0.79 +CGI-Info Version 0.80 INSTALLATION diff --git a/README.md b/README.md index 5111e85..2772729 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ --[![Actions Status](https://github.com/nigelhorne/CGI-Info/workflows/.github/workflows/all.yml/badge.svg)](https://github.com/nigelhorne/CGI-Info/actions) -[![Travis Status](https://travis-ci.org/nigelhorne/CGI-Info.svg?branch=master)](https://travis-ci.org/nigelhorne/CGI-Info) -[![Appveyor Status](https://ci.appveyor.com/api/projects/status/1t1yhvagx00c2qi8?svg=true)](https://ci.appveyor.com/project/nigelhorne/cgi-info) -[![Coveralls Status](https://coveralls.io/repos/github/nigelhorne/CGI-Info/badge.svg?branch=master)](https://coveralls.io/github/nigelhorne/CGI-Info?branch=master) -[![CPAN](https://img.shields.io/cpan/v/CGI-Info.svg)](http://search.cpan.org/~nhorne/CGI-Info/) --[![Kwalitee](https://cpants.cpanauthors.org/dist/CGI-Info.png)](http://cpants.cpanauthors.org/dist/CGI-Info) -[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Information+about+the+CGI+Environment+#perl+#CGI&url=https://github.com/nigelhorne/cgi-info&via=nigelhorne) # NAME @@ -12,7 +10,7 @@ CGI::Info - Information about the CGI environment # VERSION -Version 0.79 +Version 0.80 # SYNOPSIS @@ -93,6 +91,9 @@ Returns the file system directory containing the script. print 'HTML files are normally stored in ', $info->script_dir(), '/', File::Spec->updir(), "\n"; + # or + use lib CGI::Info::script_dir() . '../lib'; + ## host\_name Return the host-name of the current web server, according to CGI. @@ -129,7 +130,8 @@ CGI::Info helps you to test your script prior to deployment on a website: if it is not in a CGI environment (e.g. the script is being tested from the command line), the program's command line arguments (a list of key=value pairs) are used, if there are no command line arguments then they are read from stdin -as a list of key=value lines. Also you can give one of --tablet, --search-engine, +as a list of key=value lines. +Also you can give one of --tablet, --search-engine, \--mobile and --robot to mimic those agents. For example: ./script.cgi --mobile name=Nigel @@ -188,9 +190,9 @@ constructor. # ... my $info = CGI::Info->new(); my $allowed = { - 'foo' => qr(^\d*$), # foo must be a number, or empty - 'bar' => undef, - 'xyzzy' => qr(^[\w\s-]+$), # must be alphanumeric + foo => qr/^\d*$/, # foo must be a number, or empty + bar => undef, + xyzzy => qr/^[\w\s-]+$/, # must be alphanumeric # to prevent XSS, and non-empty # as a sanity check }; @@ -235,7 +237,7 @@ be thrown: use CGI::Info; my $allowed = { - 'foo' => qr(\d+), + foo => qr/\d+/ }; my $xyzzy = $info->params(allow => $allowed); my $bar = $info->param('bar'); # Gives an error message @@ -304,6 +306,10 @@ This can be run as a class or object method. Synonym of rootdir(), for compatibility with [CHI](https://metacpan.org/pod/CHI). +## documentroot + +Synonym of rootdir(), for compatibility with Apache. + ## logdir Gets and sets the name of a directory that you can use to store logs in. diff --git a/lib/CGI/Info.pm b/lib/CGI/Info.pm index 4d2148a..73f5981 100644 --- a/lib/CGI/Info.pm +++ b/lib/CGI/Info.pm @@ -25,11 +25,11 @@ CGI::Info - Information about the CGI environment =head1 VERSION -Version 0.79 +Version 0.80 =cut -our $VERSION = '0.79'; +our $VERSION = '0.80'; =head1 SYNOPSIS