Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I'm not a huge fan of the "treat everything as a local file" abstraction. You run into all kinds of pain for things like big files, authentication, proxies etc.

    In 5.8 I'm sure can you do something like: open my $fh, \get($url)?

    • by Ovid (2709) on 2003.09.29 13:28 (#24571) Homepage Journal

      We've had this discussion before and I definitely see your point. However, what you bring up is the sort of problem that I'm talking about. Ultimately, these document fetching mechanisms all boil down to "open, read/write and close". There are a few fiddly bits in there, but I don't want to deal with them. I want to simply "fetch a document from a resource". To put this in perspective, consider the JCL (job control language) used by mainframe programmers in the 60s to work with a file (and this type of stuff is still used today).

      //NEWFILE  DD DSN=B7707O.DDA50010.APDATA,
      //            DISP=(NEW,CATLG,DELETE),
      //            UNIT=DASD,
      //            SPACE=(CYL,(150,150),RLSE),
      //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400)

      Basically, we say where the file is (DSN). That's great. Then we say whether or not we're using a new file or an old one and what to do with the file upon success or failure of the JCL (DISP). Then we specify how we're storing it (UNIT), how much memory it can use (SPACE), how the records are laid out (DCB), etc. Those were the fiddly bits of the sixties and I suspect that most programmers back then would have had the same type of objections to open my $fh, $file or die $! as you do about "leaky abstractions".

      It's not that what you're pointing out is irrelevant, it's that designing smarter abstractions and better protocols will necessarily stem from someone saying "hey, this is grunt work!"