May 6, 2012 Update: If you have the ability to ssh into your server as root, skip to step 4 below. By far the fastest and cleanest method is to install cpanm (if it's not already), then turn around and use it to install CGI::WebGzip:
cpan App::cpanminus cpanm CGI::WebGzipAny Perl module can be installed using cpanm Module::Name: see Cpan for more.
I first tried the method outlined in the article How To Install Perl Modules On Shared Hosting, but I couldn’t get it to work quite like the author suggested. With a little experimentation, however, I found a way to gzip Perl files on a 1&1 Beginner’s Package.
Step 1:
Download a copy of CGI-WebGzip from CSPAN. Unzip it, and extract WebGzip.pm, the file you need. (If you don’t have the software to unzip tar.gz files, download a copy of the free 7-zip for your operating system, and tell your computer to use the 7-Zip File Manager (7zFM.exe on Windows) to open files with the tar.gz extension. Such files are "zipped twice," so you'll have to unzip the .gz part, then the .tar part before you finally get to your files.)
Step 2:
Open WebGzip.pm and take out take out the CGI:: on the very first line, changing it from:
package CGI::WebGzip;to:
package WebGzip;Step 3:
Upload the WebGzip.pm file to the same directory where the Perl CGI-scripts you want to compress live.
Now open your Perl file. On the second line under the Perl shebang (#!/usr/local/bin/perl), add the following:
use lib "$ENV{DOCUMENT_ROOT}/path_to_Perl_scripts"where you change path_to_Perl_scripts to the directory from root in which they live.
For example, if you have your Perl files stored in a directory called Perl inside another directory called scripts, the line would read use lib "$ENV{DOCUMENT_ROOT}/scripts/Perl". This tells the script to use the library located in such-and-such directory from the root.
Step 4:
Somewhere in your Perl script should be the following line or one very similar:
print "Content-type: text/html\n\n";which tells the script to print the output to the screen as HTML. Directly above that line, add the following line:
(Update continued: cpanm installers need to use
use CGI::WebGzipinstead, the normative way of importing Perl modules. Otherwise...)
use WebGzip; print "Content-type: text/html\n\n";This line tells the script to include the module you just uploaded when it outputs its contents.
Step 5:
First check and make sure that your Perl script loads as expected: it is possible that you left a semi-colon off somewhere or got something a bit out of place. Once that is done, test to see that your file is being compressed using either HTTP Compression Test or GIDZipTest.
If compression is still not working, go back to step four and see if there are any other such lines in the script. If you are not using a 1&1 hosting package, you might also look at the asterisk below.*
* Your server will need to have the Compress::Zlib module installed. It is possible, even if it is not installed, you could use a method similar to the one outlined in this document to include it: you can download it here.
If you’re not sure if you have it installed and you’re not sure how to check, try the directions here and see if it works. If it works, you have Compress::Zlib installed.
If you’re not sure if you have it installed and you’re not sure how to check, try the directions here and see if it works. If it works, you have Compress::Zlib installed.
All steps are very good, thanks for sharing this post
ReplyDeleteWeb Design Company in Bangalore | web Development Company in Bangalore | Website Design Company in Bangalore | Website Designers in Bangalore
It is amazing that people describe these things.
ReplyDeleteBlanche
Your comment was great it’s really helpful for me a lot,Thank you so much for share my blog.
ReplyDeleteJeans Manufacturers in Delhi
Superb it’s really helpful for me a lot,Thank you for share my blog.
ReplyDeleteplay school cartoon wall painting
Awesome blog, I got a lot of valuable information by this. Thank you so much for share my blog.
ReplyDeleteLifestyle Magazine
Superb blog comment, thanks for this valuable information.
ReplyDeleteShipping Company in India
Excellent post! I must thank you for this informative read. I hope you will post again soon.
ReplyDeleteWebsite Designing Company In Delhi | Internet Marketing Services In Delhi
This is an amazing blog. Your blog is really good and your blog has always good thank you for information. Online Teaching Software.
ReplyDeleteOne of the best things about these kind of services is that you can even design your own website with many advantages as well. To get more interesting details about webpage scientist, learn here.
ReplyDeleteGreat! Thanks for sharing this kind of information it’s really very nice and useful for me.
ReplyDeleteWebsite Designing Company in South Delhi
Web Plus Era is a leading Website Designing Company in Dwarka. We offer web development solutions, but also Delhi web services. Mobile apps have been the center of attraction for most of the people. For almost all e-commerce websites and business operators, mobile apps are a wonderful way to make your way to a lot of major customers, clients, and a large market segment. Web Plus Era is the best App Development Company in Delhi. Responsive Website designs are in excessive call for because of their better functionalities and responsiveness to make stop person revel in a memorable one. Companies are making an investment large on responsive net layout offerings. Web Plus Era is among the quickest rising Responsive Web Design Services responsive net designing organizations within side the India,Delhi. Website Designing Company in DelhiVery satisfied with the Website designing work effort by your team! Happy to recommend it to anyone looking for Website Designing service Web Plus Era is best Place for your Digital Work like website,seo,smo etc.