USING PERL MODULES ON TRIPOD
Note: In order to use Tripod's Script Editor and CGI service, you must sign up
to have your cgi-bin enabled within Filemanager.
Modules are a great way to add functionality to your scripts without having to
do all the work yourself. After all, if somebody else has done the job of
figuring out how to read CGI input from a form, or calculate which of two dates
is the earlier one, why shouldn't you benefit from their work?
Here at Tripod, we've already done the work on a few modules that we think might
be useful to you. In this document, we'll go over the general way these modules
work, so you can start using them in your scripts. You'll also want to read the
instructional comments at the beginning of any module that you decide to use,
which will give you more specifics about the functions the module provides.
Please note that the modules are in beta-test as well - so if you encounter any
problems with them, we'd appreciate it if you'd let us know, at rnd@tripod.com!
Also, you can use modules written by other people (including yourself) in your
scripts, as long as you copy them into your cgi-bin directory. Not all modules
work the same way the Tripod modules do, so you may need to do some additional
work to figure them out.
To start using one of the Tripod modules in a script, you'll first want to add
this line of code to your script (for this example, we'll use the TripodCGI
module):
require Modules::TripodDate;
This lets the Perl interpreter know that you want to have access to the
functions in the module. Next, you can create an "object" that will
let you access those functions (if you know any object-oriented programming,
this should sound familiar - otherwise, just think of the object as a simple way
to get access to those functions). You do that like this:
$CGI = new Modules::TripodDate;
The variable $CGI is now a TripodDate object. With it, you can use the functions
in the TripodDate module. For example, you can use the currentDate() function,
which returns today's date, like this:
$todays_date = $CGI->currentDate();
This would assign the date to the $todays_date variable.
Now, you should be able to get started in using the Tripod modules in your
scripts. Remember to look at each individual module as well, as they will give
you specifics about the functions they provide and how to use them.