From corliss at alaskapm.org Thu Mar 2 02:41:46 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:46 2004 Subject: Great CPAN site Message-ID: Greetings: For those of you in the dark, like I was until recently, there's a great site at http://search.cpan.org. Not only can you read all the documentation for every module on it, but you can find out what platforms they've been tested on, and whether or not they pass. And, of course, you can search for modules by name, distribution, author, or documentation. :-) --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Mar 9 10:11:30 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:46 2004 Subject: POD for DBD::RAM version 0.03 (fwd) Message-ID: Any DBI users out there? This guy's got a neat module under construction for modeling data-layers w/o an RDBMS. Depending on how efficient it is, I could see a lot of other uses for it, too. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ---------- Forwarded message ---------- Date: 9 Mar 2000 06:13:22 -0800 From: Jeff Zucker To: dbi-users Subject: POD for DBD::RAM version 0.03 *** From dbi-users - To unsubscribe, see the end of this message. *** *** DBI Home Page - http://www.symbolstone.org/technology/perl/DBI/ *** As requested by Tim, here's the whole current POD. Comments, gripes, and suggestions eagerly solicited. -- Jeff =head1 NAME DBD::RAM - a DBI driver for in-memory data structures =head1 SYNOPSIS use DBI; my $dbh = DBI->connect( 'DBI:RAM:','','',{RaiseError=>1} ); $dbh->func( { data_type => 'array', table_name => 'phrases', col_names => 'id,phrase', }, [ [1,'Hello new world!'], [2,'Junkity Junkity Junk'], ], 'import' ); my $sth = $dbh->prepare( "SELECT phrase FROM foo WHERE id < ?" ); $sth->execute(2); while (my @row = $sth->fetchrow_array) { for (@row) { print "$_\n" if $_; } } See also, below for creating tables from fixed-width records, from name=value records, from hashes, from any DBI accessible database, and from other user-defined data structures. All syntax supported by SQL::Statement and all methods supported by DBD::CSV are also supported, see their documentation for details. =head1 DESCRIPTION The DBD::RAM module allows you to import almost any type of Perl data structure into an in-memory table and then use DBI and SQL to access and modify it. Currently the following types of data are supported: 'array' imports an array of arrayrefs 'hash' imports an array of hashrefs 'name=value' imports an array of name=value strings 'fixed-width' imports an array of fixed-width record strings 'sth' imports a statement handle from any other DBI database 'user' imports an array of user-defined data structures With a data type of 'user', you can pass a pointer to a subroutine that parses the data, thus making the module very extendable. DBD::RAM allows you to prototype a database without having an rdbms system or other database engine and without creating or reading any disk files. The module is based on Jochen Wiedmann's SQL::Statement and DBD::File modules and behaves exactly like DBD::CSV without the file reading and writing operations. =head1 WARNING This module is in a rapid development phase and it is likely to change quite often for the next few days/weeks. I will try to keep the interface as stable as possible, but if you are going to start using this in places where it will be difficult to modify, you might want to ask me about the stabilitiy of the features you are using. =head1 INSTALLATION & PREREQUISITES This module should work on any any platform that DBI works on. You don't need an external SQL engine or a running server, or a compiler. All you need are Perl itself and installed versions of DBI and SQL::Statement. If you do *not* also have DBD::CSV installed you will need to either install it, or simply copy File.pm into your DBD directory. For this first release, there is no makefile, just copy RAM.pm into your DBD direcotry. =head1 CREATING A DATABASE In-memory tables may be created using standard CREATE/INSERT statements, or using the DBD::RAM specific import mehtod: $dbh->func( $spec, $data, 'import' ); The $spec parameter is a hashref containg: table_name a string holding the name of the table col_names a string containing the column names separated by commas data_type one of: array, hash, etc. see below for full list pattern a string containing an unpack pattern (fixed-width only) parser a pointer to a parsing subroutine (user only) The $data parameter is a an arrayref containing an array of the type specified in the $spec{data_type} parameter holding the actual table data. Data types for the data_type parameter currently include: array, hash, fixed-width, name=value, sth, and user. See below for examples. =head2 FROM AN ARRAY OF ARRAYS $dbh->func( { data_type => 'array_of_arrays', table_name => 'phrases', col_names => 'id,phrase', }, [ [1,'Hello new world!'], [2,'Junkity Junkity Junk'], ], 'import' ); =head2 FROM AN ARRAY OF HASHES $dbh->func( { table_name => 'phrases', col_names => 'id,phrase', data_type => 'hash', }, [ {id=>1,phrase=>'Hello new world!'}, {id=>2,phrase=>'Junkity Junkity Junk'}, ], 'import' ); =head2 FROM AN ARRAY OF NAME=VALUE STRINGS $dbh->func( { table_name => 'phrases', # ARRAY OF NAME=VALUE PAIRS col_names => 'id,phrase', data_type => 'name=value', }, [ '1=2Hello new world!', '2=Junkity Junkity Junk', ], 'import' ); =head2 FROM AN ARRAY OF FIXED-WIDTH RECORDS $dbh->func( { table_name => 'phrases', col_names => 'id,phrase', data_type => 'fixed-width', pattern => 'a1 a20', }, [ '1Hello new world! ', '2Junkity Junkity Junk', ], 'import' ); The $spec{pattern} value should be a string describing the fixed-width record. See the Perl documentation on "unpack()" for details. =head2 FROM ANOTHER DBI DATABASE You can import information from any other DBI accessible database with the data_type set to 'sth' in the import() method. First connect to the other database via DBI and get a database handle for it separate from the database handle for DBD::RAM. Then do a prepare and execute to get a statement handle for a SELECT statement into that database. Then pass the statement handle to the DBD::RAM import() method which will perform the fetch and insert the fetched fields and records into the DBD::RAM table. After the import() statement, you can then close the database connection to the other database. Here's an example using DBD::CSV -- my $dbh_csv = DBI->connect('DBI:CSV:','','',{RaiseError=>1}); my $sth_csv = $dbh_csv->prepare("SELECT * FROM mytest_db"); $sth_csv->execute(); $dbh->func( { table_name => 'phrases', col_names => 'id,phrase', data_type => 'sth', }, [$sth_csv], 'import' ); $dbh_csv->disconnect(); =head2 FROM USER-DEFINED DATA STRUCTURES $dbh->func( { table_name => 'phrases', # USER DEFINED STRUCTURE col_names => 'id,phrase', data_type => 'user', parser => sub { split /=/,shift }, }, [ '1=Hello new world!', '2=Junkity Junkity Junk', ], 'import' ); This example shows a way to implement a simple name=value parser. The subroutine can be as complex as you like however and could, for example, call XML or HTML or other parsers, or do any kind of fetches or massaging of data (e.g. put in some LWP calls to websites as part of the data massaging). [Note: the actual name=value implementation in the DBD uses a slightly more complex regex to be able to handle equal signs in the value.] The parsing subroutine must accept a row of data in the user-defined format and return it as an array. Basically, the import() method will cycle through the array of data, and for each element in its array, it will send that element to your parser subroutine. The parser subroutine should accept an element in that format and return an array with the elements of the array in the same order as the column names you specified in the import() statement. In the example above, the sub accepts a string and returns and array. PLEASE NOTE: If you develop generally useful parser routines that others might also be able to use, send them to me and I can encorporate them into the DBD itself. =head2 FROM SQL STATEMENTS You may also create tables with standard SQL syntax using CREATE TABLE and INSERT statements. Or you can create a table with the import method and later populate it using INSERT statements. Howver the table is created, it can be modified and accessed with all SQL syntax supported by SQL::Statement. =head1 USING MULTIPLE TABLES A single script can create as many tables as your RAM will support and you can have multiple statement handles open to the tables simultaneously. This allows you to simulate joins and multi-table operations by iterating over several statement handles at once. =head1 TO DO Lots of stuff. For now, I think the main thing I need to puzzle out is an export() method -- dumping the data back into files and/or other databases. Make some defaults for import() so it will add a table name and column names if none supplied and so it can quickly import from after a script __END__ for really fast and dirty prototyping. Let me know what else... =head1 AUTHOR Jeff Zucker Copyright (c) 2000 Jeff Zucker. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself as specified in the Perl README file. Portions copyright (C), 1998 by Jochen Wiedmann This is alpha software, no warranty of any kind is implied. =head1 SEE ALSO DBI, DBD::CSV, SQL::Statement =cut ------------------------------------------------------------------------------ To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html If you are without web access, or if you are having trouble with the web page, please send mail to dbi-users-request@isc.org with the subject line of 'unsubscribe'. ------------------------------------------------------------------------------ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Fri Mar 10 03:25:03 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:46 2004 Subject: POD for DBD::RAM version 0.03 (fwd) In-Reply-To: ; from corliss@alaskapm.org on Thu, Mar 09, 2000 at 07:11:30AM -0900 References: Message-ID: <20000310002503.M16817@shoebox.net> On Thu, Mar 09, 2000 at 07:11:30AM -0900, corliss@alaskapm.org wrote: > Any DBI users out there? This guy's got a neat module under construction > for modeling data-layers w/o an RDBMS. Depending on how efficient it is, > I could see a lot of other uses for it, too. . . > =head1 NAME > > DBD::RAM - a DBI driver for in-memory data structures This looks very interesting. The first use for it that pops into my head is a temporary storage area for complex queries on a database that doesn't do sub-selects (such as mysql). Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Fri Mar 10 03:33:53 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:46 2004 Subject: POD for DBD::RAM version 0.03 (fwd) In-Reply-To: <20000310002503.M16817@shoebox.net> Message-ID: On Fri, 10 Mar 2000, Michael Fowler wrote: > This looks very interesting. The first use for it that pops into my head is > a temporary storage area for complex queries on a database that doesn't do > sub-selects (such as mysql). Yeah, I could see a lot of uses for internal data structures, too. Once it becomes a little less developmental, I might start using it. Being able to access things with straigth SQL would nice in a lot of situations. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at gallanttech.com Fri Mar 10 16:38:02 2000 From: corliss at gallanttech.com (corliss@gallanttech.com) Date: Wed Aug 4 23:56:46 2004 Subject: A must read :-) Message-ID: Greetings: Check out an interesting dream (hint: it involves Linux developers and a Perl OS): http://lwn.net/2000/0309/a/perlos.html --Arthur Corliss Programmer/Administrator Gallant Technologies (http://www.gallanttech.com/) ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Fri Mar 10 17:01:56 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:46 2004 Subject: A must read :-) In-Reply-To: ; from corliss@gallanttech.com on Fri, Mar 10, 2000 at 01:38:02PM -0900 References: Message-ID: <20000310140155.P16817@shoebox.net> On Fri, Mar 10, 2000 at 01:38:02PM -0900, corliss@gallanttech.com wrote: > Greetings: > > Check out an interesting dream (hint: it involves Linux developers and a Perl > OS): Yea, this message was forwarded to the perl5-porters list. There was some discussion following, mostly regarding the kill /regex/ syntax and Perl shells. An archive of the discussion can be found at: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-03/msg00214.html Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Fri Mar 17 02:07:41 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:46 2004 Subject: [stephan@corecom.net: FW: O'Reilly Seeking "Perls" of Wisdom] Message-ID: <20000316230741.T620@shoebox.net> In case anyone on this list isn't also on the AKLUG list. ----- Forwarded message from "Stephan F. Stevens" ----- From: "Stephan F. Stevens" To: "AKLUG List" Subject: FW: O'Reilly Seeking "Perls" of Wisdom Date: Tue, 15 Feb 2000 16:25:20 -0900 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) >From one of your favorite publishers... :) Stephan -----Original Message----- From: Denise Olliffe [mailto:deniseo@oreilly.com] Sent: Tuesday, February 15, 2000 10:51 AM To: stephan@corecom.net Subject: O'Reilly Seeking "Perls" of Wisdom Hello from O'Reilly... We'd like to know how you're using Perl! O'Reilly & Associates invites you to participate in our Perl survey located at: http://perl.oreilly.com/survey/ After completing the survey, you'll be eligible to win an autographed copy of Johan Vromans' Perl 5 Pocket Reference, plus a newly released O'Reilly T-shirt, Perl: The Open Source Advantage. (We'll select 200 winners by a random drawing. The first 100 winners will receive both the book and T-shirt, the following 100 will receive a T-shirt). Visit our web site, complete the Perl survey, and help us find out what the Perl community is thinking! _______________________________________________ AKLUG maillist - AKLUG@aklug.org http://www.tara-lu.com/maillists/listinfo/aklug ----- End forwarded message ----- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Wed Mar 22 14:22:29 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:46 2004 Subject: Thirteen Ways to loathe VB Message-ID: Greetings: Recently ran across this article by Verity Stob, and I had to pass it on. :-) ============================================================================== Thirteen ways to loathe VB ========================== Verity Stob has recently been press-ganged into a Visual Basic project. For the benefit of other programmers who may be brought down in this way, she has prepared an executive summary of her experience. 1. Procedure and function call. This area of Basic has come on in leaps and bounds. Whereas in the bad old days you had to use GOSUB, these days you have subs ('subs' is the preferred baby-speak for what grown-ups call procedures or void functions) and functions. You write: Subname Param1, Param2 to call sub Subname and: Result = FuncName(Param1, Param2) to call function FuncName. Notice the useful difference in syntax, with and without parentheses, which serves more purposes than I can describe. It is of course a syntax error to write: Subname(Param1, Param2) but the good news is you can write: FuncName(Param1, Param2) to call a function and ignore its return. However, if Param1 or Param2 are reference parameters - and they will be unless you have specifically demanded value parameters - they will be treated in this specific case as value parameters, and any assignment to them discarded on exit from FuncName. Obviously the syntax: Call FuncName(Param1, Param2) fixes this, and causes Param1 and Param2 to be treated as reference parameters. Right. 2. Variable declaration. This is achieved using the intuitive keyword Dim. To declare an integer I write Dim I As Integer To declare a whole load of integers write: Dim I, J, K, L As Integer Actually (haha got you!) this doesn't work. This declares I, J, and K as variants and only L as an Integer. This almost never matters, except quite often. 3. Calling functions and accessing arrays. In most languages you can distinguish between a call to function F with parameter 3 and a reference to array F index 3 because one is written F(3) and the other F[3]. In Visual Basic they are both written F(3). Yes. 4. Another thing about arrays. The index of the first element is 0, unless it is set to 1 by a directive. 5. But there are also collections, modern object-oriented versions of arrays. And the first element of these is usually 1, unless it happens to be 0. Sometimes it is 0 and sometimes it is 1, depending on where you found it. Do you feel lucky, punk? Well, do ya? 6. Did I mention 'object-oriented' back there? Hahahahahahahahahahahahaha. 7. Initialisation. This area of Basic has come on in leaps and bounds. Whereas in the bad old days you had to use a completely barbaric mechanism based on the keywords DATA and READ, this has now been swept away. The fragment below illustrates the modern way to initialise an array in code. Dim A(20) As Double A(0) = 4.5 May work, may not, who can tell? A(1) = 4.71 A(2) = 4.82 A(3) = 4.92 ... You get the idea. 8. Arrays of constants. No such thing. Anyway, what would you do with 'em if you had 'em? 9. The type Integer declares a 16-bit integer. That's right, sixteen bits. Yes I am using the latest version. Unbelievable, isn't it? Let’s have a big warm EXE welcome back to code that dies suddenly around the 33 KB mark. 10. Assignment. This area of BASIC has come on in leaps and bounds. Whereas in the bad old days you used the operator for assignment, preceding it with LET if you were a fusspot of the first order, these days you use the = operator for assignment. Or Set if it's an object. Which is compulsory not optional. 11. Logic. This particular language is supposed to be easy and intuitive, so here's a test for you. Suppose that Check1 is a checkbox on a form, and you execute the code: Dim b As Boolean, c As Boolean b = Check1.Value c = Not Check1.Value Then b as expected will contain True if the checkbox is checked and False if the checkbox is unchecked. What do you think c will contain? (Clue: always True. No, really.) 12. The four magic constants of the apocalypse: Nothing, Null, Empty, and Error. 12.5 The stupid editor, which by default will put up a whining dialog if you try to leave a line which it recognises as syntactically incorrect. Like when you leave an incomplete line temporarily to go and copy a long identifier into the clipboard, for example. 12.7 The stupid compiler, which by default does a 'compile' so superficial that you can get runtime errors caused by an If missing its End If. 12.8 Procedures, sorry 'Subs', can be declared Public, Private, or Static. Two points to anybody who correctly guesses what Static does. Three points to anybody who can suggest a sane use for it. 13. Bill is making even more money out of this. And I am powerless to stop him. In fact, I am helping him. ============================================================================= --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Thu Mar 23 15:55:53 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:46 2004 Subject: Thirteen Ways to loathe VB In-Reply-To: ; from corliss@alaskapm.org on Wed, Mar 22, 2000 at 11:22:29AM -0900 References: Message-ID: <20000323125553.D313@shoebox.net> And here I was loathing VB simply because it's a Microsoft product. Who knew I had so many other good reasons.. ;) Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Mar 23 18:30:20 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:46 2004 Subject: Thirteen Ways to loathe VB In-Reply-To: <20000323125553.D313@shoebox.net> Message-ID: On Thu, 23 Mar 2000, Michael Fowler wrote: > And here I was loathing VB simply because it's a Microsoft product. Who > knew I had so many other good reasons.. ;) :-P I could certainly add to that list, believe me. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list