(ar0n) Re: Flat Files
by ar0n (Priest) on Mar 05, 2001 at 20:42 UTC
|
Check out DBD::CSV. It allows you to have a DBI interface to a text-file. Instead of actually using a database, you simply use a commma-seperated text file.
Just my $0_02;
[ar0n]
| [reply] [d/l] |
Re: Flat Files
by davorg (Chancellor) on Mar 05, 2001 at 20:46 UTC
|
DBD::CSV is a good idea, but last time I looked at it
there was very quite a long list of other modules that it
relied on.
Have you considered tieing a hash to a DBM
file? That would give you random access to the records
and the DBM module will take care of all the reads and
writes.
--
<http://www.dave.org.uk>
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
| [reply] |
Re: Flat Files
by azatoth (Curate) on Mar 05, 2001 at 20:51 UTC
|
Assuming you would like to read the email addies into an array via a filehandle, you could always use rand. Like this : -
srand; # initialize random UPDATE : This is only needed for earlier
+versions of Perl, thanks to Albannach for telling me :)
$random_email_address = $email [rand @email]; #assuming your array of
+email addresses is named @email
print $random_email_address;
This will do the random bit for you, in a very simple, low-level way. I'm sure someone will post some hardcore code that randomises via regex and sorts out your size issues with some DB stuff etc...
Just my two cents...
Azatoth a.k.a Captain Whiplash
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner? | [reply] [d/l] [select] |
Re: Flat Files
by skazat (Chaplain) on Mar 06, 2001 at 00:17 UTC
|
you may want to first think of how you're going ot handle the mailing list itself and then figure out the details. You may want to take an already existing script and tweak/build on top of it.
check out:
Mail Man - http://list.org
Majordomo - http://greatcircle.com/majordomo
Subscribe Me - http://cgiscriptcenter.com
<shamless plug>
Mojo Mail http://mojo.skazat.com
</shamless plug>
-justin simoni
!skazat!
| [reply] |
Re: Flat Files
by Anonymous Monk on Mar 05, 2001 at 20:57 UTC
|
Thanks all, about srand..The file that contains the emails will get huge, I am using one main text file to store all emails signed up..we may be talking about 1-2k per day emails. Can it handle this ?
| [reply] |
|
|
Depends on the OS you're using.
Filesize is not a Perl issue, as far as I know.
However, on a pre 2.4 linux Kernel, the file limit is 2GB.
BSD variants don't have this and can go significantly above this limit (far more than you'll get in a few weeks of plain text).
The same goes for NT and Novell. Not sure about the win 9x variants tho.
HTH,
Malk
| [reply] |
|
|
Actually file size can be a Perl issue. If you have Perl and compile without large file support, then you will be limited to 2 GB files, even if your OS can handle much larger. (Not that this matters to most people.)
| [reply] |
|
|
| [reply] |