Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Re: Alternatives to User::Agent?

by sgifford (Prior)
on Jul 20, 2003 at 15:21 UTC ( [id://276054] : note . print w/replies, xml ) Need Help??

in reply to Re: Alternatives to User::Agent?
in thread Alternatives to User::Agent?

Even without shell access, you can often install modules. I frequently write short shell scripts, upload them into my Web hoster's cgi-bin directory, then use them to compile and install my Perl modules:
#!/bin/bash -x

printf "Content-type: text/plain\n\n"
exec 2>&1

export PERL5LIB=$H/lib/perl5

cd $H/src
tar xvzf "$MOD.tar.gz"
cd "$MOD"
make clean
perl Makefile.PL LIB=$H/lib/perl5 && 
  make && 
  make test && 
  make install
I just set H to my home directory (which I often get by running a shell script that just does pwd, since I may be chroot'd when I FTP in), then browse to the CGI script. On Mozilla at least, the lines come across in real time.

Setting PREFIX may work even better than just setting LIB, but I haven't tried it (I will next time).

Replies are listed 'Best First'.
Re: Re: Re: Alternatives to User::Agent?
by tilly (Archbishop) on Jul 20, 2003 at 17:09 UTC
    Just be careful after you do so to remove them again. (Allowing people to run arbitrary shell scripts is a security hole.)

    UPDATE: bobn is right. The above script does not allow someone to run arbitrary code. This reply was just a knee-jerk response to seeing someone doing administration through running shell scripts in cgi-bin.

      Where does the script run an abritrary shell script?

      --Bob Niederman,
        I agree, even though my script doesn't allow arbitrary code to be run, that leaving it lying around is a bad idea. If you're feeling particularly paranoid, you can create an admin directory of cgi-bin with a .htaccess file that protects them with a password.
Re: Re: Re: Alternatives to User::Agent?
by meatpopsicl3 (Initiate) on Jul 21, 2003 at 23:58 UTC
    I figured out that the module I need to LWP::UserAgent is libwww-perl-5.69.tar.gz

    Now, do I need to put anything into /lib/perl5 ?

      You need to compile that package and install it somewhere. If you're not the admin of the system, you'll have to install into someplace under $HOME, like $HOME/lib/perl5.

      You should be able to modify my earlier script to compile and install your module without having shell access.