ref
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 186
Text::Refer 1.106
Text::Refer can parse Unix refer files. more>>
Text::Refer can parse Unix "refer" files.
SYNOPSIS
Pull in the module:
use Text::Refer;
Parse a refer stream from a filehandle:
while ($ref = input Text::Refer *FH) {
# ...do stuff with $ref...
}
defined($ref) or die "error parsing input";
Same, but using a parser object for more control:
# Create a new parser:
$parser = new Text::Refer::Parser LeadWhite=>KEEP;
# Parse:
while ($ref = $parser->input(*FH)) {
# ...do stuff with $ref...
}
defined($ref) or die "error parsing input";
Manipulating reference objects, using high-level methods:
# Get the title, author, etc.:
$title = $ref->title;
@authors = $ref->author; # list context
$lastAuthor = $ref->author; # scalar context
# Set the title and authors:
$ref->title("Cyberiad");
$ref->author(["S. Trurl", "C. Klapaucius"]); # arrayref for >1 value!
# Delete the abstract:
$ref->abstract(undef);
Same, using low-level methods:
# Get the title, author, etc.:
$title = $ref->get(T);
@authors = $ref->get(A); # list context
$lastAuthor = $ref->get(A); # scalar context
# Set the title and authors:
$ref->set(T, "Cyberiad");
$ref->set(A, "S. Trurl", "C. Klapaucius");
# Delete the abstract:
$ref->set(X); # sets to empty array of values
Output:
print $ref->as_string;
<<lessSYNOPSIS
Pull in the module:
use Text::Refer;
Parse a refer stream from a filehandle:
while ($ref = input Text::Refer *FH) {
# ...do stuff with $ref...
}
defined($ref) or die "error parsing input";
Same, but using a parser object for more control:
# Create a new parser:
$parser = new Text::Refer::Parser LeadWhite=>KEEP;
# Parse:
while ($ref = $parser->input(*FH)) {
# ...do stuff with $ref...
}
defined($ref) or die "error parsing input";
Manipulating reference objects, using high-level methods:
# Get the title, author, etc.:
$title = $ref->title;
@authors = $ref->author; # list context
$lastAuthor = $ref->author; # scalar context
# Set the title and authors:
$ref->title("Cyberiad");
$ref->author(["S. Trurl", "C. Klapaucius"]); # arrayref for >1 value!
# Delete the abstract:
$ref->abstract(undef);
Same, using low-level methods:
# Get the title, author, etc.:
$title = $ref->get(T);
@authors = $ref->get(A); # list context
$lastAuthor = $ref->get(A); # scalar context
# Set the title and authors:
$ref->set(T, "Cyberiad");
$ref->set(A, "S. Trurl", "C. Klapaucius");
# Delete the abstract:
$ref->set(X); # sets to empty array of values
Output:
print $ref->as_string;
Download (0.031MB)
Added: 2007-08-22 License: Perl Artistic License Price:
794 downloads
Garden 0.5.0
Garden is a dependency injection for PHP5. more>>
Garden is a dependency injection for PHP5.
Inspired by Spring Framework, it uses XML application context with syntax as similar as possible to Spring context definitions.
Kickstarter
Create example.xml file like this (dont forget to put garden-beans.dtd next to it!):
< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE beans PUBLIC "-//GARDEN//DTD BEAN//EN" "garden-beans.dtd" >
< beans default-lazy-init="true" >
< bean id="dog" class="Dog" file="ext/Dog.php" >
< property name="collar" >
< ref local="dogCollar"/ >
< /property >
< /bean >
< bean id="dogCollar" class="Collar" file="ext/Dog/Collar.php" >
< property name="spiked" value="true"/ >
< /bean >
< /beans >
etx/Dog.php contains:
class Dog
{
private $collar;
public function setCollar($collar)
{
$this->collar = $collar;
}
public function getCollar()
{
return $this->collar;
}
}
etx/Dog/Collar.php contains:
class Collar
{
private $spiked;
public function setSpiked($spiked)
{
$this->spiked = $spiked;
}
public function getSpiked()
{
return $this->spiked;
}
}
<<lessInspired by Spring Framework, it uses XML application context with syntax as similar as possible to Spring context definitions.
Kickstarter
Create example.xml file like this (dont forget to put garden-beans.dtd next to it!):
< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE beans PUBLIC "-//GARDEN//DTD BEAN//EN" "garden-beans.dtd" >
< beans default-lazy-init="true" >
< bean id="dog" class="Dog" file="ext/Dog.php" >
< property name="collar" >
< ref local="dogCollar"/ >
< /property >
< /bean >
< bean id="dogCollar" class="Collar" file="ext/Dog/Collar.php" >
< property name="spiked" value="true"/ >
< /bean >
< /beans >
etx/Dog.php contains:
class Dog
{
private $collar;
public function setCollar($collar)
{
$this->collar = $collar;
}
public function getCollar()
{
return $this->collar;
}
}
etx/Dog/Collar.php contains:
class Collar
{
private $spiked;
public function setSpiked($spiked)
{
$this->spiked = $spiked;
}
public function getSpiked()
{
return $this->spiked;
}
}
Download (0.078MB)
Added: 2006-05-16 License: The Apache License 2.0 Price:
1256 downloads
File::Repl 1.20
File::Repl is a Perl module that provides file replication utilities. more>>
File::Repl is a Perl module that provides file replication utilities.
SYNOPSIS
use File::Repl;
%con = {
dira => C:/perl,
dirb => M:/perl,
verbose => 1,
age => 10,
};
$ref=File::Repl->New(%con);
$r1 = $ref->Update(.p(l|m),ab,1);
$r2 = $ref->Update(.t.*,ab,1,.tmp$);
The File:Repl provides simple file replication and management utilities. Its main functions are
File Replication
Allowing two directory structures to be maintained, ensuring files that meet selection logic criteria are mirrored and otherwise synchronized.
Bulk Renaming
Allowing files in a directory structure to be renamed according to the selection logic.
Compressing
Allowing files in a directory structure to be compressed according to a given logic.
Process
Run a common perl process against files in a directory structure according to selection logic.
Deletion
Allowing files in a directory structure to be deleted according to the selection logic.
<<lessSYNOPSIS
use File::Repl;
%con = {
dira => C:/perl,
dirb => M:/perl,
verbose => 1,
age => 10,
};
$ref=File::Repl->New(%con);
$r1 = $ref->Update(.p(l|m),ab,1);
$r2 = $ref->Update(.t.*,ab,1,.tmp$);
The File:Repl provides simple file replication and management utilities. Its main functions are
File Replication
Allowing two directory structures to be maintained, ensuring files that meet selection logic criteria are mirrored and otherwise synchronized.
Bulk Renaming
Allowing files in a directory structure to be renamed according to the selection logic.
Compressing
Allowing files in a directory structure to be compressed according to a given logic.
Process
Run a common perl process against files in a directory structure according to selection logic.
Deletion
Allowing files in a directory structure to be deleted according to the selection logic.
Download (0.015MB)
Added: 2007-06-28 License: Perl Artistic License Price:
849 downloads
MDV::Repsys 0.08
MDV::Repsys is a Perl module to build rpm from a svn. more>>
MDV::Repsys is a Perl module to build rpm from a svn.
FUNCTIONS
set_verbosity($level)
Set the verbosity verbosity of the module:
0 silent
1 progress message
2 debug message
set_rpm_dirs($dir)
Set internals rpm macros that are used by rpm building functions:
_sourcedir to $dir/SOURCES
_patchdir to $dir/SOURCES
_specdir to $dir/SPECS
create_rpm_dirs
Create directories used by rpm building functions:
_sourcedir
_patchdir
_specdir
Return 1 on sucess, 0 on failure.
extract_srpm($rpmfile, $directory)
Extract (install) a source package into $directory.
find_unsync_files($working_dir, $specfile)
Return two array ref of lists of files that should be added or removed from the svn working copy to be sync with the specfile.
sync_svn_copy($add, $remove)
Perform add or remove of files listed in both array ref.
sync_source($workingdir, $specfile)
Synchronize svn content by performing add/remove on file need to build the package.
$workingdir should a svn directory. No changes are applied to the repository, you have to commit yourself after.
Return 1 on success, 0 on error.
strip_changelog($specfile)
Remove the %changelog section from the specfile.
build($dir, $what, %options)
Build package locate in $dir. The type of packages to build is set in the string $what: b for binaries, s for source.
If $options{specfile} is set, the build is done from this specfile and not the one contains in SPECS/ directory.
<<lessFUNCTIONS
set_verbosity($level)
Set the verbosity verbosity of the module:
0 silent
1 progress message
2 debug message
set_rpm_dirs($dir)
Set internals rpm macros that are used by rpm building functions:
_sourcedir to $dir/SOURCES
_patchdir to $dir/SOURCES
_specdir to $dir/SPECS
create_rpm_dirs
Create directories used by rpm building functions:
_sourcedir
_patchdir
_specdir
Return 1 on sucess, 0 on failure.
extract_srpm($rpmfile, $directory)
Extract (install) a source package into $directory.
find_unsync_files($working_dir, $specfile)
Return two array ref of lists of files that should be added or removed from the svn working copy to be sync with the specfile.
sync_svn_copy($add, $remove)
Perform add or remove of files listed in both array ref.
sync_source($workingdir, $specfile)
Synchronize svn content by performing add/remove on file need to build the package.
$workingdir should a svn directory. No changes are applied to the repository, you have to commit yourself after.
Return 1 on success, 0 on error.
strip_changelog($specfile)
Remove the %changelog section from the specfile.
build($dir, $what, %options)
Build package locate in $dir. The type of packages to build is set in the string $what: b for binaries, s for source.
If $options{specfile} is set, the build is done from this specfile and not the one contains in SPECS/ directory.
Download (0.034MB)
Added: 2006-09-29 License: Perl Artistic License Price:
1120 downloads
Proc::Forking 1.38
Proc::Forking is a Perl module that provides a set of tool to fork and daemonize. more>>
Proc::Forking is a Perl module that provides a set of tool to fork and daemonize.
SYNOPSIS
#!/usr/bin/perl
use strict;
use Proc::Forking;
use Data::Dumper;
use Time::HiRes qw(usleep); # to allow micro sleep
my $f = Proc::Forking->new();
$SIG{ KILL } = $SIG{ TERM } = $SIG{ INT } = sub { $f->killall_childs;sleep 1; exit },
$f->daemonize(
## uid => 1000,
## gid => 1000,
## home => "/tmp",
pid_file => "/tmp/master.pid"
);
open( STDOUT, ">>/tmp/master.log" );
my $nbr = 0;
my $timemout;
while ( 1 )
{
if ( $nbr < 20 )
{
my $extra = "other parameter";
my ( $status, $pid, $error ) = $f->fork_child(
function => &func,
name => "new_name.##",
args => [ "hello SOMEONE", 3, $extra ],
pid_file => "/tmp/fork.##.pid",
uid => 1000,
gid => 1000,
home => "/tmp",
max_load => 5,
max_mem => 185000000,
expiration => 10,
# expiration_auto => 1,
);
if ( $status == 4 ) # if the load become to high
{
print "Max load reached, do a little napn";
usleep( 100000 );
next;
}
elsif ( $status ) # if another kind of error
{
print "PID=$pidt error=$errorn";
print Dumper( $f->list_names() );
print Dumper( $f->list_pids() );
}
}
$nbr = $f->pid_nbr;
my ( $n, @dp, @dn ) = $f->expirate;
if ( $n )
{
print Dumper( @dp );
}
print "free=n";
usleep( 100000 ); # always a good idea to put a small sleep to allow task swapper to gain some free resources
}
sub func
{
my $ref = shift;
my @args = @$ref;
my ( $data, $time_out, $sockC ) = @args;
$SIG{ USR1 } = sub { open my $log, ">>/tmp/log.s"; print $log "signal USR1 receivedn"; close $log; };
if ( !$time_out )
{
$time_out = 3;
}
open my $FF, ">>/tmp/loglist";
print $FF $$, " start time =", $^T;
close $FF;
for ( 1 .. 4 )
{
open my $fh, ">>/tmp/log";
if ( defined $fh )
{
print $fh "TMOUT = $time_out " . time . " PID=$$ cwd=" . Cwd::cwd() . " name =$0n";
$fh->close;
}
sleep $time_out + rand( 5 );
}
}
<<lessSYNOPSIS
#!/usr/bin/perl
use strict;
use Proc::Forking;
use Data::Dumper;
use Time::HiRes qw(usleep); # to allow micro sleep
my $f = Proc::Forking->new();
$SIG{ KILL } = $SIG{ TERM } = $SIG{ INT } = sub { $f->killall_childs;sleep 1; exit },
$f->daemonize(
## uid => 1000,
## gid => 1000,
## home => "/tmp",
pid_file => "/tmp/master.pid"
);
open( STDOUT, ">>/tmp/master.log" );
my $nbr = 0;
my $timemout;
while ( 1 )
{
if ( $nbr < 20 )
{
my $extra = "other parameter";
my ( $status, $pid, $error ) = $f->fork_child(
function => &func,
name => "new_name.##",
args => [ "hello SOMEONE", 3, $extra ],
pid_file => "/tmp/fork.##.pid",
uid => 1000,
gid => 1000,
home => "/tmp",
max_load => 5,
max_mem => 185000000,
expiration => 10,
# expiration_auto => 1,
);
if ( $status == 4 ) # if the load become to high
{
print "Max load reached, do a little napn";
usleep( 100000 );
next;
}
elsif ( $status ) # if another kind of error
{
print "PID=$pidt error=$errorn";
print Dumper( $f->list_names() );
print Dumper( $f->list_pids() );
}
}
$nbr = $f->pid_nbr;
my ( $n, @dp, @dn ) = $f->expirate;
if ( $n )
{
print Dumper( @dp );
}
print "free=n";
usleep( 100000 ); # always a good idea to put a small sleep to allow task swapper to gain some free resources
}
sub func
{
my $ref = shift;
my @args = @$ref;
my ( $data, $time_out, $sockC ) = @args;
$SIG{ USR1 } = sub { open my $log, ">>/tmp/log.s"; print $log "signal USR1 receivedn"; close $log; };
if ( !$time_out )
{
$time_out = 3;
}
open my $FF, ">>/tmp/loglist";
print $FF $$, " start time =", $^T;
close $FF;
for ( 1 .. 4 )
{
open my $fh, ">>/tmp/log";
if ( defined $fh )
{
print $fh "TMOUT = $time_out " . time . " PID=$$ cwd=" . Cwd::cwd() . " name =$0n";
$fh->close;
}
sleep $time_out + rand( 5 );
}
}
Download (0.011MB)
Added: 2007-03-06 License: Perl Artistic License Price:
962 downloads
Parse::Binary::FixedFormat 0.10
Parse::Binary::FixedFormat is a Perl module to convert between fixed-length fields and hashes. more>>
Parse::Binary::FixedFormat is a Perl module to convert between fixed-length fields and hashes.
SYNOPSIS
use Parse::Binary::FixedFormat;
my $tarhdr =
new Parse::Binary::FixedFormat [ qw(name:a100 mode:a8 uid:a8 gid:a8 size:a12
mtime:a12 chksum:a8 typeflag:a1 linkname:a100
magic:a6 version:a2 uname:a32 gname:a32
devmajor:a8 devminor:a8 prefix:a155) ];
my $buf;
read TARFILE, $buf, 512;
# create a hash from the buffer read from the file
my $hdr = $tarhdr->unformat($buf); # $hdr gets a hash ref
# create a flat record from a hash reference
my $buf = $tarhdr->format($hdr); # $hdr is a hash ref
# create a hash for a new record
my $newrec = $tarhdr->blank();
Parse::Binary::FixedFormat can be used to convert between a buffer with fixed-length field definitions and a hash with named entries for each field. The perl pack and unpack functions are used to perform the conversions. Parse::Binary::FixedFormat builds the format string by concatenating the field descriptions and converts between the lists used by pack and unpack and a hash that can be reference by field name.
<<lessSYNOPSIS
use Parse::Binary::FixedFormat;
my $tarhdr =
new Parse::Binary::FixedFormat [ qw(name:a100 mode:a8 uid:a8 gid:a8 size:a12
mtime:a12 chksum:a8 typeflag:a1 linkname:a100
magic:a6 version:a2 uname:a32 gname:a32
devmajor:a8 devminor:a8 prefix:a155) ];
my $buf;
read TARFILE, $buf, 512;
# create a hash from the buffer read from the file
my $hdr = $tarhdr->unformat($buf); # $hdr gets a hash ref
# create a flat record from a hash reference
my $buf = $tarhdr->format($hdr); # $hdr is a hash ref
# create a hash for a new record
my $newrec = $tarhdr->blank();
Parse::Binary::FixedFormat can be used to convert between a buffer with fixed-length field definitions and a hash with named entries for each field. The perl pack and unpack functions are used to perform the conversions. Parse::Binary::FixedFormat builds the format string by concatenating the field descriptions and converts between the lists used by pack and unpack and a hash that can be reference by field name.
Download (0.031MB)
Added: 2006-08-09 License: Perl Artistic License Price:
1171 downloads
Variable::Alias 0.01
Variable::Alias is a Perl module created to alias any variable to any other variable. more>>
Variable::Alias is a Perl module created to alias any variable to any other variable.
SYNOPSIS
use Variable::Alias alias;
my $src;
my $a;
our $b;
my @c;
our @d;
alias $src => $a;
alias $a => $b;
alias $b => $c[0];
alias @c => @d;
$src=src;
# All the other variables now have the string
# src in the appropriate places.
There are various ways to alias one variable to another in Perl. The most popular is by assigning to typeglobs. This is quite efective, but only works with globals. Another method is to use a module like Lexical::Alias or Devel::LexAlias, but as their names suggest, these only work with lexicals. Theres no way to alias an element of an array or hash.
Variable::Alias changes all that. It uses a tie to provide One True Way to alias a variable.
Interface
Variable::Alias may export any or all of five functions. If youve used Lexical::Alias, the interface is virtually identical.
alias(VAR, VAR)
alias takes two variables of any type (scalar, array or hash) and aliases them. Make sure they have the sigil you want on the front.
This function is only available in Perl 5.8.0 and later, because the prototype tricks it uses were first implemented in that version.
alias_s(SCALAR, SCALAR)
alias_s takes two scalars and aliases them.
alias_a(ARRAY, ARRAY)
alias_a takes two arrays and aliases them. Note that this is actual arrays, not array elements, although you can alias references in elements, like so:
alias_a(@short, @{$some->sequence->{of}->calls->{thats}[2]{long}});
alias_h(HASH, HASH)
alias_h takes two hashes and aliases them.
alias_r(REF, REF)
alias_r takes two references and aliases them. The referents must be of the same type.
<<lessSYNOPSIS
use Variable::Alias alias;
my $src;
my $a;
our $b;
my @c;
our @d;
alias $src => $a;
alias $a => $b;
alias $b => $c[0];
alias @c => @d;
$src=src;
# All the other variables now have the string
# src in the appropriate places.
There are various ways to alias one variable to another in Perl. The most popular is by assigning to typeglobs. This is quite efective, but only works with globals. Another method is to use a module like Lexical::Alias or Devel::LexAlias, but as their names suggest, these only work with lexicals. Theres no way to alias an element of an array or hash.
Variable::Alias changes all that. It uses a tie to provide One True Way to alias a variable.
Interface
Variable::Alias may export any or all of five functions. If youve used Lexical::Alias, the interface is virtually identical.
alias(VAR, VAR)
alias takes two variables of any type (scalar, array or hash) and aliases them. Make sure they have the sigil you want on the front.
This function is only available in Perl 5.8.0 and later, because the prototype tricks it uses were first implemented in that version.
alias_s(SCALAR, SCALAR)
alias_s takes two scalars and aliases them.
alias_a(ARRAY, ARRAY)
alias_a takes two arrays and aliases them. Note that this is actual arrays, not array elements, although you can alias references in elements, like so:
alias_a(@short, @{$some->sequence->{of}->calls->{thats}[2]{long}});
alias_h(HASH, HASH)
alias_h takes two hashes and aliases them.
alias_r(REF, REF)
alias_r takes two references and aliases them. The referents must be of the same type.
Download (0.003MB)
Added: 2007-05-04 License: Perl Artistic License Price:
903 downloads
Data::TreeDumper 0.33
Data::TreeDumper is an improved replacement for Data::Dumper. more>>
Data::TreeDumper is an improved replacement for Data::Dumper. Powerful filtering capability.
SYNOPSIS
use Data::TreeDumper ;
my $sub = sub {} ;
my $s =
{
A =>
{
a =>
{
}
, bbbbbb => $sub
, c123 => $sub
, d => $sub
}
, C =>
{
b =>
{
a =>
{
a =>
{
}
, b => sub
{
}
, c => 42
}
}
}
, ARRAY => [qw(elment_1 element_2 element_3)]
} ;
#-------------------------------------------------------------------
# package setup data
#-------------------------------------------------------------------
$Data::TreeDumper::Useascii = 0 ;
$Data::TreeDumper::Maxdepth = 2 ;
print DumpTree($s, title) ;
print DumpTree($s, title, MAX_DEPTH => 1) ;
print DumpTrees
(
[$s, "title", MAX_DEPTH => 1]
, [$s2, "other_title", DISPLAY_ADDRESS => 0]
, USE_ASCII => 1
, MAX_DEPTH => 5
) ;
Output:
title:
|- A [H1]
| |- a [H2]
| |- bbbbbb = CODE(0x8139fa0) [C3]
| |- c123 [C4 -> C3]
| `- d [R5]
| `- REF(0x8139fb8) [R5 -> C3]
|- ARRAY [A6]
| |- 0 [S7] = elment_1
| |- 1 [S8] = element_2
| `- 2 [S9] = element_3
`- C [H10]
`- b [H11]
`- a [H12]
|- a [H13]
|- b = CODE(0x81ab130) [C14]
`- c [S15] = 42
<<lessSYNOPSIS
use Data::TreeDumper ;
my $sub = sub {} ;
my $s =
{
A =>
{
a =>
{
}
, bbbbbb => $sub
, c123 => $sub
, d => $sub
}
, C =>
{
b =>
{
a =>
{
a =>
{
}
, b => sub
{
}
, c => 42
}
}
}
, ARRAY => [qw(elment_1 element_2 element_3)]
} ;
#-------------------------------------------------------------------
# package setup data
#-------------------------------------------------------------------
$Data::TreeDumper::Useascii = 0 ;
$Data::TreeDumper::Maxdepth = 2 ;
print DumpTree($s, title) ;
print DumpTree($s, title, MAX_DEPTH => 1) ;
print DumpTrees
(
[$s, "title", MAX_DEPTH => 1]
, [$s2, "other_title", DISPLAY_ADDRESS => 0]
, USE_ASCII => 1
, MAX_DEPTH => 5
) ;
Output:
title:
|- A [H1]
| |- a [H2]
| |- bbbbbb = CODE(0x8139fa0) [C3]
| |- c123 [C4 -> C3]
| `- d [R5]
| `- REF(0x8139fb8) [R5 -> C3]
|- ARRAY [A6]
| |- 0 [S7] = elment_1
| |- 1 [S8] = element_2
| `- 2 [S9] = element_3
`- C [H10]
`- b [H11]
`- a [H12]
|- a [H13]
|- b = CODE(0x81ab130) [C14]
`- c [S15] = 42
Download (0.026MB)
Added: 2007-07-06 License: Perl Artistic License Price:
840 downloads
ShiftJIS::Regexp 1.00
ShiftJIS::Regexp contains regular expressions in Shift-JIS. more>>
ShiftJIS::Regexp contains regular expressions in Shift-JIS.
SYNOPSIS
use ShiftJIS::Regexp qw(:all);
match($string, p{Hiragana}{2}p{Digit}{2});
match($string, pH{2}pD{2});
# these two are equivalent:
This module provides some functions to use regular expressions in Shift-JIS on the byte-oriented perl.
The legal Shift-JIS character in this module must match the following regular expression:
[x00-x7FxA1-xDF]|[x81-x9FxE0-xFC][x40-x7Ex80-xFC]
To avoid false matching in multibyte encoding, this module uses anchoring technique to ensure each matching position places at the character boundaries.
cf. perlfaq6, "How can I match strings with multibyte characters?"
Functions
re(PATTERN)
re(PATTERN, MODIFIER)
Returns a regular expression parsable by the byte-oriented perl.
PATTERN is specified as a string. MODIFIER is specified as a string. Modifiers in the following list are allowed.
i case-insensitive pattern (only for ascii alphabets)
I case-insensitive pattern (greek, cyrillic, fullwidth latin)
j hiragana-katakana-insensitive pattern (but halfwidth katakana
are not considered.)
s treat string as single line
m treat string as multiple lines
x ignore whitespace (i.e. [x20nrtf]) unless backslashed
or inside a character class; but comments are not recognized!
o once parsed (not compiled!) and the result is cached internally.
o modifier
while ( ) {
print replace($_, (perl), $1, igo);
}
is more efficient than
while ( ) {
print replace($_, (perl), $1, ig);
}
because in the latter case the pattern is parsed every time
whenever the function is called.
match(STRING, PATTERN)
match(STRING, PATTERN, MODIFIER)
An emulation of m// operator aware of Shift-JIS. But, to emulate @list = $string =~ m/PATTERN/g, the pattern should be parenthesized (capturing parentheses are not added automatically).
@list = match($string, pH, g); # wrong; returns garbage!
@list = match($string,(pH),g); # good
PATTERN is specified as a string. MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
g match globally
z tell the function the pattern matches an empty string
(sorry, due to the poor auto-detection)
replace(STRING or SCALAR REF, PATTERN, REPLACEMENT)
replace(STRING or SCALAR REF, PATTERN, REPLACEMENT, MODIFIER)
An emulation of s/// operator but aware of Shift-JIS.
If a reference to a scalar is specified as the first argument, substitutes the referent scalar and returns the number of substitutions made. If a string (not a reference) is specified as the first argument, returns the substituted string and the specified string is unaffected.
MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
g,z please see match().
jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING)
jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING, LIMIT)
An emulation of CORE::split but aware of Shift-JIS.
In scalar/void context, it does not split into the @_ array; in scalar context, only returns the number of fields found.
PATTERN is specified as a string. But as PATTERN has no special meaning; it splits the string on a single space similarly to CORE::split / /.
When you want to split the string on whitespace, pass an undefined value as PATTERN or use the splitspace() function.
jsplit(undef, " x81x40 This is x81x40 perl.");
splitspace(" x81x40 This is x81x40 perl.");
# (This, is, perl.)
If you want to pass pattern with modifiers, specify an arrayref of [PATTERN, MODIFIER] as the first argument. You can also use "Embedded Modifiers").
MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
splitspace(STRING)
splitspace(STRING, LIMIT)
This function emulates CORE::split( , STRING, LIMIT). It returns a list given by split STRING on whitespace including "x81x40" (IDEOGRAPHIC SPACE). Leading whitespace characters do not produce any field.
Note: splitspace(STRING, LIMIT) is equivalent to jsplit(undef, STRING, LIMIT).
splitchar(STRING)
splitchar(STRING, LIMIT)
This function emulates CORE::split(//, STRING, LIMIT). It returns a list given by split of STRING into characters.
Note: splitchar(STRING, LIMIT) is equivalent to jsplit(, STRING, LIMIT).
<<lessSYNOPSIS
use ShiftJIS::Regexp qw(:all);
match($string, p{Hiragana}{2}p{Digit}{2});
match($string, pH{2}pD{2});
# these two are equivalent:
This module provides some functions to use regular expressions in Shift-JIS on the byte-oriented perl.
The legal Shift-JIS character in this module must match the following regular expression:
[x00-x7FxA1-xDF]|[x81-x9FxE0-xFC][x40-x7Ex80-xFC]
To avoid false matching in multibyte encoding, this module uses anchoring technique to ensure each matching position places at the character boundaries.
cf. perlfaq6, "How can I match strings with multibyte characters?"
Functions
re(PATTERN)
re(PATTERN, MODIFIER)
Returns a regular expression parsable by the byte-oriented perl.
PATTERN is specified as a string. MODIFIER is specified as a string. Modifiers in the following list are allowed.
i case-insensitive pattern (only for ascii alphabets)
I case-insensitive pattern (greek, cyrillic, fullwidth latin)
j hiragana-katakana-insensitive pattern (but halfwidth katakana
are not considered.)
s treat string as single line
m treat string as multiple lines
x ignore whitespace (i.e. [x20nrtf]) unless backslashed
or inside a character class; but comments are not recognized!
o once parsed (not compiled!) and the result is cached internally.
o modifier
while ( ) {
print replace($_, (perl), $1, igo);
}
is more efficient than
while ( ) {
print replace($_, (perl), $1, ig);
}
because in the latter case the pattern is parsed every time
whenever the function is called.
match(STRING, PATTERN)
match(STRING, PATTERN, MODIFIER)
An emulation of m// operator aware of Shift-JIS. But, to emulate @list = $string =~ m/PATTERN/g, the pattern should be parenthesized (capturing parentheses are not added automatically).
@list = match($string, pH, g); # wrong; returns garbage!
@list = match($string,(pH),g); # good
PATTERN is specified as a string. MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
g match globally
z tell the function the pattern matches an empty string
(sorry, due to the poor auto-detection)
replace(STRING or SCALAR REF, PATTERN, REPLACEMENT)
replace(STRING or SCALAR REF, PATTERN, REPLACEMENT, MODIFIER)
An emulation of s/// operator but aware of Shift-JIS.
If a reference to a scalar is specified as the first argument, substitutes the referent scalar and returns the number of substitutions made. If a string (not a reference) is specified as the first argument, returns the substituted string and the specified string is unaffected.
MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
g,z please see match().
jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING)
jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING, LIMIT)
An emulation of CORE::split but aware of Shift-JIS.
In scalar/void context, it does not split into the @_ array; in scalar context, only returns the number of fields found.
PATTERN is specified as a string. But as PATTERN has no special meaning; it splits the string on a single space similarly to CORE::split / /.
When you want to split the string on whitespace, pass an undefined value as PATTERN or use the splitspace() function.
jsplit(undef, " x81x40 This is x81x40 perl.");
splitspace(" x81x40 This is x81x40 perl.");
# (This, is, perl.)
If you want to pass pattern with modifiers, specify an arrayref of [PATTERN, MODIFIER] as the first argument. You can also use "Embedded Modifiers").
MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().
splitspace(STRING)
splitspace(STRING, LIMIT)
This function emulates CORE::split( , STRING, LIMIT). It returns a list given by split STRING on whitespace including "x81x40" (IDEOGRAPHIC SPACE). Leading whitespace characters do not produce any field.
Note: splitspace(STRING, LIMIT) is equivalent to jsplit(undef, STRING, LIMIT).
splitchar(STRING)
splitchar(STRING, LIMIT)
This function emulates CORE::split(//, STRING, LIMIT). It returns a list given by split of STRING into characters.
Note: splitchar(STRING, LIMIT) is equivalent to jsplit(, STRING, LIMIT).
Download (0.035MB)
Added: 2007-08-08 License: Perl Artistic License Price:
811 downloads
Bio::Factory::SequenceFactoryI 1.4
Bio::Factory::SequenceFactoryI is a Perl interface that allows for generic building of sequences in factories. more>>
Bio::Factory::SequenceFactoryI is a Perl interface that allows for generic building of sequences in factories which create sequences (like SeqIO).
SYNOPSIS
# do not use this object directly it is an interface # get a Bio::Factory::SequenceFactoryI object like
use Bio::Seq::SeqFactory;
my $seqbuilder = new Bio::Seq::SeqFactory(type => Bio::PrimarySeq);
my $seq = $seqbuilder->create(-seq => ACTGAT,
-display_id => exampleseq);
print "seq is a ", ref($seq), "n";
A generic way to build Sequence objects via a pluggable factory. This reduces the amount of code that looks like
if( $type eq Bio::PrimarySeq ) { ... }
elsif( $type eq Bio::Seq::RichSeq ) { ... }
<<lessSYNOPSIS
# do not use this object directly it is an interface # get a Bio::Factory::SequenceFactoryI object like
use Bio::Seq::SeqFactory;
my $seqbuilder = new Bio::Seq::SeqFactory(type => Bio::PrimarySeq);
my $seq = $seqbuilder->create(-seq => ACTGAT,
-display_id => exampleseq);
print "seq is a ", ref($seq), "n";
A generic way to build Sequence objects via a pluggable factory. This reduces the amount of code that looks like
if( $type eq Bio::PrimarySeq ) { ... }
elsif( $type eq Bio::Seq::RichSeq ) { ... }
Download (4.7MB)
Added: 2006-09-02 License: Perl Artistic License Price:
1147 downloads
Brick::Composers 0.223
Brick::Composers Perl module defines composing functions in the Brick::Constraints package. more>>
Brick::Composers Perl module defines composing functions in the Brick::Constraints package. Each function takes a list of code refs and returns a single code ref that wraps all of them. The single code ref returns true or false (but defined), as with other constraints.
If a composer cannot create the single code ref (for instance, due to bad input) it returns undef of the empty list, indicating a failure in programming rather than a failure of the data to validate.
__and( LIST OF CODEREFS )
__compose_satisfy_all( LIST OF CODEREFS )
This is AND with NO short-circuiting.
( A && B && C )
This function creates a new constraint that returns true if all of its constraints return true. All constraints are checked so there is no short-circuiting. This allows you to get back all of the errors at once.
__or( LIST OF CODEREFS )
__compose_satisfy_any( LIST OF CODEREFS )
This is OR but with NO short-circuiting.
( A || B || C )
This function creates a new constraint that returns true if all of its constraints return true. All constraints are checked so there is no short-circuiting.
__none( LIST OF CODEREFS )
__compose_satisfy_none( LIST OF CODEREFS )
( NOT A && NOT B && NOT C )
NOT ( A || B || C )
This function creates a new constraint that returns true if all of its constraints return false. All constraints are checked so there is no short-circuiting.
__compose_satisfy_N( SCALAR, LIST OF CODEREFS )
This function creates a new constraint that returns true if exactly N of its constraints return true. All constraints are checked so there is no short-circuiting.
__compose_satisfy_N_to_M( LIST OF CODEREFS )
This function creates a new constraint that returns true if between N and M (inclusive) of its constraints return true. All constraints are checked so there is no short-circuiting.
__not( CODEREF )
__compose_not( CODEREF )
This composers negates the sense of the code ref. If the code ref returns true, this composer makes it false, and vice versa.
__compose_until_pass
__compose_pass_or_skip
Go through the list of closures, trying each one until one suceeds. If a closure doesnt die, but doesnt return true, this doesnt fail but just moves on. Return true for the first one that passes, short-circuited the rest. If none of the closures pass, die with an error noting that nothing passed.
If one of the subs dies, this composer still dies.
This can still die for programming (not logic) errors.
__compose_until_fail
__compose_pass_or_stop
Keep going as long as the closures return true.
The closure that returns undef is a selector.
If a closure doesnt die and doesnt dont fail, just move on. Return true for the first one that passes, short-circuited the rest. If none of the closures pass, die with an error noting that nothing passed.
This can still die for programming (not logic) errors.
$result $@ what action
------------------------------------------------------------
1 undef passed go on to next brick
undef undef selector stop, return undef, no die
failed
undef string program stop, die with string
error
undef ref validator stop, die with ref
failed
<<lessIf a composer cannot create the single code ref (for instance, due to bad input) it returns undef of the empty list, indicating a failure in programming rather than a failure of the data to validate.
__and( LIST OF CODEREFS )
__compose_satisfy_all( LIST OF CODEREFS )
This is AND with NO short-circuiting.
( A && B && C )
This function creates a new constraint that returns true if all of its constraints return true. All constraints are checked so there is no short-circuiting. This allows you to get back all of the errors at once.
__or( LIST OF CODEREFS )
__compose_satisfy_any( LIST OF CODEREFS )
This is OR but with NO short-circuiting.
( A || B || C )
This function creates a new constraint that returns true if all of its constraints return true. All constraints are checked so there is no short-circuiting.
__none( LIST OF CODEREFS )
__compose_satisfy_none( LIST OF CODEREFS )
( NOT A && NOT B && NOT C )
NOT ( A || B || C )
This function creates a new constraint that returns true if all of its constraints return false. All constraints are checked so there is no short-circuiting.
__compose_satisfy_N( SCALAR, LIST OF CODEREFS )
This function creates a new constraint that returns true if exactly N of its constraints return true. All constraints are checked so there is no short-circuiting.
__compose_satisfy_N_to_M( LIST OF CODEREFS )
This function creates a new constraint that returns true if between N and M (inclusive) of its constraints return true. All constraints are checked so there is no short-circuiting.
__not( CODEREF )
__compose_not( CODEREF )
This composers negates the sense of the code ref. If the code ref returns true, this composer makes it false, and vice versa.
__compose_until_pass
__compose_pass_or_skip
Go through the list of closures, trying each one until one suceeds. If a closure doesnt die, but doesnt return true, this doesnt fail but just moves on. Return true for the first one that passes, short-circuited the rest. If none of the closures pass, die with an error noting that nothing passed.
If one of the subs dies, this composer still dies.
This can still die for programming (not logic) errors.
__compose_until_fail
__compose_pass_or_stop
Keep going as long as the closures return true.
The closure that returns undef is a selector.
If a closure doesnt die and doesnt dont fail, just move on. Return true for the first one that passes, short-circuited the rest. If none of the closures pass, die with an error noting that nothing passed.
This can still die for programming (not logic) errors.
$result $@ what action
------------------------------------------------------------
1 undef passed go on to next brick
undef undef selector stop, return undef, no die
failed
undef string program stop, die with string
error
undef ref validator stop, die with ref
failed
Download (0.052MB)
Added: 2007-08-01 License: Perl Artistic License Price:
814 downloads
WebService::Eventful 1.0
WebService::Eventful is a Perl interface to EVDB public API. more>>
WebService::Eventful is a Perl interface to EVDB public API.
SYNOPSIS
use WebService::Eventful;
my $evdb = WebService::Eventful->new(app_key => $app_key);
$evdb->login(user => harry, password => H0gwart$)
or die "Cant log in: $WebService::Eventful::errstr";
# call() accepts either an array ref or a hash ref.
my $event = $evdb->call(events/get, {id => E0-001-000218163-6})
or die "Cant retrieve event: $WebService::Eventful::errstr";
print "Title: $event->{title}n";
my $venue = $evdb->call(venues/get, [id => $event->{venue_id}])
or die "Cant retrieve venue: $WebService::Eventful::errstr";
print "Venue: $venue->{name}n";
The Eventful API allows you to build tools and applications that interact with Eventful. This module provides a Perl interface to that API, including the digest-based authentication infrastructure.
<<lessSYNOPSIS
use WebService::Eventful;
my $evdb = WebService::Eventful->new(app_key => $app_key);
$evdb->login(user => harry, password => H0gwart$)
or die "Cant log in: $WebService::Eventful::errstr";
# call() accepts either an array ref or a hash ref.
my $event = $evdb->call(events/get, {id => E0-001-000218163-6})
or die "Cant retrieve event: $WebService::Eventful::errstr";
print "Title: $event->{title}n";
my $venue = $evdb->call(venues/get, [id => $event->{venue_id}])
or die "Cant retrieve venue: $WebService::Eventful::errstr";
print "Venue: $venue->{name}n";
The Eventful API allows you to build tools and applications that interact with Eventful. This module provides a Perl interface to that API, including the digest-based authentication infrastructure.
Download (0.008MB)
Added: 2007-03-27 License: Perl Artistic License Price:
941 downloads
XML::Simple::DTDReader 0.04
XML::Simple::DTDReader is a simple XML file reading based on their DTDs. more>>
XML::Simple::DTDReader is a simple XML file reading based on their DTDs.
SYNOPSIS
use XML::Simple::DTDReader;
my $ref = XMLin("data.xml");
Or the object oriented way:
require XML::Simple::DTDReader;
my $xsd = XML::Simple::DTDReader->new;
my $ref = $xsd->XMLin("data.xml");
XML::Simple::DTDReader aims to be a XML::Simple drop-in replacement, but with several aspects of the module controlled by the XMLs DTD. Specifically, array folding and array forcing are inferred from the DTD.
Currently, only XMLin is supported; support for XMLout is planned for later releases.
<<lessSYNOPSIS
use XML::Simple::DTDReader;
my $ref = XMLin("data.xml");
Or the object oriented way:
require XML::Simple::DTDReader;
my $xsd = XML::Simple::DTDReader->new;
my $ref = $xsd->XMLin("data.xml");
XML::Simple::DTDReader aims to be a XML::Simple drop-in replacement, but with several aspects of the module controlled by the XMLs DTD. Specifically, array folding and array forcing are inferred from the DTD.
Currently, only XMLin is supported; support for XMLout is planned for later releases.
Download (0.010MB)
Added: 2006-09-06 License: Perl Artistic License Price:
1146 downloads
NewsLib 0.84
NewsLib is a library of perl modules for managing Network News services. more>>
NewsLib is a library of perl modules for managing Network News services. Its meant to be used for code-reuse and sharing when writing news-based applications.
It currently includes:
- News::Article::Response - Create responses to News::Article articles
- News::Article::Ref - Reference functions for news articles
- News::Article::Clean - Subroutines to clean News::Article headers
- News::Article::Cancel - Generate accurate cancel messages
- News::NNTPAuth - Deprecated for Net::NNTP::Auth
- Net::NNTP::Auth - A standard NNTP authentication method
- Net::NNTP::Proxy - A news server in perl
- Net::NNTP::Client - Simulate an entire NNTP client
- Net::NNTP::Functions - Code to implement NNTP-standard functions
<<lessIt currently includes:
- News::Article::Response - Create responses to News::Article articles
- News::Article::Ref - Reference functions for news articles
- News::Article::Clean - Subroutines to clean News::Article headers
- News::Article::Cancel - Generate accurate cancel messages
- News::NNTPAuth - Deprecated for Net::NNTP::Auth
- Net::NNTP::Auth - A standard NNTP authentication method
- Net::NNTP::Proxy - A news server in perl
- Net::NNTP::Client - Simulate an entire NNTP client
- Net::NNTP::Functions - Code to implement NNTP-standard functions
Download (0.033MB)
Added: 2005-09-27 License: GPL (GNU General Public License) Price:
1487 downloads
netToe 1.1.0
netToe project is a Tic Tac Toe game for the Linux console, playable over the network. more>>
netToe project is a Tic Tac Toe game for the Linux console, playable over the network.
netToe is a Tic Tac Toe-like game for the Linux console written in C using UNIX sockets. It is playable by 2 players over the network, against computer AI, or against another player on the same machine.
Enhancements:
- Completed the code section regarding colors.
- netToe now uses colors !
- Modified the parse_cmd_args(...) function to accept more than one argument at time, option --no-colors added. (ref: misc.c)
- Added modules terminal.c and terminal.h Those file include the new code to handle colors in nettoe.
- Added modules matrices.c and matrices.h Those files include the new code to handle the nettoe board matrix.
- Removed netmisc.c and netmisc.h modules and included the code in the network.c and network.h modules.
<<lessnetToe is a Tic Tac Toe-like game for the Linux console written in C using UNIX sockets. It is playable by 2 players over the network, against computer AI, or against another player on the same machine.
Enhancements:
- Completed the code section regarding colors.
- netToe now uses colors !
- Modified the parse_cmd_args(...) function to accept more than one argument at time, option --no-colors added. (ref: misc.c)
- Added modules terminal.c and terminal.h Those file include the new code to handle colors in nettoe.
- Added modules matrices.c and matrices.h Those files include the new code to handle the nettoe board matrix.
- Removed netmisc.c and netmisc.h modules and included the code in the network.c and network.h modules.
Download (MB)
Added: 2006-11-27 License: GPL (GNU General Public License) Price:
1064 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 ref 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