ASP

 view release on metacpan or  search on metacpan

ASP.pm  view on Meta::CPAN


require 5.005;
use strict;

my ($APACHE, $WIN32);
$APACHE	= $Apache::ASP::VERSION; 
$WIN32	= $^O =~ /win/i;

package ASP::IO;
sub TIEHANDLE	{ shift->new(@_) }
sub PRINT		{ shift->print(@_) }
sub PRINTF		{ shift->print(sprintf(@_)) }
sub new { bless {}, shift; }
sub print {
    my $self = shift;
    ASP::Print(@_);
    1;
}

1;

package ASP;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $ASPOUT);

ASP.pm  view on Meta::CPAN


=head1 NAME

ASP - a Module for ASP (PerlScript) Programming

=head1 SYNOPSIS

	use strict;
	use ASP qw(:strict);

	print "Testing, testing.<BR><BR>";
	my $item = param('item');

	if($item eq 'Select one...') {
	    die "Please select a value from the list.";
	}

	print "You selected $item.";
	exit;

=head1 DESCRIPTION

This module is based on Matt Sergeant's excellent
Win32::ASP module, which can be found at
E<lt>F<http://www.fastnetltd.ndirect.co.uk/Perl>E<gt>.
After using Mr. Sergeant's module, I took on the task of
customizing and optimizing it for my own purposes. Feel
free to use it if you find it useful.

=head1 NOTES

This module is designed to work with both ASP PerlScript on IIS4,
as well as mod_perl/Apache::ASP on *nix platforms. Apache::ASP
already provides some of the functionality provided by this module;
because of this (and to avoid redundancy), ASP.pm attempts to detect
its environment. Differences between Apache and MS ASP are noted.

Both of the print() and warn() standard perl funcs are overloaded
to output to the browser. print() is also available via the
$ASP::ASPOUT->print() method call.

$Request->ServerVariables are only stuffed into %ENV on Win32
platforms, as Apache::ASP already provides this.

ASP.pm also exports the $ScriptingNamespace symbol (Win32 only).
This symbol allows PerlScript to call subs/functions written in
another script language. For example:

    <%@ language=PerlScript %>
    <%
        use ASP qw(:strict);
        print $ScriptingNamespace->SomeSub("arg1");
    %>
    <SCRIPT language=VBScript runat=server>
    Function SomeSub (str)
        SomeSub = SomethingThatReturnsSomething()
    End Function
    </SCRIPT>

=head1 USE

=head2 use ASP qw(:basic);

ASP.pm  view on Meta::CPAN


NOTE: This is not the only way to accomplish this, but I think it's
the cleanest, most convenient way.

=head2 use ASP qw(:all);

Exports all subs except those marked 'not exported'.

=head2 use ASP ();

Overloads print() and warn() and provides the $ASP::ASPOUT object.

=head1 FUNCTION REFERENCE

=head2 warn LIST

C<warn> (or more specifically, the __WARN__ signal) has been re-routed to
output to the browser.

FYI: When implemented, this tweak led to the removal of the prototypes
Matt placed on his subs.

=head2 Warn LIST

C<Warn> is an alias for the ASP::Print method described below. The
overloading of C<warn> as described above does not currently work
in Apache::ASP, so this is provided.

=cut
sub Warn { ASP::Print(@_); }

=head2 print LIST

C<print> is overloaded to write to the browser by default. The inherent
behavior of print has not been altered and you can still use an alternate
filehandle as you normally would. This allows you to use print just
as you would in CGI scripts. The following statement would need no
modification between CGI and ASP PerlScript:

    print param('URL'), " was requested by ", $ENV{REMOTE_HOST}, "\n";

=head2 Print LIST

Prints a string or comma separated list of strings to the browser. Use
as if you were using C<print> in a CGI application. Print gets around ASP's
limitations of 128k in a single $Response->Write() call.

NB: C<print> calls Print, so you could use either, but
print more closely resembles perl.

=cut
sub Print {
	for (@_) {
		if ( length($_) > 128000 ) {
			ASP::Print( unpack('a128000a*', $_) );
		} else {
			$main::Response->Write($_);
		}
	}

README  view on Meta::CPAN

NAME
    ASP - a Module for ASP (PerlScript) Programming

SYNOPSIS
            use strict;
            use ASP qw(:strict);

            print "Testing, testing.<BR><BR>";
            my $item = param('item');

            if($item eq 'Select one...') {
                die "Please select a value from the list.";
            }

            print "You selected $item.";
            exit;

DESCRIPTION
    This module is based on Matt Sergeant's excellent Win32::ASP
    module, which can be found at
    <http://www.fastnetltd.ndirect.co.uk/Perl>. After using Mr.
    Sergeant's module, I took on the task of customizing and
    optimizing it for my own purposes. Feel free to use it if you
    find it useful.

NOTES
    This module is designed to work with both ASP PerlScript on
    IIS4, as well as mod_perl/Apache::ASP on *nix platforms.
    Apache::ASP already provides some of the functionality provided
    by this module; because of this (and to avoid redundancy),
    ASP.pm attempts to detect its environment. Differences between
    Apache and MS ASP are noted.

    Both of the print() and warn() standard perl funcs are
    overloaded to output to the browser. print() is also available
    via the $ASP::ASPOUT->print() method call.

    $Request->ServerVariables are only stuffed into %ENV on Win32
    platforms, as Apache::ASP already provides this.

    ASP.pm also exports the $ScriptingNamespace symbol (Win32 only).
    This symbol allows PerlScript to call subs/functions written in
    another script language. For example:

        <%@ language=PerlScript %>
        <%
            use ASP qw(:strict);
            print $ScriptingNamespace->SomeSub("arg1");
        %>
        <SCRIPT language=VBScript runat=server>
        Function SomeSub (str)
            SomeSub = SomethingThatReturnsSomething()
        End Function
        </SCRIPT>

USE
  use ASP qw(:basic);

README  view on Meta::CPAN


    NOTE: This is not the only way to accomplish this, but I think
    it's the cleanest, most convenient way.

  use ASP qw(:all);

    Exports all subs except those marked 'not exported'.

  use ASP ();

    Overloads print() and warn() and provides the $ASP::ASPOUT
    object.

FUNCTION REFERENCE
  warn LIST

    `warn' (or more specifically, the __WARN__ signal) has been re-
    routed to output to the browser.

    FYI: When implemented, this tweak led to the removal of the
    prototypes Matt placed on his subs.

  Warn LIST

    `Warn' is an alias for the ASP::Print method described below.
    The overloading of `warn' as described above does not currently
    work in Apache::ASP, so this is provided.

  print LIST

    `print' is overloaded to write to the browser by default. The
    inherent behavior of print has not been altered and you can
    still use an alternate filehandle as you normally would. This
    allows you to use print just as you would in CGI scripts. The
    following statement would need no modification between CGI and
    ASP PerlScript:

        print param('URL'), " was requested by ", $ENV{REMOTE_HOST}, "\n";

  Print LIST

    Prints a string or comma separated list of strings to the
    browser. Use as if you were using `print' in a CGI application.
    Print gets around ASP's limitations of 128k in a single
    $Response->Write() call.

    NB: `print' calls Print, so you could use either, but print more
    closely resembles perl.

  DebugPrint LIST

    Output is displayed between HTML comments so the output doesn't
    interfere with page aesthetics.

  HTMLPrint LIST

    The same as `Print' except the output is HTML-encoded so that



( run in 0.850 second using v1.01-cache-2.11-cpan-de7293f3b23 )