Skip to content
Browse files

add dzil support files, remove old cruft

  • Loading branch information...
1 parent d7fb8e9 commit 47eece76d93ab3c8d543702b7bac97311d5e14f1 @jonswar committed
Sorry, we could not display the entire diff because it was too big.
View
66 Build.PL
@@ -1,66 +0,0 @@
-use strict;
-
-use 5.006;
-
-use lib 'inc';
-
-use Mason::Build;
-
-use File::Spec;
-
-my %prereq = ( 'Cache::Cache' => 1.00,
- 'Class::Container' => 0.07,
- 'CGI' => 2.46,
- 'Exception::Class' => 1.15,
- 'File::Spec' => 0.8,
- 'HTML::Entities' => 0,
- 'Log::Any' => 0.08,
- 'Params::Validate' => 0.70,
- 'Scalar::Util' => 1.01,
- 'Test::Deep' => 0,
- );
-
-my $is_dist = grep { /dist=1/ } @ARGV;
-
-unless ($is_dist)
-{
- my $has_mod_perl_1 = eval { require mod_perl } || 0;
- if ($has_mod_perl_1)
- {
- $prereq{mod_perl} = 1.24;
- }
-
- my $has_mod_perl_2 = eval { require mod_perl2 } || 0;
- my $has_only_mp2 = ! $has_mod_perl_1 && $has_mod_perl_2;
-
- # XXX - this really isn't right since we really want to know which
- # version of mod_perl they _intend_ to use with Mason, rather than
- # just blindly adding all these prereqs.
- if ($has_mod_perl_1)
- {
- $prereq{'Apache::Request'} = 1.05; # minimum for OSX
- }
-
- if ($has_only_mp2)
- {
- $prereq{CGI} = 3.08;
- $prereq{mod_perl2} = 1.999022;
- }
-}
-
-my $build = Mason::Build->new
- ( module_name => 'HTML::Mason',
- requires => \%prereq,
- configure_requires => { 'Module::Build' => 0.26 },
- build_requires => { 'Module::Build' => 0.26,
- 'Test' => 0,
- 'Test::Builder' => 0,
- },
- license => 'perl',
- create_makefile_pl => 'small',
- is_dist => $is_dist,
- recursive_test_files => 1,
- dynamic_config => 1,
- );
-
-$build->create_build_script;
View
383 LICENSE
@@ -1,383 +0,0 @@
-Terms of Perl itself
-
-a) the GNU General Public License as published by the Free
- Software Foundation; either version 1, or (at your option) any
- later version, or
-b) the "Artistic License"
-
----------------------------------------------------------------------------
-
-The General Public License (GPL)
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
-Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
-verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most of
-the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you wish), that
-you receive source code or can get it if you want it, that you can change the
-software or use pieces of it in new free programs; and that you know you can do
-these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show
-them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually obtain
-patent licenses, in effect making the program proprietary. To prevent this, we
-have made it clear that any patent must be licensed for everyone's free use or
-not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
-MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or translated
-into another language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you also
-meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices stating that you
-changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in whole or in
-part contains or is derived from the Program or any part thereof, to be licensed
-as a whole at no charge to all third parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively when run, you
-must cause it, when started running for such interactive use in the most ordinary
-way, to print or display an announcement including an appropriate copyright
-notice and a notice that there is no warranty (or else, saying that you provide a
-warranty) and that users may redistribute the program under these conditions,
-and telling the user how to view a copy of this License. (Exception: if the
-Program itself is interactive but does not normally print such an announcement,
-your work based on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Program, the distribution of the whole must be on
-the terms of this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to
-work written entirely by you; rather, the intent is to exercise the right to control
-the distribution of derivative or collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and 2
-above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three years, to give any
-third party, for a charge no more than your cost of physically performing source
-distribution, a complete machine-readable copy of the corresponding source
-code, to be distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer to distribute
-corresponding source code. (This alternative is allowed only for noncommercial
-distribution and only if you received the program in object code or executable
-form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-executable. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary form)
-with the major components (compiler, kernel, and so on) of the operating system
-on which the executable runs, unless that component itself accompanies the
-executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so long
-as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not accept
-this License. Therefore, by modifying or distributing the Program (or any work
-based on the Program), you indicate your acceptance of this License to do so,
-and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to copy,
-distribute or modify the Program subject to these terms and conditions. You
-may not impose any further restrictions on the recipients' exercise of the rights
-granted herein. You are not responsible for enforcing compliance by third parties
-to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed on
-you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your obligations
-under this License and any other pertinent obligations, then as a consequence
-you may not distribute the Program at all. For example, if a patent license would
-not permit royalty-free redistribution of the Program by all those who receive
-copies directly or indirectly through you, then the only way you could satisfy
-both it and this License would be to refrain entirely from distribution of the
-Program.
-
-If any portion of this section is held invalid or unenforceable under any particular
-circumstance, the balance of the section is intended to apply and the section as
-a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other
-property right claims or to contest validity of any such claims; this section has
-the sole purpose of protecting the integrity of the free software distribution
-system, which is implemented by public license practices. Many people have
-made generous contributions to the wide range of software distributed through
-that system in reliance on consistent application of that system; it is up to the
-author/donor to decide if he or she is willing to distribute software through any
-other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain countries
-either by patents or by copyrighted interfaces, the original copyright holder who
-places the Program under this License may add an explicit geographical
-distribution limitation excluding those countries, so that distribution is permitted
-only in or among countries not thus excluded. In such case, this License
-incorporates the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems or
-concerns.
-
-Each version is given a distinguishing version number. If the Program specifies a
-version number of this License which applies to it and "any later version", you
-have the option of following the terms and conditions either of that version or of
-any later version published by the Free Software Foundation. If the Program does
-not specify a version number of this License, you may choose any version ever
-published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of all
-derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
-NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
-COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
-"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
-IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
-CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
-TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
-WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
-PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
-OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-
----------------------------------------------------------------------------
-
-The Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a Package
-may be copied, such that the Copyright Holder maintains some semblance of
-artistic control over the development of the package, while giving the users of the
-package the right to use and distribute the Package in a more-or-less customary
-fashion, plus the right to make reasonable modifications.
-
-Definitions:
-
-- "Package" refers to the collection of files distributed by the Copyright
- Holder, and derivatives of that collection of files created through textual
- modification.
-- "Standard Version" refers to such a Package if it has not been modified,
- or has been modified in accordance with the wishes of the Copyright
- Holder.
-- "Copyright Holder" is whoever is named in the copyright or copyrights for
- the package.
-- "You" is you, if you're thinking about copying or distributing this Package.
-- "Reasonable copying fee" is whatever you can justify on the basis of
- media cost, duplication charges, time of people involved, and so on. (You
- will not be required to justify it to the Copyright Holder, but only to the
- computing community at large as a market that must bear the fee.)
-- "Freely Available" means that no fee is charged for the item itself, though
- there may be fees involved in handling the item. It also means that
- recipients of the item may redistribute it under the same conditions they
- received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you duplicate
-all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications derived from
-the Public Domain or from the Copyright Holder. A Package modified in such a
-way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and when
-you changed that file, and provided that you do at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said modifications
- to Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not
- conflict with standard executables, which must also be provided,
- and provide a separate manual page for each non-standard
- executable that clearly documents how it differs from the Standard
- Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or executable
-form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions (in the manual page or equivalent)
- on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their
- corresponding Standard Version executables, giving the
- non-standard executables non-standard names, and clearly
- documenting the differences in manual pages (or equivalent),
- together with instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this Package.
-You may charge any fee you choose for support of this Package. You may not
-charge a fee for this Package itself. However, you may distribute this Package in
-aggregate with other (possibly commercial) programs as part of a larger
-(possibly commercial) software distribution provided that you do not advertise
-this Package as a product of your own.
-
-6. The scripts and library files supplied as input to or produced as output from
-the programs of this Package do not automatically fall under the copyright of this
-Package, but belong to whomever generated them, and may be sold
-commercially, and may be aggregated with this Package.
-
-7. C or perl subroutines supplied by you and linked into this Package shall not
-be considered part of this Package.
-
-8. Aggregation of this Package with a commercial distribution is always permitted
-provided that the use of this Package is embedded; that is, when no overt attempt
-is made to make this Package's interfaces visible to the end user of the
-commercial distribution. Such use shall not be construed as a distribution of
-this Package.
-
-9. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The End
-
-
View
175 README
@@ -1,175 +0,0 @@
-Copyright (c) 1998-2012 by Jonathan Swartz. All rights reserved.
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-Welcome to Mason, a Perl-based web site development and delivery
-system. Mason allows web pages and sites to be constructed from
-shared, reusable building blocks called components. Components contain
-a mix of Perl and HTML, and can call each other and pass values back
-and forth like subroutines. Components increase modularity and
-eliminate repetitive work: common design elements (headers, footers,
-menus, logos) can be extracted into their own components where they
-need be changed only once to affect the whole site.
-
-Other Mason features include powerful filtering and templating
-facilities, and a HTML/data caching model. See
-http://www.masonhq.com/ for more information.
-
-MASON 1 VERSUS MASON 2
-
-Version 1 of Mason -- this distribution -- has been around since 1998, is in wide use, and is
-very stable. However it has not changed much in years and is no longer actively developed.
-
-Version 2 of Mason was released in February of 2011. It is being very actively developed
-and has a much more modern architecture. If you are just starting out, we recommend you
-give Mason 2 a try. It is available at
-
- https://metacpan.org/release/Mason
-
-For a summary of differences between Mason 1 and 2 see
-
- http://www.openswartz.com/2011/02/21/announcing-mason-2/
-
-PREREQUISITES
-
-Mason requires Perl 5.6.0 or greater, and the following CPAN modules:
-
-* Params::Validate
-
-* Exception::Class
-
-* Class::Container
-
-* File::Spec
-
-* Scalar::Util
-
-The following CPAN modules are optional for certain features, but not required:
-
-* Apache::Request
-
-* Cache::Cache
-
-* CGI.pm
-
-INSTALLATION
-
-To install Mason, run the standard sequence:
-
- perl Build.PL
- ./Build
- ./Build install
-
-By default, Mason will prompt you for information about where Apache
-is installed so that it can help you configure Mason to run under
-mod_perl. If you would like to skip this, invoke the Makefile.PL like
-this:
-
- perl Build.PL --noprompts
-
-After Mason is installed, you will need to activate it by adding some
-directives to your Apache configuration files.
-
-The included pod docs have been pre-converted to HTML for you and
-placed in the htdocs/ directory. The Mason overview (a good place to
-start) is in Mason.html.
-
-WARNINGS!
-
-* Don't use Mason with an older mod_perl DSO (dynamic shared object).
-
-Using Mason with a mod_perl DSO may cause your Apache server to crash
-silently at startup, or fail intermittently. The fix for this problem
-is to install Apache/mod_perl with mod_perl compiled statically into
-the Apache binary. Packages of Apache with a static mod_perl are
-available around the net.
-
-Testing with recent mod_perls showed improvements, but because this
-bug can be so intermittent and difficult to spot, mod_perl DSO with
-Mason is still strictly unsupported.
-
-This should not be a problem with Apache2.
-
-* Don't use Mason with PerlFreshRestart.
-
-The mod_perl PerlFreshRestart directive attempts to reload modules on
-restart in a very simplistic way. Mason cannot be reloaded this way.
-The Apache::Reload module from CPAN does a much better job, and
-appears to work with Mason. However, the safest thing to do is to
-actually stop and start the server.
-
-GETTING HELP
-
-The official Mason web site is at http://www.masonhq.com/. It's a
-wiki, so most pages can be edited by any registered user.
-
-The official documentation is at http://www.masonhq.com/docs/manual/.
-
-The FAQ is at http://www.masonhq.com/?FAQ.
-
-Several mailing lists exist for Mason users and developers. Full
-information can be found at
-http://www.masonhq.com/?MailingLists.
-
-There is a book about Mason, _Embedding Perl in HTML with Mason_, by
-Dave Rolsky and Ken Williams. This book is published by O'Reilly and
-Associates. The book's home page is http://www.masonbook.com/.
-
-CODE EXAMPLES
-
-The samples/ directory contains a few basic components.
-
-The Mason site contains a variety of user-contributed code and
-how-tos; see http://www.masonhq.com/?ContributedCode, for example.
-
-Links to various articles containing code examples are listed at
-http://www.masonhq.com/?Articles.
-
-REPORTING BUGS
-
-Send bug reports to the user's mailing list for quickest response. But
-first check the mailing list archives and the official bugs list on
-the Mason site to see if the problem has already been reported.
-
-For all bug reports indicate your architecture, Apache/Perl/module
-versions, etc. For installation problems send your handler.pl and
-httpd.conf. For component problems try to isolate the bug in a single
-small component or set of components, and send those.
-
-If you are experiencing test failures, please run the tests like this:
-
- ./Build test verbose=1
-
-and send the output along with the bug report. Otherwise we'll just
-ask you to do this before we can do anything.
-
-LICENSE
-
-Mason was originally developed for the Internet technology group at
-CMP Media, a publisher of technology magazines. CMP
-graciously supported our efforts to release Mason as open source
-software to the Perl community. However, CMP has NO direct
-involvement with the open source release and bears NO responsibility
-for its support or maintenance.
-
-Mason is provided "as is" and without any express or implied
-warranties, including, without limitation, the implied warranties of
-merchantibility and fitness for a particular purpose.
-
-Mason is released under the same terms as Perl itself. For more
-information see the "README" or "Artistic" files provided with the
-Perl distribution.
-
-AUTHORS
-
-Jonathan Swartz
-swartz <AT> pobox.com
-
-Dave Rolsky
-autarch <AT> urth.org
-
-Ken Williams
-ken <AT> mathforum.org
-
-John Williams
-williams <AT> tni.com
View
168 bin/convert0.6.pl
@@ -1,12 +1,12 @@
#!/usr/bin/perl -w
use Data::Dumper;
-use File::Find;
+use File::Find;
use Getopt::Std;
use IO::File;
use strict;
-my ($EXCLUDE, $HELP, $LOWER, $QUIET, $TEST, $UPPER);
+my ( $EXCLUDE, $HELP, $LOWER, $QUIET, $TEST, $UPPER );
my $usage = <<EOF;
Usage: $0 -hlqtu [-e <regexp>] <directory> [<directory>...]
@@ -51,109 +51,131 @@
modified destructively and no automatic backups are created.
EOF
-sub usage
-{
+sub usage {
print $usage;
exit;
}
-sub main
-{
+sub main {
my (%opts);
- getopts('e:hlqtu',\%opts);
- ($EXCLUDE, $HELP, $LOWER, $QUIET, $TEST, $UPPER) = @opts{qw(e h l q t u)};
- if ($HELP) { print "$helpmsg\n$usage"; exit }
- if (!@ARGV) { print "$usage\n$helpmsg"; exit }
+ getopts( 'e:hlqtu', \%opts );
+ ( $EXCLUDE, $HELP, $LOWER, $QUIET, $TEST, $UPPER ) = @opts{qw(e h l q t u)};
+ if ($HELP) { print "$helpmsg\n$usage"; exit }
+ if ( !@ARGV ) { print "$usage\n$helpmsg"; exit }
my @dirs = @ARGV;
-
- if (!$TEST) {
- print "*** Mason 0.6 Conversion ***\n\n";
- print "Quiet mode.\n" if defined($QUIET);
- print "Excluding paths matching ($EXCLUDE).\n" if defined($EXCLUDE);
- print "Processing ".(@dirs==1 ? "directory " : "directories ").join(",",@dirs)."\n";
- print $warning;
- print "\nProceed? [n] ";
- exit if ((my $ans = <STDIN>) !~ /[Yy]/);
+
+ if ( !$TEST ) {
+ print "*** Mason 0.6 Conversion ***\n\n";
+ print "Quiet mode.\n" if defined($QUIET);
+ print "Excluding paths matching ($EXCLUDE).\n" if defined($EXCLUDE);
+ print "Processing "
+ . ( @dirs == 1 ? "directory " : "directories " )
+ . join( ",", @dirs ) . "\n";
+ print $warning;
+ print "\nProceed? [n] ";
+ exit if ( ( my $ans = <STDIN> ) !~ /[Yy]/ );
}
my $sub = sub {
- if (-f $_ && -s _) {
- return if defined($EXCLUDE) && "$File::Find::dir/$_" =~ /$EXCLUDE/i;
- convert($_,"$File::Find::dir/$_");
- }
+ if ( -f $_ && -s _ ) {
+ return if defined($EXCLUDE) && "$File::Find::dir/$_" =~ /$EXCLUDE/i;
+ convert( $_, "$File::Find::dir/$_" );
+ }
};
- find($sub,@dirs);
+ find( $sub, @dirs );
}
-sub convert
-{
- my ($file,$path) = @_;
+sub convert {
+ my ( $file, $path ) = @_;
my $buf;
my $infh = new IO::File $file;
- if (!$infh) { warn "cannot read $path: $!"; return }
+ if ( !$infh ) { warn "cannot read $path: $!"; return }
{ local $/ = undef; $buf = <$infh> }
my $c = 0;
my @changes;
- my $report = sub { push(@changes,"$_[0] --> $_[1]") };
+ my $report = sub { push( @changes, "$_[0] --> $_[1]" ) };
#
# Convert section names to short versions
#
my $pat = "<(/?%)perl_(args|cleanup|doc|init|once|text)>";
- if (!$TEST) {
- if ($UPPER) {
- $c += ($buf =~ s{$pat}{"<$1".uc($2).">"}geio);
- } elsif ($LOWER) {
- $c += ($buf =~ s{$pat}{"<$1".lc($2).">"}geio);
- } else {
- $c += ($buf =~ s{$pat}{<$1$2>}gio);
- }
- } else {
- while ($buf =~ m{($pat)}gio) {
- $report->($1,"<$2".($UPPER ? uc($3) : $LOWER ? lc($3) : $3).">");
- }
+ if ( !$TEST ) {
+ if ($UPPER) {
+ $c += ( $buf =~ s{$pat}{"<$1".uc($2).">"}geio );
+ }
+ elsif ($LOWER) {
+ $c += ( $buf =~ s{$pat}{"<$1".lc($2).">"}geio );
+ }
+ else {
+ $c += ( $buf =~ s{$pat}{<$1$2>}gio );
+ }
+ }
+ else {
+ while ( $buf =~ m{($pat)}gio ) {
+ $report->(
+ $1, "<$2" . ( $UPPER ? uc($3) : $LOWER ? lc($3) : $3 ) . ">"
+ );
+ }
}
#
# Convert <% mc_comp ... %> to <& ... &>
#
- if (!$TEST) {
- $c += ($buf =~ s{<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g);
- $c += ($buf =~ s{<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g);
- $c += ($buf =~ s{<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g);
- $c += ($buf =~ s{<%\s*mc_comp\s*\(\s*(.*?)\s*\)\s*%>} {<& $1 &>}g);
- } else {
- while ($buf =~ m{(<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>)}g) {
- $report->($1,"<& $2$3 &>");
- }
- $buf =~ s{<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
- while ($buf =~ m{(<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>)}g) {
- $report->($1,"<& $2$3 &>");
- }
- $buf =~ s{<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
- while ($buf =~ m{(<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>)}g) {
- $report->($1,"<& $2$3 &>");
- }
- $buf =~ s{<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
- while ($buf =~ m{(<%\s*mc_comp\s*\((.*?)\s*\)\s*%>)}g) {
- $report->($1,"<& $2 &>");
- }
+ if ( !$TEST ) {
+ $c +=
+ ( $buf =~
+ s{<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g
+ );
+ $c +=
+ ( $buf =~
+ s{<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g
+ );
+ $c +=
+ ( $buf =~
+ s{<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g
+ );
+ $c += ( $buf =~ s{<%\s*mc_comp\s*\(\s*(.*?)\s*\)\s*%>} {<& $1 &>}g );
+ }
+ else {
+ while (
+ $buf =~ m{(<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>)}g )
+ {
+ $report->( $1, "<& $2$3 &>" );
+ }
+ $buf =~
+ s{<%\s*mc_comp\s*\(\s*\'([^\']+)\'\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
+ while (
+ $buf =~ m{(<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>)}g )
+ {
+ $report->( $1, "<& $2$3 &>" );
+ }
+ $buf =~
+ s{<%\s*mc_comp\s*\(\s*\"([^\"\$]+)\"\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
+ while (
+ $buf =~ m{(<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>)}g )
+ {
+ $report->( $1, "<& $2$3 &>" );
+ }
+ $buf =~
+ s{<%\s*mc_comp\s*\(\s*(\"[^\"]+\")\s*(.*?)\s*\)\s*%>} {<& $1$2 &>}g;
+ while ( $buf =~ m{(<%\s*mc_comp\s*\((.*?)\s*\)\s*%>)}g ) {
+ $report->( $1, "<& $2 &>" );
+ }
}
if ($TEST) {
- if (@changes) {
- print scalar(@changes)." substitutions in $path:\n";
- print join("\n",@changes)."\n\n";
- }
+ if (@changes) {
+ print scalar(@changes) . " substitutions in $path:\n";
+ print join( "\n", @changes ) . "\n\n";
+ }
}
-
- if ($c && !$TEST) {
- print "$c substitutions in $path\n" if !$QUIET;
- my $outfh = new IO::File ">$file";
- if (!$outfh) { warn "cannot write $path: $!"; return }
- $outfh->print($buf);
+
+ if ( $c && !$TEST ) {
+ print "$c substitutions in $path\n" if !$QUIET;
+ my $outfh = new IO::File ">$file";
+ if ( !$outfh ) { warn "cannot write $path: $!"; return }
+ $outfh->print($buf);
}
}
-
main();
View
230 bin/convert0.8.pl
@@ -1,12 +1,12 @@
#!/usr/bin/perl -w
use Data::Dumper;
-use File::Find;
+use File::Find;
use Getopt::Std;
use IO::File;
use strict;
-my ($EXCLUDE, $HELP, $QUIET, $TEST);
+my ( $EXCLUDE, $HELP, $QUIET, $TEST );
my $usage = <<EOF;
Usage: $0 -hqt [-e <regexp>] <directory> [<directory>...]
@@ -37,162 +37,170 @@
modified destructively and no automatic backups are created.
EOF
-sub usage
-{
+sub usage {
print $usage;
exit;
}
-sub main
-{
+sub main {
my (%opts);
- getopts('e:hlqtu',\%opts);
- ($EXCLUDE, $HELP, $QUIET, $TEST) = @opts{qw(e h q t)};
- if ($HELP) { print "$helpmsg\n$usage"; exit }
- if (!@ARGV) { print "$usage\n$helpmsg"; exit }
+ getopts( 'e:hlqtu', \%opts );
+ ( $EXCLUDE, $HELP, $QUIET, $TEST ) = @opts{qw(e h q t)};
+ if ($HELP) { print "$helpmsg\n$usage"; exit }
+ if ( !@ARGV ) { print "$usage\n$helpmsg"; exit }
my @dirs = @ARGV;
-
- if (!$TEST) {
- print "*** Mason 0.8 Conversion ***\n\n";
- print "Quiet mode.\n" if defined($QUIET);
- print "Excluding paths matching ($EXCLUDE).\n" if defined($EXCLUDE);
- print "Processing ".(@dirs==1 ? "directory " : "directories ").join(",",@dirs)."\n";
- print $warning;
- print "\nProceed? [n] ";
- exit if ((my $ans = <STDIN>) !~ /[Yy]/);
+
+ if ( !$TEST ) {
+ print "*** Mason 0.8 Conversion ***\n\n";
+ print "Quiet mode.\n" if defined($QUIET);
+ print "Excluding paths matching ($EXCLUDE).\n" if defined($EXCLUDE);
+ print "Processing "
+ . ( @dirs == 1 ? "directory " : "directories " )
+ . join( ",", @dirs ) . "\n";
+ print $warning;
+ print "\nProceed? [n] ";
+ exit if ( ( my $ans = <STDIN> ) !~ /[Yy]/ );
}
my $sub = sub {
- if (-f $_ && -s _) {
- return if defined($EXCLUDE) && "$File::Find::dir/$_" =~ /$EXCLUDE/i;
- convert($_,"$File::Find::dir/$_");
- }
+ if ( -f $_ && -s _ ) {
+ return if defined($EXCLUDE) && "$File::Find::dir/$_" =~ /$EXCLUDE/i;
+ convert( $_, "$File::Find::dir/$_" );
+ }
};
- find($sub,@dirs);
+ find( $sub, @dirs );
}
-sub convert
-{
- my ($file,$path) = @_;
+sub convert {
+ my ( $file, $path ) = @_;
my $buf;
my $infh = new IO::File $file;
- if (!$infh) { warn "cannot read $path: $!"; return }
+ if ( !$infh ) { warn "cannot read $path: $!"; return }
{ local $/ = undef; $buf = <$infh> }
my $c = 0;
- my (@changes,@failures);
- my $report = sub { push(@changes,$_[1] ? "$_[0] --> $_[1]" : "removed $_[0]") };
- my $report_failure = sub { push(@failures,$_[0]) };
+ my ( @changes, @failures );
+ my $report =
+ sub { push( @changes, $_[1] ? "$_[0] --> $_[1]" : "removed $_[0]" ) };
+ my $report_failure = sub { push( @failures, $_[0] ) };
#
# Convert mc_ commands to $m-> method equivalents
#
# Easy substitutions
#
- my $easy_cmds = join("|",qw(abort cache cache_self call_self comp comp_exists dhandler_arg file file_root out time));
- if (!$TEST) {
- $c += ($buf =~ s{mc_($easy_cmds)(?![A-Za-z0-9 _])}{"\$m->$1"}geo);
- } else {
- while ($buf =~ m{(mc_($easy_cmds)(?![A-Za-z0-9 _]))}go) {
- $report->($1,"\$m->$2");
- }
+ my $easy_cmds = join( "|",
+ qw(abort cache cache_self call_self comp comp_exists dhandler_arg file file_root out time)
+ );
+ if ( !$TEST ) {
+ $c += ( $buf =~ s{mc_($easy_cmds)(?![A-Za-z0-9 _])}{"\$m->$1"}geo );
+ }
+ else {
+ while ( $buf =~ m{(mc_($easy_cmds)(?![A-Za-z0-9 _]))}go ) {
+ $report->( $1, "\$m->$2" );
+ }
}
# Boilerplate substitutions for methods with no arguments
- my @subs =
- (['mc_auto_comp', '$m->fetch_next->path'],
- ['mc_caller', '$m->callers(1)->path'],
- ['mc_comp_source', '$m->current_comp->source_file'],
- ['mc_comp_stack', 'map($_->title,$m->callers)'],
- );
+ my @subs = (
+ [ 'mc_auto_comp', '$m->fetch_next->path' ],
+ [ 'mc_caller', '$m->callers(1)->path' ],
+ [ 'mc_comp_source', '$m->current_comp->source_file' ],
+ [ 'mc_comp_stack', 'map($_->title,$m->callers)' ],
+ );
foreach my $sub (@subs) {
- my ($mc_cmd,$repl) = @$sub;
- if (!$TEST) {
- $c += ($buf =~ s{$mc_cmd(\s*\(\))?(?!\s*[\(])}{$repl}ge);
- } else {
- while ($buf =~ m{($mc_cmd(\s*\(\))?(?!\s*[\(]))}g) {
- $report->($1,$repl);
- }
- }
+ my ( $mc_cmd, $repl ) = @$sub;
+ if ( !$TEST ) {
+ $c += ( $buf =~ s{$mc_cmd(\s*\(\))?(?!\s*[\(])}{$repl}ge );
+ }
+ else {
+ while ( $buf =~ m{($mc_cmd(\s*\(\))?(?!\s*[\(]))}g ) {
+ $report->( $1, $repl );
+ }
+ }
}
# Boilerplate substitutions for methods with arguments
- @subs =
- (['mc_auto_next', '$m->call_next'],
- );
+ @subs = ( [ 'mc_auto_next', '$m->call_next' ], );
foreach my $sub (@subs) {
- my ($mc_cmd,$repl) = @$sub;
- if (!$TEST) {
- $c += ($buf =~ s{$mc_cmd}{$repl}ge);
- } else {
- while ($buf =~ m{($mc_cmd)}g) {
- $report->($1,$repl);
- }
- }
+ my ( $mc_cmd, $repl ) = @$sub;
+ if ( !$TEST ) {
+ $c += ( $buf =~ s{$mc_cmd}{$repl}ge );
+ }
+ else {
+ while ( $buf =~ m{($mc_cmd)}g ) {
+ $report->( $1, $repl );
+ }
+ }
}
# mc_comp_source with simple argument
- if (!$TEST) {
- $c += ($buf =~ s{mc_comp_source\s*\(([^\(\)]+)\)}{"\$m->fetch_comp($1)->source_file"}ge);
- } else {
- while ($buf =~ m{(mc_comp_source\s*\(([^\(\)]+)\))}g) {
- $report->($1,"\$m->fetch_comp($2)->source_file");
- }
+ if ( !$TEST ) {
+ $c +=
+ ( $buf =~
+ s{mc_comp_source\s*\(([^\(\)]+)\)}{"\$m->fetch_comp($1)->source_file"}ge
+ );
+ }
+ else {
+ while ( $buf =~ m{(mc_comp_source\s*\(([^\(\)]+)\))}g ) {
+ $report->( $1, "\$m->fetch_comp($2)->source_file" );
+ }
}
# mc_suppress_http_header with and without arguments
- if (!$TEST) {
- $c += ($buf =~ s{mc_suppress_http_header\s*(?!\s*\();?}{}g);
- $c += ($buf =~ s{mc_suppress_http_header\s*\([^\(\)]*\)\s*;?}{}g);
- } else {
- while ($buf =~ m{(mc_suppress_http_header\s*(?!\s*\();?)}g) {
- $report->($1,"");
- }
- while ($buf =~ m{(mc_suppress_http_header\s*\([^\(\)]*\)\s*;?)}g) {
- $report->($1,"");
- }
- }
-
+ if ( !$TEST ) {
+ $c += ( $buf =~ s{mc_suppress_http_header\s*(?!\s*\();?}{}g );
+ $c += ( $buf =~ s{mc_suppress_http_header\s*\([^\(\)]*\)\s*;?}{}g );
+ }
+ else {
+ while ( $buf =~ m{(mc_suppress_http_header\s*(?!\s*\();?)}g ) {
+ $report->( $1, "" );
+ }
+ while ( $buf =~ m{(mc_suppress_http_header\s*\([^\(\)]*\)\s*;?)}g ) {
+ $report->( $1, "" );
+ }
+ }
+
#
# Convert $REQ to $m
#
- if (!$TEST) {
- $c += ($buf =~ s{\$REQ(?![A-Za-z0-9_])}{\$m}go);
- } else {
- while ($buf =~ m{(\$REQ(?![A-Za-z0-9_]))}go) {
- $report->($1,"\$m");
- }
- }
-
+ if ( !$TEST ) {
+ $c += ( $buf =~ s{\$REQ(?![A-Za-z0-9_])}{\$m}go );
+ }
+ else {
+ while ( $buf =~ m{(\$REQ(?![A-Za-z0-9_]))}go ) {
+ $report->( $1, "\$m" );
+ }
+ }
+
# Report substitutions we can't handle
foreach my $cmd (qw(mc_comp_source mc_suppress_http_header)) {
- if ($buf =~ m{$cmd\s*\([^\)]*\(}) {
- $report_failure->("Can't convert $cmd with complex arguments");
- }
+ if ( $buf =~ m{$cmd\s*\([^\)]*\(} ) {
+ $report_failure->("Can't convert $cmd with complex arguments");
+ }
}
- if ($buf =~ m{mc_date}) {
- $report_failure->("Can't convert mc_date");
+ if ( $buf =~ m{mc_date} ) {
+ $report_failure->("Can't convert mc_date");
}
-
+
if ($TEST) {
- if (@changes) {
- print scalar(@changes)." substitutions in $path:\n";
- print join("\n",@changes)."\n";
- }
- }
-
- if ($c && !$TEST) {
- print "$c substitutions in $path\n" if !$QUIET;
- my $outfh = new IO::File ">$file";
- if (!$outfh) { warn "cannot write $path: $!"; return }
- $outfh->print($buf);
- }
-
+ if (@changes) {
+ print scalar(@changes) . " substitutions in $path:\n";
+ print join( "\n", @changes ) . "\n";
+ }
+ }
+
+ if ( $c && !$TEST ) {
+ print "$c substitutions in $path\n" if !$QUIET;
+ my $outfh = new IO::File ">$file";
+ if ( !$outfh ) { warn "cannot write $path: $!"; return }
+ $outfh->print($buf);
+ }
+
foreach my $failure (@failures) {
- print "** Warning: $failure; must fix manually\n";
+ print "** Warning: $failure; must fix manually\n";
}
- print "\n" if (($TEST && @changes) || @failures);
+ print "\n" if ( ( $TEST && @changes ) || @failures );
}
-
main();
View
75 bin/mason.pl
@@ -4,56 +4,61 @@
use HTML::Mason '1.11';
use File::Basename qw(dirname basename);
use File::Spec ();
-use Cwd ();
+use Cwd ();
-my ($params, $component, $args) = parse_command_line(@ARGV);
+my ( $params, $component, $args ) = parse_command_line(@ARGV);
# Set a default comp_root
-unless (exists $params->{comp_root}) {
- if (File::Spec->file_name_is_absolute($component)) {
- $params->{comp_root} = dirname($component);
- $component = '/' . basename($component);
- } else {
- $params->{comp_root} = Cwd::cwd;
- # Convert local path syntax to slashes
- my ($dirs, $file) = (File::Spec->splitpath($component))[1,2];
- $component = '/' . join '/', File::Spec->splitdir($dirs), $file;
- }
+unless ( exists $params->{comp_root} ) {
+ if ( File::Spec->file_name_is_absolute($component) ) {
+ $params->{comp_root} = dirname($component);
+ $component = '/' . basename($component);
+ }
+ else {
+ $params->{comp_root} = Cwd::cwd;
+
+ # Convert local path syntax to slashes
+ my ( $dirs, $file ) = ( File::Spec->splitpath($component) )[ 1, 2 ];
+ $component = '/' . join '/', File::Spec->splitdir($dirs), $file;
+ }
}
my $interp = HTML::Mason::Interp->new(%$params);
-$interp->exec($component, @$args);
+$interp->exec( $component, @$args );
#######################################################################################
sub parse_command_line {
- die usage() unless @_;
+ die usage() unless @_;
+
+ my %params;
+ while (@_) {
+ if ( $_[0] eq '--config_file' ) {
+ shift;
+ my $file = shift;
+ eval { require YAML; 1 }
+ or die
+ "--config_file requires the YAML Perl module to be installed.\n";
+ my $href = YAML::LoadFile($file);
+ @params{ keys %$href } = values %$href;
+
+ }
+ elsif ( $_[0] =~ /^--/ ) {
+ my ( $k, $v ) = ( shift, shift );
+ $k =~ s/^--//;
+ $params{$k} = $v;
- my %params;
- while (@_) {
- if ( $_[0] eq '--config_file' ) {
- shift;
- my $file = shift;
- eval {require YAML; 1}
- or die "--config_file requires the YAML Perl module to be installed.\n";
- my $href = YAML::LoadFile($file);
- @params{keys %$href} = values %$href;
-
- } elsif ( $_[0] =~ /^--/ ) {
- my ($k, $v) = (shift, shift);
- $k =~ s/^--//;
- $params{$k} = $v;
-
- } else {
- my $comp = shift;
- return (\%params, $comp, \@_);
+ }
+ else {
+ my $comp = shift;
+ return ( \%params, $comp, \@_ );
+ }
}
- }
- die usage();
+ die usage();
}
sub usage {
- return <<EOF;
+ return <<EOF;
Usage: $0 [--param1 value1 ...] [--config_file file] component [arg1 arg2 ...]
e.g.: $0 --comp_root /mason/comps component.mas
View
6 htdocs/.cvsignore
@@ -1,6 +0,0 @@
-*.html
-Cache
-Compiler
-Resolver
-Component
-Plugin
View
171 htdocs/index.html
@@ -1,171 +0,0 @@
-<html>
-
-<head>
-<title>Mason Documentation</title>
-</head>
-
-<body bgcolor=white>
-
-<h3>Mason Documentation</h3>
-
- <table border=0 cellpadding=4 cellspacing=2>
-
- <tr><td colspan=8><h4>Manuals</h4></td></tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Mason.html">Introduction</a><br>
-Introduction and basic installation.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Admin.html">Administrator's Manual</a><br>
-This manual is written for the web master or system administrator. It
-describes how to install, configure, and tune a Mason system.
-</td>
-
-
- </tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Devel.html">Developer's Manual</a><br>
-This manual is written for the Mason developer. It describes how to
-write, run, and debug Mason components.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Subclassing.html">Subclassing Manual</a><br>
-This guide describes how to create your own custom subclasses to
-override parts of Mason.
-</td>
-
-
- </tr>
-
- <tr><td>&nbsp;</td></tr>
- <tr><td colspan=8><h4>Common Reference</h4></td></tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Params.html">Parameters</a><br>
-List of all configuration parameters, with both Perl and Apache
-configuration variants.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Request.html">Request</a><br>
-The Request API is the gateway to all Mason features not provided by syntactic tags.
-</td>
-
-
- </tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Component.html">Component</a><br>
-The Component object represents a component loaded into memory.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Interp.html">Interp</a><br>
-The Interp object spawns requests and maintains persistent data
-between requests.
-</td>
-
-
- </tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="ApacheHandler.html">ApacheHandler</a><br>
-The ApacheHandler glues Mason and mod_perl together.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="CGIHandler.html">CGIHandler</a><br>
-The CGIHandler glues Mason and CGI together.
-</td>
-
-
- </tr>
-
- <tr><td>&nbsp;</td></tr>
- <tr><td colspan=8><h4>Other Reference</h4></td></tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Compiler.html">Compiler</a><br>
-The Compiler object translates a lexed component source into Perl code.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Lexer.html">Lexer</a><br>
-The Lexer object parses the component source to generate compiler events.
-</td>
-
-
- </tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Resolver.html">Resolver</a><br>
-The Resolver object translates a component path into a component
-source item.
-
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="ComponentSource.html">ComponentSource</a><br>
-The ComponentSource object represents information about the source of
-a component (e.g. a file).
-</td>
-
-
- </tr>
-
- <tr>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Exceptions.html">Exceptions</a><br>
-Mason's exception objects.
-</td>
-
-<td valign=top align=left>&nbsp;&#149;</td>
-<td valign=top align=left>
-<a href="Plugin.html">Plugin</a><br>
-Mason's plugin system.
-</td>
-
- </tr>
-
-</table>
-
-</body>
-</html>
-
-
-
-
View
1,507 inc/Mason/Build.pm
0 additions, 1,507 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
167 inc/params.mtxt
@@ -1,167 +0,0 @@
-<%doc>
-Template for Params.pod, used in make_params_pod.pl.
-</%doc>
-#
-# This documentation was automatically generated by the
-# make_params_pod.pl script in the release
-# directory of the CVS repository.
-#
-# Edit that script instead of this document.
-#
-
-=head1 NAME
-
-HTML::Mason::Params - Mason configuration parameters
-
-=head1 DESCRIPTION
-
-This document lists all of the Mason configuration parameters that are
-intended to be used by end users.
-
-=head1 PERL AND APACHE NAMES
-
-Each parameter has two names: a Perl version and an Apache version.
-The Perl version uses C<lowercase_with_underscores>, while the Apache
-version uses C<StudlyCaps> with a C<Mason> prefix. The conversion from
-one version to the other is otherwise very predictable. For example,
-
-=over 4
-
-=item *
-
-C<autohandler_name> C<E<lt>--E<gt>> C<MasonAutohandlerName>
-
-=item *
-
-C<comp_root> C<E<lt>--E<gt>> C<MasonCompRoot>
-
-=item *
-
-C<data_cache_defaults> C<E<lt>--E<gt>> C<MasonDataCacheDefaults>
-
-=back
-
-=head2 Where Apache Names Are Used
-
-The Apache parameter names are used in the Apache configuration file
-in an L<httpd-based configuration|HTML::Mason::Admin/BASIC
-CONFIGURATION VIA httpd.conf DIRECTIVES>.
-
-=head2 Where Perl Names Are Used
-
-The Perl parameter names are used from Perl code, i.e. anywhere other
-than the Apache configuration file. For example,
-
-=over 4
-
-=item *
-
-In an L<custom wrapper-based configuration|HTML::Mason::Admin/ADVANCED
-CONFIGURATION>, you can pass most of these parameters to the
-L<ApacheHandler|HTML::Mason::ApacheHandler> constructor.
-
-=item *
-
-In a L<standalone Mason script|HTML::Mason::Admin/Using Mason from a
-standalone script>, you can pass most of these parameters to the
-L<Interp|HTML::Mason::Interp> constructor.
-
-=item *
-
-When launching a L<subrequest|HTML::Mason::Devel/Subrequests>, you can
-pass any of the C<HTML::Mason::Request> parameters to
-L<make_subrequest|HTML::Mason::Request/item_make_subrequest>.
-
-=back
-
-=head1 PARAMETERS
-
-% foreach my $param (@params) {
-
-
-=head2 <% $param->{name} %>
-
-=over 4
-
-=item * Perl name: <% $param->{name} %>
-
-% if ($param->{apache_name}) {
-=item * Apache name: Mason<% $param->{apache_name} %>
-
-% }
-=item * Type in httpd.conf: <% $param->{type} %>
-
-=item * Default: <% defined($param->{default}) && $param->{default} =~ /\S/ ? $param->{default} : 'None' %>
-
-=item * Belongs to: <& .class_pod_link, $param->{class} &>
-
-=back
-
-<% $param->{pod} %>
-% }
-
-<%shared>
-my %pods;
-</%shared>
-
-<%args>
-@params
-@pods
-</%args>
-
-<%init>
-%pods = map { $_ => 1 } @pods;
-</%init>
-
-%#-----------
-
-<%def .oneline>
-<%init>;
-(my $content = $m->content) =~ s/\n/ /g;
-$m->out($content);
-</%init>
-</%def>
-
-%#-----------
-
-<%def .trim>
-<%init>;
-my $content = $m->content;
-for ($content) { s/^\s+//; s/\s+$// }
-$m->out($content);
-</%init>
-</%def>
-
-%#-----------
-
-<%def .class_pod_link><&| .trim &>
-% if (exists($pods{"Mason/$class_url.pm"})) {
-L<<% $class %>|<% $class %>>
-% } else {
-C<<% $class %>>
-% }
-</&>
-
-<%init>;
-my ($class) = @_;
-(my $class_url = $class) =~ s/^HTML::Mason:://;
-$class_url =~ s/::/\//g;
-</%init>
-</%def>
-
-%#-----------
-
-<%def .class_html_link><&| .trim &>
-% if (exists($pods{"Mason/$class_url.pm"})) {
-<a href="<% $class_url %>.html"><% $class %></a>
-% } else {
-<tt><% $class %></tt>
-% }
-</&>
-
-<%init>;
-my ($class) = @_;
-(my $class_url = $class) =~ s/^HTML::Mason:://;
-$class_url =~ s/::/\//g;
-</%init>
-</%def>
View
15 lib/Apache/Mason.pm
@@ -1,15 +0,0 @@
-package Apache::Mason;
-# Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved.
-# This program is free software; you can redistribute it and/or modify
-# it under the same terms as Perl itself.
-
-# This is a placeholder module whose sole purpose is to create a CPAN
-# "alias" Apache::Mason -> HTML::Mason.
-
-$VERSION = '0.4';
-
-sub handler ($$) {
- return 1;
-}
-
-1;
View
41 lib/Bundle/HTML/Mason.pm
@@ -1,41 +0,0 @@
-# -*- perl -*-
-
-package Bundle::HTML::Mason;
-
-$VERSION = '0.09';
-
-1;
-
-__END__
-
-=head1 NAME
-
-Bundle::HTML::Mason - A bundle to install the HTML::Mason package
-
-=head1 SYNOPSIS
-
-C<perl -MCPAN -e 'install Bundle::HTML::Mason'>
-
-=head1 CONTENTS
-
-Cache::Cache 1.00
-
-Class::Container 0.07
-
-CGI 2.46
-
-Exception::Class 1.15
-
-File::Spec 0.8
-
-Params::Validate 0.70
-
-Scalar::Util 1.01
-
-HTML::Mason
-
-=head1 DESCRIPTION
-
-This bundle includes all that's needed to run the HTML::Mason package.
-
-=cut
View
55 lib/HTML/Mason.pm
@@ -1,16 +1,14 @@
package HTML::Mason;
+
# Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
use 5.006;
-$HTML::Mason::VERSION = '1.49';
-
use HTML::Mason::Interp;
-sub version
-{
+sub version {
return $HTML::Mason::VERSION;
}
@@ -31,6 +29,20 @@ Mason - High-performance, dynamic web site authoring system
PerlHandler HTML::Mason::ApacheHandler
</Location>
+=head1 STOP - HAVE YOU SEEN MASON 2?
+
+Version 1 of Mason (which you are looking at now) has been around since
+1998, is in wide use, and is very stable. However it has not changed much in
+years and is no longer actively developed.
+
+Version 2 of Mason -- L<Mason|Mason> -- was released in February of 2011.
+It is being very actively developed and has a much more modern architecture.
+If you are just starting out, we recommend you go directly to Mason 2.
+
+For a summary of differences between Mason 1 and 2 see
+
+ http://www.openswartz.com/2011/02/21/announcing-mason-2/
+
=head1 DESCRIPTION
Mason is a tool for building, serving and managing large web
@@ -87,21 +99,6 @@ of Perl code (say, to pull records from a database). They can also
call other components, cache results for later reuse, and perform all
the tricks you expect from a regular Perl program.
-=head1 MASON 1 (HTML::MASON) VERSUS MASON 2 (MASON)
-
-Version 1 of Mason -- L<HTML::Mason|HTML::Mason> -- has been around since
-1998, is in wide use, and is very stable. However it has not changed much in
-years and is no longer actively developed.
-
-Version 2 of Mason -- L<Mason|Mason> -- was released in February of 2011.
-It is being very actively developed and has a much more modern
-architecture. If you are just starting out, we recommend you give Mason 2 a
-try.
-
-For a summary of differences between Mason 1 and 2 see
-
- http://www.openswartz.com/2011/02/21/announcing-mason-2/
-
=head1 INSTALLATION
Mason has been tested under Linux, FreeBSD, Solaris, HPUX, and
@@ -112,6 +109,8 @@ modules.
Mason has a standard MakeMaker-driven installation. See the README
file for details.
+=for readme stop
+
=head1 CONFIGURING MASON
This section assumes that you are able to install and configure a
@@ -182,22 +181,4 @@ Associates. The book's website is at http://www.masonbook.com/. This
book goes into detail on a number of topics, and includes a chapter of
recipes as well as a sample Mason-based website.
-=head1 AUTHORS
-
-Jonathan Swartz <swartz@pobox.com>, Dave Rolsky <autarch@urth.org>, Ken Williams <ken@mathforum.org>, John Williams <williams@tni.com>
-
-=head1 COPYRIGHT
-
-Copyright (c) 1998-2005 Jonathan Swartz. All rights reserved. This
-program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-The full text of the license can be found in the LICENSE file included
-with this module.
-
-=head1 SEE ALSO
-
-L<HTML::Mason::Devel|HTML::Mason::Devel>,
-L<HTML::Mason::Admin|HTML::Mason::Admin>
-
=cut
View
8 lib/HTML/Mason/Apache/Request.pm
@@ -11,17 +11,14 @@ use warnings;
use base 'Apache::Request';
-
-sub new
-{
+sub new {
my $class = shift;
my $r = Apache::Request->instance(shift);
return bless { r => $r }, $class;
}
-sub send_http_header
-{
+sub send_http_header {
my $self = shift;
return if $self->notes('sent_http_header');
@@ -31,5 +28,4 @@ sub send_http_header
$self->notes( 'sent_http_header' => 1 );
}
-
1;
View
773 lib/HTML/Mason/ApacheHandler.pm
@@ -10,32 +10,27 @@ use warnings;
package HTML::Mason::ApacheHandler;
use vars qw($VERSION);
+
# do not change the version number
$VERSION = 1.69;
-
# PerlAddVar was introduced in mod_perl-1.24
# Support for modperl2 < 1.999022 was removed due to API changes
-BEGIN
-{
- if ( $ENV{MOD_PERL} && $ENV{MOD_PERL} =~ /1\.99|2\.0/ )
- {
+BEGIN {
+ if ( $ENV{MOD_PERL} && $ENV{MOD_PERL} =~ /1\.99|2\.0/ ) {
require mod_perl2;
}
- elsif ( $ENV{MOD_PERL} )
- {
+ elsif ( $ENV{MOD_PERL} ) {
require mod_perl;
}
- my $mpver = (mod_perl2->VERSION || mod_perl->VERSION || 0);
+ my $mpver = ( mod_perl2->VERSION || mod_perl->VERSION || 0 );
# This is the version that introduced PerlAddVar
- if ($mpver && $mpver < 1.24)
- {
+ if ( $mpver && $mpver < 1.24 ) {
die "mod_perl VERSION >= 1.24 required";
}
- elsif ($mpver >= 1.99 && $mpver < 1.999022)
- {
+ elsif ( $mpver >= 1.99 && $mpver < 1.999022 ) {
die "mod_perl-1.99 is not supported; upgrade to 2.00";
}
}
@@ -49,56 +44,71 @@ package HTML::Mason::Request::ApacheHandler;
use HTML::Mason::Request;
use Class::Container;
use Params::Validate qw(BOOLEAN);
-Params::Validate::validation_options( on_fail => sub { param_error( join '', @_ ) } );
+Params::Validate::validation_options(
+ on_fail => sub { param_error( join '', @_ ) } );
use base qw(HTML::Mason::Request);
use HTML::Mason::Exceptions( abbr => [qw(param_error error)] );
-use constant APACHE2 => ($mod_perl2::VERSION || $mod_perl::VERSION || 0) >= 1.999022;
-use constant OK => 0;
-use constant HTTP_OK => 200;
-use constant DECLINED => -1;
-use constant NOT_FOUND => 404;
-use constant REDIRECT => 302;
+use constant APACHE2 => ( $mod_perl2::VERSION || $mod_perl::VERSION || 0 ) >=
+ 1.999022;
+use constant OK => 0;
+use constant HTTP_OK => 200;
+use constant DECLINED => -1;
+use constant NOT_FOUND => 404;
+use constant REDIRECT => 302;
-BEGIN
-{
+BEGIN {
my $ap_req_class = APACHE2 ? 'Apache2::RequestRec' : 'Apache';
- __PACKAGE__->valid_params
- ( ah => { isa => 'HTML::Mason::ApacheHandler',
- descr => 'An ApacheHandler to handle web requests',
- public => 0 },
-
- apache_req => { isa => $ap_req_class, default => undef,
- descr => "An Apache request object",
- public => 0 },
-
- cgi_object => { isa => 'CGI', default => undef,
- descr => "A CGI.pm request object",
- public => 0 },
-
- auto_send_headers => { parse => 'boolean', type => BOOLEAN, default => 1,
- descr => "Whether HTTP headers should be auto-generated" },
- );
+ __PACKAGE__->valid_params(
+ ah => {
+ isa => 'HTML::Mason::ApacheHandler',
+ descr => 'An ApacheHandler to handle web requests',
+ public => 0
+ },
+
+ apache_req => {
+ isa => $ap_req_class,
+ default => undef,
+ descr => "An Apache request object",
+ public => 0
+ },
+
+ cgi_object => {
+ isa => 'CGI',
+ default => undef,
+ descr => "A CGI.pm request object",
+ public => 0
+ },
+
+ auto_send_headers => {
+ parse => 'boolean',
+ type => BOOLEAN,
+ default => 1,
+ descr => "Whether HTTP headers should be auto-generated"
+ },
+ );
}
-use HTML::Mason::MethodMaker
- ( read_write => [ map { [ $_ => __PACKAGE__->validation_spec->{$_} ] }
- qw( ah apache_req auto_send_headers ) ] );
+use HTML::Mason::MethodMaker (
+ read_write => [
+ map { [ $_ => __PACKAGE__->validation_spec->{$_} ] }
+ qw( ah apache_req auto_send_headers )
+ ]
+);
# A hack for subrequests
sub _properties { qw(ah apache_req), shift->SUPER::_properties }
-sub new
-{
+sub new {
my $class = shift;
- my $self = $class->SUPER::new(@_); # Magic!
+ my $self = $class->SUPER::new(@_); # Magic!
- unless ($self->apache_req or $self->cgi_object)
- {
- param_error __PACKAGE__ . "->new: must specify 'apache_req' or 'cgi_object' parameter";
+ unless ( $self->apache_req or $self->cgi_object ) {
+ param_error __PACKAGE__
+ . "->new: must specify 'apache_req' or 'cgi_object' parameter";
}
# Record a flag indicating whether the user passed a custom out_method
@@ -108,16 +118,16 @@ sub new
return $self;
}
-sub cgi_object
-{
+sub cgi_object {
my ($self) = @_;
error "Can't call cgi_object() unless 'args_method' is set to CGI.\n"
- unless $self->ah->args_method eq 'CGI';
+ unless $self->ah->args_method eq 'CGI';
- if (defined($_[1])) {
+ if ( defined( $_[1] ) ) {
$self->{cgi_object} = $_[1];
- } else {
+ }
+ else {
# We may not have created a CGI object if, say, request was a
# GET with no query string. Create one on the fly if necessary.
$self->{cgi_object} ||= CGI->new('');
@@ -132,21 +142,19 @@ sub cgi_object
# Apache into not reading POST content again. Wish there were
# a more standardized way to do this...
#
-sub exec
-{
+sub exec {
my $self = shift;
- my $r = $self->apache_req;
+ my $r = $self->apache_req;
my $retval;
- if ( $self->is_subrequest )
- {
+ if ( $self->is_subrequest ) {
+
# no need to go through all the rigamorale below for
# subrequests, and it may even break things to do so, since
# $r's print should only be redefined once.
$retval = $self->SUPER::exec(@_);
}
- else
- {
+ else {
# ack, this has to be done at runtime to account for the fact
# that Apache::Filter changes $r's class and implements its
# own print() method.
@@ -173,10 +181,11 @@ sub exec
# headers, this will typically only apply after $m->abort.
# On an error code, leave it to Apache to send the headers.
if ( !$self->is_subrequest
- and !APACHE2
- and $self->auto_send_headers
- and !$r->notes('mason-sent-headers')
- and ( !$retval or $retval eq HTTP_OK ) ) {
+ and !APACHE2
+ and $self->auto_send_headers
+ and !$r->notes('mason-sent-headers')
+ and ( !$retval or $retval eq HTTP_OK ) )
+ {
$r->send_http_header();
}
@@ -189,13 +198,13 @@ sub exec
# Override this method to always die when top level component is not found,
# so we can return NOT_FOUND.
#
-sub _handle_error
-{
- my ($self, $err) = @_;
+sub _handle_error {
+ my ( $self, $err ) = @_;
- if (isa_mason_exception($err, 'TopLevelNotFound')) {
+ if ( isa_mason_exception( $err, 'TopLevelNotFound' ) ) {
rethrow_exception $err;
- } else {
+ }
+ else {
if ( $self->error_format eq 'html' ) {
$self->apache_req->content_type('text/html');
@@ -207,15 +216,14 @@ sub _handle_error
}
}
-sub redirect
-{
- my ($self, $url, $status) = @_;
+sub redirect {
+ my ( $self, $url, $status ) = @_;
my $r = $self->apache_req;
$r->method('GET');
$r->headers_in->unset('Content-length');
$r->err_headers_out->{Location} = $url;
- $self->clear_and_abort($status || REDIRECT);
+ $self->clear_and_abort( $status || REDIRECT );
}
#----------------------------------------------------------------------
@@ -231,17 +239,19 @@ use HTML::Mason::Interp;
use HTML::Mason::Tools qw( load_pkg );
use HTML::Mason::Utils;
use Params::Validate qw(:all);
-Params::Validate::validation_options( on_fail => sub { param_error( join '', @_ ) } );
+Params::Validate::validation_options(
+ on_fail => sub { param_error( join '', @_ ) } );
-use constant APACHE2 => ($mod_perl2::VERSION || $mod_perl::VERSION || 0) >= 1.999022;
-use constant OK => 0;
-use constant HTTP_OK => 200;
-use constant DECLINED => -1;
-use constant NOT_FOUND => 404;
-use constant REDIRECT => 302;
+use constant APACHE2 => ( $mod_perl2::VERSION || $mod_perl::VERSION || 0 ) >=
+ 1.999022;
+use constant OK => 0;
+use constant HTTP_OK => 200;
+use constant DECLINED => -1;
+use constant NOT_FOUND => 404;
+use constant REDIRECT => 302;
BEGIN {
- if ($ENV{MOD_PERL}) {
+ if ( $ENV{MOD_PERL} ) {
if (APACHE2) {
require Apache2::RequestRec;
require Apache2::RequestIO;
@@ -249,7 +259,8 @@ BEGIN {
require Apache2::RequestUtil;
require Apache2::Log;
require APR::Table;
- } else {
+ }
+ else {
require Apache;
require Apache::Request;
require HTML::Mason::Apache::Request;
@@ -258,65 +269,78 @@ BEGIN {
}
}
-if ( $ENV{MOD_PERL} && ! APACHE2 )
-{
+if ( $ENV{MOD_PERL} && !APACHE2 ) {
+
# No modern distro/OS packages a mod_perl without all of this
# stuff turned on, does it?
- error "mod_perl must be compiled with PERL_METHOD_HANDLERS=1 (or EVERYTHING=1) to use ", __PACKAGE__, "\n"
- unless Apache::perl_hook('MethodHandlers');
+ error
+ "mod_perl must be compiled with PERL_METHOD_HANDLERS=1 (or EVERYTHING=1) to use ",
+ __PACKAGE__, "\n"
+ unless Apache::perl_hook('MethodHandlers');
- error "mod_perl must be compiled with PERL_TABLE_API=1 (or EVERYTHING=1) to use ", __PACKAGE__, "\n"
- unless Apache::perl_hook('TableApi');
+ error
+ "mod_perl must be compiled with PERL_TABLE_API=1 (or EVERYTHING=1) to use ",
+ __PACKAGE__, "\n"
+ unless Apache::perl_hook('TableApi');
}
use base qw(HTML::Mason::Handler);
-BEGIN
-{
- __PACKAGE__->valid_params
- (
- apache_status_title =>
- { parse => 'string', type => SCALAR, default => 'HTML::Mason status',
- descr => "The title of the Apache::Status page" },
-
- args_method =>
- { parse => 'string', type => SCALAR,
- default => APACHE2 ? 'CGI' : 'mod_perl',
- regex => qr/^(?:CGI|mod_perl)$/,
- descr => "Whether to use CGI.pm or Apache::Request for parsing the incoming HTTP request",
- },
-
- decline_dirs =>
- { parse => 'boolean', type => BOOLEAN, default => 1,
- descr => "Whether Mason should decline to handle requests for directories" },
-
- # the only required param
- interp =>
- { isa => 'HTML::Mason::Interp',
- descr => "A Mason interpreter for processing components" },
- );
-
- __PACKAGE__->contained_objects
- (
- interp =>
- { class => 'HTML::Mason::Interp',
- descr => 'The interp class coordinates multiple objects to handle request execution'
- },
- );
-}
+BEGIN {
+ __PACKAGE__->valid_params(
+ apache_status_title => {
+ parse => 'string',
+ type => SCALAR,
+ default => 'HTML::Mason status',
+ descr => "The title of the Apache::Status page"
+ },
+
+ args_method => {
+ parse => 'string',
+ type => SCALAR,
+ default => APACHE2 ? 'CGI' : 'mod_perl',
+ regex => qr/^(?:CGI|mod_perl)$/,
+ descr =>
+ "Whether to use CGI.pm or Apache::Request for parsing the incoming HTTP request",
+ },
+
+ decline_dirs => {
+ parse => 'boolean',
+ type => BOOLEAN,
+ default => 1,
+ descr =>
+ "Whether Mason should decline to handle requests for directories"
+ },
+
+ # the only required param
+ interp => {
+ isa => 'HTML::Mason::Interp',
+ descr => "A Mason interpreter for processing components"
+ },
+ );
-use HTML::Mason::MethodMaker
- ( read_only => [ 'args_method' ],
- read_write => [ map { [ $_ => __PACKAGE__->validation_spec->{$_} ] }
- qw( apache_status_title
- decline_dirs
- interp ) ]
+ __PACKAGE__->contained_objects(
+ interp => {
+ class => 'HTML::Mason::Interp',
+ descr =>
+ 'The interp class coordinates multiple objects to handle request execution'
+ },
);
+}
-sub _get_apache_server
-{
- return APACHE2 ? Apache2::ServerUtil->server() : Apache->server();
+use HTML::Mason::MethodMaker (
+ read_only => ['args_method'],
+ read_write => [
+ map { [ $_ => __PACKAGE__->validation_spec->{$_} ] }
+ qw( apache_status_title
+ decline_dirs
+ interp )
+ ]
+);
+
+sub _get_apache_server {
+ return APACHE2 ? Apache2::ServerUtil->server() : Apache->server();
}
my ($STARTED);
@@ -324,25 +348,26 @@ my ($STARTED);
# The "if _get_apache_server" bit is a hack to let this module load
# when not under mod_perl, which is needed to generate Params.pod
__PACKAGE__->_startup() if eval { _get_apache_server };
-sub _startup
-{
+
+sub _startup {
my $pack = shift;
- return if $STARTED++; # Allows a subclass to call this method without running it twice
+ return
+ if $STARTED++
+ ; # Allows a subclass to call this method without running it twice
- if ( my $args_method = $pack->_get_string_param('MasonArgsMethod') )
- {
- if ($args_method eq 'CGI')
- {
+ if ( my $args_method = $pack->_get_string_param('MasonArgsMethod') ) {
+ if ( $args_method eq 'CGI' ) {
eval { require CGI unless defined CGI->VERSION; };
+
# mod_perl2 does not warn about this, so somebody should
- if (APACHE2 && CGI->VERSION < 3.08) {
+ if ( APACHE2 && CGI->VERSION < 3.08 ) {
die "CGI version 3.08 is required to support mod_perl2 API";
}
die $@ if $@;
}
- elsif ( $args_method eq 'mod_perl' && APACHE2 )
- {
- eval "require Apache2::Request" unless defined Apache2::Request->VERSION;
+ elsif ( $args_method eq 'mod_perl' && APACHE2 ) {
+ eval "require Apache2::Request"
+ unless defined Apache2::Request->VERSION;
}
}
}
@@ -351,18 +376,18 @@ sub _startup
# with a more informative status once an interpreter has been created.
my $status_name = 'mason0001';