SPUG: Inline.pm is on th CPAN (and other SPUG-dev)

Scott Blachowicz scott at sabmail.rresearch.com
Wed Aug 16 11:52:23 CDT 2000

On Wed, Aug 16, 2000 at 07:46:55AM -0700, B.Ingerson at epixtech.com wrote:
> So, if there's any interest in doing the one-liner thing, I'd be happy to
> get it rolling in a very minimal fashion. I suspect (and hope) that every
> bit of it would get rewritten by the group.

OK...to start some discussion now that you mentioned it :-))...

Last night, I'd made some comments about thinking of this as a simple
database lookup type of thing at its basic level.  Something along the
lines of a data structure like this:

my %db = (
       'schwarzian_transform' =>
       {aliases => ['s_t', 'st', "Randal's Transform"],
		type => 'template_code',
		data => 'map {} ...'},

	   'primes' =>
       {type => 'runnable_code',
		data => 'print "2,3,5,7\n"'},

       'valid_zip' =>
	   {aliases => ['is_zip', 'zip'],
		type => 'runnable_regexp',
		data => '/\d\d\d\d\d(\-?\d\d\d\d)?/'},

       'CPAN' =>
	   {aliases => ['cpan.org', 'The Perl Archive'],
		type => 'URL',
		data => 'http://www.cpan.org/'},
my %aliases;
foreach my $key (keys %db) {
  foreach my $alias (@{$db{$key}->aliases}) {
	$aliases{$alias} = $key;

Then, you could have Get functions that check for $db{$KEY} existence,
then check for $db{$aliases{$KEY}} existence.  You could also probably
add a 'keywords' field to do searching/browsing on the db.

So, that's one task area - general data storage and retrieval of short
bits of text for retrieval by keyword.

Another is what you do with the data. The default action could depend on the
'type' field and/or how the script/module is invoked (e.g. via an interactive
front end).

Another task area could be developing a set of functions that use the data
store and do things with the returned data - so an "action" module.

Another task area could be developing an interactive command line front end.

Maybe another task would be playing with other specific applications
(e.g. that Regex::Common stuff, the standard perl oneliners, something
similar to the "fortune" program or email signature generators) and
deciding if the provided lower level interfaces make sense.

Maybe another task would be to think about how one might parameterize the data
to be able to provide input to their expansion (kinda like code

Maybe another task would be investigating what other modules are
already there that do something similar?

Maybe I should get back to "real" work now :-)?

Scott Blachowicz

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/

More information about the spug-list mailing list