params
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 99
Params-Util 0.20
Params-Util is a simple, compact and correct param-checking functions. more>>
Params-Util is a simple, compact and correct param-checking functions.
SYNOPSIS
# Import some functions
use Params::Util qw{_SCALAR _HASH _INSTANCE};
# If you are lazy, or need a lot of them...
use Params::Util :ALL;
sub foo {
my $object = _INSTANCE(shift, Foo) or return undef;
my $image = _SCALAR(shift) or return undef;
my $options = _HASH(shift) or return undef;
# etc...
}
"Params::Util" provides a basic set of importable functions that makes checking parameters a hell of a lot easier
While they can be (and are) used in other contexts, the main point behind this module is that the functions both Do What You Mean, and Do The Right Thing, so they are most useful when you are getting params passed into your code from someone and/or somewhere else and you cant really trust the quality.
Thus, "Params::Util" is of most use at the edges of your API, where params and data are coming in from outside your code.
The functions provided by "Params::Util" check in the most strictly correct manner known, are documented as thoroughly as possible so their exact behaviour is clear, and heavily tested so make sure they are not fooled by weird data and Really Bad Things.
To use, simply load the module providing the functions you want to use as arguments (as shown in the SYNOPSIS).
To aid in maintainability, "Params::Util" will never export by default.
You must explicitly name the functions you want to export, or use the ":ALL" param to just have it export everything (although this is not recommended if you have any _FOO functions yourself with which future additions to "Params::Util" may clash)
<<lessSYNOPSIS
# Import some functions
use Params::Util qw{_SCALAR _HASH _INSTANCE};
# If you are lazy, or need a lot of them...
use Params::Util :ALL;
sub foo {
my $object = _INSTANCE(shift, Foo) or return undef;
my $image = _SCALAR(shift) or return undef;
my $options = _HASH(shift) or return undef;
# etc...
}
"Params::Util" provides a basic set of importable functions that makes checking parameters a hell of a lot easier
While they can be (and are) used in other contexts, the main point behind this module is that the functions both Do What You Mean, and Do The Right Thing, so they are most useful when you are getting params passed into your code from someone and/or somewhere else and you cant really trust the quality.
Thus, "Params::Util" is of most use at the edges of your API, where params and data are coming in from outside your code.
The functions provided by "Params::Util" check in the most strictly correct manner known, are documented as thoroughly as possible so their exact behaviour is clear, and heavily tested so make sure they are not fooled by weird data and Really Bad Things.
To use, simply load the module providing the functions you want to use as arguments (as shown in the SYNOPSIS).
To aid in maintainability, "Params::Util" will never export by default.
You must explicitly name the functions you want to export, or use the ":ALL" param to just have it export everything (although this is not recommended if you have any _FOO functions yourself with which future additions to "Params::Util" may clash)
Download (0.033MB)
Added: 2006-09-28 License: Perl Artistic License Price:
1121 downloads
Params::Profile 0.10
Params::Profile is a Perl module for registering Parameter profiles. more>>
Params::Profile is a Perl module for registering Parameter profiles.
SYNOPSIS
package Foo::Bar;
use Params::Profile;
### Single profile
Params::Profile->register_profile(
method => subroto,
profile => {
testkey1 => { required => 1 },
testkey2 => {
required => 1,
allow => qr/^d+$/,
},
testkey3 => {
allow => qr/^w+$/,
},
},
);
sub subroto {
my (%params) = @_;
return unlesss Params::Profile->validate(params => %params);
### DO SOME STUFF HERE ...
}
my $profile = Params::Profile->get_profile(method => subroto);
### Multiple Profile
Params::Profile->register_profile(
method => subalso,
profile => [
subroto,
{
testkey4 => { required => 1 },
testkey5 => {
required => 1,
allow => qr/^d+$/,
},
testkey6 => {
allow => qr/^w+$/,
},
},
],
);
sub subalso {
my (%params) = @_;
### Checks parameters agains profile of subroto and above registered
### profile
return unlesss Params::Profile->validate(params => %params);
### DO SOME STUFF HERE ...
}
Params::Profile provides a mechanism for a centralised Params::Check or a Data::FormValidater profile. You can bind a profile to a class::subroutine, then, when you are in a subroutine you can simply call Params::Profile->check($params) of Params::Profile->validate($params) to validate against this profile. Validate will return true or false on successfull or failed validation. Check will return what Data::FormValidator or Params::Check would return. (For Params::Check this is simply a hash with the validated parameters , for Data::FormValidator, this is a Data::FormValidator::Results object)
<<lessSYNOPSIS
package Foo::Bar;
use Params::Profile;
### Single profile
Params::Profile->register_profile(
method => subroto,
profile => {
testkey1 => { required => 1 },
testkey2 => {
required => 1,
allow => qr/^d+$/,
},
testkey3 => {
allow => qr/^w+$/,
},
},
);
sub subroto {
my (%params) = @_;
return unlesss Params::Profile->validate(params => %params);
### DO SOME STUFF HERE ...
}
my $profile = Params::Profile->get_profile(method => subroto);
### Multiple Profile
Params::Profile->register_profile(
method => subalso,
profile => [
subroto,
{
testkey4 => { required => 1 },
testkey5 => {
required => 1,
allow => qr/^d+$/,
},
testkey6 => {
allow => qr/^w+$/,
},
},
],
);
sub subalso {
my (%params) = @_;
### Checks parameters agains profile of subroto and above registered
### profile
return unlesss Params::Profile->validate(params => %params);
### DO SOME STUFF HERE ...
}
Params::Profile provides a mechanism for a centralised Params::Check or a Data::FormValidater profile. You can bind a profile to a class::subroutine, then, when you are in a subroutine you can simply call Params::Profile->check($params) of Params::Profile->validate($params) to validate against this profile. Validate will return true or false on successfull or failed validation. Check will return what Data::FormValidator or Params::Check would return. (For Params::Check this is simply a hash with the validated parameters , for Data::FormValidator, this is a Data::FormValidator::Results object)
Download (0.006MB)
Added: 2007-04-11 License: Perl Artistic License Price:
926 downloads
Params::Validate 0.88
Params::Validate is a Perl module to validate method/function parameters. more>>
Params::Validate is a Perl module to validate method/function parameters.
SYNOPSIS
use Params::Validate qw(:all);
# takes named params (hash or hashref)
sub foo
{
validate( @_, { foo => 1, # mandatory
bar => 0, # optional
}
);
}
# takes positional params
sub bar
{
# first two are mandatory, third is optional
validate_pos( @_, 1, 1, 0 );
}
sub foo2
{
validate( @_,
{ foo =>
# specify a type
{ type => ARRAYREF },
bar =>
# specify an interface
{ can => [ print, flush, frobnicate ] },
baz =>
{ type => SCALAR, # a scalar ...
# ... that is a plain integer ...
regex => qr/^d+$/,
callbacks =>
{ # ... and smaller than 90
less than 90 => sub { shift() < 90 },
},
}
}
);
}
sub with_defaults
{
my %p = validate( @_, { foo => 1, # required
# $p{bar} will be 99 if bar is not
# given. bar is now optional.
bar => { default => 99 } } );
}
sub pos_with_defaults
{
my @p = validate_pos( @_, 1, { default => 99 } );
}
sub sets_options_on_call
{
my %p = validate_with
( params => @_,
spec => { foo => { type SCALAR, default => 2 } },
normalize_keys => sub { $_[0] =~ s/^-//; lc $_[0] },
);
}
The Params::Validate module allows you to validate method or function call parameters to an arbitrary level of specificity. At the simplest level, it is capable of validating the required parameters were given and that no unspecified additional parameters were passed in.
It is also capable of determining that a parameter is of a specific type, that it is an object of a certain class hierarchy, that it possesses certain methods, or applying validation callbacks to arguments.
<<lessSYNOPSIS
use Params::Validate qw(:all);
# takes named params (hash or hashref)
sub foo
{
validate( @_, { foo => 1, # mandatory
bar => 0, # optional
}
);
}
# takes positional params
sub bar
{
# first two are mandatory, third is optional
validate_pos( @_, 1, 1, 0 );
}
sub foo2
{
validate( @_,
{ foo =>
# specify a type
{ type => ARRAYREF },
bar =>
# specify an interface
{ can => [ print, flush, frobnicate ] },
baz =>
{ type => SCALAR, # a scalar ...
# ... that is a plain integer ...
regex => qr/^d+$/,
callbacks =>
{ # ... and smaller than 90
less than 90 => sub { shift() < 90 },
},
}
}
);
}
sub with_defaults
{
my %p = validate( @_, { foo => 1, # required
# $p{bar} will be 99 if bar is not
# given. bar is now optional.
bar => { default => 99 } } );
}
sub pos_with_defaults
{
my @p = validate_pos( @_, 1, { default => 99 } );
}
sub sets_options_on_call
{
my %p = validate_with
( params => @_,
spec => { foo => { type SCALAR, default => 2 } },
normalize_keys => sub { $_[0] =~ s/^-//; lc $_[0] },
);
}
The Params::Validate module allows you to validate method or function call parameters to an arbitrary level of specificity. At the simplest level, it is capable of validating the required parameters were given and that no unspecified additional parameters were passed in.
It is also capable of determining that a parameter is of a specific type, that it is an object of a certain class hierarchy, that it possesses certain methods, or applying validation callbacks to arguments.
Download (0.078MB)
Added: 2007-04-11 License: Perl Artistic License Price:
927 downloads
Aorta 0.05
Aorta project is a load-balancing clustered P2P application. more>>
Aorta project is a load-balancing clustered P2P application.
It executes Tasklets (which have the ability to split themselves into sub tasks that can be executed in pararell).
A typical cluster contains of a LAN with 1-256 computers, each one running aorta.
A Tasklet can be of any type ranging from encoding MP3s, Genomic DNA Alignment, or simply to rendering Web pages for high speed/heavily loaded Web sites.
You can make functions calls to C/C++, applications like Matlab, etc.
Main features:
- PingTasklet simply traversers your net of aortas.
- ImageTasklet , simply rescale imagecolours.
- EncodeTasklet, spreads out mp3 encode in your LAN.
- SimpleSort , Merge sort by Gretsam.
Enhancements:
- Refactored to one base class Moblet,the smalles code and data entity moving around
- Improved Moblet Receiver and executing. Minimizing worker idle time
- startup script aorta.sh improved now can start with remote debug params
- Aorta core can now be used as an API to emit/delegete Moblets from an user created application
- Preferences stuff should work on a MS platform now
- Herve added DocBook to buildsystem
- Gretsam added a MergeSorter Tasklet
<<lessIt executes Tasklets (which have the ability to split themselves into sub tasks that can be executed in pararell).
A typical cluster contains of a LAN with 1-256 computers, each one running aorta.
A Tasklet can be of any type ranging from encoding MP3s, Genomic DNA Alignment, or simply to rendering Web pages for high speed/heavily loaded Web sites.
You can make functions calls to C/C++, applications like Matlab, etc.
Main features:
- PingTasklet simply traversers your net of aortas.
- ImageTasklet , simply rescale imagecolours.
- EncodeTasklet, spreads out mp3 encode in your LAN.
- SimpleSort , Merge sort by Gretsam.
Enhancements:
- Refactored to one base class Moblet,the smalles code and data entity moving around
- Improved Moblet Receiver and executing. Minimizing worker idle time
- startup script aorta.sh improved now can start with remote debug params
- Aorta core can now be used as an API to emit/delegete Moblets from an user created application
- Preferences stuff should work on a MS platform now
- Herve added DocBook to buildsystem
- Gretsam added a MergeSorter Tasklet
Download (2.2MB)
Added: 2006-10-09 License: GPL (GNU General Public License) Price:
1110 downloads
Palabre 0.5
Palabre is an open source (and free as in free beer) XML Socket Python Server. more>>
Palabre is an open source (and free as in free beer) XML Socket Python Server.
It is meant to be used in replacement (for example) of the Macromedia Flash Communication Server. (which is lets admit it really expensive)
Of course, its much more limited, but has all the basic functionnalities for connecting Flash based Clients through Xml Sockets (sending and receiving messages).
So you can use it to create, multiuser applications like a Chat, (almost) Real Time Flash Games, Online support, ...
It does not include Video streaming functions ( FLV via RTMP ) instead of Flash Communication Server.
Main features:
- Have multiple Rooms
- Each Room can have any parameter you want ( A title, a lock, operators, any flag, ...)
- The creator of the room can change this parameters
- The room can have Sub rooms (or child rooms)
- For Example, you can host 10 games and chats on a server, and each game has a lobby room for chatting, and as many subrooms as wanted. Players can chat, start a new game, wait for people to join, and then start the game. (Then the child room of the game can be "locked" so that no one else joins it.
- Have multiple clients
- They are identified by a nickname (like on IRC)
- One client can be in multiple rooms / subrooms
- Clients can send messages to a room
- Clients can send messages to other clients (private messages)
- Clients can send a broadcast message (or reserve this to root)
- Clients can ping the server
- Clients can ask for a "room message" to be sent back to them. (to test latency, ...)
Enhancements:
- Database identification support (< connect nickname="X" password="Y" / >)
- Clients params (< clientparam name="X" value="Y" / >)
- SubXML nodes : (< msg toroom="X" >< position >< x >12< /x >< /position >< /msg >)
- Customizable nodes (< mynode toroom="X" anyparam="Y" >< AnyContent >< /mynode >)
- Joined/Left information (< client name="Nickname" joined="Lobby" / >)
<<lessIt is meant to be used in replacement (for example) of the Macromedia Flash Communication Server. (which is lets admit it really expensive)
Of course, its much more limited, but has all the basic functionnalities for connecting Flash based Clients through Xml Sockets (sending and receiving messages).
So you can use it to create, multiuser applications like a Chat, (almost) Real Time Flash Games, Online support, ...
It does not include Video streaming functions ( FLV via RTMP ) instead of Flash Communication Server.
Main features:
- Have multiple Rooms
- Each Room can have any parameter you want ( A title, a lock, operators, any flag, ...)
- The creator of the room can change this parameters
- The room can have Sub rooms (or child rooms)
- For Example, you can host 10 games and chats on a server, and each game has a lobby room for chatting, and as many subrooms as wanted. Players can chat, start a new game, wait for people to join, and then start the game. (Then the child room of the game can be "locked" so that no one else joins it.
- Have multiple clients
- They are identified by a nickname (like on IRC)
- One client can be in multiple rooms / subrooms
- Clients can send messages to a room
- Clients can send messages to other clients (private messages)
- Clients can send a broadcast message (or reserve this to root)
- Clients can ping the server
- Clients can ask for a "room message" to be sent back to them. (to test latency, ...)
Enhancements:
- Database identification support (< connect nickname="X" password="Y" / >)
- Clients params (< clientparam name="X" value="Y" / >)
- SubXML nodes : (< msg toroom="X" >< position >< x >12< /x >< /position >< /msg >)
- Customizable nodes (< mynode toroom="X" anyparam="Y" >< AnyContent >< /mynode >)
- Joined/Left information (< client name="Nickname" joined="Lobby" / >)
Download (0.051MB)
Added: 2006-10-23 License: GPL (GNU General Public License) Price:
1098 downloads
Prima::Utils 1.20
Prima::Utils are miscellanneous routines. more>>
Prima::Utils are miscellanneous routines.
The module contains several helper routines, implemented in both C and perl. Whereas the C-coded parts are accessible only if use Prima; statement was issued prior to the use Prima::Utils invocation, the perl-coded are always available. This makes the module valuable when used without the rest of toolkit code.
API
alarm $TIMEOUT, $SUB, @PARAMS
Calls SUB with PARAMS after TIMEOUT milliseconds.
beep [ FLAGS = mb::Error ]
Invokes the system-depended sound and/or visual bell, corresponding to one of following constants:
mb::Error
mb::Warning
mb::Information
mb::Question
get_gui
Returns one of gui::XXX constants, reflecting the graphic user interface used in the system:
gui::Default
gui::PM
gui::Windows
gui::XLib
gui::OpenLook
gui::Motif
The meaning of the return value is somewhat vague, and might be deprecated in future releases.
get_os
Returns one of apc::XXX constants, reflecting the platfrom. Currently, the list of the supported platforms is:
apc::Os2
apc::Win32
apc::Unix
ceil DOUBLE
Obsolete function.
Returns stdlibs ceil() of DOUBLE
find_image PATH
Converts PATH from perl module notation into a file path, and searches for the file in @INC paths set. If a file is found, its full filename is returned; otherwise undef is returned.
floor DOUBLE
Obsolete function.
Returns stdlibs floor() of DOUBLE
getdir PATH
Reads content of PATH directory and returns array of string pairs, where the first item is a file name, and the second is a file type.
The file type is a string, one of the following:
"fifo" - named pipe
"chr" - character special file
"dir" - directory
"blk" - block special file
"reg" - regular file
"lnk" - symbolic link
"sock" - socket
"wht" - whiteout
This function was implemented for faster directory reading, to avoid successive call of stat for every file.
path [ FILE ]
If called with no parameters, returns path to a directory, usually ~/.prima, that can be used to contain the user settings of a toolkit module or a program. If FILE is specified, appends it to the path and returns the full file name. In the latter case the path is automatically created by File::Path::mkpath unless it already exists.
post $SUB, @PARAMS
Postpones a call to SUB with PARAMS until the next event loop tick.
query_drives_map [ FIRST_DRIVE = "A:" ]
Returns anonymous array to drive letters, used by the system. FIRST_DRIVE can be set to other value to start enumeration from. Some OSes can probe eventual diskette drives inside the drive enumeration routines, so there is a chance to increase responsiveness of the function it might be reasonable to set FIRST_DRIVE to C: string.
If the system supports no drive letters, empty array reference is returned ( unix ).
query_drive_type DRIVE
Returns one of dt::XXX constants, describing the type of drive, where DRIVE is a 1-character string. If there is no such drive, or the system supports no drive letters ( unix ), dt::None is returned.
dt::None
dt::Unknown
dt::Floppy
dt::HDD
dt::Network
dt::CDROM
dt::Memory
sound [ FREQUENCY = 2000, DURATION = 100 ]
Issues a tone of FREQUENCY in Hz with DURATION in milliseconds.
username
Returns the login name of the user. Sometimes is preferred to the perl-provided getlogin ( see "getlogin" in perlfunc ) .
xcolor COLOR
Accepts COLOR string on one of the three formats:
#rgb
#rrggbb
#rrrgggbbb
and returns 24-bit RGB integer value.
<<lessThe module contains several helper routines, implemented in both C and perl. Whereas the C-coded parts are accessible only if use Prima; statement was issued prior to the use Prima::Utils invocation, the perl-coded are always available. This makes the module valuable when used without the rest of toolkit code.
API
alarm $TIMEOUT, $SUB, @PARAMS
Calls SUB with PARAMS after TIMEOUT milliseconds.
beep [ FLAGS = mb::Error ]
Invokes the system-depended sound and/or visual bell, corresponding to one of following constants:
mb::Error
mb::Warning
mb::Information
mb::Question
get_gui
Returns one of gui::XXX constants, reflecting the graphic user interface used in the system:
gui::Default
gui::PM
gui::Windows
gui::XLib
gui::OpenLook
gui::Motif
The meaning of the return value is somewhat vague, and might be deprecated in future releases.
get_os
Returns one of apc::XXX constants, reflecting the platfrom. Currently, the list of the supported platforms is:
apc::Os2
apc::Win32
apc::Unix
ceil DOUBLE
Obsolete function.
Returns stdlibs ceil() of DOUBLE
find_image PATH
Converts PATH from perl module notation into a file path, and searches for the file in @INC paths set. If a file is found, its full filename is returned; otherwise undef is returned.
floor DOUBLE
Obsolete function.
Returns stdlibs floor() of DOUBLE
getdir PATH
Reads content of PATH directory and returns array of string pairs, where the first item is a file name, and the second is a file type.
The file type is a string, one of the following:
"fifo" - named pipe
"chr" - character special file
"dir" - directory
"blk" - block special file
"reg" - regular file
"lnk" - symbolic link
"sock" - socket
"wht" - whiteout
This function was implemented for faster directory reading, to avoid successive call of stat for every file.
path [ FILE ]
If called with no parameters, returns path to a directory, usually ~/.prima, that can be used to contain the user settings of a toolkit module or a program. If FILE is specified, appends it to the path and returns the full file name. In the latter case the path is automatically created by File::Path::mkpath unless it already exists.
post $SUB, @PARAMS
Postpones a call to SUB with PARAMS until the next event loop tick.
query_drives_map [ FIRST_DRIVE = "A:" ]
Returns anonymous array to drive letters, used by the system. FIRST_DRIVE can be set to other value to start enumeration from. Some OSes can probe eventual diskette drives inside the drive enumeration routines, so there is a chance to increase responsiveness of the function it might be reasonable to set FIRST_DRIVE to C: string.
If the system supports no drive letters, empty array reference is returned ( unix ).
query_drive_type DRIVE
Returns one of dt::XXX constants, describing the type of drive, where DRIVE is a 1-character string. If there is no such drive, or the system supports no drive letters ( unix ), dt::None is returned.
dt::None
dt::Unknown
dt::Floppy
dt::HDD
dt::Network
dt::CDROM
dt::Memory
sound [ FREQUENCY = 2000, DURATION = 100 ]
Issues a tone of FREQUENCY in Hz with DURATION in milliseconds.
username
Returns the login name of the user. Sometimes is preferred to the perl-provided getlogin ( see "getlogin" in perlfunc ) .
xcolor COLOR
Accepts COLOR string on one of the three formats:
#rgb
#rrggbb
#rrrgggbbb
and returns 24-bit RGB integer value.
Download (1.4MB)
Added: 2006-08-29 License: Perl Artistic License Price:
1155 downloads
ModPerl::ParamBuilder 0.08
ModPerl::ParamBuilder is a Perl module that makes building custom Apache directives easy. more>>
ModPerl::ParamBuilder is a Perl module that makes building custom Apache directives easy.
SYNOPSIS
package MyApp::Parameters;
use ModPerl::ParamBuilder;
use base qw( ModPerl::ParamBuilder );
my $builder = ModPerl::ParamBuilder->new( __PACKAGE__ );
# Build simple one argument parameter
$builder->param( Template );
$builder->param( PageTitle );
$builder->param( ItemsPerPage );
# Build an On/Off parameter
$builder->on_off( Caching );
# Build a Yes/No parameter
$builder->yes_no( AutoCommit );
# Build a no argument/flag parameter
$builder->no_arg( Active );
# Build a one argument parameter with a custom error message
# and special configuration hash key
$builder->param( {
name => SMTPServer,
err => SMTPServer xx.xx.xx.xx,
key => smtp_server,
});
# Load the configuration into Apache
$builder->load;
################################################
# And elsewhere in your application
################################################
package MyApp::Main;
# Retrieve the configuration like so
my $params = MyApp::Parameters->new;
my $conf_ref = $params->get_config( $r );
# Or if you have PerlOptions +GlobalRequest on then you can just
# call
my $conf_ref = $params->get_config;
One of the neatest features of mod_perl 2.0 is the ability to easily create your own custom Apache directives. Not only are they more efficient to use compared to PerlSetEnv, PerlPassEnv, PerlAddVar, and PerlSetVar, but they give your application a more polished and professional look and feel..
Not to mention theyre just plain cool. This module aims to make the already easy, even easier.
Note that you MUST load your parameter module with PerlLoadModule in your httpd.conf and not PerlModule. This is necessary because Apache needs to load your module earlier than usual in the startup to be able to read its own configuration now.
LIMITATIONS
The biggest limitation is that this module ONLY works with mod_perl 2.0 and above. There are no plans to support mod_perl 1.x for this module, trust me you want to upgrade to mod_perl 2 as soon as you can.
This modules intent is not to replace the underlying mod_perl APIs nor is it intended to be used for complicated cases where special processing is needed. It is intended to make the simple things simple.
Some things to keep in mind when using ModPerl::ParamBuilder
This module does not restrict where the directives can be used in Apaches httpd.conf. To restrict directives to particular area ( only in main server conf, a VirtualHost, or a Location, etc ) you will need to use the mod_perl APIs to build your directives.
This also does not do, by default, any error checking or validation on the arguments passed to directives. If you create a directive NumberOfItemsPerPage and then put:
NumberOfItemsPerPage rhubarb
Apache will not see this as an error and your configuration hash for the key NumberOfItemsPerPage will contain the string rhubarb. You can validate this data in three different ways:
1) Validate the configuration data in your application prior to
using it.
2) Instruct ModPerl::ParamBuilder to use a special function for
processing the arguments by passing the func option.
3) Revert to using the mod_perl API where you have more control.
See the appropriate mod_perl 2.0 API modules for how to accomplish more in depth processing of directives and their data.
<<lessSYNOPSIS
package MyApp::Parameters;
use ModPerl::ParamBuilder;
use base qw( ModPerl::ParamBuilder );
my $builder = ModPerl::ParamBuilder->new( __PACKAGE__ );
# Build simple one argument parameter
$builder->param( Template );
$builder->param( PageTitle );
$builder->param( ItemsPerPage );
# Build an On/Off parameter
$builder->on_off( Caching );
# Build a Yes/No parameter
$builder->yes_no( AutoCommit );
# Build a no argument/flag parameter
$builder->no_arg( Active );
# Build a one argument parameter with a custom error message
# and special configuration hash key
$builder->param( {
name => SMTPServer,
err => SMTPServer xx.xx.xx.xx,
key => smtp_server,
});
# Load the configuration into Apache
$builder->load;
################################################
# And elsewhere in your application
################################################
package MyApp::Main;
# Retrieve the configuration like so
my $params = MyApp::Parameters->new;
my $conf_ref = $params->get_config( $r );
# Or if you have PerlOptions +GlobalRequest on then you can just
# call
my $conf_ref = $params->get_config;
One of the neatest features of mod_perl 2.0 is the ability to easily create your own custom Apache directives. Not only are they more efficient to use compared to PerlSetEnv, PerlPassEnv, PerlAddVar, and PerlSetVar, but they give your application a more polished and professional look and feel..
Not to mention theyre just plain cool. This module aims to make the already easy, even easier.
Note that you MUST load your parameter module with PerlLoadModule in your httpd.conf and not PerlModule. This is necessary because Apache needs to load your module earlier than usual in the startup to be able to read its own configuration now.
LIMITATIONS
The biggest limitation is that this module ONLY works with mod_perl 2.0 and above. There are no plans to support mod_perl 1.x for this module, trust me you want to upgrade to mod_perl 2 as soon as you can.
This modules intent is not to replace the underlying mod_perl APIs nor is it intended to be used for complicated cases where special processing is needed. It is intended to make the simple things simple.
Some things to keep in mind when using ModPerl::ParamBuilder
This module does not restrict where the directives can be used in Apaches httpd.conf. To restrict directives to particular area ( only in main server conf, a VirtualHost, or a Location, etc ) you will need to use the mod_perl APIs to build your directives.
This also does not do, by default, any error checking or validation on the arguments passed to directives. If you create a directive NumberOfItemsPerPage and then put:
NumberOfItemsPerPage rhubarb
Apache will not see this as an error and your configuration hash for the key NumberOfItemsPerPage will contain the string rhubarb. You can validate this data in three different ways:
1) Validate the configuration data in your application prior to
using it.
2) Instruct ModPerl::ParamBuilder to use a special function for
processing the arguments by passing the func option.
3) Revert to using the mod_perl API where you have more control.
See the appropriate mod_perl 2.0 API modules for how to accomplish more in depth processing of directives and their data.
Download (0.008MB)
Added: 2006-09-02 License: Perl Artistic License Price:
1148 downloads
Thread::Apartment 0.51
Thread::Apartment is an apartment threading wrapper for Perl objects. more>>
Thread::Apartment is an apartment threading wrapper for Perl objects.
SYNOPSIS
package MyClass;
use Thread::Apartment::Server;
use base qw(Thread::Apartment::Server);
sub new {
#
# the usual constructor
#
}
#
# mark some methods as simplex
#
sub get_simplex_methods {
return { bar => 1 };
}
#
# mark some methods as urgent
#
sub get_urgent_methods {
return { bingo => 1 };
}
sub foo {
#
# do something
#
}
sub bar {
#
# do something else
#
}
sub bingo {
print "BINGO!n";
}
1;
#
# create pool of 20 apartment threads
#
Thread::Apartment->create_pool(AptPoolSize => 20);
my $apt = Thread::Apartment->new(
AptClass => MyClass, # class to install in apartment
AptTimeout => 10, # timeout secs for TQD responses
AptRequire => { # classes to require into the thread
This::Class => 1.234,
That::Class => 0.02
},
AptParams => @params_for_MyClass) || die $@;
my $result = $apt->foo(@params);
die $@ unless $result;
#
# bar is simplex
#
$apt->bar(@params);
Thread::Apartment provides an apartment threading wrapper for Perl classes. "Apartment threading" is a method for isolating an object (or object hierarchy) in its own thread, and providing external interfaces via lightweight client proxy objects. This approach is especially valuable in the Perl threads environment, which doesnt provide a direct means of passing complex, nested structure objects between threads, and for non-threadsafe legacy object architectures, e.g., Perl/Tk.
By using lightweight client proxy objects that implement the Thread::Queue::Queueable interface, with Thread::Queue::Duplex objects as the communication channel between client proxies and apartment threads (or between threads in general), a more thread-friendly OO environment is provided, ala Java, i.e., the ability to pass arbitrary objects between arbitrary threads.
<<lessSYNOPSIS
package MyClass;
use Thread::Apartment::Server;
use base qw(Thread::Apartment::Server);
sub new {
#
# the usual constructor
#
}
#
# mark some methods as simplex
#
sub get_simplex_methods {
return { bar => 1 };
}
#
# mark some methods as urgent
#
sub get_urgent_methods {
return { bingo => 1 };
}
sub foo {
#
# do something
#
}
sub bar {
#
# do something else
#
}
sub bingo {
print "BINGO!n";
}
1;
#
# create pool of 20 apartment threads
#
Thread::Apartment->create_pool(AptPoolSize => 20);
my $apt = Thread::Apartment->new(
AptClass => MyClass, # class to install in apartment
AptTimeout => 10, # timeout secs for TQD responses
AptRequire => { # classes to require into the thread
This::Class => 1.234,
That::Class => 0.02
},
AptParams => @params_for_MyClass) || die $@;
my $result = $apt->foo(@params);
die $@ unless $result;
#
# bar is simplex
#
$apt->bar(@params);
Thread::Apartment provides an apartment threading wrapper for Perl classes. "Apartment threading" is a method for isolating an object (or object hierarchy) in its own thread, and providing external interfaces via lightweight client proxy objects. This approach is especially valuable in the Perl threads environment, which doesnt provide a direct means of passing complex, nested structure objects between threads, and for non-threadsafe legacy object architectures, e.g., Perl/Tk.
By using lightweight client proxy objects that implement the Thread::Queue::Queueable interface, with Thread::Queue::Duplex objects as the communication channel between client proxies and apartment threads (or between threads in general), a more thread-friendly OO environment is provided, ala Java, i.e., the ability to pass arbitrary objects between arbitrary threads.
Download (0.072MB)
Added: 2007-06-14 License: Perl Artistic License Price:
862 downloads
Data::CGIForm 0.4
Data::CGIForm is a Perl module with form data interface. more>>
Data::CGIForm is a Perl module with form data interface.
Data::CGIForm is yet another way to parse and handle CGI form data. The main motivation behind this module was a simple specification based validator that could handle multiple values.
You probably dont want to use this module. CGI::Validate is a much more feature complete take on getting this sort of work done. You may then ask why this is on the CPAN, I ask that of myself from time to time....
SYNOPSIS
my %spec = (
username => qr/^([a-z0-9]+)$/,
password => {
regexp => qr/^([a-z0-9+])$/,
filter => [qw(strip_leading_ws, strip_trailing_ws)],
},
email => {
regexp => qr/^([a-z0-9@.]+)$/,
filter => &qualify_domain,
optional => 1,
errors => {
empty => You didnt enter an email address.,
invalid => Bad [% key %]: "[% value %]",
},
extra_test => &check_email_addr,
},
email2 => {
equal_to => email,
errors => {
unequal => Both email addresses must be the same.,
},
},
);
my $r = $ENV{MOD_PERL} ? Apache::Request->instance : CGI->new;
my $form = Data::CGIForm->new(datasource => $r, spec => %spec);
my @params = $form->params;
foreach $param (@params) {
next unless my $error_string = $form->error($param);
print STDERR $error_string;
}
if ($form->error(username)) {
handle_error($form->username, $form->error(username));
}
my $email = $form->param(email);
my $password = $form->password;
<<lessData::CGIForm is yet another way to parse and handle CGI form data. The main motivation behind this module was a simple specification based validator that could handle multiple values.
You probably dont want to use this module. CGI::Validate is a much more feature complete take on getting this sort of work done. You may then ask why this is on the CPAN, I ask that of myself from time to time....
SYNOPSIS
my %spec = (
username => qr/^([a-z0-9]+)$/,
password => {
regexp => qr/^([a-z0-9+])$/,
filter => [qw(strip_leading_ws, strip_trailing_ws)],
},
email => {
regexp => qr/^([a-z0-9@.]+)$/,
filter => &qualify_domain,
optional => 1,
errors => {
empty => You didnt enter an email address.,
invalid => Bad [% key %]: "[% value %]",
},
extra_test => &check_email_addr,
},
email2 => {
equal_to => email,
errors => {
unequal => Both email addresses must be the same.,
},
},
);
my $r = $ENV{MOD_PERL} ? Apache::Request->instance : CGI->new;
my $form = Data::CGIForm->new(datasource => $r, spec => %spec);
my @params = $form->params;
foreach $param (@params) {
next unless my $error_string = $form->error($param);
print STDERR $error_string;
}
if ($form->error(username)) {
handle_error($form->username, $form->error(username));
}
my $email = $form->param(email);
my $password = $form->password;
Download (0.012MB)
Added: 2006-10-04 License: Perl Artistic License Price:
1115 downloads
Apache2::Ajax 0.1
Apache2::Ajax is a mod_perl interface to CGI::Ajax. more>>
Apache2::Ajax is a mod_perl interface to CGI::Ajax.
SYNOPSIS
######################################################
# in httpd.conf
PerlLoadModule Apache2::MyAjaxApp
< Location /ajax >
SetHandler perl-script
PerlResponseHandler Apache2::MyAjaxApp
PJX_fn js_function_name perl_function_name
PJX_html Show_Form_sub
PJX_JSDEBUG 2
PJX_DEBUG 1
< /Location >
######################################################
######################################################
# module file Apache2/MyAjaxApp.pm
package Apache2::MyAjaxApp
use Apache2::Ajax;
# use whatever else
sub perl_function_name {
my @params = @_;
# do whatever
return $return_value;
}
sub Show_Form_sub {
my $html = ;
# construct html string
return $html;
}
sub handler {
my $r = shift;
# do stuff
my $ajax = Apache2::Ajax->new($r);
$r->print($ajax->build_html());
return Apache2::Const::OK;
}
1;
##################################################
This module is a mod_perl2 interface to CGI::Ajax, which provides a mechanism for using perl code asynchronously from javascript-enhanced HTML pages.
As well as mod_perl2, this package requires CGI::Ajax, as well as a CGI.pm-compatible CGI module for supplying the param() and header() methods. If available, CGI::Apache2::Wrapper will be used, which is a minimal module that uses methods of mod_perl2 and Apache2::Request to provide these methods; if this is not available, CGI (version 2.93 or greater) will be used.
Setting things up can be illustrated by the following example of CGI::Ajax, which contains a more thorough discussion, as well as a number of illustrative example scripts.
<<lessSYNOPSIS
######################################################
# in httpd.conf
PerlLoadModule Apache2::MyAjaxApp
< Location /ajax >
SetHandler perl-script
PerlResponseHandler Apache2::MyAjaxApp
PJX_fn js_function_name perl_function_name
PJX_html Show_Form_sub
PJX_JSDEBUG 2
PJX_DEBUG 1
< /Location >
######################################################
######################################################
# module file Apache2/MyAjaxApp.pm
package Apache2::MyAjaxApp
use Apache2::Ajax;
# use whatever else
sub perl_function_name {
my @params = @_;
# do whatever
return $return_value;
}
sub Show_Form_sub {
my $html = ;
# construct html string
return $html;
}
sub handler {
my $r = shift;
# do stuff
my $ajax = Apache2::Ajax->new($r);
$r->print($ajax->build_html());
return Apache2::Const::OK;
}
1;
##################################################
This module is a mod_perl2 interface to CGI::Ajax, which provides a mechanism for using perl code asynchronously from javascript-enhanced HTML pages.
As well as mod_perl2, this package requires CGI::Ajax, as well as a CGI.pm-compatible CGI module for supplying the param() and header() methods. If available, CGI::Apache2::Wrapper will be used, which is a minimal module that uses methods of mod_perl2 and Apache2::Request to provide these methods; if this is not available, CGI (version 2.93 or greater) will be used.
Setting things up can be illustrated by the following example of CGI::Ajax, which contains a more thorough discussion, as well as a number of illustrative example scripts.
Download (0.010MB)
Added: 2007-03-19 License: Perl Artistic License Price:
951 downloads
App::Modular::Module::Events 0.1.2
App::Modular::Module::Events is a Perl module with event handling for App::Modular compatible applications. more>>
App::Modular::Module::Events is a Perl module with event handling for App::Modular compatible applications.
SYNOPSIS
####################################################################
package App::Modular::Module::Me;
use base qw(App::Modular::Module);
sub depends { return Events; }
sub start_listen {
my $self = shift;
$self->{modularizer}->module(Events)->
register(Listener, TelephoneRings);
};
sub event_handler {
my $self = shift;
my $event = shift;
print Yeah! Somebody thought about me!
if ($event eq TelephoneRings);
};
####################################################################
package App::Modular::Module::You;
use base qw(App::Modular::Module);
sub depends { return Events; }
sub call_me {
$self->{modularizer}->module(Events)->
trigger(TelephoneRings);
};
####################################################################
package main;
use App::Modular;
my $modul = instance App::Modular;
$modul->module(Me)->start_listen();
$modul->module(You)->callme();
exit;
App::Modular aims to provide a framework which should it make very easy to programmes to create any kind of modular program.
This module provides basic event handling as a contribution to that toolkit. Modules may register themselves as listeners for events, if an event is triggered, all the modules are notified by calling $module-event_handler(event, @params) >.
The events are speciefied as simple strings.
<<lessSYNOPSIS
####################################################################
package App::Modular::Module::Me;
use base qw(App::Modular::Module);
sub depends { return Events; }
sub start_listen {
my $self = shift;
$self->{modularizer}->module(Events)->
register(Listener, TelephoneRings);
};
sub event_handler {
my $self = shift;
my $event = shift;
print Yeah! Somebody thought about me!
if ($event eq TelephoneRings);
};
####################################################################
package App::Modular::Module::You;
use base qw(App::Modular::Module);
sub depends { return Events; }
sub call_me {
$self->{modularizer}->module(Events)->
trigger(TelephoneRings);
};
####################################################################
package main;
use App::Modular;
my $modul = instance App::Modular;
$modul->module(Me)->start_listen();
$modul->module(You)->callme();
exit;
App::Modular aims to provide a framework which should it make very easy to programmes to create any kind of modular program.
This module provides basic event handling as a contribution to that toolkit. Modules may register themselves as listeners for events, if an event is triggered, all the modules are notified by calling $module-event_handler(event, @params) >.
The events are speciefied as simple strings.
Download (0.016MB)
Added: 2007-02-28 License: Perl Artistic License Price:
969 downloads
File::PathList 0.02
File::PathList is a Perl module that can find a file within a set of paths (like @INC or Java classpaths). more>>
File::PathList is a Perl module that can find a file within a set of paths (like @INC or Java classpaths).
SYNOPSIS
# Create a basic pathset
my $inc = File::PathList->new( @INC );
# Again, but with more explicit params
my $inc2 = File::PathList->new(
paths => @INC,
cache => 1,
);
# Get the full (localised) path for a unix-style relative path
my $file = "foo/bar/baz.txt";
my $path = $inc->find_file( $file );
if ( $path ) {
print "Found $file at $pathn";
} else {
print "Failed to find $filen";
}
Many systems that map generic relative paths to absolute paths do so with a set of base paths.
For example, perl itself when loading classes first turn a Class::Name into a path like Class/Name.pm, and thens looks through each element of @INC to find the actual file.
To aid in portability, all relative paths are provided as unix-style relative paths, and converted to the localised version in the process of looking up the path.
<<lessSYNOPSIS
# Create a basic pathset
my $inc = File::PathList->new( @INC );
# Again, but with more explicit params
my $inc2 = File::PathList->new(
paths => @INC,
cache => 1,
);
# Get the full (localised) path for a unix-style relative path
my $file = "foo/bar/baz.txt";
my $path = $inc->find_file( $file );
if ( $path ) {
print "Found $file at $pathn";
} else {
print "Failed to find $filen";
}
Many systems that map generic relative paths to absolute paths do so with a set of base paths.
For example, perl itself when loading classes first turn a Class::Name into a path like Class/Name.pm, and thens looks through each element of @INC to find the actual file.
To aid in portability, all relative paths are provided as unix-style relative paths, and converted to the localised version in the process of looking up the path.
Download (0.026MB)
Added: 2007-06-06 License: Perl Artistic License Price:
870 downloads
Stream::Reader 0.09
Stream::Reader is a stream reader Perl class. more>>
Stream::Reader is a stream reader Perl class.
SYNOPSIS
# Input stream can be reference to TYPEGLOB or SCALAR, output stream
# can be the same types or undefined
# Constructor
$stream = Stream::Reader->new( *IN,
{ Limit => $limit, BuffSize => $buffsize, Mode => UB } );
# Reading all before delimiter beginning from current position.
# Delimiter is SCALAR or reference to array with many SCALARs.
# Returns true value on succesfull matching or if end of stream
# expected at first time
$bool = $stream->readto( $delimiter,
{ Out => *OUT, Limit => $limit, Mode => AIE } );
# Reading fixed number of chars beginning from current position.
# Returns true value if was readed number of chars more then zero or
# end of stream was not expected yet
$bool = $stream->readsome( $limit, { Out => *OUT, Mode => A } );
# Mode is string, what can contains:
# U - modificator for constructor. disable utf-8 checking
# B - modificator for constructor. enable second buffer for speed up
# case insensitive search
# A - modificator for readto() and readsome(). appending data to
# output stream, if stream is SCALAR
# I - modificator for readto(). enable case insensitive search
# E - modificator for readto(). at end of input stream alltimes
# returns false value
$number = $stream->{Total}; # total number of readed chars
$number = $stream->{Readed}; # number of readed chars at last
# operation (without matched string
# length at readto() method)
$number = $stream->{Stored}; # number of succesfully stored chars
# at last operation
$string = $stream->{Match}; # matched string at last operation
# (actually for readto() only)
$bool = $stream->{Error}; # error status. true on error
METHODS
OBJ = Stream::Reader->new( INPUT, { ... Params ... } )
The constructor method instantiates a new Stream::Reader object.
INPUT - is a reference to file stream, opened for reading, or reference to defined string. This is an obligatory parameter.
Params (all optionaly):
Limit - limit size of input stream data in characters. If this parameter is absent, not defined or less then zero, then all data from input stream will be available for reading.
BuffSize - size of buffer in characters. If this parameter is absent, not defined or less then zero, then will be used default buffer size 32768 characters.
Mode - is string with letters-modificators:
B - use second buffer. Can really speed up search in case insensitive mode.
U - disable UTF-8 data check in UTF-8 mode. Use this flag if you are absolutely sure, that your UTF-8 data is valid.
RESULT = OBJ->readto( DELIMITER, { ... Params ... } )
This method reads all data from input stream before first found delimiter, beginning from current position.
RESULT - boolean value. True value if successfuly found delimeter or and of input stream has expected at first time. False value otherwise, or in case of reading error.
DELIMETER - is a string-delimeter or reference to array with many delimeters. This is an obligatory parameter and must be defined.
Remember! In case of many delimiters, left delimiter alltimes have more priority then right!
Params (all optionaly):
Out - is a reference to file stream, opened for writing, or reference to string. If this parameter is absent then data will not stored.
Limit - size in characters. Defines, the maximum number of characters that must be stored in Out. If this paramter is absent, not defined or less then zero, then this method will be trying to store all readed data.
Mode - is string with letters-modificators:
A - appendig data to Out if Out is a reference to string.
I - search in case insensitive mode.
E - at the end of input stream returns only false value. Without this modificator, if end of stream expected at first time, then will be returned true value.
RESULT = OBJ->readsome( LIMIT, { ... Params ... } )
This method reads fixed number of characters from input stream beginning from current position.
RESULT - boolean value. True value, if any characters were read or end of input stream is not expected yet. False value otherwise, or in case of reading error.
LIMIT - limit size in characters, how many it is necessary to read. If this parameter is absent, not defined or less then zero, then will be read all available data from input stream.
Params (all optionaly):
Out - the same as in readto() method.
Mode - is string with letters-modificators:
A - the same as in readto() method.
Statistics:
OBJ->{Total} - total number of readed characters. Warning! This module using block reading and real position in stream is different.
OBJ->{Readed} - number of readed characters at last operation (without matched string length at readto() method).
OBJ->{Stored} - number of succesfully stored chars at last operation
OBJ->{Match} - matched string at last operation (actually for readto() only)
OBJ->{Error} - boolen error status. At any reading erorrs all operations will be stopes and this flag turned to true value.
<<lessSYNOPSIS
# Input stream can be reference to TYPEGLOB or SCALAR, output stream
# can be the same types or undefined
# Constructor
$stream = Stream::Reader->new( *IN,
{ Limit => $limit, BuffSize => $buffsize, Mode => UB } );
# Reading all before delimiter beginning from current position.
# Delimiter is SCALAR or reference to array with many SCALARs.
# Returns true value on succesfull matching or if end of stream
# expected at first time
$bool = $stream->readto( $delimiter,
{ Out => *OUT, Limit => $limit, Mode => AIE } );
# Reading fixed number of chars beginning from current position.
# Returns true value if was readed number of chars more then zero or
# end of stream was not expected yet
$bool = $stream->readsome( $limit, { Out => *OUT, Mode => A } );
# Mode is string, what can contains:
# U - modificator for constructor. disable utf-8 checking
# B - modificator for constructor. enable second buffer for speed up
# case insensitive search
# A - modificator for readto() and readsome(). appending data to
# output stream, if stream is SCALAR
# I - modificator for readto(). enable case insensitive search
# E - modificator for readto(). at end of input stream alltimes
# returns false value
$number = $stream->{Total}; # total number of readed chars
$number = $stream->{Readed}; # number of readed chars at last
# operation (without matched string
# length at readto() method)
$number = $stream->{Stored}; # number of succesfully stored chars
# at last operation
$string = $stream->{Match}; # matched string at last operation
# (actually for readto() only)
$bool = $stream->{Error}; # error status. true on error
METHODS
OBJ = Stream::Reader->new( INPUT, { ... Params ... } )
The constructor method instantiates a new Stream::Reader object.
INPUT - is a reference to file stream, opened for reading, or reference to defined string. This is an obligatory parameter.
Params (all optionaly):
Limit - limit size of input stream data in characters. If this parameter is absent, not defined or less then zero, then all data from input stream will be available for reading.
BuffSize - size of buffer in characters. If this parameter is absent, not defined or less then zero, then will be used default buffer size 32768 characters.
Mode - is string with letters-modificators:
B - use second buffer. Can really speed up search in case insensitive mode.
U - disable UTF-8 data check in UTF-8 mode. Use this flag if you are absolutely sure, that your UTF-8 data is valid.
RESULT = OBJ->readto( DELIMITER, { ... Params ... } )
This method reads all data from input stream before first found delimiter, beginning from current position.
RESULT - boolean value. True value if successfuly found delimeter or and of input stream has expected at first time. False value otherwise, or in case of reading error.
DELIMETER - is a string-delimeter or reference to array with many delimeters. This is an obligatory parameter and must be defined.
Remember! In case of many delimiters, left delimiter alltimes have more priority then right!
Params (all optionaly):
Out - is a reference to file stream, opened for writing, or reference to string. If this parameter is absent then data will not stored.
Limit - size in characters. Defines, the maximum number of characters that must be stored in Out. If this paramter is absent, not defined or less then zero, then this method will be trying to store all readed data.
Mode - is string with letters-modificators:
A - appendig data to Out if Out is a reference to string.
I - search in case insensitive mode.
E - at the end of input stream returns only false value. Without this modificator, if end of stream expected at first time, then will be returned true value.
RESULT = OBJ->readsome( LIMIT, { ... Params ... } )
This method reads fixed number of characters from input stream beginning from current position.
RESULT - boolean value. True value, if any characters were read or end of input stream is not expected yet. False value otherwise, or in case of reading error.
LIMIT - limit size in characters, how many it is necessary to read. If this parameter is absent, not defined or less then zero, then will be read all available data from input stream.
Params (all optionaly):
Out - the same as in readto() method.
Mode - is string with letters-modificators:
A - the same as in readto() method.
Statistics:
OBJ->{Total} - total number of readed characters. Warning! This module using block reading and real position in stream is different.
OBJ->{Readed} - number of readed characters at last operation (without matched string length at readto() method).
OBJ->{Stored} - number of succesfully stored chars at last operation
OBJ->{Match} - matched string at last operation (actually for readto() only)
OBJ->{Error} - boolen error status. At any reading erorrs all operations will be stopes and this flag turned to true value.
Download (0.006MB)
Added: 2007-04-27 License: Perl Artistic License Price:
910 downloads
NetPacket::ARP 0.04
NetPacket::ARP is a Perl module to assemble and disassemble ARP (Address Resolution Protocol) packets. more>>
NetPacket::ARP is a Perl module to assemble and disassemble ARP (Address Resolution Protocol) packets.
SYNOPSIS
use NetPacket::ARP;
$tcp_obj = NetPacket::ARP->decode($raw_pkt);
$tcp_pkt = NetPacket::ARP->encode(params...); # Not implemented
NetPacket::ARP provides a set of routines for assembling and disassembling packets using ARP (Address Resolution Protocol).
Methods
NetPacket::ARP->decode([RAW PACKET])
Decode the raw packet data given and return an object containing instance data. This method will quite happily decode garbage input. It is the responsibility of the programmer to ensure valid packet data is passed to this method.
NetPacket::ARP->encode(param => value)
Return a ARP packet encoded with the instance data specified. Not implemented.
Functions
NetPacket::ARP::strip([RAW PACKET])
Return the encapsulated data (or payload) contained in the TCP packet. Since no payload data is encapulated in an ARP packet (only instance data), this function returns undef.
Instance data
The instance data for the NetPacket::ARP object consists of the following fields.
htype
Hardware type.
proto
Protocol type.
hlen
Header length.
plen
Protocol length.
opcode
One of the following constants:
ARP_OPCODE_REQUEST
ARP_OPCODE_REPLY
RARP_OPCODE_REQUEST
RARP_OPCODE_REPLY
sha
Source hardware address.
spa
Source protocol address.
tha
Target hardware address.
tpa
Target protocol address.
<<lessSYNOPSIS
use NetPacket::ARP;
$tcp_obj = NetPacket::ARP->decode($raw_pkt);
$tcp_pkt = NetPacket::ARP->encode(params...); # Not implemented
NetPacket::ARP provides a set of routines for assembling and disassembling packets using ARP (Address Resolution Protocol).
Methods
NetPacket::ARP->decode([RAW PACKET])
Decode the raw packet data given and return an object containing instance data. This method will quite happily decode garbage input. It is the responsibility of the programmer to ensure valid packet data is passed to this method.
NetPacket::ARP->encode(param => value)
Return a ARP packet encoded with the instance data specified. Not implemented.
Functions
NetPacket::ARP::strip([RAW PACKET])
Return the encapsulated data (or payload) contained in the TCP packet. Since no payload data is encapulated in an ARP packet (only instance data), this function returns undef.
Instance data
The instance data for the NetPacket::ARP object consists of the following fields.
htype
Hardware type.
proto
Protocol type.
hlen
Header length.
plen
Protocol length.
opcode
One of the following constants:
ARP_OPCODE_REQUEST
ARP_OPCODE_REPLY
RARP_OPCODE_REQUEST
RARP_OPCODE_REPLY
sha
Source hardware address.
spa
Source protocol address.
tha
Target hardware address.
tpa
Target protocol address.
Download (0.011MB)
Added: 2007-03-08 License: Perl Artistic License Price:
968 downloads
KinoSearch::Util::Class 0.13
KinoSearch::Util::Class is a Perl class building utility. more>>
KinoSearch::Util::Class is a Perl class building utility.
PRIVATE CLASS
This is a private class and the interface may change radically and without warning. Do not use it on its own.
SYNOPSIS
package KinoSearch::SomePackage::SomeClass;
use base qw( KinoSearch::Util::Class );
BEGIN {
__PACKAGE__->init_instance_vars(
# constructor params / members
foo => undef,
bar => {},
# members
baz => {},
);
}
KinoSearch::Util::Class is a class-building utility a la Class::Accessor, Class::Meta, etc. It provides four main services:
- A mechanism for inheriting instance variable declarations.
- A constructor with basic argument checking.
- Manufacturing of get_xxxx and set_xxxx methods.
- Convenience methods which help in defining abstract classes.
<<lessPRIVATE CLASS
This is a private class and the interface may change radically and without warning. Do not use it on its own.
SYNOPSIS
package KinoSearch::SomePackage::SomeClass;
use base qw( KinoSearch::Util::Class );
BEGIN {
__PACKAGE__->init_instance_vars(
# constructor params / members
foo => undef,
bar => {},
# members
baz => {},
);
}
KinoSearch::Util::Class is a class-building utility a la Class::Accessor, Class::Meta, etc. It provides four main services:
- A mechanism for inheriting instance variable declarations.
- A constructor with basic argument checking.
- Manufacturing of get_xxxx and set_xxxx methods.
- Convenience methods which help in defining abstract classes.
Download (0.21MB)
Added: 2006-09-02 License: Perl Artistic License Price:
1147 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above params search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed