SPUG: Stupid Ascii question
Peter Darley
pdarley at kinesis-cem.com
Thu Aug 15 12:53:37 CDT 2002
Asim,
I've used Data::Dumper to store structures in a db in the past, but since
these will never be complex hashes (only simple key/value pairs)I figured
that it would be better to have something that is a little smaller.
After compression do you end up with a text string, or a binary string? I
need to figure out how to deal with binary objects in the db, but don't want
to do that right
at this point. :)
If I can't figure out weither the non-printable characters are safe I'll
fall back to Data::Dumper.
Thanks,
Peter Darley
-----Original Message-----
From: Asim Jalis [mailto:asimjalis at yahoo.com]
Sent: Thursday, August 15, 2002 10:42 AM
To: Peter Darley; SPUG
Subject: Re: SPUG: Stupid Ascii question
Peter Darley <pdarley at kinesis-cem.com> 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 to do this by having my front end
> app, written in Perl, put all the field names
> and values into a single string separated by a
> non-printing Ascii character which I can just do
> a split() on later to return a hash of the
> record, which is exactly what I would get if I
> did a fetchrow_hashref() on the original record.
> My question is this; what non-printing Ascii
> character can I use for this? I wanted to use
> chr(0), the ascii null, but postgresql or
> DBD::Pg or DBI or something chokes on it. I
> went with chr(31) which is described as 'unit
> separator'. I'm worried that there may be some
> unexpected interaction with file systems or
> something that I'm unaware of, so I thought I'd
> ask y'all. Thanks, Peter Darley
You should look into using Data::Dumper or YAML
instead of defining your own format. If space is a
consideration, you can compress the file as (or
after) you write it.
Asim
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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