bar code
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 5732
Barcode::Code128 2.01
Barcode::Code128 is a Perl module that can generate CODE 128 bar codes. more>>
Barcode::Code128 is a Perl module that can generate CODE 128 bar codes.
SYNOPSIS
use Barcode::Code128;
$code = new Barcode::Code128;
EXPORTS
By default, nothing. However there are a number of constants that represent special characters used in the CODE 128 symbology that you may wish to include. For example if you are using the EAN-128 or UCC-128 code, the string to encode begins with the FNC1 character. To encode the EAN-128 string "00 0 0012345 555555555 8", you would do the following:
use Barcode::Code128 FNC1;
$code = new Barcode::Code128;
$code->text(FNC1.00000123455555555558);
To have this module export one or more of these characters, specify them on the use statement or use the special token :all instead to include all of them. Examples:
use Barcode::Code128 qw(FNC1 FNC2 FNC3 FNC4 Shift);
use Barcode::Code128 qw(:all);
Here is the complete list of the exportable characters. They are assigned to high-order ASCII characters purely arbitrarily for the purposes of this module; the values used do not reflect any part of the CODE 128 standard. Warning: Using the CodeA, CodeB, CodeC, StartA, StartB, StartC, and Stop codes may cause your barcodes to be invalid, and be rejected by scanners. They are inserted automatically as needed by this module.
CodeA 0xf4 CodeB 0xf5 CodeC 0xf6
FNC1 0xf7 FNC2 0xf8 FNC3 0xf9
FNC4 0xfa Shift 0xfb StartA 0xfc
StartB 0xfd StartC 0xfe Stop 0xff
Barcode::Code128 generates bar codes using the CODE 128 symbology. It can generate images in PNG or GIF format using the GD package, or it can generate a text string representing the barcode that you can render using some other technology if desired.
The intended use of this module is to create a web page with a bar code on it, which can then be printed out and faxed or mailed to someone who will scan the bar code. The application which spurred its creation was an expense report tool, where the employee submitting the report would print out the web page and staple the receipts to it, and the Accounts Payable clerk would scan the bar code to indicate that the receipts were received.
The default settings for this module produce a large image that can safely be FAXed several times and still scanned easily. If this requirement is not important you can generate smaller image using optional parameters, described below.
If you wish to generate images with this module you must also have the GD.pm module (written by Lincoln Stein, and available from CPAN) installed. Version 1.20 or higher of GD generates a PNG file, due to issues with the GIF patent. If you want to create a GIF, you must use version 1.19 or earlier of GD. However, most browsers have no trouble with PNG files.
If the GD module is not present, you can still use the module, but you will not be able to use its functions for generating images. You can use the barcode() method to get a string of "#" and " " (hash and space) characters, and use your own image-generating routine with that as input.
To use the the GD module, you will need to install it along with this module. You can obtain it from the CPAN (Comprehensive Perl Archive Network) repository of your choice under the directory authors/id/LDS. Visit http://www.cpan.org/ for more information about CPAN. The GD home page is: http://stein.cshl.org/WWW/software/GD/GD.html
<<lessSYNOPSIS
use Barcode::Code128;
$code = new Barcode::Code128;
EXPORTS
By default, nothing. However there are a number of constants that represent special characters used in the CODE 128 symbology that you may wish to include. For example if you are using the EAN-128 or UCC-128 code, the string to encode begins with the FNC1 character. To encode the EAN-128 string "00 0 0012345 555555555 8", you would do the following:
use Barcode::Code128 FNC1;
$code = new Barcode::Code128;
$code->text(FNC1.00000123455555555558);
To have this module export one or more of these characters, specify them on the use statement or use the special token :all instead to include all of them. Examples:
use Barcode::Code128 qw(FNC1 FNC2 FNC3 FNC4 Shift);
use Barcode::Code128 qw(:all);
Here is the complete list of the exportable characters. They are assigned to high-order ASCII characters purely arbitrarily for the purposes of this module; the values used do not reflect any part of the CODE 128 standard. Warning: Using the CodeA, CodeB, CodeC, StartA, StartB, StartC, and Stop codes may cause your barcodes to be invalid, and be rejected by scanners. They are inserted automatically as needed by this module.
CodeA 0xf4 CodeB 0xf5 CodeC 0xf6
FNC1 0xf7 FNC2 0xf8 FNC3 0xf9
FNC4 0xfa Shift 0xfb StartA 0xfc
StartB 0xfd StartC 0xfe Stop 0xff
Barcode::Code128 generates bar codes using the CODE 128 symbology. It can generate images in PNG or GIF format using the GD package, or it can generate a text string representing the barcode that you can render using some other technology if desired.
The intended use of this module is to create a web page with a bar code on it, which can then be printed out and faxed or mailed to someone who will scan the bar code. The application which spurred its creation was an expense report tool, where the employee submitting the report would print out the web page and staple the receipts to it, and the Accounts Payable clerk would scan the bar code to indicate that the receipts were received.
The default settings for this module produce a large image that can safely be FAXed several times and still scanned easily. If this requirement is not important you can generate smaller image using optional parameters, described below.
If you wish to generate images with this module you must also have the GD.pm module (written by Lincoln Stein, and available from CPAN) installed. Version 1.20 or higher of GD generates a PNG file, due to issues with the GIF patent. If you want to create a GIF, you must use version 1.19 or earlier of GD. However, most browsers have no trouble with PNG files.
If the GD module is not present, you can still use the module, but you will not be able to use its functions for generating images. You can use the barcode() method to get a string of "#" and " " (hash and space) characters, and use your own image-generating routine with that as input.
To use the the GD module, you will need to install it along with this module. You can obtain it from the CPAN (Comprehensive Perl Archive Network) repository of your choice under the directory authors/id/LDS. Visit http://www.cpan.org/ for more information about CPAN. The GD home page is: http://stein.cshl.org/WWW/software/GD/GD.html
Download (0.014MB)
Added: 2007-07-24 License: Perl Artistic License Price:
834 downloads
Pretty Code Web 1.00
Pretty Code Web is a syntax highlighter for publishing code, written in any programming language, to the Web. more>>
Pretty Code Web is a syntax highlighter for publishing code, written in any programming language, to the web.
Written in php it uses syntax files separate from the main code to highlight a specified language.
Main features:
- Syntax highlighting for (potentially) any language.
- User defined syntax files.
- User defined colors
- Separate colors for:
- 6 Keyword Groups
- Text Strings
- Operators
- Block and Line Comments
- Bracket Characters
<<lessWritten in php it uses syntax files separate from the main code to highlight a specified language.
Main features:
- Syntax highlighting for (potentially) any language.
- User defined syntax files.
- User defined colors
- Separate colors for:
- 6 Keyword Groups
- Text Strings
- Operators
- Block and Line Comments
- Bracket Characters
Download (0.024MB)
Added: 2005-10-20 License: Free for non-commercial use Price:
1470 downloads
KDeskBar 1.2
KDeskBar is a panel applet that utilizes configured web shortcuts in kde to perform searches from the panel bar. more>>
KDeskBar is a kicker applet that utilizes configured web shortcuts in kde to perform searches from the panel bar.
Note that its mainly suited for horizontal panels. It doesnt quite display properly on vertical panels.
Installation:
The simplest way to compile this package is:
1. `cd to the directory containing the packages source code and type `./configure to configure the package for your system. If youre using `csh on an old version of System V, you might need to type `sh ./configure instead to prevent `csh from trying to execute `configure itself.
Running `configure takes a while. While running, it prints some messages telling which features it is checking for.
2. Type `make to compile the package.
3. Type `make install to install the programs and any data files and documentation.
4. You can remove the program binaries and object files from the source code directory by typing `make clean.
Enhancements:
- Added focus and auto select all text after choosing a new engine.
<<lessNote that its mainly suited for horizontal panels. It doesnt quite display properly on vertical panels.
Installation:
The simplest way to compile this package is:
1. `cd to the directory containing the packages source code and type `./configure to configure the package for your system. If youre using `csh on an old version of System V, you might need to type `sh ./configure instead to prevent `csh from trying to execute `configure itself.
Running `configure takes a while. While running, it prints some messages telling which features it is checking for.
2. Type `make to compile the package.
3. Type `make install to install the programs and any data files and documentation.
4. You can remove the program binaries and object files from the source code directory by typing `make clean.
Enhancements:
- Added focus and auto select all text after choosing a new engine.
Download (0.55MB)
Added: 2006-01-13 License: GPL (GNU General Public License) Price:
1379 downloads
MyDBO Code Generator 2.1
MyDBO is a powerful object-oriented code generator for PHP/MySQL Web application developers. more>>
MyDBO is a powerful object-oriented code generator for PHP/MySQL Web application developers.
It is designed to remove the hassle of implementing familiar database operations (select, update, insert, etc) over and over again when creating Web applications. MyDBO Code Generator creates code for accessing your database tables without you having to worry about connections or SQL queries.
It also allows you to approach your database in an object-oriented fashion, thus giving you real flexibility. It uses templates to generate code, so it is also possible to create your own templates.
Main features:
- Forget about accessing your database with SQL queries.
- Use the far more flexible object-oriented approach.
- Create logic foreign key links between your tables and navigate between your objects.
- Map the default MySQL date type to whatever you want.
- Create your own templates for unlimited possibilities.
- Fast and reliable.
- Should your database structure change, just re-generate the code.
- Easy to generate with the generation wizard.
- The generated code has standard comments for each class and functions.
- Free for personal and commercial use (GNU), Open source.
- Clean and tested code.
Enhancements:
- Boolean return values were added in API methods.
- A LIMIT argument was added in the tableCollector of the businessAPI plugin.
- The number of queries to execute when using Collector was reduced to 1.
- The use of database connections was optimized, and $DB is now a global variable.
- Memory is allowed increased to 16M.
- The ADOdb installation was customized to be minimal.
- instantAdmin was updated with a new API.
- Collector classes can now return the number of results only.
<<lessIt is designed to remove the hassle of implementing familiar database operations (select, update, insert, etc) over and over again when creating Web applications. MyDBO Code Generator creates code for accessing your database tables without you having to worry about connections or SQL queries.
It also allows you to approach your database in an object-oriented fashion, thus giving you real flexibility. It uses templates to generate code, so it is also possible to create your own templates.
Main features:
- Forget about accessing your database with SQL queries.
- Use the far more flexible object-oriented approach.
- Create logic foreign key links between your tables and navigate between your objects.
- Map the default MySQL date type to whatever you want.
- Create your own templates for unlimited possibilities.
- Fast and reliable.
- Should your database structure change, just re-generate the code.
- Easy to generate with the generation wizard.
- The generated code has standard comments for each class and functions.
- Free for personal and commercial use (GNU), Open source.
- Clean and tested code.
Enhancements:
- Boolean return values were added in API methods.
- A LIMIT argument was added in the tableCollector of the businessAPI plugin.
- The number of queries to execute when using Collector was reduced to 1.
- The use of database connections was optimized, and $DB is now a global variable.
- Memory is allowed increased to 16M.
- The ADOdb installation was customized to be minimal.
- instantAdmin was updated with a new API.
- Collector classes can now return the number of results only.
Download (0.12MB)
Added: 2006-02-17 License: LGPL (GNU Lesser General Public License) Price:
791 downloads
Glib::CodeGen 1.120
Glib::CodeGen is a code generation utilities for Glib-based bindings. more>>
Glib::CodeGen is a code generation utilities for Glib-based bindings.
SYNOPSIS
# usually in Makefile.PL
use Glib::CodeGen;
# most common, use all defaults
Glib::CodeGen->parse_maps (myprefix);
Glib::CodeGen->write_boot;
# more exotic, change everything
Glib::CodeGen->parse_maps (foo,
input => foo.maps,
header => foo-autogen.h,
typemap => foo.typemap,
register => register-foo.xsh);
Glib::CodeGen->write_boot (filename => bootfoo.xsh,
glob => Foo*.xs,
ignore => ^(Foo|Foo::Bar)$);
# add a custom type handler (rarely necessary)
Glib::CodeGen->add_type_handler (FooType => ≥n_foo_stuff);
# (see the section EXTENDING TYPE SUPPORT for more info.)
This module packages some of the boilerplate code needed for performing code generation typically used by perl bindings for gobject-based libraries, using the Glib module as a base.
The default output filenames are in the subdirectory build, which usually will be present if you are using ExtUtils::Depends (as most Glib-based extensions probably should).
<<lessSYNOPSIS
# usually in Makefile.PL
use Glib::CodeGen;
# most common, use all defaults
Glib::CodeGen->parse_maps (myprefix);
Glib::CodeGen->write_boot;
# more exotic, change everything
Glib::CodeGen->parse_maps (foo,
input => foo.maps,
header => foo-autogen.h,
typemap => foo.typemap,
register => register-foo.xsh);
Glib::CodeGen->write_boot (filename => bootfoo.xsh,
glob => Foo*.xs,
ignore => ^(Foo|Foo::Bar)$);
# add a custom type handler (rarely necessary)
Glib::CodeGen->add_type_handler (FooType => ≥n_foo_stuff);
# (see the section EXTENDING TYPE SUPPORT for more info.)
This module packages some of the boilerplate code needed for performing code generation typically used by perl bindings for gobject-based libraries, using the Glib module as a base.
The default output filenames are in the subdirectory build, which usually will be present if you are using ExtUtils::Depends (as most Glib-based extensions probably should).
Download (0.22MB)
Added: 2006-07-17 License: Perl Artistic License Price:
1195 downloads
StringParser_BBCode 0.3.1
StringParser_BBCode class provides the possibility to parse strings with BB-Codes and convert them to e.g. HTML code. more>>
StringParser_BBCode class provides the possibility to parse strings with BB-Codes and convert them to e.g. HTML code.
BBCode is a kind of markup "language" with which one may structure and format text. It is similar to HTML but it utilizes square braces instead of angle brackets.
Another difference between BBCode and HTML is that when using BBCode invalid code is ignored whereas the validity of the code is important when using HTML.
Enhancements:
- Several bugfixes were made.
- Support was added for parsing [code=foo attr=bar].
- A callback function may be called again on close tag occurrence.
- A processing type "callback_replace?" was added which exhibits the opposite behavior of "usecontent?".
<<lessBBCode is a kind of markup "language" with which one may structure and format text. It is similar to HTML but it utilizes square braces instead of angle brackets.
Another difference between BBCode and HTML is that when using BBCode invalid code is ignored whereas the validity of the code is important when using HTML.
Enhancements:
- Several bugfixes were made.
- Support was added for parsing [code=foo attr=bar].
- A callback function may be called again on close tag occurrence.
- A processing type "callback_replace?" was added which exhibits the opposite behavior of "usecontent?".
Download (0.32MB)
Added: 2006-04-27 License: GPL (GNU General Public License) Price:
1276 downloads
XML::Code 0.04
XML::Diff is a Perl module for XML DOM-Tree based Diff & Patch Module. more>>
XML::Diff is a Perl module for XML DOM-Tree based Diff & Patch Module.
SYNOPSIS
my $diff = XML::Diff->new();
# to generate a diffgram of two XML files, use compare.
# $old and $new can be filepaths, XML as a string,
# XML::LibXML::Document or XML::LibXML::Element objects.
# The diffgram is a XML::LibXML::Document by default.
my $diffgram = $diff->compare(
-old => $old_xml,
-new => $new_xml,
);
# To patch an XML document, an patch. $old and $diffgram
# follow the same formatting rules as compare.
# The resulting XML is a XML::LibXML::Document by default.
my $patched = $diff->patch(
-old => $old,
-diffgram => $diffgram,
);
This module provides methods for generating and applying an XML diffgram of two related XML files. The basis of the algorithm is tree-wise comparison using the DOM model as provided by XML::LibXML.
The Diffgram is well-formed XML in the XVCS namespance and supports update, insert, delete and move operations. It is meant to be human and machine readable. It uses XPath expressions for locating the nodes to operate on.
<<lessSYNOPSIS
my $diff = XML::Diff->new();
# to generate a diffgram of two XML files, use compare.
# $old and $new can be filepaths, XML as a string,
# XML::LibXML::Document or XML::LibXML::Element objects.
# The diffgram is a XML::LibXML::Document by default.
my $diffgram = $diff->compare(
-old => $old_xml,
-new => $new_xml,
);
# To patch an XML document, an patch. $old and $diffgram
# follow the same formatting rules as compare.
# The resulting XML is a XML::LibXML::Document by default.
my $patched = $diff->patch(
-old => $old,
-diffgram => $diffgram,
);
This module provides methods for generating and applying an XML diffgram of two related XML files. The basis of the algorithm is tree-wise comparison using the DOM model as provided by XML::LibXML.
The Diffgram is well-formed XML in the XVCS namespance and supports update, insert, delete and move operations. It is meant to be human and machine readable. It uses XPath expressions for locating the nodes to operate on.
Download (0.017MB)
Added: 2006-09-14 License: Perl Artistic License Price:
1138 downloads
Artichow 1.1.0
Artichow is a complete framework to create statistical graphs such as line, bar, or radar plots, pies charts, and so on. more>>
Artichow is a complete framework to create statistical graphs such as line, bar, or radar plots, pies charts, and so on.
Artichow can also produce antispam images for applications such as user account creation.
Enhancements:
- This version comes with a mostly rewritten new driver model: all the code needed to draw the graphs (usually function calls to some PHP extension) are now separated from the data.
- This is meant to allow easy driver development in the future, as anyone will be able to add a new one without caring about the rest of the code.
- This version also corrects some bugs and adds a few new features like new marks.
<<lessArtichow can also produce antispam images for applications such as user account creation.
Enhancements:
- This version comes with a mostly rewritten new driver model: all the code needed to draw the graphs (usually function calls to some PHP extension) are now separated from the data.
- This is meant to allow easy driver development in the future, as anyone will be able to add a new one without caring about the rest of the code.
- This version also corrects some bugs and adds a few new features like new marks.
Download (0.18MB)
Added: 2006-12-18 License: GPL (GNU General Public License) Price:
614 downloads
Code::Perl 0.03
Code::Perl is a Perl module to produce Perl code from a tree. more>>
Code::Perl is a Perl module to produce Perl code from a tree.
SYNOPSIS
use Code::Perl::Expr qw( :easy );
my $c = derefh(scal(hash), calls(getkey));
print $c->perl; # ($hash)->{getkey()}
Code::Perl allows you to build chunks of Perl code as a tree and then when youre finished building, the tree can output the Perl code. This is useful if you have built your own mini-language and you want to generate Perl from it. Rather than generating the Perl at parse time and having to worry about quoting, escaping, parenthese etc, you can just build a tree using Code::Perl and then dump out the correct Perl at the end.
<<lessSYNOPSIS
use Code::Perl::Expr qw( :easy );
my $c = derefh(scal(hash), calls(getkey));
print $c->perl; # ($hash)->{getkey()}
Code::Perl allows you to build chunks of Perl code as a tree and then when youre finished building, the tree can output the Perl code. This is useful if you have built your own mini-language and you want to generate Perl from it. Rather than generating the Perl at parse time and having to worry about quoting, escaping, parenthese etc, you can just build a tree using Code::Perl and then dump out the correct Perl at the end.
Download (0.017MB)
Added: 2006-10-05 License: Perl Artistic License Price:
1127 downloads

