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

ReleaseAction 0.07

  Date Added: January 18, 2010  |  Visits: 492

ReleaseAction

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


RELEASEACTION RELATED
Programming  -  Transmuter Programming Language 0.9.2
Transmuter Programming Language is an extremely dynamic, biologically-inspired prototyping language providing a framework for experimenting with naturally evolving systems of objects over the net, and for exploring new ideas about recombinant...
348.16 KB  
Audio Tools  -  ChucK 1.2.0.6
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 1.0.0.0
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 1.1.0.0
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  
Utilities  -  sarPplot 1.0.3
sarPplot project is a simple application which takes output of atsar application and put it into Gnuplot config files, kind of useful on server boxes for performance analyze, which is availabel on: - cpu - processload - disk - disk-partition...
11.26 KB  
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  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
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 freedesktop.org, 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