SPUG: Stupid Ascii question

Peter Darley pdarley at kinesis-cem.com
Thu Aug 15 13:15:00 CDT 2002

	The Text::CSV_XS option seems very close to the Data::Dumper option, which
I guess I would prefer since it creates more human readable (at least to me)
	It looks like the consensus is that I should use something to create a
string for me that will take care of all the escaping of separators and
such.  I'll probably use Data::Dumper.
Thanks everyone,
Peter Darley

-----Original Message-----
From: Colin Meyer [mailto:cmeyer at helvella.org]
Sent: Thursday, August 15, 2002 10:56 AM
To: Peter Darley
Subject: Re: SPUG: Stupid Ascii question

On Thu, Aug 15, 2002 at 09:54:44AM -0700, Peter Darley wrote:
> Friends,
> 	I am working with database stuff and I want to store deleted database
> records, so there's a history of what was in the database.  I have chosen
> do this by having my front end app, written in Perl, put all the field
> and values into a single string separated by a non-printing Ascii
> which I can just do a split() on later to return a hash of the record,
> is exactly what I would get if I did a fetchrow_hashref() on the original
> record.

I would suggest two alternatives. Since you are already using a
database, which does a good job of keeping separate fields, you could
use another table to hold the deleted records. This table would simply
have the same columns as the original table. Trying to encode and decode
fields from a string seems like a lot of extra work that the db is quite
capable of.

Another option would be to use Text::CSV_XS. This is a module that is
very good at joining and splitting fields to and from strings. You can
select the separator character, or let it use the default comma (which
it automatically escapes within your fields).

Have fun,

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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 daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list