Apache-Roaming
view release on metacpan or search on metacpan
ChangeLog Revision history
MANIFEST This file
MANIFEST.SKIP
Makefile.PL Makefile generator
README I mean it! :-)
lib/Apache/Roaming.pm The roaming access module
lib/Apache/Roaming/LiPrefs.pm A module for parsing liprefs files
lib/Bundle/Apache/Roaming.pm A bundle for CPAN installation
t/01base.t Base test (Loading the module)
t/10methods.t Testing the PUT, GET, MOVE and DELETE methods
t/20liprefs.t Testing Apache::Roaming::LiPrefs
http://www.xs4all.nl/~vincentp/software/mod_roaming.html
Vincent in turn was inspired by a Perl script from Frederik Vermeulen
<Frederik.Vermeulen@imec.be>, see
http://www.esat.kuleuven.ac.be/~vermeule/roam/put
Compared to Apache::Roaming, this script doesn't need mod_perl. On the
other hand it doesn't support the MOVE method, thus you need to set the
li.prefs.http.useSimplePut attribute in your Netscape preferences. Due
to the missing MOVE method, it may be even slower than Apache::Roaming
and perhaps a little bit less stable.
The modules features are:
* GET, HEAD, PUT, DELETE and MOVE are handled by the module. In
particular the Non-standard MOVE method is implemented, although
Apache doesn't know it by default. Thus you need no set the
li.prefs.http.useSimplePut attribute to true.
* Directories are created automatically.
* The module is subclassable, so that you can create profiles on
the fly or parse and modify the user preferences. See the
Apache::Roaming::LiPrefs(3) manpage for an example subclass.
INSTALLATION
First of all you need an Apache Web server with mod_perl support. The
TypeHandler must be enabled, so you need to set PERL_TYPE=1 when running
$ar_req->GET();
$ar_req->PUT();
$ar_req->MOVE();
$ar_req->DELETE();
(Instance Methods) These methods are called finally for performing the
real action. With the exception of GET, they call *Success* finally for
reporting Ok.
Alternative method names are possible, depending on the name of the
requested file. For example, if you request the file *liprefs* via GET,
then it is checked whether your sublass has a method *GET_liprefs*. If
so, this method is called rather than the default method *GET*. The
alternative method names are obtained by removing all non-alpha- numeric
characters from the files base name. That is, if you request a file
*pab.na2*, then the alternative name is *pabna2*. Note, these method
names are case sensitive!
MkDir
$ar_req->MkDir($file);
lib/Apache/Roaming.pm view on Meta::CPAN
http://www.xs4all.nl/~vincentp/software/mod_roaming.html
Vincent in turn was inspired by a Perl script from Frederik
Vermeulen <Frederik.Vermeulen@imec.be>, see
http://www.esat.kuleuven.ac.be/~vermeule/roam/put
Compared to Apache::Roaming, this script doesn't need mod_perl. On
the other hand it doesn't support the MOVE method, thus you need
to set the li.prefs.http.useSimplePut attribute in your Netscape
preferences. Due to the missing MOVE method, it may be even slower
than Apache::Roaming and perhaps a little bit less stable.
The modules features are:
=over 8
=item *
GET, HEAD, PUT, DELETE and MOVE are handled by the module. In particular
the Non-standard MOVE method is implemented, although Apache doesn't know
it by default. Thus you need no set the li.prefs.http.useSimplePut
attribute to true.
=item *
Directories are created automatically.
=item *
The module is subclassable, so that you can create profiles on the fly
or parse and modify the user preferences. See L<Apache::Roaming::LiPrefs(3)>
lib/Apache/Roaming.pm view on Meta::CPAN
$ar_req->GET();
$ar_req->PUT();
$ar_req->MOVE();
$ar_req->DELETE();
(Instance Methods) These methods are called finally for performing the
real action. With the exception of GET, they call I<Success> finally
for reporting Ok.
Alternative method names are possible, depending on the name of the
requested file. For example, if you request the file I<liprefs> via
GET, then it is checked whether your sublass has a method I<GET_liprefs>.
If so, this method is called rather than the default method I<GET>.
The alternative method names are obtained by removing all non-alpha-
numeric characters from the files base name. That is, if you request
a file I<pab.na2>, then the alternative name is I<pabna2>. Note, these
method names are case sensitive!
=cut
sub GET {
my $self = shift;
lib/Apache/Roaming/LiPrefs.pm view on Meta::CPAN
PerlModule Apache::Roaming
<Location /roaming>
PerlHandler Apache::Roaming::LiPrefs->handler
PerlTypeHandler Apache::Roaming::LiPrefs->handler_type
AuthType Basic
AuthName "Roaming User"
AuthUserFile /home/httpd/.htusers
require valid-user
PerlSetVar BaseDir /home/httpd/html/roaming
PerlSetVar LiPrefsConfigFile /home/httpd/liprefs.cnf
</Location>
In theory any AuthType and require statement should be possible
as long as the $r->connection()->user() method returns something
non trivial.
=head1 DESCRIPTION
This is a subclass of Apache::Roaming that allows you to overwrite
certain Netscape settings of your users, both initial and/or
permanent. The idea is to overwrite the web servers GET method
for parsing and modifying the users liprefs files.
Liprefs files are a collection of lines in the format
user_pref("varname", value);
In other words, they are obviously close to hash arrays. Thus the
module configuration is read from two hash arrays:
=over 8
=item %Apache::Roaming::LiPrefs::INITIAL
If any of the given hash keys is missing in the liprefs file, then a
corresponding line will be added to the liprefs file.
=item %Apache::Roaming::LiPrefs::ALWAYS
Lines corresponding to one of the given hash keys will be silently
replaced by the given values. If no corresponding line is found,
the hash key will be treated like it where part of the I<INITIAL>
hash.
=back
lib/Apache/Roaming/LiPrefs.pm view on Meta::CPAN
%Apache::Roaming::LiPrefs::INITIAL = {
'security.email_as_ftp_password' => 'true',
'mail.remember_password' => 'false'
};
%Apache::Roaming::LiPrefs::ALWAYS = {
'network.hosts.pop_server' => 'pop.cmo.de',
'network.hosts.smtp_server' => 'smtp.cmo.de'
}
If the users saved liprefs file is
user_pref("network.hosts.pop_server", "pop.company.com");
user_pref("mail.remember_password", true);
Then the module will change it to
user_pref("network.hosts.pop_server", "pop.cmo.de");
user_pref("network.hosts.smtp_server", "smtp.cmo.de");
user_pref("mail.remember_password", true);
user_pref("security.email_as_ftp_password", true);
lib/Apache/Roaming/LiPrefs.pm view on Meta::CPAN
</Location>
By default the arrays INITIAL and ALWAYS are read via
require Apache::Roaming::LiPrefs::Config;
This file can be generated automatically while installing the
Apache::Roaming module. However, you can overwrite this by
using the instruction
PerlSetVar LiPrefsConfigFile /home/httpd/liprefs.cnf
In that case the variables will be read via
require "/home/httpd/liprefs.cnf";
=head1 METHOD INTERFACE
No methods from Apache::Roaming are overwritten, there's only an
additional method, I<GET_liprefs>, that is called in favour of
I<GET> if the user requests an I<liprefs> file.
=cut
sub MakeLine {
my($self, $var, $val) = @_;
$val = '' unless defined($val);
if ($val !~ /^(?:true|false|\d+(?:\.\d+))$/) {
$val =~ s/[\\\"]/\\\"/g;
$val = "\"$val\"";
}
"user_pref(\"$var\", $val);\n";
}
sub GET_liprefs {
my $self = shift;
my $file = $self->{'file'};
my $r = $self->{'request'};
my $inc = ($r->dir_config('LiPrefsConfigFile')
|| 'Apache/Roaming/LiPrefs/Config.pm');
require $inc unless $INC{$inc};
my %initial = (%Apache::Roaming::LiPrefs::INITIAL,
%Apache::Roaming::LiPrefs::ALWAYS);
t/20liprefs.t view on Meta::CPAN
'New-uri' => '/roaming/foo bar/test4');
$res = Request($ua, 'GET', '/roaming/foo bar/test4');
Test($res->content() and ($res->content() eq $contents2));
Test(!-f $testfile2);
Request($ua, 'DELETE', '/roaming/foo bar/test3');
Test(!-f $testfile3);
Request($ua, 'DELETE', '/roaming/foo bar/test4');
Test(!-f $testfile4);
$res = Request($ua, 'GET', '/roaming/foo bar/liprefs');
print $res->content();
sleep 5;
END {
my $status = $?;
KillHttpd();
$? = $status;
}
( run in 1.188 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )