We asked MacPerl users to share code examples with us.
The examples listed here were contributed by MacPerl users
for inclusion on the MacPerl disc and on the MacPerl Pages
(www.macperl.com/).
We've divided the code into these categories:
We're still gathering examples; if you have something to share, please send it in. We'll post it to the MacPerl Pages and put it on the next MacPerl:Power and Ease CD-ROM! Code contributions can be made using our web form. Be sure to give us permission to include your software (required). Optionally, please give us permission to use your name and company name. |
|
Disclaimer: These files are all distributed as-is, with no warranties or guarantees expressed or implied. Most of the files are accompanied by a description and the author's name and e-mail address as comments in the file, or in a readme.
Categories and Code DescriptionsFragments/matrix_sort (Xah Lee) is a function that sorts a matrix in all possibly specified ways. slurp_file (Darin S. Morley) is a robust code fragment for slurping a file into an array. Plugins/change_leading_tabs (Benjamin Elijah Griffin) - BBEdit has a nifty tool that inserts recursive directory listings into files. (Edit->Insert->Folder Listing...) Unfortunately, it uses to tabs to indicate the file structure in a visual way which is not always useful. This program, designed to run as a filter from the Perl Filters BBEdit plug-in, replaces the leading tabs with the name of the subdirectory. Mac Highlights/Speaking of Pi (Brian McNett) - MacPerl speaks the digits of Pi to more precision than you'll ever need! Modules/AssistantFrame (Georg Bauer) - a code-framework to create assistant-like dialog sequences. MPEdit (Alan Fry) - a MacPerl script that behaves as a text editor. Alan is actively working on this one and asks for comments. ajf@afco.demon.co.uk Password (Alan Fry) - a Perl module that prompts for a password; the password shows as bullets as the user types. Serial (Joseph DiVerdi) - an object-oriented serial interface library for MacPerl. TEC.pm (Andreas Marcel Riechert) - a Perl interface to Iimore-sans TEC Osax, which is an interface to the MacOS Text Encoding Converter. Tools/busFinder (Paul Schaap) - finds business names in data files (e.g., company directories). CD_Remote_Programs (Sean Burke) - displays the contents of the Apple CD Audio Player file "CD Remote Programs" database. Shows how to find the path to the Preferences folder. Includes a subroutine for decomposing "STR#" resources. Uses a list of lists, and a fancy sort(). cleanup (Dave Belcher) - "deletes" the Netscape cache, globalhistory and cookie files (best saved as a droplet for double-click ease of use). delete_geometry (Sean Burke) - deletes the screen and print preferences (font, window position, etc) for a given MacPerl file. Demonstrates elementary writing to resources. droplet2txt (Sean Burke) - creates source code (text) files from MacPerl droplet, CGI, or Runtime files. Demonstrates elementary resource-reading -- no resource-writing. fastFind (Paul Schaap) - a fast way to search a very large file. Could be useful in an application or CGI script. goHelpers (Paul Schaap) - allows a Perl script to be set up as a Web browser "helper", using MIME type information. interactive (Phil Robare) - a Perl interactive shell program. This little bit of code allows you to test out one-liners and regular expressions to quickly see if they do what you think they do. kill_WWW*_suffix_map.pl (Eric Dobbs) - a script to remove suffix maps from a collection of WebSTAR 2.0 servers Mog (Joshua Gemmell) - a droplet that will change a file's (or a group of files') creator and type. MP_Write.plx.sit.hqx (Alan Fry) "I have attempted a MacPerl TextEditor _without_ using the Toolbox TextEdit routines, so as to avoid the TE size limitation. I think the script is probably only a curiosity (I can't think of a good use for it) but bits of it might be of interest. Although slower than a 'real' text editor it runs faster than I thought might be the case." mpg.pl (Rick Hogan) - This program will give you the MPG (Miles Per Gallon) when you have the given number of miles driven and the gallons it took to fill the car. This was written with MacPerl and reused on my Unix server. my_geometry (Sean Burke) - overwrites the screen and print preferences (font, window position, etc) for given MacPerl files with whatever the preferences are for this file. Demonstrates slightly more advanced resource use than delete_geometry. Netscape Cache Control (Jack Browning) - A MacPerl droplet that, when you drop your Netscape Preferences file on it, allows you to simply and easily set the disk and memory cache for Navigator or Communicator. parseName (Paul Schaap) - parses (poorly formatted) business names and address data. PerlBackup (Ken Tanaka) - an incremental backup script. Printer Gateway (Robert Carl Rice) - a PostScript and impact printer server for HP JetDirect networked printers. RuntimeBuilder (Michael Ziege) - converts a Perl script into a folder containing a Perl runtime, along with all of its dynamically loaded shared libraries. All imported modules are copied into the resource fork of the runtime file. (PowerPC only) select_by_regexp (Sean Burke) - selects files (under the Finder) whose names match a regular expression. Demonstrates elementary interfacing with Finder via Applescript. Makes the reader have to think about map(). Related Stuff/These files are not written in MacPerl, but are written for use with MacPerl.PerlWS (Michael Schuerig); Perl Word Services Glue is a MacPerl extension to provide text-handling services (specifically, to save and use scripts as Word Services servers). ShuckPlugin (Angus McIntyre) is a Contextual Menu Manager (CMM) plug-in for looking up terms in Shuck. Word Services CM (Michael Schuerig) is a Contextual Menu Manager (CMM) plug-in that allows you to run a Word Services server (e.g. a MacPerl script) on the selected text.
_kpreid/This folder contains files contributed by Kevin Reid well-known by the MacPerl mailing list as a contributor of cool toys... _neeri/This folder contains files contributed by Matthias Neeracher, along with Matthias' PGP public key, for those who use PGP. It contains a special extension and module to save scripts as BBEdit plugins, and alternate forms of the Calculator DA written in MacPerl, among other tidbits. _pudge/This folder contains files contributed by Chris Nandor, along with Chris' PGP public key, for those who use PGP. It contains several modules; some he has written and some written by others that have been compiled for use with MacPerl. For more of Chris' work, visit Chris' site The folder contains Chris' Calculator program (a rewrite of the Mac OS Calculator Desk Accessory in MacPerl). Also in here is a reprise of whichMacPerl, a standalone MacPerl app to report what parts of MacPerl should be installed, and a special version of the CGI Script extension that turns taint checks on. The pudge_snippets subdirectory is a partial dump of Chris' miscellaneous code folder. _schinder/This folder contains files contributed by Paul Schinder. Many of these are scripts and modules found on the CPAN or elsewhere on the Internet, modified so they will work under MacPerl. These include Graham Barr's latest libnet, as well as the most recent libWWW distribution. Also included are scripts written by Paul for his own use. These can largely be found in the "lib" folder. For more details on the collection, see Paul's README file. We have unpacked (de-binhexed and uncompressed) the archives, but have otherwise left things in the form in which Paul distributes them. _seay/This folder contains files contributed by David Seay well-known by the MacPerl mailing list as a contributor of musically inclined MacPerl scripts... |