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.290.461 Times

ReleaseAction 0.07

  Date Added: January 18, 2010  |  Visits: 523


Report Broken Link
Printer Friendly Version

Product Homepage
Download (70 downloads)

ReleaseAction - call actions upon release. SYNOPSIS use ReleaseAction on_release; { # OO style my $handle = ReleaseAction->new( sub {print "Exiting scopen"} ); print "In scopen"; } { # Functional style my $handle = on_release {print "Exiting scopen"}; print "In scopen"; } { my $rollback = on_release {rollback_trans()}; if (do_stuff()) { $rollback->cancel(); } } This provides an easy way to create opaque handles which will do something when they are destroyed. There are two ways of creating a new handle. Both take one or more arguments, with the first being the action to take when the handle is released and the (optional) rest being the arguments that the handle will get. new is the method oriented constructor. my $handle = ReleaseAction->new( sub {print shift}, "Goodbye cruel worldn" ); And an optional function on_release that you can import. For those who like that sort of thing, I have provided the prototype &@ for syntactic sugar. my $handle = on_release {print "Goodbye cruel worldn"}; And should you decide that you dont want to do the action on release after all, you can call the cancel() method. As suggested in the SYNOPSIS, this is useful if you wish to set up transactional mechanics. Make the release action do your cleanup. And then when you commit your changes, cancel the cleanup. EXAMPLE use ReleaseAction on_release; # This does the same thing as the module SelectSaver. sub tmp_select { on_release {select shift} select shift; } print "This print goes to STDOUTn"; { my $hold_select = tmp_select(*STDERR); print "This print goes to STDERRn"; } print "Printing to STDOUT againn"; A LONGER EXAMPLE use Carp; use Cwd; use ReleaseAction; sub cd_to { chdir($_[0]) or confess("Cannot chdir to $_[0]: $!"); } sub tmp_cd { my $cwd = cwd(); cd_to(shift); ReleaseAction->new(&cd_to, $cwd); } sub something_interesting { my $in_dir = tmp_cd("some_dir"); # Do something interesting in the new dir # I will automagically return to the old dir # when I exit the subroutine and $in_dir goes # out of scope. }.

Requirements: No special requirements
Platforms: Linux
Keyword: Handle Libraries New Print Programming Release Releaseaction Select Sub
Users rating: 0/10

License: Freeware Size: 4.1 KB
Audio Tools  -  ChucK
ChucK is a new audio programming language for real-time synthesis, composition, and performance - fully supported on MacOS X, Windows, and Linux. ChucK presents a new time-based concurrent programming model, which supports a highly precise and...
1.5 MB  
Business  -  POS for Restaurants & Cafes
Easily create table orders (or takeaway), add - then customize your item(s), process to print in kitchen and/or coffee printer. New floor map. Option to select take away. Print directly to kitchen. Support 10 inch tablets!...
1024 KB  
Entertainment  -  SMS_Compressor
This application let you send messages longer than 160 characters in just one message! I succesfully putted about 240-250 signs. Soon new version will release, and i think it could handle more than 400 signs! Soon andorid version will...
1024 KB  
Development Editors  -  Chapel 1.4.0 PreAlpha
Chapel is designed to be a new parallel programming language that is part of the DARPA-led High Productivity Computing Systems program or HPCS. Chapel is designed to improve the productivity of high-end computer users while also serving as a...
Puzzles  -  Clocks N900 1.0
I am new to programming on the N900 and python. Hopefully someone will get some enjoyment out of this little game that I wrote just to see if I could. Its packaged as a zip file, simply extract to a folder on your n900 (preferably...
501.76 KB  
Web Browser Tools  -  Drag & DropZones 1.5.3
Today I finally found some spare time to finish up the work on the new Drag & DropZones release. Firefox 3.6 compatibility being the most urgent new feature, but I already had developed a lot more goodies for you all. Drag & DropZones now allows...
51.2 KB  
Entertainment  -  TotalGuide xD for Buckeye CableSystem 1.2.2
Explore TV in a New Way! This release is available only for Buckeye CableSystem subscribers. Discover more of what you like and have endless fun connecting with your favorite programs and stars! TotalGuide xD is the must-have app...
30.3 MB  
Desktop Utilities  -  KFileManagerUtils 1.1.3
KFileManagerUtils project is a simple utility which adds several shell extensions to Konqueror: - Copy path to clipboard: copy the path(s) of the selected element(s) to the clipboard - Copy URL to clipboard: copy the url(s) of the selected...
57.34 KB  
Network & Internet  -  Kylie 0.0.7
Kylie is a web browser. It does text, images, tables and soon forms. It doesnt know css, frames or scripting. And its neither fast nor cute. Thats why it is version 0.0.x. Parsing The HTML parser in MwHtmlParser.c creates a linked list of all...
103.42 KB  
Icon Tools  -  Shop Cart Icons 1.0
The Fast Icon Stock Icons is more than pleased to annouce their new icon set release, called Shop Cart Icons. Download these five shop cart icons to use in your e-commerce projects. Available for download as PNG and Windows Ico files. The PNG...
517 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  -  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