ASP4
view release on metacpan or search on metacpan
- YAML can still be used.
2011-10-31 1.058
- Added experimental deployment tools `asp4-prep` and `asp4-deploy`.
* asp4-prep does an `svn export` and then gzips the folder and prints the *.tar.gz filename.
* asp4-deploy decompresses the *.tar.gz, creates a symbolic link 'deploying'
to the new folder, copies the existing config files from latest/*/conf/*
(if it exists) or copies conf/*.template config files and renames them without
the *.template suffix. If a 'latest/*' folder was found, asp4-deploy will
run any unit tests found. If all tests pass, then 'deploying' is removed
and 'latest' is changed to point to the new folder.
- TODO: Add POD for asp4-prep and asp4-deploy. This is delayed until it's proven
that this is the correct way for onesie-twosie deployments.
2011-10-04 1.057
- Renamed @AppRoot@ macro to @ProjectRoot@ to avoid confusion with $Config->web->application_root
- Adjusted package declarations in some "stealth-mode" pm files because they have no POD yet.
2011-10-03 1.056
- Updated asphelper to include directives that disable mod_deflate and Apache2::Reload
for ASP4 websites. RayBaksh++
/home/bart/Projects/facebook
- Erikdj pointed out the need for the @AppRoot@ macro and suggested the (excellent) name. Thanks Erik!
2011-09-19 1.053
- Updated asphelper script to genenrate sample app conforming to new App::db::*
root namespace.
2011-09-19 1.052
[Bug Fixes]
- Blank lines in asp4-config.json no longer causes an exception to be thrown.
- Update documentation to reflect preference change from app::* to App::db::*
root namespace for database classes.
2011-08-14 1.051
[Bug Fixes]
- 'Redirect Loop' fixed! Under mod_perl, $context->send_headers() was not
called for non-200 http responses.
Now it is.
This means that if you had `return $Response->Redirect("/foo/")` in a RequestFilter
you may have gotten a "redirect loop" because although the '301 Moved' status
was set, the `location: /foo/` header was *not* set. This would result in
- Actually it turned out that setting $Session->is_read_only(1) *DID* prevent
$Session->save() from working. This is now fixed to match the documentation.
2011-05-01 v1.044
[Bug Fixes]
- ASP4::ModPerl now does the Right Thing when a non-200 response is encountered.
- 500 response does not result in an "encoding error" in firefox.
- 200 (or 0 response) does the right thing.
- non-200 (and non-500) response does the right thing (eg: 401)
- ASP4::SessionStateManager now checks $s->is_changed *before* checking $s->{__lastMod} date
before deciding whether is should persist its changes in ->save().
[New Features]
- $Session->is_read_only(1) is new. Setting it to a true value (eg: 1) will prevent
the default behavior of calling $Session->save() at the end of each successful request.
2011-04-08 v1.043
- Documentation overhaul.
2011-03-23 v1.042
- Fixed sporadic error in master pages that looks like this:
2010-05-18 v1.030
- $ENV{HTTP_HOST} is set to $r->hostname or $ENV{DOCUMENT_ROOT} in ASP4::ModPerl and ASP4::UserAgent, respectively.
2010-04-18 v1.029
- The document root was not always set properly in some very, very strange
circumstances.
- Upgrade recommended.
2010-04-18 v1.028
- $Request->Reroute($uri) no longer changes $ENV{REQUEST_URI} to $uri.
2010-04-15 v1.027
- ASP4::Request was not properly URLDecoding parameters. Now it does.
2010-04-13 v1.026
- Now both POST'ed and GET'ed parameters are added to $Form. This means that if
you...
<form action="/page/?foo=abc" method="post"><input name="bar" value="123" /></form>
...both foo=abc and bar=123 will be in $Form. Before this update, only bar=123 would
be there, and foo=abc would be lost.
2010-03-08 v1.023
- ASP4::HTTPContext now checks to see if any RequestFilters match a uri before
returning a 404. This is helpful for SEO optimizations.
- New feature: $Request->Reroute("/new-uri/?foo=bar")
* Also very useful for SEO.
2010-03-08 v1.022
- asphelper's final instructions are now more clear and concise.
- Fixes a bug that caused active sessions to timeout as though inactive simply
because they were not changed before the timeout occurred. Now, $Session->save()
checks to see if it's been more than 60 seconds since the last time the __lastMod
was changed - and if it has been more than 60 seconds, the session is saved
and the __lastMod value is updated to time() - thus preventing expiry of
active sessions.
2010-03-08 v1.021
- Removed a warning that popped up now and then about the use of an uninitialized value.
- Added a more informative "Yay you're finished!" message after running asphelper.
2010-03-04 v1.020
- Now asphelper will output sbin/ddl.sql, which contains the structure of the
asp_sessions database table. This is a handy place to start describing the
- $Config->data_connections->session->cookie_domain should set to "*" in these cases.
- $Response->SetCookie accepts the "*" value for domain also.
- The result is that no "domain=xyz" attribute is given to these cookies.
2010-02-18 v1.014
- $Response->ContentType now functions correctly.
- Upgrade mandatory!
2010-02-18 v1.013
- ASP4::HandlerResolver was not properly remembering timestamps on handler files.
This resulted in unnecessary reloads of handlers that had not been changed.
2010-02-18 v1.012
- MANIFEST was missing a few files that caused tests to fail.
2010-02-17 v1.011
! Upgrade Recommended !
- $Response->SetCookie and $Response->ContentType were not functioning properly.
- Added new method $Response->SetHeader.
2010-02-10 v1.010
2010-02-07 v1.008
- Multi-value form parameters (eg 3 checkboxes with the same name) will now
*correctly* appear as an arrayref in $Form, instead of 3 values joined with
a null byte.
2010-01-31 v1.007
- $FileUpload->SaveAs("/path/to/file.txt") will now create "/path" and "/path/to"
before writing "/path/to/file.txt".
2010-01-27 v1.006
- Sometimes changes in MasterPages are not immediately reflected in child pages.
This release attempts to correct this bug.
2010-01-25 v1.005
- Request Filters were not always matching properly
because of a regexp bug in ASP4::FilterResolver.
2010-01-22 v1.004
- $ENV{REQUEST_URI} was not getting set properly - this is now fixed.
2009-12-22 v1.003
- $ENV{HTTP_REFERER} can be set and preserved properly.
- conf/asp4-config.json will be reloaded if it is modified. This means that
the server does not have to be restarted for changes to asp4-config.json
to take effect.
- Added ASP4::TransHandler
2009-12-17 v1.002
- %ENV is no longer clobbered by ASP4::UserAgent.
2009-12-16 v1.001
- Fixed a bug that prevented ASP4 for reliably detecting when an ASP script
had been updated.
README.markdown view on Meta::CPAN
cherry => "red",
peach => "pink,
};
### Get a session variable
my $foo = $Session->{foo};
### $Session->save()
Called automatically at the end of every successful request, causes any changes
to the `$Session` to be saved to the database.
### $Session->reset()
Call `$Session->reset()` to clear all the data out of the session and save
it to the database.
## $Config
The ASP4 `$Config` object is stored in a simple JSON format on disk, and accessible
lib/ASP4.pm view on Meta::CPAN
cherry => "red",
peach => "pink,
};
=head3 Get a session variable
my $foo = $Session->{foo};
=head3 $Session->save()
Called automatically at the end of every successful request, causes any changes
to the C<$Session> to be saved to the database.
=head3 $Session->reset()
Call C<< $Session->reset() >> to clear all the data out of the session and save
it to the database.
=head2 $Config
The ASP4 C<$Config> object is stored in a simple JSON format on disk, and accessible
lib/ASP4/ConfigNode/Web.pm view on Meta::CPAN
=head2 www_root
Returns the absolute path to where the normal website files (ASP, images, css, javascripts, etc) are located,
i.e. C</usr/local/projects/mysite.com/htdocs>
=head2 page_cache_root
Returns the absolute path to where 'compiled' ASP scripts are stored, i.e. C</tmp/PAGE_CACHE>
Since the 'compiled' ASP scripts are overwritten whenever the source ASP script has been changed on disk,
the webserver process must have read/write access to this location.
It is recommended that a temporary path is used - '/tmp' on most Linux distributions.
=head2 request_filters
Returns a list of ConfigNodes that represent individual C<filter> elements in the configuration.
=head2 router
lib/ASP4/PageLoader.pm view on Meta::CPAN
my $key = ($ENV{DOCUMENT_ROOT}||"") . ":$info->{filename}";
if( $class->needs_recompile( $info->{saved_to}, $info->{filename} ) )
{
my $page = ASP4::PageParser->new( script_name => $info->{script_name} )->parse();
$FileTimes{ $key } = stat($info->{filename})->mtime;
return $page;
}# end if()
my $config = ASP4::ConfigLoader->load();
# Deal with changes all the way up the master/child chain:
ASP4::HandlerResolver->_forget_package( $info->{compiled_as}, $info->{package} );
$config->load_class( $info->{package} );
$FileTimes{ $key } ||= stat($info->{filename})->mtime;
return $info->{package}->new();
}# end load()
sub needs_recompile
{
lib/ASP4/SessionStateManager.pm view on Meta::CPAN
no warnings 'uninitialized';
md5_hex(
join ":",
map { "$_:$s->{$_}" }
grep { $_ ne '__signature' && $_ ne '____is_read_only' } sort keys(%$s)
);
}# end _hash()
sub is_changed
{
my $s = shift;
no warnings 'uninitialized';
$s->_hash ne $s->{__signature};
}# end is_changed()
sub reset
{
my $s = shift;
delete($s->{$_}) for grep { $_ ne 'SessionID' } keys %$s;
$s->save;
return;
}# end reset()
sub DESTROY
{
my $s = shift;
return undef(%$s) unless $s->{SessionID};
unless( $s->is_read_only )
{
$s->save;# if $s->is_changed;
}# end unless()
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
lib/ASP4/SessionStateManager.pm view on Meta::CPAN
You've seen this page <%= $Session->{counter}++ %> times before.
=head1 DESCRIPTION
Web applications require session state management - and the simpler, the better.
C<ASP4::SessionStateManager> is a simple blessed hash. When it goes out of scope,
it is saved to the database (or whatever).
If no changes were made to the session, it is not saved.
=head1 PUBLIC PROPERTIES
=head2 is_read_only( 1:0 )
Starting with version 1.044, setting this property to a true value will prevent
any changes made to the contents of the session during the current request from
being saved at the end of the request.
B<NOTE:> A side-effect is that calling C<< $Session->save() >> after calling C<< $Session->is_read_only(1) >>
will B<*NOT*> prevent changes from being saved B<ON PURPOSE>. Explicitly calling C<< $Session->save() >>
will still cause the session data to be stored. Setting C<< $Session->is_read_only(1) >> will only
prevent the default behavior of saving session state at the end of each successful request.
=head1 PUBLIC METHODS
=head2 save( )
Causes the session data to be saved. (Unless C<< $Session->is_read_only(1) >> is set.)
=head2 reset( )
lib/ASP4/SessionStateManager/Memcached.pm view on Meta::CPAN
package
ASP4::SessionStateManager::Memcached;
# XXX: Experimental memcached session storage.
# TODO: Configuration section is likely to change.
use strict;
use warnings 'all';
use base 'ASP4::SessionStateManager';
use Cache::Memcached;
use JSON::XS;
my $memd;
sub new
lib/ASP4/SessionStateManager/Memcached.pm view on Meta::CPAN
}# end create()
sub save
{
my ($s, $id) = @_;
return unless $s->{SessionID};
no warnings 'uninitialized';
my $seconds_since_last_modified = time() - ($s->{__lastMod} || 0);
return unless $s->is_changed || ( $seconds_since_last_modified > 60 );
$s->{__lastMod} = time();
$s->sign;
my %clone = %$s;
my $json = encode_json(\%clone);
$memd->set( $s->{SessionID}, $json, $s->{__ttl} );
}# end save()
sub reset
sbin/asp4-deploy view on Meta::CPAN
Copies all your configuration files from 'C<latest/*/conf/*>' into 'C<deploying/*/conf/*>'
=item Step 4
Runs unit tests on all folders under deploying except for 'C<common>'.
If all tests pass, we continue. Otherwise, we bail out with errors.
=item Step 5
Unlink the C<deploying> symbolic link and change C<latest> to point to the new directory.
=item Step 6
B<After a successful deployment, you should restart apache.>
=back
=head1 DEPLOYMENT DIRECTORY FOLDER STRUCTURE
Initially you will have a folder structure like this:
sbin/asphelper view on Meta::CPAN
use base '$appName\::db::model';
__PACKAGE__->set_up_table('things');
1;# return true:
\=head1 DESCRIPTION
This module was generated by $0 on @{[ scalar(localtime()) ]}.
B<***IT IS SAFE to make changes to this file, as it will not be overwritten.***>.
\=head1 SEE ALSO
L<Class::DBI::Lite>
\=cut
CODE
close($ofh);
}# end unless()
( run in 0.311 second using v1.01-cache-2.11-cpan-c333fce770f )