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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |