Apache-ASP

 view release on metacpan or  search on metacpan

ASP.pm  view on Meta::CPAN

with $Response->{FormFill} = 1

  PerlSetVar FormFill 1

=item TimeHiRes

default 0, if set and Time::HiRes is installed, will do 
sub second timing of the time it takes Apache::ASP to process
a request.  This will not include the time spent in the 
session manager, nor modperl or Apache, and is only a 
rough approximation at best.

If Debug is set also, you will get a comment in your
HTML output that indicates the time it took to process
that script.

If system debugging is set with Debug -1 or -2, you will
also get this time in the Apache error log with the 
other system messages.

=head2 Mail Administration

ASP.pm  view on Meta::CPAN

	};

and the first command would be:

 # you don't need to use hash notation when you are only setting 
 # a simple value
 $Response->{Cookies}{'Test Name'} = 'Test Value'; 

I prefer the hash notation for cookies, as this looks nice, and is 
quite perlish.  It is here to stay.  The Cookie() routine is 
very complex and does its best to allow access to the 
underlying hash structure of the data.  This is the best emulation 
I could write trying to match the Collections functionality of 
cookies in IIS ASP.

For more information on Cookies, please go to the source at
http://home.netscape.com/newsref/std/cookie_spec.html

=item $Response->Debug(@args)

API Extension. If the Debug config option is set greater than 0, 
this routine will write @args out to server error log.  refs in @args 

ASP.pm  view on Meta::CPAN

This NON-PORTABLE API extension returns a user $Session given
a session id.  This allows one to easily write a session manager if
session ids are stored in $Application during Session_OnStart, with 
full access to these sessions for administrative purposes.  

Be careful not to expose full session ids over the net, as they
could be used by a hacker to impersonate another user.  So when 
creating a session manager, for example, you could create
some other id to reference the SessionID internally, which 
would allow you to control the sessions.  This kind of application
would best be served under a secure web server.

The ./site/eg/global_asa_demo.asp script makes use of this routine 
to display all the data in current user sessions.

=item $Application->SessionCount()

This NON-PORTABLE method returns the current number of active sessions
in the application, and is enabled by the SessionCount configuration setting.
This method is not implemented as part of the original ASP
object model, but is implemented here because it is useful.  In particular,
when accessing databases with license requirements, one can monitor usage
effectively through accessing this value.

=back

=head2 $Server Object

The server object is that object that handles everything the other
objects do not.  The best part of the server object for Win32 users is 
the CreateObject method which allows developers to create instances of
ActiveX components, like the ADO component.

=over

=item $Server->{ScriptTimeout} = $seconds

Not implemented. May never be.  Please see the 
Apache Timeout configuration option, normally in httpd.conf.  

ASP.pm  view on Meta::CPAN


CGI.pm is a very useful module that aids developers in 
the building of these applications, and Apache::ASP has been made to 
be compatible with function calls in CGI.pm.  Please see cgi.htm in the 
./site/eg directory for a sample ASP script written almost entirely in CGI.

As of version 0.09, use of CGI.pm for both input and output is seamless
when working under Apache::ASP.  Thus if you would like to port existing
cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around
the script to get going.  This functionality has been implemented so that
developers may have the best of both worlds when building their 
web applications.

For more information about CGI.pm, please see the web site

  http://search.cpan.org/dist/CGI/

=item Query Object Initialization

You may create a CGI.pm $query object like so:

ASP.pm  view on Meta::CPAN

Several incompatibilities exist between PerlScript and Apache::ASP:

 > Collection->{Count} property has not been implemented.
 > VBScript dates may not be used for Expires property of cookies.
 > Win32::OLE::in may not be used.  Use keys() to iterate over.
 > The ->{Item} property does not work, use the ->Item() method.

=head1 STYLE GUIDE

Here are some general style guidelines.  Treat these as tips for
best practices on Apache::ASP development if you will.

=head2 UseStrict

One of perl's blessings is also its bane, variables do not need to be
declared, and are by default globally scoped.  The problem with this in 
mod_perl is that global variables persist from one request to another
even if a different web browser is viewing a page.  

To avoid this problem, perl programmers have often been advised to
add to the top of their perl scripts:

ASP.pm  view on Meta::CPAN

Database connectivity is handled through perl's DBI & DBD interfaces.
In the UNIX world, it seems most databases have cross platform support in perl.
You can find the book on DBI programming at http://www.oreilly.com/catalog/perldbi/

