ASP4

 view release on metacpan or  search on metacpan

README.markdown  view on Meta::CPAN

    

      # Path:
      path    => "/some/folder/"    # will ONLY work within /some/folder/ on your website
    );

### $Response->Include( $path, %args )

ASP4's `$Response` object offers 3 different include methods.

    <!-- Normal SSI-style Include -->
    <!-- #include virtual="/includes/page.asp" -->

If you want to supply arguments to the included ASP script you can use `$Response->Include($path, \%args)`

    # Add the output of C</includes/page.asp> to the current output buffer:
    my %args = ( foo => "bar" );
    $Response->Include( $Server->MapPath("/includes/page.asp"), \%args );

`\%args` is optional.

README.markdown  view on Meta::CPAN

    %>
    

    <%
      # Get our $user:
      use App::db::user;
      my $user = App::db::user->retrieve( $Session->{user_id} );
    %>
    

    <div style="float: left; width: 40%; border-right: solid 1px #000;">
      <h3>Incoming Messages</h3>
    <%
      foreach my $msg ( $user->messages_in(undef, { order_by => "created_on ASC"} ) ) {
    %>
      <div class="msg">
        <span class="from"><%= $msg->sender->email %></span> says:<br/>
        <div class="body"><%= $Server->HTMLEncode( $msg->body ) %></div>
        <span class="date"><%= $msg->created_on %></span>
      </div>
    <%
      }# end foreach()
    %>
    </div>
    

    <div style="float: right; width: 40%; border: dotted 1px #000;">
      <h3>Send New Message</h3>
      <form id="send_form" method="post" action="/handlers/app.send">
        <p>
          <label>Recipient:</label>
          <select name="to_user_id">
    <%
      my @users = App::db::user->search_where({
        user_id => {'!=' => $user->id }
      }, {
        order_by => "email"

lib/ASP4.pm  view on Meta::CPAN

    domain  => "www.example.com", # will ONLY work for www.example.com
    
    # Path:
    path    => "/some/folder/"    # will ONLY work within /some/folder/ on your website
  );

=head3 $Response->Include( $path, %args )

ASP4's C<$Response> object offers 3 different include methods.

  <!-- Normal SSI-style Include -->
  <!-- #include virtual="/includes/page.asp" -->

If you want to supply arguments to the included ASP script you can use C<< $Response->Include($path, \%args) >>

  # Add the output of C</includes/page.asp> to the current output buffer:
  my %args = ( foo => "bar" );
  $Response->Include( $Server->MapPath("/includes/page.asp"), \%args );

C<\%args> is optional.

lib/ASP4.pm  view on Meta::CPAN

  <%
    }# end if()
  %>
  
  <%
    # Get our $user:
    use App::db::user;
    my $user = App::db::user->retrieve( $Session->{user_id} );
  %>
  
  <div style="float: left; width: 40%; border-right: solid 1px #000;">
    <h3>Incoming Messages</h3>
  <%
    foreach my $msg ( $user->messages_in(undef, { order_by => "created_on ASC"} ) ) {
  %>
    <div class="msg">
      <span class="from"><%= $msg->sender->email %></span> says:<br/>
      <div class="body"><%= $Server->HTMLEncode( $msg->body ) %></div>
      <span class="date"><%= $msg->created_on %></span>
    </div>
  <%
    }# end foreach()
  %>
  </div>
  
  <div style="float: right; width: 40%; border: dotted 1px #000;">
    <h3>Send New Message</h3>
    <form id="send_form" method="post" action="/handlers/app.send">
      <p>
        <label>Recipient:</label>
        <select name="to_user_id">
  <%
    my @users = App::db::user->search_where({
      user_id => {'!=' => $user->id }
    }, {
      order_by => "email"

lib/ASP4/ErrorHandler.pm  view on Meta::CPAN


sub error_html
{
  my ($s, $error) = @_;
  
  my $msg = <<"ERROR";
<!DOCTYPE html>
<html>
<head><title>500 Server Error</title>
<meta charset="utf-8" />
<style type="text/css">
HTML,BODY {
  background-color: #FFFFFF;
}
HTML,BODY,P,DIV {
  font-family: Arial, Helvetica, Sans-Serif;
}
HTML,BODY,P,PRE,DIV {
  font-size: 12px;
}
H1 {

lib/ASP4/ErrorHandler.pm  view on Meta::CPAN

  text-align: right;
  padding-right: 5px;
  float: left;
  width: 80px;
  font-weight: bold;
}
.info {
  float: left;
  color: #CC0000;
}
</style>
<body>
<h1>500 Server Error</h1>
<h2>@{[ $error->message ]}</h2>
<div><div class="label">URL:</div> <div class="info"><code>@{[ $ENV{HTTP_HOST} ]}@{[ $ENV{REQUEST_URI} ]}</code></div></div>
<div class="clear"></div>
<div><div class="label">File:</div> <div class="info"><code>@{[ $error->file ]}</code></div></div>
<div class="clear"></div>
<div><div class="label">Line:</div> <div class="info">@{[ $error->line ]}</div></div>
<div class="clear"></div>
<div><div class="label">Time:</div> <div class="info">@{[ HTTP::Date::time2iso() ]}</div></div>

lib/ASP4/ErrorHandler.pm  view on Meta::CPAN

<h3>\%ENV</h3>
<div class="code"><pre>
HTTP_REFERER:     '@{[ $Server->HTMLEncode($ENV{HTTP_REFERER}||'NONE') ]}'
HTTP_COOKIE:      '@{[ $Server->HTMLEncode($ENV{HTTP_COOKIE}||'NONE') ]}'
HTTP_USER_AGENT:  '@{[ $Server->HTMLEncode($ENV{HTTP_USER_AGENT}||'NONE') ]}'
REMOTE_ADDR:      '@{[ $Server->HTMLEncode($ENV{REMOTE_ADDR}||'NONE') ]}'
</pre></div>
<h3>\$Form</h3>
<div class="code"><pre>@{[ Dumper($Form) ]}</pre></div>
<div class="clear"></div>
<div style="display: none;">
</body>
</html>
ERROR
  
  return $msg;
}# end error_html()


1;# return true:

t/htdocs/index.asp  view on Meta::CPAN

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>ASP4 Installed</title>
  <style type="text/css">
  HTML, BODY {
    margin: 0px;
    padding: 0px;
    border: 0px;
    font-size: 14px;
    font-family: Verdana, Arial, Sans-Serif;
    background-color: #333333;
    color: #000000;
    width: 100%;
    height: 100%;

t/htdocs/index.asp  view on Meta::CPAN

  }
  
  #leftnav {
    float: left;
    width: 198px;
  }
  
  UL {
    margin: 0px;
    padding: 0px;
    list-style: none;
  }
  
  UL LI {
    line-height: 28px;
  }
  
  UL LI A {
    border-right: solid 2px #FF0000;
    padding-left: 10px;
    display: block;

t/htdocs/index.asp  view on Meta::CPAN

  }
  
  PRE {
    background-color: lightyellow;
    height: 300px;
    overflow: auto;
    padding: 5px;
    border: solid 1px #CCCCCC;
  }

  </style>
</head>
<body>
<div id="header">
  <div id="header-container">
<%
  require ASP4;
%>
    ASP4 v<%= $ASP4::VERSION %> Installed // Date: <%= scalar(localtime(time)) %>
  </div>
</div>

t/htdocs/pageparser/master.asp  view on Meta::CPAN

    <p>Before Inner 2</p>
    <asp:ContentPlaceHolder id="inner2">
      <p>Inner 2</p>
    </asp:ContentPlaceHolder>
    <p>After Inner 2</p>
    
  </asp:ContentPlaceHolder>
  <p>After Inner 1</p>
  
</asp:ContentPlaceHolder>
<p><font color="white" style="background-color: green; border: solid 1px black;">After Outer^^^</font></p>
</body> 
</html>



( run in 1.918 second using v1.01-cache-2.11-cpan-49f99fa48dc )