Acme-ReturnValue

 view release on metacpan or  search on metacpan

t/pms/RayApp.pm  view on Meta::CPAN

You will need to configure Apache for B<RayApp> to do its job. It
can operate both in the mod_perl and in pure CGI way.

=head2 Pure mod_perl approach

If you have a mod_perl 2 support in your Apache 2 and want to use
it to run you B<RayApp>-based applications, the following setup
will give you the correct result:

	Alias /sub /opt/www
	<LocationMatch ^/sub/(.+\.(html|xml))?$/>
		SetHandler perl-script
		PerlResponseHandler RayApp::mod_perl
	</LocationMatch>

The Alias directive ensures that the DSD and Perl code will be
correctly found in the /opt/www/ directory, for requests coming to
/sub/ Location.

Instead of perl-script, you can also use C<SetHandler modperl>.

t/pms/RayApp.pm  view on Meta::CPAN

		return (
			my_full_url => $q->url( -full => 1 ),
			my_relative_url => $q->url( -relative => 1 ),
			dbuser => $dbh->{'Username'},
                );
	}
	1;

and in the XSLT you will get to them for example via

	<xsl:value-of select="$my_relative_url"/>

=item RayAppStyleStaticParams / RAYAPP_STYLE_STATIC_PARAMS

When a static .xml file is processed into HTML, the XSL
transformation is run, even if there was no application invocation
in the process. Normally, the B<handler> of module specified by
B<RayAppInputModule> would not be run in this case. If you want the
module to be run even in this case (thus generating input argument for
the B<RayAppStyleParamModule> module), set this option to true.

=head2 The applications

Having the Web server set up, you can write your first application
in B<RayApp> manner. For start, a simplistic application which only
returns two values will be enough.

First the DSD file, /opt/www/app.dsd:

	<?xml version="1.0"?>
	<root>
		<_param name="name"/>
		<name/>
		<time/>
	</root>

The application will accept one parameter, B<name> and will return
hash with two values, B<name> and B<time>. The code in
/opt/www/app.mpl can be

	sub handler {
		my ($dbh, $q) = @_;
		return {
			name => scalar($q->param('name')),



( run in 1.270 second using v1.01-cache-2.11-cpan-e1769b4cff6 )