DBD::ODBC is often your ticket on Win32.  On UNIX, commercial vendors
like OpenLink Software (http://www.openlinksw.com/) provide the nuts and 
bolts for ODBC.

Database connections can be cached per process with Apache::DBI.

=item What is the best way to debug an ASP application ?

There are lots of perl-ish tricks to make your life developing
and debugging an ASP application easier.  For starters,
you will find some helpful hints by reading the 
$Response->Debug() API extension, and the Debug
configuration directive.

=item How are file uploads handled?

Please see the CGI section.  File uploads are implemented

ASP.pm  view on Meta::CPAN

 -- Richard Ward, HOSTING 321, LLC.

=item Concept Online Ltd.

=begin html

<a href=http://www.conceptonline.com><img src=concept_online.gif border=0></a>

=end html

I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not "forced" to use JSP, we chose ASP....

  -- Csongor Fagyal, Concept Online Ltd.

=item WebTime

=begin html

<a href="http://webtime-project.net"><img border=0 src="webtimelogo.jpg"></a>

=end html

README  view on Meta::CPAN


        This feature can be enabled on a per form basis at runtime with
        $Response->{FormFill} = 1

          PerlSetVar FormFill 1

    TimeHiRes
        default 0, if set and Time::HiRes is installed, will do sub second
        timing of the time it takes Apache::ASP to process a request. This will
        not include the time spent in the session manager, nor modperl or
        Apache, and is only a rough approximation at best.

        If Debug is set also, you will get a comment in your HTML output that
        indicates the time it took to process that script.

        If system debugging is set with Debug -1 or -2, you will also get this
        time in the Apache error log with the other system messages.

  Mail Administration
    Apache::ASP has some powerful administrative email extensions that let you
    sleep at night, knowing full well that if an error occurs at the web site,

README  view on Meta::CPAN

                };

        and the first command would be:

         # you don't need to use hash notation when you are only setting 
         # a simple value
         $Response->{Cookies}{'Test Name'} = 'Test Value';

        I prefer the hash notation for cookies, as this looks nice, and is quite
        perlish. It is here to stay. The Cookie() routine is very complex and
        does its best to allow access to the underlying hash structure of the
        data. This is the best emulation I could write trying to match the
        Collections functionality of cookies in IIS ASP.

        For more information on Cookies, please go to the source at
        http://home.netscape.com/newsref/std/cookie_spec.html

    $Response->Debug(@args)
        API Extension. If the Debug config option is set greater than 0, this
        routine will write @args out to server error log. refs in @args will be
        expanded one level deep, so data in simple data structures like
        one-level hash refs and array refs will be displayed. CODE refs like

README  view on Meta::CPAN

    $Application->GetSession($sess_id)
        This NON-PORTABLE API extension returns a user $Session given a session
        id. This allows one to easily write a session manager if session ids are
        stored in $Application during Session_OnStart, with full access to these
        sessions for administrative purposes.

        Be careful not to expose full session ids over the net, as they could be
        used by a hacker to impersonate another user. So when creating a session
        manager, for example, you could create some other id to reference the
        SessionID internally, which would allow you to control the sessions.
        This kind of application would best be served under a secure web server.

        The ./site/eg/global_asa_demo.asp script makes use of this routine to
        display all the data in current user sessions.

    $Application->SessionCount()
        This NON-PORTABLE method returns the current number of active sessions
        in the application, and is enabled by the SessionCount configuration
        setting. This method is not implemented as part of the original ASP
        object model, but is implemented here because it is useful. In
        particular, when accessing databases with license requirements, one can
        monitor usage effectively through accessing this value.

  $Server Object
    The server object is that object that handles everything the other objects
    do not. The best part of the server object for Win32 users is the
    CreateObject method which allows developers to create instances of ActiveX
    components, like the ADO component.

    $Server->{ScriptTimeout} = $seconds
        Not implemented. May never be. Please see the Apache Timeout
        configuration option, normally in httpd.conf.

    $Server->Config($setting)
        API extension. Allows a developer to read the CONFIG settings, like
        Global, GlobalPackage, StateDir, etc. Currently implemented as a wrapper

README  view on Meta::CPAN

    CGI.pm
        CGI.pm is a very useful module that aids developers in the building of
        these applications, and Apache::ASP has been made to be compatible with
        function calls in CGI.pm. Please see cgi.htm in the ./site/eg directory
        for a sample ASP script written almost entirely in CGI.

        As of version 0.09, use of CGI.pm for both input and output is seamless
        when working under Apache::ASP. Thus if you would like to port existing
        cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around
        the script to get going. This functionality has been implemented so that
        developers may have the best of both worlds when building their web
        applications.

        For more information about CGI.pm, please see the web site

          http://search.cpan.org/dist/CGI/

    Query Object Initialization
        You may create a CGI.pm $query object like so:

                use CGI;