Html Code Convert 3.3
Speed up the conversion of HTML code into different format more>>
HTML Code Convert helps speed up the conversion of HTML code into different format including Java Script, JavaServer Pages, Microsoft ASP, PHP, Perl, Python, and the UNIX Shell. It is particularly useful in CGI scripting.
Enhancements:
- Colors and font selected in prefeferences box.
- Fixe bug with Quit button. First try to support accessibility.
- Updated schemas.
<<lessEnhancements:
- Colors and font selected in prefeferences box.
- Fixe bug with Quit button. First try to support accessibility.
- Updated schemas.
Download (184KB)
Added: 2009-04-29 License: Freeware Price:
198 downloads
PHP Active Code Library 0.10
PHP Active Code Library (ACL) is a PHP 5 class used to store and call PHP files that are stored in a database. more>>
PHP Active Code Library (ACL) is a PHP 5 class used to store and call PHP files that are stored in a database.
The files are stored in a plain text field and not a binary field. PHP ACL also takes care of include/require calls.
If a file includes another file stored in the database, PHP ACL takes care of getting, generating, and including that file.
<<lessThe files are stored in a plain text field and not a binary field. PHP ACL also takes care of include/require calls.
If a file includes another file stored in the database, PHP ACL takes care of getting, generating, and including that file.
Download (0.013MB)
Added: 2006-07-27 License: GPL (GNU General Public License) Price:
1191 downloads
Programs Bar 0.6
Programs Bar is a programs launcher bar theme for SuperKaramba. more>>
Programs Bar is a programs launcher bar theme for SuperKaramba.
Was tested on Mandriva 2006 and Fedora Core 5.
<<lessWas tested on Mandriva 2006 and Fedora Core 5.
Download (0.18MB)
Added: 2006-06-28 License: GPL (GNU General Public License) Price:
1217 downloads

