variable types
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 4640
Variable::Strongly::Typed 1.1.0
Variable::Strongly::Typed is a Perl module to let some variables be strongly typed. more>>
Variable::Strongly::Typed is a Perl module to let some variables be strongly typed.
SYNOPSIS
use Variable::Strongly::Typed;
my $int :TYPE(int); # must have an int value
my $float :TYPE(float); # must have a float value
my $string :TYPE(string); # must not be a reference
my $file :TYPE(IO::File); # must be an IO::File
my @array_of_ints :TYPE(int); # Each slot must contain
# an int
my %hash_of_floats :TYPE(float); # Each value must be a float
my $int_own_error :TYPE(int, &my_own_error_handler);
# Roll my own error handler
my @array_of_rgb :TYPE(&red_green_blue); # my enumerated type
# For subs!!
sub return_an_int :TYPE(int) {
# .. do some stuff ..
return $something;
}
# ... and later ...
$int = 23; # All is well
$int = howdy!; # This line will croak with a good error message
$float = 3.23; # All is well, nothing to see here
$float = new XML::Parser; # croak!
$array_of_ints[23] = 44; # Groovy
$array_of_ints[12] = yah; # croak!
$hash_of_floats{pi} = 3.14159; # no problem
$hash_of_floats{e} = new IO::File; # croak!
# Return 1 if this val is RED, BLUE, or GREEN
# 0 otherwise
sub red_green_blue {
local $_ = shift;
/A RED z/xms || /A BLUE z/xms || /A GREEN z/xms;
}
$array_of_my_very_own_types[23] = 99; # croak!
$array_of_my_very_own_types[2] = BLUE; # OK!
$int_own_error = lksdklwe; # The sub my_own_error_hanlder
# will be # called with the
# offending value
my $got_it = return_an_int(); # Will croak (or call your error
# function) # if this sub doesnt
# return an int
This modules allow you to strongly type your variables. Also known as the no fun module - it can greatly enhance you codes quality and robustness.
By enforcing types on some (or all) of your variables you will eliminate a large class of careless (& not so careless) errors.
This could also aid an editor or code-browsing tools to verify code correctness without having to execute the script.
<<lessSYNOPSIS
use Variable::Strongly::Typed;
my $int :TYPE(int); # must have an int value
my $float :TYPE(float); # must have a float value
my $string :TYPE(string); # must not be a reference
my $file :TYPE(IO::File); # must be an IO::File
my @array_of_ints :TYPE(int); # Each slot must contain
# an int
my %hash_of_floats :TYPE(float); # Each value must be a float
my $int_own_error :TYPE(int, &my_own_error_handler);
# Roll my own error handler
my @array_of_rgb :TYPE(&red_green_blue); # my enumerated type
# For subs!!
sub return_an_int :TYPE(int) {
# .. do some stuff ..
return $something;
}
# ... and later ...
$int = 23; # All is well
$int = howdy!; # This line will croak with a good error message
$float = 3.23; # All is well, nothing to see here
$float = new XML::Parser; # croak!
$array_of_ints[23] = 44; # Groovy
$array_of_ints[12] = yah; # croak!
$hash_of_floats{pi} = 3.14159; # no problem
$hash_of_floats{e} = new IO::File; # croak!
# Return 1 if this val is RED, BLUE, or GREEN
# 0 otherwise
sub red_green_blue {
local $_ = shift;
/A RED z/xms || /A BLUE z/xms || /A GREEN z/xms;
}
$array_of_my_very_own_types[23] = 99; # croak!
$array_of_my_very_own_types[2] = BLUE; # OK!
$int_own_error = lksdklwe; # The sub my_own_error_hanlder
# will be # called with the
# offending value
my $got_it = return_an_int(); # Will croak (or call your error
# function) # if this sub doesnt
# return an int
This modules allow you to strongly type your variables. Also known as the no fun module - it can greatly enhance you codes quality and robustness.
By enforcing types on some (or all) of your variables you will eliminate a large class of careless (& not so careless) errors.
This could also aid an editor or code-browsing tools to verify code correctness without having to execute the script.
Download (0.010MB)
Added: 2007-01-18 License: Perl Artistic License Price:
1009 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
Variable Expression Library 1.1
Variable Expression Library is a C++ library that expands variables in text buffers. more>>
libvarexp is a C++ library that allows its users to detach any kind of information from the representation of that information by providing a simple-to-use but powerful text-template mechanism.
Similar mechanisms have been available in tools like sh(1), make(1), or perl(1) forever and have proven to be very useful.
The basic idea is that the relevant information is made available in variables, which the author of the template can than use within the text itself as he or she sees fit.
Consider, for example, a tool that will calculate the monthly financial reports of a small company.
Such a program should only calculate the required values, it should not worry about writing the resulting reports into an HTML file, a CSV file, or whatever format is desired. Instead, it should make the results of the calculation available in the variables "$TURNOVER", "$PROFIT", and "$INCREASE".
Then, using libvarexp, it could load an arbitrary template file and have the actual values inserted at the apropriate positions. Without changing a single line of code, one could generate the monthly report in HTML
<<lessSimilar mechanisms have been available in tools like sh(1), make(1), or perl(1) forever and have proven to be very useful.
The basic idea is that the relevant information is made available in variables, which the author of the template can than use within the text itself as he or she sees fit.
Consider, for example, a tool that will calculate the monthly financial reports of a small company.
Such a program should only calculate the required values, it should not worry about writing the resulting reports into an HTML file, a CSV file, or whatever format is desired. Instead, it should make the results of the calculation available in the variables "$TURNOVER", "$PROFIT", and "$INCREASE".
Then, using libvarexp, it could load an arbitrary template file and have the actual values inserted at the apropriate positions. Without changing a single line of code, one could generate the monthly report in HTML
Download (0.093MB)
Added: 2005-10-06 License: BSD License Price:
1478 downloads
Variable::Strongly::Typed::Scalar 1.1.0
Variable::Strongly::Typed::Scalar is Perl module for strongly typed scalar. more>>
Variable::Strongly::Typed::Scalar is Perl module for strongly typed scalar.
SYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly
=head1 DESCRIPTION
<<lessSYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly
=head1 DESCRIPTION
Download (0.010MB)
Added: 2007-01-18 License: Perl Artistic License Price:
1009 downloads
Variable::Strongly::Typed::Array 1.1.0
Variable::Strongly::Typed::Array is a Perl module for strongly typed array. more>>
Variable::Strongly::Typed::Array is a Perl module for strongly typed array.
SYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly
my @array_of_ints :TYPE(int); # Each slot must contain an int
my @array_of_rgb :TYPE(&red_green_blue); # my enumerated type
# ... and later ...
$array_of_ints[23] = 44; # Groovy
$array_of_ints[12] = yah; # croak!
# Return 1 if this val is RED, BLUE, or GREEN
# 0 otherwise
sub red_green_blue {
local $_ = shift;
/A RED z/xms || /A BLUE z/xms || /A GREEN z/xms;
}
$array_of_my_very_own_types[23] = 99; # croak!
$array_of_my_very_own_types[2] = BLUE; # OK!
<<lessSYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly
my @array_of_ints :TYPE(int); # Each slot must contain an int
my @array_of_rgb :TYPE(&red_green_blue); # my enumerated type
# ... and later ...
$array_of_ints[23] = 44; # Groovy
$array_of_ints[12] = yah; # croak!
# Return 1 if this val is RED, BLUE, or GREEN
# 0 otherwise
sub red_green_blue {
local $_ = shift;
/A RED z/xms || /A BLUE z/xms || /A GREEN z/xms;
}
$array_of_my_very_own_types[23] = 99; # croak!
$array_of_my_very_own_types[2] = BLUE; # OK!
Download (0.010MB)
Added: 2007-01-18 License: Perl Artistic License Price:
1009 downloads
Variable::Strongly::Typed::Validators 1.1.0
Variable::Strongly::Typed::Validators is Perl module with built-in type validators. more>>
Variable::Strongly::Typed::Validators is Perl module with built-in type validators.
SYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly. This module defines a %conditions hash contained expressions that define the built-in types. If you want to create a new type just pass a CODE ref in your TYPE() attribute rather than modifying this hash.
=head1 DESCRIPTION
DO NOT USE THIS MODULE DIRECTLY!! Its used by Variable::Strongly::Typed to do its magic.
<<lessSYNOPSIS
This class is utilized by Variable::Strongly::Typed - you dont access this directly. This module defines a %conditions hash contained expressions that define the built-in types. If you want to create a new type just pass a CODE ref in your TYPE() attribute rather than modifying this hash.
=head1 DESCRIPTION
DO NOT USE THIS MODULE DIRECTLY!! Its used by Variable::Strongly::Typed to do its magic.
Download (0.010MB)
Added: 2007-01-18 License: Perl Artistic License Price:
1009 downloads
MIME::Type 1.19
MIME::Type is a definition of one MIME type. more>>
MIME::Type is a definition of one MIME type.
SYNOPSIS
use MIME::Types;
my $mimetypes = MIME::Types->new;
my MIME::Type $plaintext = $mimetypes->type(text/plain);
print $plaintext->mediaType; # text
print $plaintext->subType; # plain
my @ext = $plaintext->extensions;
print "@ext" # txt asc c cc h hh cpp
print $plaintext->encoding # 8bit
if($plaintext->isBinary) # false
if($plaintext->isAscii) # true
if($plaintext->equals(text/plain) {...}
if($plaintext eq text/plain) # same
print MIME::Type->simplified(x-appl/x-zip) # appl/zip
MIME types are used in MIME entities, for instance as part of e-mail and HTTP traffic. Sometimes real knowledge about a mime-type is need. Objects of MIME::Type store the information on one such type.
This module is built to conform to the MIME types of RFCs 2045 and 2231. It follows the official IANA registry at http://www.iana.org/assignments/media-types/ and the collection kept at http://www.ltsw.se/knbase/internet/mime.htp
<<lessSYNOPSIS
use MIME::Types;
my $mimetypes = MIME::Types->new;
my MIME::Type $plaintext = $mimetypes->type(text/plain);
print $plaintext->mediaType; # text
print $plaintext->subType; # plain
my @ext = $plaintext->extensions;
print "@ext" # txt asc c cc h hh cpp
print $plaintext->encoding # 8bit
if($plaintext->isBinary) # false
if($plaintext->isAscii) # true
if($plaintext->equals(text/plain) {...}
if($plaintext eq text/plain) # same
print MIME::Type->simplified(x-appl/x-zip) # appl/zip
MIME types are used in MIME entities, for instance as part of e-mail and HTTP traffic. Sometimes real knowledge about a mime-type is need. Objects of MIME::Type store the information on one such type.
This module is built to conform to the MIME types of RFCs 2045 and 2231. It follows the official IANA registry at http://www.iana.org/assignments/media-types/ and the collection kept at http://www.ltsw.se/knbase/internet/mime.htp
Download (0.017MB)
Added: 2007-06-01 License: Perl Artistic License Price:
877 downloads
Language::Basic::Variable 1.44
Language::Basic::Variable is a Perl module to handle parsing and implementing BASIC variables. more>>
Language::Basic::Variable is a Perl module to handle parsing and implementing BASIC variables.
SYNOPSIS
See Language::Basic for the overview of how the Language::Basic module works. This pod page is more technical.
There are two sorts of variables: Arrays and Scalars. Each of those classes has a subclass for Numeric or String variables.
An Array needs to have full LBV::Scalar objects in it, rather than just having an array of values. The reason is that, for example, you might use ARR(3) as the variable in a FOR loop. Also, the "set" and "value" methods apply to a LBV::Scalar (since you cant set an array to a value (in BASIC) so in order to be handle A(3)=3, A(3) needs to be an LBV::Scalar.
The lookup method looks up a variable in the Array or Scalar lookup table (depending on whether there were parentheses after the variable name). BASIC allows undeclared variables, so if the variable name hasnt been seen before, a new variable is created.
Language::Basic::Variable::Scalar class
This class handles a variable or one cell in an array.
Methods include "value", which gets the variables value, and "set", which sets it.
Language::Basic::Variable::Array class
This class handles a BASIC array. Each cell in the array is a LBV::Scalar object.
Methods include "dimension", which dimensions the array to a given size (or a default size) and get_cell, which returns the LBV::Scalar object in a given array location.
Note that BASIC arrays start from 0!
<<lessSYNOPSIS
See Language::Basic for the overview of how the Language::Basic module works. This pod page is more technical.
There are two sorts of variables: Arrays and Scalars. Each of those classes has a subclass for Numeric or String variables.
An Array needs to have full LBV::Scalar objects in it, rather than just having an array of values. The reason is that, for example, you might use ARR(3) as the variable in a FOR loop. Also, the "set" and "value" methods apply to a LBV::Scalar (since you cant set an array to a value (in BASIC) so in order to be handle A(3)=3, A(3) needs to be an LBV::Scalar.
The lookup method looks up a variable in the Array or Scalar lookup table (depending on whether there were parentheses after the variable name). BASIC allows undeclared variables, so if the variable name hasnt been seen before, a new variable is created.
Language::Basic::Variable::Scalar class
This class handles a variable or one cell in an array.
Methods include "value", which gets the variables value, and "set", which sets it.
Language::Basic::Variable::Array class
This class handles a BASIC array. Each cell in the array is a LBV::Scalar object.
Methods include "dimension", which dimensions the array to a given size (or a default size) and get_cell, which returns the LBV::Scalar object in a given array location.
Note that BASIC arrays start from 0!
Download (0.051MB)
Added: 2006-09-29 License: Perl Artistic License Price:
1121 downloads
C++ Portable Types Library (PTypes) 2.1.1
C++ Portable Types Library (PTypes) is a simple alternative to the STL with multithreading and networking. more>>
C++ Portable Types Library (PTypes) is a simple alternative to the STL that includes multithreading and networking. C++ Portable Types Library (PTypes) defines dynamic strings, variants, character sets, lists and other basic data types along with portable thread and synchronization objects, IP sockets and named pipes. Its main `target audience is developers of complex network daemons, robots or non-visual client/server applications of any kind.
PTypes defines simple and intuitive interfaces and differs from the STL in fairly moderate use of templates. The library is portable across many modern operating systems (currently FreeBSD, Linux, SunOS, Mac OS X and Windows). All platform-dependent issues are hidden inside. A simple web server called wshare is included in the package to demonstrate the full power of the library.
And finally, PTypes is open and free.
Main features:
- Threads and synchronization primitives solve the vital problem of diversity of the threading APIs on different platforms. The library also offers message queues and job queues as additional methods of thread synchronization and maintenance.
- IP socket classes and utilities provide complete IP-based framework for both client-side and server-side programming. Combined with PTypes multithreading, these classes can be used for designing complex non-visual applications, such like network daemons or web robots.
- Dynamic strings, variants, character sets, date/time type and various kinds of dynamic and associative arrays: Delphi programmers will find them very similar to the ones in their favorite language. The collection of these basic data types may be useful, among other things, for building compilers and interpreters for higher-level languages.
- Streaming interfaces provide buffered I/O with simple and powerful text parsing methods. A strictly defined syntax for a given text format or a formal language can be represented by calls to PTypes token extraction methods. The unified streaming interface is applicable to files, named pipes and network sockets.
- Special thread class with enhanced functionality called unit. Units have their own main() and input/output plugs; they can be connected to each other within one application to form pipes, like processes in the UNIX shell.
- Finally, everything above is portable: all platform-dependent details are hidden inside.
Enhancements:
- Added support for HP-UX
- Compilation problems solved on *BSD systems (64-bit seek issue)
- Several MacOS X compilation problems solved (socklen_t, libtool)
- MSVC project files are now in the new VC7+ format (.sln, .vcproj)
- Dropped support for BSDi, CygWin and also the Borland C++ compiler.
<<lessPTypes defines simple and intuitive interfaces and differs from the STL in fairly moderate use of templates. The library is portable across many modern operating systems (currently FreeBSD, Linux, SunOS, Mac OS X and Windows). All platform-dependent issues are hidden inside. A simple web server called wshare is included in the package to demonstrate the full power of the library.
And finally, PTypes is open and free.
Main features:
- Threads and synchronization primitives solve the vital problem of diversity of the threading APIs on different platforms. The library also offers message queues and job queues as additional methods of thread synchronization and maintenance.
- IP socket classes and utilities provide complete IP-based framework for both client-side and server-side programming. Combined with PTypes multithreading, these classes can be used for designing complex non-visual applications, such like network daemons or web robots.
- Dynamic strings, variants, character sets, date/time type and various kinds of dynamic and associative arrays: Delphi programmers will find them very similar to the ones in their favorite language. The collection of these basic data types may be useful, among other things, for building compilers and interpreters for higher-level languages.
- Streaming interfaces provide buffered I/O with simple and powerful text parsing methods. A strictly defined syntax for a given text format or a formal language can be represented by calls to PTypes token extraction methods. The unified streaming interface is applicable to files, named pipes and network sockets.
- Special thread class with enhanced functionality called unit. Units have their own main() and input/output plugs; they can be connected to each other within one application to form pipes, like processes in the UNIX shell.
- Finally, everything above is portable: all platform-dependent details are hidden inside.
Enhancements:
- Added support for HP-UX
- Compilation problems solved on *BSD systems (64-bit seek issue)
- Several MacOS X compilation problems solved (socklen_t, libtool)
- MSVC project files are now in the new VC7+ format (.sln, .vcproj)
- Dropped support for BSDi, CygWin and also the Borland C++ compiler.
Download (0.22MB)
Added: 2007-06-27 License: zlib/libpng License Price:
853 downloads
Data::Type 0.01.04
Data::Type is a Perl module with versatile data and value types. more>>
Data::Type is a Perl module with versatile data and value types.
SYNOPSIS
use Data::Type qw(:all);
use Error qw(:try);
try
{
verify $email , EMAIL;
verify $homepage , URI(http);
verify $cc , CREDITCARD( MASTERCARD, VISA );
verify $answer_a , YESNO;
verify $gender , GENDER;
verify one , ENUM( qw(one two three) );
verify [qw(two six)], SET( qw(one two three four five six) ) );
verify $server_ip4 , IP(v4);
verify $server_ip6 , IP(v6);
verify A35231AH1 , CINS;
verify 14565935 , ISSN;
verify DE , LANGCODE;
verify German , LANGNAME;
verify 012345678905, UPC();
verify 5276440065421319, CREDITCARD( MASTERCARD ) );
verify ATGCAAAT , BIO::DNA;
verify AUGGGAAAU , BIO::RNA;
verify 01001001110110101, BINARY;
verify 0F 0C 0A, HEX;
verify 0 , DEFINED;
verify 234 , NUM( 20 );
verify 1 , BOOL( true );
verify 100 , INT;
verify 1.1 , REAL;
my $foo = bless( 123, SomeThing );
verify $foo , REF;
verify $foo , REF( qw(SomeThing Else) );
verify [ bar ] , REF( ARRAY );
verify x 20 , VARCHAR( 20 );
verify 2001-01-01 , DATE( MYSQL );
verify 16 Nov 94 22:28:20 PST , DATE( DATEPARSE );
verify 9999-12-31 23:59:59, DATETIME;
verify 1970-01-01 00:00:00, TIMESTAMP;
verify -838:59:59 , TIME;
verify 2155 , YEAR;
verify 69 , YEAR(2);
verify 0 x 20 , TINYTEXT;
verify 0 x 20 , MEDIUMTEXT;
verify 0 x 20 , LONGTEXT;
verify 0 x 20 , TEXT;
verify 80 , PORT;
verify www.cpan.org, DOMAIN;
}
catch Type::Exception with
{
my $e = shift;
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
foreach my $entry ( testplan( $e->type ) )
{
printf "texpecting it %s %s ", $entry->[1] ? is : is NOT, $entry->[0]->info();
}
};
# believe it or not, this really works
foreach ( EMAIL, WORD, CREDITCARD( MASTERCARD, VISA ), BIO::DNA, HEX )
{
print $_->info;
print $_->usage;
print $_->export; # does it have other names
print $_->param; # what are my choice i.e. [yes,no]
print $_->isa( IType::Business ); # is it a Business related type ?
print $_->VERSION; # first apperance in Data::Type release
}
# tied interface (alias typ)
try
{
typ ENUM( qw(DNA RNA) ), ( my $a, my $b );
print "a is typed" if istyp( $a );
$a = DNA; # $alias only accepts DNA or RNA
$a = RNA;
$a = xNA; # throws exception
untyp( $alias );
}
catch Type::Exception ::with
{
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
};
dverify( $email, EMAIL ) or die $!;
my $g = Data::Type::Guard->new(
allow => [ Human, Others ], # blessed objects of that type
tests =>
{
email => EMAIL( 1 ), # mxcheck ON ! see Email::Valid
firstname => WORD,
social_id => [ NUM, VARCHAR( 10 ) ],
contacts => sub { my %args = @_; exists $args{lucy} },
}
);
$g->inspect( $h );
# compact version
overify { email => EMAIL( 1 ), firstname => WORD }, $object_a, $object_b;
print toc();
print catalog();
This module supports versatile data and value types. Out of the ordinary it supports parameterised types (like databases have i.e. VARCHAR(80) ). When you try to feed a typed variable against some odd data, this module explains what he would have expected.
<<lessSYNOPSIS
use Data::Type qw(:all);
use Error qw(:try);
try
{
verify $email , EMAIL;
verify $homepage , URI(http);
verify $cc , CREDITCARD( MASTERCARD, VISA );
verify $answer_a , YESNO;
verify $gender , GENDER;
verify one , ENUM( qw(one two three) );
verify [qw(two six)], SET( qw(one two three four five six) ) );
verify $server_ip4 , IP(v4);
verify $server_ip6 , IP(v6);
verify A35231AH1 , CINS;
verify 14565935 , ISSN;
verify DE , LANGCODE;
verify German , LANGNAME;
verify 012345678905, UPC();
verify 5276440065421319, CREDITCARD( MASTERCARD ) );
verify ATGCAAAT , BIO::DNA;
verify AUGGGAAAU , BIO::RNA;
verify 01001001110110101, BINARY;
verify 0F 0C 0A, HEX;
verify 0 , DEFINED;
verify 234 , NUM( 20 );
verify 1 , BOOL( true );
verify 100 , INT;
verify 1.1 , REAL;
my $foo = bless( 123, SomeThing );
verify $foo , REF;
verify $foo , REF( qw(SomeThing Else) );
verify [ bar ] , REF( ARRAY );
verify x 20 , VARCHAR( 20 );
verify 2001-01-01 , DATE( MYSQL );
verify 16 Nov 94 22:28:20 PST , DATE( DATEPARSE );
verify 9999-12-31 23:59:59, DATETIME;
verify 1970-01-01 00:00:00, TIMESTAMP;
verify -838:59:59 , TIME;
verify 2155 , YEAR;
verify 69 , YEAR(2);
verify 0 x 20 , TINYTEXT;
verify 0 x 20 , MEDIUMTEXT;
verify 0 x 20 , LONGTEXT;
verify 0 x 20 , TEXT;
verify 80 , PORT;
verify www.cpan.org, DOMAIN;
}
catch Type::Exception with
{
my $e = shift;
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
foreach my $entry ( testplan( $e->type ) )
{
printf "texpecting it %s %s ", $entry->[1] ? is : is NOT, $entry->[0]->info();
}
};
# believe it or not, this really works
foreach ( EMAIL, WORD, CREDITCARD( MASTERCARD, VISA ), BIO::DNA, HEX )
{
print $_->info;
print $_->usage;
print $_->export; # does it have other names
print $_->param; # what are my choice i.e. [yes,no]
print $_->isa( IType::Business ); # is it a Business related type ?
print $_->VERSION; # first apperance in Data::Type release
}
# tied interface (alias typ)
try
{
typ ENUM( qw(DNA RNA) ), ( my $a, my $b );
print "a is typed" if istyp( $a );
$a = DNA; # $alias only accepts DNA or RNA
$a = RNA;
$a = xNA; # throws exception
untyp( $alias );
}
catch Type::Exception ::with
{
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
};
dverify( $email, EMAIL ) or die $!;
my $g = Data::Type::Guard->new(
allow => [ Human, Others ], # blessed objects of that type
tests =>
{
email => EMAIL( 1 ), # mxcheck ON ! see Email::Valid
firstname => WORD,
social_id => [ NUM, VARCHAR( 10 ) ],
contacts => sub { my %args = @_; exists $args{lucy} },
}
);
$g->inspect( $h );
# compact version
overify { email => EMAIL( 1 ), firstname => WORD }, $object_a, $object_b;
print toc();
print catalog();
This module supports versatile data and value types. Out of the ordinary it supports parameterised types (like databases have i.e. VARCHAR(80) ). When you try to feed a typed variable against some odd data, this module explains what he would have expected.
Download (0.022MB)
Added: 2006-10-02 License: Perl Artistic License Price:
1117 downloads
MySQL Global User Variables UDF 1.0
MySQL Global User Variables UDF is a MySQL extension to store persistent variables. more>>
MySQL Global User Variables UDF is a MySQL extension to store persistent variables.
This shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
<<lessThis shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
Download (0.004MB)
Added: 2007-03-19 License: GPL (GNU General Public License) Price:
951 downloads
xor-analyze 0.5
xor-analyze provides a program for cryptanalyzing xor encryption with variable key length. more>>
xor-analyze provides a program for cryptanalyzing xor "encryption" with variable key length.
Main features:
- Could possibly crack bad implementations of one-time pads
- Check ftp://ftp.habets.pp.se/pub/synscan/ for windows binaries
To find out what length the password is the ciphertext is XOR-ed against itself with different shifts (see XOR_analyze::coincidence() in analyze.cc) and the number of zeroes (equal bytes) are counted. This is called counting coincidences. When the number of zeroes is high the shift value is potentially a multiple of the key length. The one that stands out most is checked with statistics (with a frequency table) to get the key. To check with statistics on all key-lengths in key-length interval (-m and -M) use the -a switch (with -v for one key per keylength)
Compiling
Type make. Mail me if it doesnt compile and dont forget to tell me what kind of system you have.
Encryption
$ ./xor-enc secret file.txt file.xor
<<lessMain features:
- Could possibly crack bad implementations of one-time pads
- Check ftp://ftp.habets.pp.se/pub/synscan/ for windows binaries
To find out what length the password is the ciphertext is XOR-ed against itself with different shifts (see XOR_analyze::coincidence() in analyze.cc) and the number of zeroes (equal bytes) are counted. This is called counting coincidences. When the number of zeroes is high the shift value is potentially a multiple of the key length. The one that stands out most is checked with statistics (with a frequency table) to get the key. To check with statistics on all key-lengths in key-length interval (-m and -M) use the -a switch (with -v for one key per keylength)
Compiling
Type make. Mail me if it doesnt compile and dont forget to tell me what kind of system you have.
Encryption
$ ./xor-enc secret file.txt file.xor
Download (0.026MB)
Added: 2007-04-20 License: GPL (GNU General Public License) Price:
924 downloads
Vala 0.1.2
Vala is a new programming language that aims to bring modern programming language features to GNOME developers. more>>
Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements, and without using a different ABI compared to applications and libraries written in C.
Main features:
- Interfaces
- Properties
- Signals
- Foreach
- Lambda expressions
- Type inference for local variables
- Generics [PLANNED]
- Non-null types [PARTIAL]
- Assisted memory management
- Exception handling [PLANNED]
Vala is designed to allow access to existing C libraries, especially GObject-based libraries, without the need for runtime bindings. Each to be used library requires a Vala API file at compile-time, containing the class and method declarations in Vala syntax. Vala currently comes with incomplete bindings for GLib and GTK+. Its planned to provide generated bindings for the full GNOME Platform at a later stage.
Using classes and methods written in Vala from an application written in C is not difficult. The Vala library only has to install the generated header files and C applications may then access the GObject-based API of the Vala library as usual. It should also be easily possible to write a bindings generator for access to Vala libraries from applications written in e.g. C# as the Vala parser is written as a library, so that all compile-time information is available when generating a binding.
Enhancements:
- This release integrates support for the libgee collection library, improves support for generic types, and adds support for inner classes.
- Performance and memory management have been improved, and there are new command line options to control the C compiler.
- Experimental GStreamer bindings have been added.
<<lessMain features:
- Interfaces
- Properties
- Signals
- Foreach
- Lambda expressions
- Type inference for local variables
- Generics [PLANNED]
- Non-null types [PARTIAL]
- Assisted memory management
- Exception handling [PLANNED]
Vala is designed to allow access to existing C libraries, especially GObject-based libraries, without the need for runtime bindings. Each to be used library requires a Vala API file at compile-time, containing the class and method declarations in Vala syntax. Vala currently comes with incomplete bindings for GLib and GTK+. Its planned to provide generated bindings for the full GNOME Platform at a later stage.
Using classes and methods written in Vala from an application written in C is not difficult. The Vala library only has to install the generated header files and C applications may then access the GObject-based API of the Vala library as usual. It should also be easily possible to write a bindings generator for access to Vala libraries from applications written in e.g. C# as the Vala parser is written as a library, so that all compile-time information is available when generating a binding.
Enhancements:
- This release integrates support for the libgee collection library, improves support for generic types, and adds support for inner classes.
- Performance and memory management have been improved, and there are new command line options to control the C compiler.
- Experimental GStreamer bindings have been added.
Download (0.75MB)
Added: 2007-07-29 License: LGPL (GNU Lesser General Public License) Price:
817 downloads
HTTP Server type 1.2.3
httptype is a program that returns the http host software of a website. more>>
httptype is a program that returns the http host software of a website. It is written in Perl.
httptype reads a list of http hosts and optionally the port number for each of these. It queries each host, displaying the type of HTTP server running on that host. It reads the http_proxy and no_proxy environment variables to determine whether to use a proxy or not.
httptype reads a list of http servers and, optionally, the port number for each of these. It then queries each of the hosts and displays the HTTP server software of the host.
Input may be read from a host file if specified using the --hosts switch:
httptype --hosts [hostfile]
If hostfile is omitted or `-, httptype reads from standard input. See Format of host file for more info.
A single host may be queried by passing its name on the command line:
httptype host [port]
If port is omitted, 80 is used.
If no host file is specified through the --hosts file and no host is specified on the command line, httptype will read the list from standard input. See Format of host file for more info.
httptype will read the http_proxy environment variable and try to determine if a proxy server is being used. This setting may be overridden using the --proxy switch:
httptype --proxy proxyhost[:proxyport]
If proxyport is omitted, 80 is used.
If the proxy server is `none, no proxy is used. This is typically used to prevent httptype from using the proxy server specified by http_proxy. The --noproxy switch can be used to achieve the same.
Additionally, you may use the no_proxy environment variable to specify a comma delimited list of hosts for which httptype should not use the proxy. If httptype comes across any of these hosts, it will make a direct connection to them.
Enhancements:
- made 1.3.8 stable and renamed to 1.2.3
<<lesshttptype reads a list of http hosts and optionally the port number for each of these. It queries each host, displaying the type of HTTP server running on that host. It reads the http_proxy and no_proxy environment variables to determine whether to use a proxy or not.
httptype reads a list of http servers and, optionally, the port number for each of these. It then queries each of the hosts and displays the HTTP server software of the host.
Input may be read from a host file if specified using the --hosts switch:
httptype --hosts [hostfile]
If hostfile is omitted or `-, httptype reads from standard input. See Format of host file for more info.
A single host may be queried by passing its name on the command line:
httptype host [port]
If port is omitted, 80 is used.
If no host file is specified through the --hosts file and no host is specified on the command line, httptype will read the list from standard input. See Format of host file for more info.
httptype will read the http_proxy environment variable and try to determine if a proxy server is being used. This setting may be overridden using the --proxy switch:
httptype --proxy proxyhost[:proxyport]
If proxyport is omitted, 80 is used.
If the proxy server is `none, no proxy is used. This is typically used to prevent httptype from using the proxy server specified by http_proxy. The --noproxy switch can be used to achieve the same.
Additionally, you may use the no_proxy environment variable to specify a comma delimited list of hosts for which httptype should not use the proxy. If httptype comes across any of these hosts, it will make a direct connection to them.
Enhancements:
- made 1.3.8 stable and renamed to 1.2.3
Download (0.014MB)
Added: 2006-07-11 License: GPL (GNU General Public License) Price:
1203 downloads
Class::Meta::Type 0.53
Class::Meta::Type is a Perl module for data type validation and accessor building. more>>
Class::Meta::Type is a Perl module for data type validation and accessor building.
SYNOPSIS
package MyApp::TypeDef;
use strict;
use Class::Meta::Type;
use IO::Socket;
my $type = Class::Meta::Type->add( key => io_socket,
desc => IO::Socket object,
name => IO::Socket Object );
This class stores the various data types used by Class::Meta. It manages all aspects of data type validation and method creation. New data types can be added to Class::Meta::Type by means of the add() constructor. This is useful for creating custom types for your Class::Meta-built classes.
Note:This class manages the most advanced features of Class::Meta. Before deciding to create your own accessor closures as described in add(), you should have a thorough working knowledge of how Class::Meta works, and have studied the add() method carefully. Simple data type definitions such as that shown in the SYNOPSIS, on the other hand, are encouraged.
<<lessSYNOPSIS
package MyApp::TypeDef;
use strict;
use Class::Meta::Type;
use IO::Socket;
my $type = Class::Meta::Type->add( key => io_socket,
desc => IO::Socket object,
name => IO::Socket Object );
This class stores the various data types used by Class::Meta. It manages all aspects of data type validation and method creation. New data types can be added to Class::Meta::Type by means of the add() constructor. This is useful for creating custom types for your Class::Meta-built classes.
Note:This class manages the most advanced features of Class::Meta. Before deciding to create your own accessor closures as described in add(), you should have a thorough working knowledge of how Class::Meta works, and have studied the add() method carefully. Simple data type definitions such as that shown in the SYNOPSIS, on the other hand, are encouraged.
Download (0.060MB)
Added: 2006-09-22 License: Perl Artistic License Price:
1127 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 variable types 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