README  view on Meta::CPAN

     [N] print $Request->{Cookies}{Testing} . "<br>\n";

    Several incompatibilities exist between PerlScript and Apache::ASP:

     > Collection->{Count} property has not been implemented.
     > VBScript dates may not be used for Expires property of cookies.
     > Win32::OLE::in may not be used.  Use keys() to iterate over.
     > The ->{Item} property does not work, use the ->Item() method.

STYLE GUIDE
    Here are some general style guidelines. Treat these as tips for best
    practices on Apache::ASP development if you will.

  UseStrict
    One of perl's blessings is also its bane, variables do not need to be
    declared, and are by default globally scoped. The problem with this in
    mod_perl is that global variables persist from one request to another even
    if a different web browser is viewing a page.

    To avoid this problem, perl programmers have often been advised to add to
    the top of their perl scripts:

README  view on Meta::CPAN

        the UNIX world, it seems most databases have cross platform support in
        perl. You can find the book on DBI programming at
        http://www.oreilly.com/catalog/perldbi/

        DBD::ODBC is often your ticket on Win32. On UNIX, commercial vendors
        like OpenLink Software (http://www.openlinksw.com/) provide the nuts and
        bolts for ODBC.

        Database connections can be cached per process with Apache::DBI.

    What is the best way to debug an ASP application ?
        There are lots of perl-ish tricks to make your life developing and
        debugging an ASP application easier. For starters, you will find some
        helpful hints by reading the $Response->Debug() API extension, and the
        Debug configuration directive.

    How are file uploads handled?
        Please see the CGI section. File uploads are implemented through CGI.pm
        which is loaded at runtime only for this purpose. This is the only time
        that CGI.pm will be loaded by Apache::ASP, which implements all other
        cgi-ish functionality natively. The rationale for not implementing file

README  view on Meta::CPAN


        Thank you!

         -- Richard Ward, HOSTING 321, LLC.

    Concept Online Ltd.
        I would like to say that your ASP module rocks :-) We have practically
        stopped developing in anything else about half a year ago, and are now
        using Apache::ASP extensively. I just love Perl, and whereever we are
        not "forced" to use JSP, we chose ASP. It is fast, reliable, versatile,
        documented in a way that is the best for professionals - so thank you
        for writting and maintaining it!

          -- Csongor Fagyal, Concept Online Ltd.

    WebTime
        As we have seen with WebTime, Apache::ASP is not only good for the
        development of website, but also for the development of webtools. Since
        I first discoverd it, I made it a must-have in my society by taking
        traditional PHP users to the world of perl afficionados.

lib/Apache/ASP/Response.pm  view on Meta::CPAN

		    # don't need this for mod_perl2 it seems from Apache::compat
		    $r->send_http_header();
		}
	    }
	}
    }

    1;
}

