To answer your questions: I switched from the object-oriented interface to the function oriented interface because you were using both and I decided to stick with one or the other:

use CGI ':all'; use Fcntl; use strict; my $q = new CGI; print header, start_html('file upload'), h1('file upload');

From the snippet above, you can see that you're instantiating a new CGI object but you're also using the start_html and h1 functions that you've imported into your namespace with ":all". There are other examples in your program, but I decided to just use the function-oriented interface as it makes the code look a bit cleaner (though there are times that the object-oriented interface can give you some fine-grained control that the function oriented interface cannot). If I were to have switched to the OO interface, the above snippet would have looked like this:

use CGI; use Fcntl; use strict; my $q = CGI->new; print $q->header, $q->start_html('file upload'), $q->h1('file upload');

To be frank, the reason I used sysopen is because that's what you were using :) I wasn't really focusing on making sure that everything was exactly what you needed. I was just trying to get the darned thing to work.

sysopen has the advantage of offering finer control over opening files than open. For instance, you can open files with sysopen and specify that they not exist when you try to open that. With open, you have to add extra code to test for existence of the file.

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re(3): CGI Uploads, again! by Ovid
in thread CGI Uploads, again! by michellem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.