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 32.389.857 Times

Sub::PatMat 0.01

  Date Added: January 18, 2010  |  Visits: 639

Sub::PatMat

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
USER REVIEWS
More Reviews or Write Review


SUB::PATMAT RELATED
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 1.0.0.0
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  
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  
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  
Windows Software  -  Startup Guard 3.31
Free, easy tool to choose programs to allow to run on Windows startup. You can specify approved applications, close unwanted or find more about unknown. Startup Guard catches new startup records, so you can even remove a virus or spyware. You can...
1.42 MB  
Image Galleries  -  activeWatermark Script 1.1
This is a free script that places watermark on images in current folder and sub-folders.Features:- Easy to install- Easy to use, just upload your images by FTP- You can use text or image for your watermark- Setting intensity of the transition for...
10 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
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  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 3.15.3
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...
3.88 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