Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: File I/O structure

by marinersk (Priest)
on Jul 11, 2013 at 20:23 UTC ( #1043819=note: print w/replies, xml ) Need Help??


in reply to File I/O structure

"Seem to" dominate? The very meaning of the name of Perl suggests it would be predominately focused on sequential text files.

That said, and DBM::Deep already mentioned, if you want to spin your own module to support what we in the dinosaur days would have called Fixed-Length Random Access File processes, you could look into the following features of Perl:

Input and output functions:

  • binmode
  • read
  • seek
  • sysread
  • sysseek
  • syswrite
  • tell
  • write

Modern data processing (is that an oxymoron?) thinks more in terms of XML and DB for re-usable, rewriteable data; but if you must play in the old fashioned fixed-length random-access file space, the above tools will readily permit migration of your old C code where you last reinvented that wheel to Perl where you seem fixated on this somewhat dated approach to data storage.

:-)

All that having been said, I myself could not resist the urge to port my old FLRAF routines to Perl when I first got here. I never bothered to write a module I would dare to put in front of other software engineers, however, since I knew going into the effort it was an exercise to produce a tool I was unlikely to ever need.

DBI/SQLite has been a good friend:

use DBI; my $dbargs = { AutoCommit => 0, PrintError => 1 }; my $dbscns = "dbi:SQLite:dbname=$Db_dbn"; &debug::debug("\$dbscns = '$dbscns\n"); my $dbshan = DBI->connect($dbscns,"","",$dbargs); &debug::debug("\$dbshan = '$dbshan'\n");
Updated to computerize DBM::Deep

Replies are listed 'Best First'.
Re^2: File I/O structure
by silverbullet (Initiate) on Jul 12, 2013 at 00:18 UTC
    I appreciate your suggestions and perspective. Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043819]
help
Chatterbox?
[choroba]: timestamps are hard
[1nickt]: not all all yet
[1nickt]: the stable subversion of each major version on the platform I have in my hands most of the day
[Tux]: choroba can't you up the default stack size to 17?
[1nickt]: and I will maybe add the other subversions
[1nickt]: I am on MacOSX and there is a sore lack of testing resources for CPANTS I think

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2017-09-19 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (228 votes). Check out past polls.

    Notices?