Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.882.636 Times

Sub::PatMat 0.01

  Date Added: January 18, 2010  |  Visits: 614


Report Broken Link
Printer Friendly Version

Product Homepage
Download (70 downloads)

Sub::PatMat can call a version of subroutine depending on its arguments. SYNOPSIS use Sub::PatMat; # basics: sub fact : when($_[0] <= 1) { 1 } sub fact { my ($n) = @_; $n*fact($n-1) } print fact(6); # referring to things other than @_: sub mysort : when($a < $b) { -1 } sub mysort : when($a == $b) { 0 } sub mysort : when($a > $b) { 1 } print join ", ", sort mysort (3,1,2); # intuiting parameter names: sub dispatch : when($ev eq "help") { my ($ev) = @_; print "helpn" } sub dispatch : when($ev eq "blah") { my ($ev) = @_; print "blahn" } dispatch("help"); dispatch("blah"); # no fallback, this will die: dispatch("hest"); # dies with "Bad match" # silly sub do_something : when(full_moon()) { do_one_thing() } sub do_something { do_something_else() } The Sub::PatMat module provides the programmer with the ability to define a subroutine multiple times and to specify what version of the subroutine should be called, depending on the parameters passed to it (or any other condition). This is somewhat similar to argument pattern matching facility provided by many programming languages. To use argument pattern matching on a sub, the programmer has to specify the when attribute. The parameter to the attribute must be a single Perl expression. When the sub is called, those expressions are evaluated consequitively until one of them evaluates to a true value. When this happens, the corresponding version of a sub is called. If none of the expressions evaluates to a true value, a Bad Match exception is thrown. It is possible to specify a fall-back version of the function by doing one of the following: specifying when without an expression specifying when with an empty expression not specifying the when attribute at all Please note that it does not make sense to specify any non-fall-back version of the sub after the fall-back version, since such will never be called. There is an additional limitation for the last form of the fall-back version (the one without the when attribute at all), namely, it must be the last version of the sub defined. It is possible to specify named sub parameters in the when-expression. This facility is highly experimental and is currently limited to scalar parameters only. The named sub parameters are extracted from expressions of the form my (parameter list) = @_; anywhere in the body of the sub. Limitations:.

Requirements: No special requirements
Platforms: Linux
Keyword: Attribute Depending Depending On Dispatch Libraries Patmat Programming Specify Sub Subpatmat Subroutine
Users rating: 0/10

License: Freeware Size: 14.34 KB
More Reviews or Write Review

Development Tools  -  Economic dispatch by quadratic programming 1.0
This code solves the economic dispatch by quadratic programming.Monotonic quadratic Fuel cost equations with Bmn coefficients is considered this model.
30.72 KB  
Development Tools  -  Economic emission dispatch 1.0
This software solves the economic emission dispatch by quadratic programming.The fuel cost equations,emission coefficients ,Bmn coeffcients and the demand should be entered and the subroutien emield.m should be executed.
40.96 KB  
Games  -  Shoot Them All
ATTENTION! UFOs are flying around you, here and there, and will soon land and wreak havoc! You are the Striker now, You have the Tanks and Missiles!! So go, and Shoot Them ALL! [Features] Control the Tank by using Swipe Movement...
27 MB  
Programming  -  Anaglyph Canvas3D 0.87
AnaglyphCanvas3D is library for adding anaglyphs (red-green, red-cyan and so on) to the Java3D programming language. It utilizes the normal Canvas3D class of Java3D and extends it for stereoscopic effects. A prototypic GUI for testing is also...
20.48 KB  
Development Editors  -  The QPascal Project
The QPascal Project is an endeavour to produce a new generation of development tools based on the object-oriented programming language QPascal. Its goal is to create a compiler, linker, debugger, assembler, and eventually an extensive and...
256 KB  
Shell & Desktop  -  Qtswaret 0.1.5-3
QtSwaret is a Swaret Front-End based on QT Libraries. Installation These are generic installation instructions. The `configure shell script attempts to guess correct values for various ystem-dependent variables used during compilation. It...
112.64 KB  
Programming  -  daro 1.3
A collection of Java client applications based on OSGi, libraries and utilities.
83.58 KB  
Libraries  -  luanotify 0.1
LuaNotify is inspired on many libraries that do event dispatching, like py-notify, GSignals, QT event system, wxWidgets event system, etc. Making easier to implement lua software using Notifier/Observer pattern.
162 KB  
Audio Tools  -  VobsubMuxer 1.9
VobSubMuxer can join more than one languages on one single vobsub file (idx/sub). Vobsub files, generated by the extracion of the dvd, can contain more than one language streams. So if you rip an dvd on your computer, the extracted idx/sub package...
311 KB  
Utilities  -  MoniDIR 2.0
This FREE useful utility can help you to stay abreast of changes that occur in folders on your computer, letting you specify up to 20 directories to monitor, including your network drives. Great for System Administrators!
556 KB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  wolfSSL 3.11.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
2.73 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB