tags:

views:

124

answers:

1

I had a recent problem where Tie::File proved the best answer I could work with for a Perl program. I'm at a point where I'm ready to work with CGI, and I need to ask: are there Perl modules that can't be used in CGI, especially that Tie::File? If there are any complications, are there ways to reconcile them?

+9  A: 

A CGI is basically just a program that reads a request on STDIN and spews header + HTML on STDOUT. It isn't really special: there aren't any modules you can't use, if you try hard enough.

You could even get graphical (e.g., GTK) ones working with enough pain. Not that you'd want to. Unless you're a third-party vendor I've had the displeasure of making that work for.

But remember that multiple copies of your program may be running simultaneously (one per simultaneous web request), so if you're using flat files, you'll have to deal with locking.

derobert
That does help me a lot, but if you know, would there be any limitation to the Tie::File one? Right now I'm assuming that it should be fine, but if there are any problems I'll definitely need help figuring out what I need to do to make it work in CGI. Thank you very much.
No reason it shouldn't work provided it's available in the environment you're going to run the CGI in. Without looking at Tie::File, I'm confident that it's as simple as shipping it alongside your foo.cgi file in an appropriate library directory. Beter would be using CPAN to install it, of course.
tsee
Tie::File comes with perl, so it's going to be there. It should work fine *if you lock the file*.
derobert