ASP4
view release on metacpan or search on metacpan
2010-03-01 v1.018
- Updated asphelper script so that the POD on CPAN is not contaminated with POD
from within one of the modules that asphelper generates.
- Now asphelper will not create a Class::DBI::Lite model class unless
Class::DBI::Lite is installed.
2010-03-01 v1.017
- Updated asphelper script to only accept options on the command-line, like "normal" scripts.
2010-02-28 v1.016
- A vestigial "use encoding 'utf8'" was removed from ASP4::Server.
- It was causing Apache to segfault on ubuntu 9.10.
2010-02-19 v1.015
- Hostnames like http://myapplication/ were not setting session cookies properly.
- $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.
README.markdown view on Meta::CPAN
...
Suppose you had the following tables in your database:
create table users (
user_id bigint unsigned not null primary key auto_increment,
email varchar(200) not null,
password char(32) not null,
created_on timestamp not null default current_timestamp,
unique(email)
) engine=innodb charset=utf8;
create table messages (
message_id bigint unsigned not null primary key auto_increment,
from_user_id bigint unsigned not null,
to_user_id bigint unsigned not null,
subject varchar(100) not null,
body text,
created_on timestamp not null default current_timestamp,
foreign key fk_messages_to_senders (from_user_id) references users (user_id) on delete cascade,
foreign key fk_messages_to_recipients (to_user_id) references users (user_id) on delete cascade
) engine=innodb charset=utf8;
__NOTE:__ It's best to assign every ASP4 application its own namespace. For this
example the namespace is `App::db::`
Create the file `lib/App::db/model.pm` and add the following lines:
package App::db::model;
use strict;
lib/ASP4.pm view on Meta::CPAN
...
Suppose you had the following tables in your database:
create table users (
user_id bigint unsigned not null primary key auto_increment,
email varchar(200) not null,
password char(32) not null,
created_on timestamp not null default current_timestamp,
unique(email)
) engine=innodb charset=utf8;
create table messages (
message_id bigint unsigned not null primary key auto_increment,
from_user_id bigint unsigned not null,
to_user_id bigint unsigned not null,
subject varchar(100) not null,
body text,
created_on timestamp not null default current_timestamp,
foreign key fk_messages_to_senders (from_user_id) references users (user_id) on delete cascade,
foreign key fk_messages_to_recipients (to_user_id) references users (user_id) on delete cascade
) engine=innodb charset=utf8;
B<NOTE:> It's best to assign every ASP4 application its own namespace. For this
example the namespace is C<App::db::>
Create the file C<lib/App::db/model.pm> and add the following lines:
package App::db::model;
use strict;
use warnings 'all';
lib/ASP4/SimpleCGI.pm view on Meta::CPAN
$toencode;
}# end escape()
sub unescape
{
my ($s, $todecode) = @_;
return unless defined($todecode);
$todecode =~ tr/+/ /; # pluses become spaces
$todecode =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
return $todecode;
}# end unescape()
sub DESTROY
{
my $s = shift;
map {
close($s->{uploads}->{$_}->{filehandle});
sbin/asphelper view on Meta::CPAN
set foreign_key_checks = 0;
drop table if exists asp_sessions;
set foreign_key_checks = 1;
create table asp_sessions (
session_id char(32) not null primary key,
session_data blob,
created_on datetime default null,
modified_on datetime default null
) engine=innodb charset=utf8;
SQL
close($ofh);
open my $ifh, "common/sbin/ddl.sql"
or die "Cannot open 'common/sbin/ddl.sql' for reading: $!";
local $/ = ';';
while( my $cmd = <$ifh> )
{
$cmd =~ s/^\s+//s;
$cmd =~ s/\s+$//s;
t/050-encoding/010-default.t view on Meta::CPAN
#!/usr/bin/perl -w
use utf8;
use strict;
use warnings 'all';
use Test::More 'no_plan';
use ASP4::API;
my $hellos = {
arabic => {
original => 'Ù
Ø±ØØ¨Ø§ Ø Ø§ÙØ¹Ø§ÙÙ
!',
encoded => 'JiMxNjA1OyYjMTU4NTsmIzE1ODE7JiMxNTc2OyYjMTU3NTsgJiMxNTQ4OyAmIzE1NzU7JiMxNjA0
OyYjMTU5MzsmIzE1NzU7JiMxNjA0OyYjMTYwNTsh'
t/handlers/dev/encoding/hello.pm view on Meta::CPAN
package dev::encoding::hello;
use strict;
use warnings 'all';
use base 'ASP4::FormHandler';
use vars __PACKAGE__->VARS;
use MIME::Base64;
use Encode;
use utf8;
# TODO: Encoding tests to make sure we get round-trip encoding integrity.
sub run
{
my ($s, $context) = @_;
my $hellos = {
arabic => {
original => 'Ù
Ø±ØØ¨Ø§ Ø Ø§ÙØ¹Ø§ÙÙ
!',
encoded => 'JiMxNjA1OyYjMTU4NTsmIzE1ODE7JiMxNTc2OyYjMTU3NTsgJiMxNTQ4OyAmIzE1NzU7JiMxNjA0
t/handlers/dev/encoding/hello.pm view on Meta::CPAN
},
foo => {
original => 'Bjòrknù',
}
};
my $lang = $Form->{lang}
or return;
$Response->ContentType("text/plain; charset=utf-8");
$Response->Write(
encode_utf8(
$hellos->{$lang}->{original}
)
);
}# end run()
1;# return true:
( run in 0.586 second using v1.01-cache-2.11-cpan-49f99fa48dc )