# do cookies, try our best to emulate cookie collections
sub AddCookieHeaders {
    my $self = shift;
    my $cookies = $self->{'Cookies'};
    my $dbg = $self->{asp}{dbg};

#    print STDERR Data::Dumper::DumperX($cookies);

    my($cookie_name, $cookie);
    for $cookie_name (sort keys %{$cookies}) {
	# skip key used for session id

lib/Apache/ASP/StateManager.pm  view on Meta::CPAN


    # SESSION if we are tracking state, set up the appropriate objects
    my $session;
    if($self->{session_state}) {
	## SESSION INITS
	$self->{cookie_path}       = &config($self, 'CookiePath', undef, '/');
	$self->{cookie_domain}     = &config($self, 'CookieDomain');
	$self->{paranoid_session}  = &config($self, 'ParanoidSession');

	$self->{remote_ip}         = eval { $r->connection()->remote_ip() };   # may not exist in Apache 2.4
	$self->{remote_ip}         ||= eval { $r->useragent_ip() };            # should exist in Apache 2.4, best for end user agent IP address
	$self->{remote_ip}         ||= eval { $r->connection()->client_ip() }; # if useragent_ip not defined for Apache 2.4, try this one

	$self->{session_count}     = &config($self, 'SessionCount');
	
	# cookieless session support, cascading values
	$self->{session_url_parse_match} = &config($self, 'SessionQueryParseMatch');
	$self->{session_url_parse} = $self->{session_url_parse_match} || &config($self, 'SessionQueryParse');
	$self->{session_url_match} = $self->{session_url_parse_match} || &config($self, 'SessionQueryMatch');
	$self->{session_url} = $self->{session_url_parse} || $self->{session_url_match} || &config($self, 'SessionQuery');
	$self->{session_url_force} = &config($self, 'SessionQueryForce');

site/articles/perlmonth1_intro.html  view on Meta::CPAN

<body bgcolor=white>

<h2>Introduction to Apache::ASP</h2>

<h3>By: Joshua Chamas</h3>

<i>published in PerlMonth.com in 1999</i>
<p>

I was first drawn to Active Server Pages (ASP) as a web development
platform a couple years ago when researching how to best develop the 
<font size=-1><a href=http://www.nodeworks.com>NODEWORKS</a></font> web site.  I needed 
something maintainable, powerful, fast, portable, and of course perl.
<p>
Microsoft had developed the ASP standard as the end all to web
application development, which promised to be maintainable, powerful,
and fast.  But support for perl under PerlScript was shoddy, VBScript, 
ASP's native tongue, seemed a pathetic alternative, and an NT/IIS solution lacks a certain 
portability.  Thus I was led to developing <a href=http://www.apache-asp.org>Apache::ASP</a>, 
which runs under Doug MacEachern's <a href=http://perl.apache.org>mod_perl</a> 
for <a href=http://www.apache.org>Apache</a>.

site/cgi.html  view on Meta::CPAN

<font face="courier new" size=3><pre>
</pre></font>CGI.pm is a very useful module that aids developers in 
the building of these applications, and Apache::ASP has been made to 
be compatible with function calls in CGI.pm.  Please see cgi.htm in the 
./site/eg directory for a sample ASP script written almost entirely in <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a>.
<font face="courier new" size=3><pre>
</pre></font>As of version 0.09, use of CGI.pm for both input and output is seamless
when working under Apache::ASP.  Thus if you would like to port existing
cgi scripts over to Apache::ASP, all you need to do is wrap &lt;% %&gt; around
the script to get going.  This functionality has been implemented so that
developers may have the best of both worlds when building their 
web applications.
<font face="courier new" size=3><pre>
</pre></font>For more information about CGI.pm, please see the web site
<font face="courier new" size=3><pre>
  <a href=http://search.cpan.org/dist/CGI/>http://search.cpan.org/dist/CGI/</a>
</pre></font>
	
	<p>
	<a name=Query%20Object4fef5875></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>Query Object Initialization</b></font>

site/config.html  view on Meta::CPAN

</pre></font>
	
	<p>
	<a name=TimeHiRes></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>TimeHiRes</b></font>
<font face="courier new" size=3><pre>
</pre></font>default 0, if set and Time::HiRes is installed, will do 
sub second timing of the time it takes Apache::ASP to process
a request.  This will not include the time spent in the 
session manager, nor modperl or Apache, and is only a 
rough approximation at best.
<font face="courier new" size=3><pre>
</pre></font>If Debug is set also, you will get a comment in your
HTML output that indicates the time it took to process
that script.
<font face="courier new" size=3><pre>
</pre></font>If system debugging is set with Debug -1 or -2, you will
also get this time in the Apache error log with the 
other system messages.</font>
	
	<p>

site/faq.html  view on Meta::CPAN

		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Why%20do%20varia68e97184>Why do variables retain their values between requests?</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#What%20is%20the%20ffd599fa>What is the best way to debug an ASP application ?</a>
			</font>
			</td>
							
		</tr>
		
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Apache%20errorf0bcd572>Apache errors on the PerlHandler or PerlModule directives ?</a>

site/faq.html  view on Meta::CPAN

You can find the book on DBI programming at <a href=http://www.oreilly.com/catalog/perldbi/>http://www.oreilly.com/catalog/perldbi/</a>
<font face="courier new" size=3><pre>
</pre></font>DBD::ODBC is often your ticket on Win32.  On UNIX, commercial vendors
like OpenLink Software (<a href=http://www.openlinksw.com/>http://www.openlinksw.com/</a>) provide the nuts and 
bolts for ODBC.
<font face="courier new" size=3><pre>
</pre></font>Database connections can be cached per process with Apache::DBI.</font>
	
	<p>
	<a name=What%20is%20the%20ffd599fa></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>What is the best way to debug an ASP application ?</b></font>
<font face="courier new" size=3><pre>
</pre></font>There are lots of perl-ish tricks to make your life developing
and debugging an ASP application easier.  For starters,
you will find some helpful hints by reading the 
$Response-&gt;Debug() API extension, and the Debug
configuration directive.</font>
	
	<p>
	<a name=How%20are%20file3e89fb5c></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>How are file uploads handled?</b></font>

site/objects.html  view on Meta::CPAN

		Domain	=&gt; &#39;host.com&#39;,
		Path    =&gt; &#39;/&#39;
	};
</pre></font>and the first command would be:
<font face="courier new" size=3><pre>
 # you don&#39;t need to use hash notation when you are only setting 
 # a simple value
 $Response-&gt;{Cookies}{&#39;Test Name&#39;} = &#39;Test Value&#39;; 
</pre></font>I prefer the hash notation for cookies, as this looks nice, and is 
quite perlish.  It is here to stay.  The Cookie() routine is 
very complex and does its best to allow access to the 
underlying hash structure of the data.  This is the best emulation 
I could write trying to match the Collections functionality of 
cookies in IIS ASP.
<font face="courier new" size=3><pre>
</pre></font>For more information on Cookies, please go to the source at
<a href=http://home.netscape.com/newsref/std/cookie_spec.html>http://home.netscape.com/newsref/std/cookie_spec.html</a></font>
	
	<p>
	<a name=%24Response-%3EDe321f073></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Debug(@args)</b></font>
<font face="courier new" size=3><pre>

site/objects.html  view on Meta::CPAN

</pre></font>This NON-PORTABLE API extension returns a user $Session given
a session id.  This allows one to easily write a session manager if
session ids are stored in $Application during Session_OnStart, with 
full access to these sessions for administrative purposes.  
<font face="courier new" size=3><pre>
</pre></font>Be careful not to expose full session ids over the net, as they
could be used by a hacker to impersonate another user.  So when 
creating a session manager, for example, you could create
some other id to reference the SessionID internally, which 
would allow you to control the sessions.  This kind of application
would best be served under a secure web server.
<font face="courier new" size=3><pre>
</pre></font>The <a href=eg/global_asa_demo.asp>./site/eg/global_asa_demo.asp</a> script makes use of this routine 
to display all the data in current user sessions.</font>
	
	<p>
	<a name=%24Application7441b337></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Application->SessionCount()</b></font>
<font face="courier new" size=3><pre>
</pre></font>This NON-PORTABLE method returns the current number of active sessions
in the application, and is enabled by the SessionCount configuration setting.
This method is not implemented as part of the original ASP
object model, but is implemented here because it is useful.  In particular,
when accessing databases with license requirements, one can monitor usage
effectively through accessing this value.</font>
	
	<p>
	<a name=%24Server%20Objeed08cf85></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$Server Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>The server object is that object that handles everything the other
objects do not.  The best part of the server object for Win32 users is 
the CreateObject method which allows developers to create instances of
ActiveX components, like the ADO component.</font>
	
	<p>
	<a name=%24Server-%3E%7BSc74a89b4a></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Server->{ScriptTimeout} = $seconds</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented. May never be.  Please see the 
Apache Timeout configuration option, normally in httpd.conf.</font>
	

site/style.html  view on Meta::CPAN

</td>



<td valign=top bgcolor=white>
<font size=+0 face=verdana,arial>

<font face=verdana><font class=title size=+1 color=#555555><b>STYLE GUIDE</b></font>
<font face="courier new" size=3><pre>
</pre></font>Here are some general style guidelines.  Treat these as tips for
best practices on Apache::ASP development if you will.</font>

	<hr size=1>
	<table width=100% border=0 cellpadding=1 cellspacing=3>
	<tr>
	<td valign=top><font face="lucida console" size=-1>
	
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>

site/testimonials.html  view on Meta::CPAN

<font face="courier new" size=3><pre>
 -- Richard Ward, HOSTING 321, LLC.
</pre></font>
	
	<p>
	<a name=Concept%20Onli9b9ce434></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>Concept Online Ltd.</b></font>
<font face="courier new" size=3><pre>
</pre></font><a href=http://www.conceptonline.com><img src=concept_online.gif border=0></a>
<font face="courier new" size=3><pre>
</pre></font>I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not &quot;forced&quot; to...
<font face="courier new" size=3><pre>
  -- Csongor Fagyal, Concept Online Ltd.
</pre></font>
	
	<p>
	<a name=WebTime></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>WebTime</b></font>
<font face="courier new" size=3><pre>
</pre></font><a href="http://webtime-project.net"><img border=0 src="webtimelogo.jpg"></a>
<font face="courier new" size=3><pre>



( run in 1.213 second using v1.01-cache-2.11-cpan-4e96b696675 )