Audacity Linux Source Code 1..2.4b
Audacity Linux Source Code free software for recording editing sounds. more>> Audacity Linux Source Code is a free, easy-to-use audio editor and recorder for Linux, and other operating systems. You can use Audacity to:
Record live audio.
Convert tapes and records into digital recordings or CDs.
Edit Ogg Vorbis, MP3, and WAV sound files.
Cut, copy, splice, and mix sounds together.
Change the speed or pitch of a recording.
And more! See the complete list of features.
This editor can record and play sounds and import and export WAV, AIFF, MP3, and OGG files. Edit your sounds using cut, copy, and paste features (with unlimited undo functionality), mix tracks, or apply effects to your recordings. The program also has a built-in amplitude-envelope editor, a customizable spectrogram mode, and a frequency-analysis window for audio-analysis applications. Built-in effects include bass boost, wah wah, and noise removal, and the program also supports VST plug-in effects. This program is open-source, and this version adds tool tips, keyboard shortcuts, and OGG exporting and fixes some bugs.
Version 1.2.4b has a Meter Toolbar added for monitoring volume levels during playback and recording, allows you to export multiple files at once, attempts to automatically correct latency in full-duplex recordings, and contains some bug fixes.<<less
Download (4.29MB)
Added: 2009-04-03 License: Freeware Price: Free
203 downloads
Code::Splice 0.01
Code::Splice injects the contents of one subroutine at a specified point elsewhere. more>>
Code::Splice injects the contents of one subroutine at a specified point elsewhere.
SYNOPSIS
use Code::Splice;
Code::Splice::inject(
code => sub { print "fredn"; },
package => main,
method => foo,
precondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/four/;
},
postcondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/five/;
},
);
sub foo {
print "onen";
print "twon";
print "threen";
print "fourn";
print "fiven";
}
This module removes the contents of a subroutine (usually an anonymous subroutine created just for the purpose) and splices in into the program elsewhere.
Why, you ask?
Write stronger unit tests than the granularity of the API would otherwise allow
Write unit tests for nasty, interdependant speghetti code (my motivation -- hey, you gotta have tests before you can start refactoring, and if you cant write tests for the code, youre screwed)
Fix stupid bugs and remove stupid restrictions in other peoples code in a way thats more resiliant across upgrades than editing files you dont own
Be what "aspects" should be
Screw with your cow-orkers by introducing monster heisenbugs
Play with self-modifying code
Write self-replicating code (but be nice, were all friends here, right?)
The specifics:
The body of the code { } block are extracted from the subroutine and inserted in a place in the code specified by the call to the splice() function. Where the new code is spliced in, the old code is spliced out. The package and method arguments are required and tell the thing how to find the code to be modified. The code argument is required as it specifies the code to be spliced in. That same code block should not be used for anything else under penalty of coredump.
The rest of the argumets specify where the code is to be inserted. Any number of precondition and postcondition arguments provide callbacks to help locate the exact area to splice the code in at. Before the code can e spliced in, all of the precondition blocks must have returned true, and none of the postcondition blocks may have yet returned true. If a postcondition returns true before all of the precondition blocks have, an error is raised. Both blocks get called numerous times per line and get passed a reference to the B OP object currently under consideration and the text of the current line:
precondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/four/;
},
... or...
precondition => sub { my $op = shift; $op->name eq padsv and $op->sv->sv =~ m/fred/; },
Its possible to insert code in the middle of an expression when testing ops, but when testing the text of the line of code, the spliced in code will always replace the whole line.
Ill probably drop sending in the opcode in a future version, at least for the precondition/postcondition blocks, or maybe Ill swap them to the 2nd arg so theyre more optional.
Do not attempt to match text in comments as it wont be there. The code in $line is re-generated from the bytecode using B::Deparse and will vary from the original source code in a few ways, including changes to formatting, changes to some idioms and details of the expressions, and formatting of the code with regards to whitespace.
The splicing code will die if it fails for any reason. This will likely change in possible future versions.
There are also label and line arguments that create preconditions for you, for simple cases. Of course, you shouldnt use line for anything other than simple experimentation.
References to lexical variables in the code to be injected are replaced with references to the lexical variables of the same name in the location the code is inserted into. If a variable of the same name doesnt exist there, its an error. ... but it probably shouldnt be an error, at least in the cases where the code being spliced in declares that lexical with my, or when the variable was initiailized entirely outside of the sub block being spliced in and was merely closed over by it.
See the comments in the source code (at the top, in a nice block) for my todo/desired features. Let me know if there are any features in there or yet unsuggested that you want. I wont promise them, but I would like to hear about them.
<<lessSYNOPSIS
use Code::Splice;
Code::Splice::inject(
code => sub { print "fredn"; },
package => main,
method => foo,
precondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/four/;
},
postcondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/five/;
},
);
sub foo {
print "onen";
print "twon";
print "threen";
print "fourn";
print "fiven";
}
This module removes the contents of a subroutine (usually an anonymous subroutine created just for the purpose) and splices in into the program elsewhere.
Why, you ask?
Write stronger unit tests than the granularity of the API would otherwise allow
Write unit tests for nasty, interdependant speghetti code (my motivation -- hey, you gotta have tests before you can start refactoring, and if you cant write tests for the code, youre screwed)
Fix stupid bugs and remove stupid restrictions in other peoples code in a way thats more resiliant across upgrades than editing files you dont own
Be what "aspects" should be
Screw with your cow-orkers by introducing monster heisenbugs
Play with self-modifying code
Write self-replicating code (but be nice, were all friends here, right?)
The specifics:
The body of the code { } block are extracted from the subroutine and inserted in a place in the code specified by the call to the splice() function. Where the new code is spliced in, the old code is spliced out. The package and method arguments are required and tell the thing how to find the code to be modified. The code argument is required as it specifies the code to be spliced in. That same code block should not be used for anything else under penalty of coredump.
The rest of the argumets specify where the code is to be inserted. Any number of precondition and postcondition arguments provide callbacks to help locate the exact area to splice the code in at. Before the code can e spliced in, all of the precondition blocks must have returned true, and none of the postcondition blocks may have yet returned true. If a postcondition returns true before all of the precondition blocks have, an error is raised. Both blocks get called numerous times per line and get passed a reference to the B OP object currently under consideration and the text of the current line:
precondition => sub {
my $op = shift;
my $line = shift;
$line =~ m/print/ and $line =~ m/four/;
},
... or...
precondition => sub { my $op = shift; $op->name eq padsv and $op->sv->sv =~ m/fred/; },
Its possible to insert code in the middle of an expression when testing ops, but when testing the text of the line of code, the spliced in code will always replace the whole line.
Ill probably drop sending in the opcode in a future version, at least for the precondition/postcondition blocks, or maybe Ill swap them to the 2nd arg so theyre more optional.
Do not attempt to match text in comments as it wont be there. The code in $line is re-generated from the bytecode using B::Deparse and will vary from the original source code in a few ways, including changes to formatting, changes to some idioms and details of the expressions, and formatting of the code with regards to whitespace.
The splicing code will die if it fails for any reason. This will likely change in possible future versions.
There are also label and line arguments that create preconditions for you, for simple cases. Of course, you shouldnt use line for anything other than simple experimentation.
References to lexical variables in the code to be injected are replaced with references to the lexical variables of the same name in the location the code is inserted into. If a variable of the same name doesnt exist there, its an error. ... but it probably shouldnt be an error, at least in the cases where the code being spliced in declares that lexical with my, or when the variable was initiailized entirely outside of the sub block being spliced in and was merely closed over by it.
See the comments in the source code (at the top, in a nice block) for my todo/desired features. Let me know if there are any features in there or yet unsuggested that you want. I wont promise them, but I would like to hear about them.
Download (0.010MB)
Added: 2007-08-14 License: Perl Artistic License Price:
806 downloads
Cleaner 0.1
Cleaner is a Java beautifier that transforms ugly syntax into beautiful syntax. more>>
Cleaner is a Java beautifier that transforms ugly syntax into beautiful syntax. The Java code syntax is parsed using ANTLR and then printed to standard output.
Source is included.
Something like this:
public void foo(String bar)
{
for(int x=0; x < 9; x++ )
{
System.out.println ("X = " + x);
}
}
Will become
public void foo( String bar ){
for ( int x = 0; x < 9; x++ ){
System.out.println( "X = " + x );
}
}
Compile:
$ ant
Run:
$ java -classpath cleaner.jar:lib/antlr.jar cleaner.Cleaner < some-file >
<<lessSource is included.
Something like this:
public void foo(String bar)
{
for(int x=0; x < 9; x++ )
{
System.out.println ("X = " + x);
}
}
Will become
public void foo( String bar ){
for ( int x = 0; x < 9; x++ ){
System.out.println( "X = " + x );
}
}
Compile:
$ ant
Run:
$ java -classpath cleaner.jar:lib/antlr.jar cleaner.Cleaner < some-file >
Download (0.58MB)
Added: 2006-04-17 License: GPL (GNU General Public License) Price:
1335 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 bar code 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