(uiserver):u61210220:/kunden/homepages/9/d349337426$ groups
ftpusers
####
(uiserver):u61210220:~$ perl -MCPAN -e shell
####
Warning: You do not have write permission for Perl library directories.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
####
---------env vars----
HOME=/kunden/homepages/9/d349337426/htdocs
LANG=C
LC_CTYPE=en_US.UTF-8
LOGNAME=u61210220
MAIL=/var/mail/u61210220
PATH=/kunden/homepages/9/d349337426/htdocs/perl5/bin::/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
PERL5LIB=/kunden/homepages/9/d349337426/htdocs/perl5/lib/perl5
PERL_LOCAL_LIB_ROOT=/kunden/homepages/9/d349337426/htdocs/perl5
PERL_MB_OPT=--install_base "/kunden/homepages/9/d349337426/htdocs/perl5"
PERL_MM_OPT=INSTALL_BASE=/kunden/homepages/9/d349337426/htdocs/perl5
PWD=/kunden/homepages/9/d349337426/htdocs
SHELL=/bin/bash
SHLVL=2
SSH_CLIENT=10.71.53.5 46314 22
SSH_CONNECTION=10.71.53.5 46314 74.208.56.168 22
SSH_TTY=/dev/pts/0
TERM=xterm-256color
USER=u61210220
_=/usr/bin/env
---------bash driver----
#!/bin/bash
#
#
...
PATH="/kunden/homepages/9/d349337426/htdocs/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/kunden/homepages/9/d349337426/htdocs/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/kunden/homepages/9/d349337426/htdocs/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/kunden/homepages/9/d349337426/htdocs/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/kunden/homepages/9/d349337426/htdocs/perl5"; export PERL_MM_OPT;
...
cd "perlmonks"
cd "scripts"
perl 1.upload.pl /home/bob/1.scripts/8.nik.pl | tee -a "$out"
...
exit $SUCCESS
####
-------executing 1.upload.sh
Can't open /home/bob/1.scripts/8.nik.pl: No such file or directory at /kunden/homepages/9/d349337426/htdocs/perl5/lib/perl5/CGI/Lite.pm line 862.
Use of uninitialized value $readme in concatenation (.) or string at 1.upload.pl line 79.
Use of uninitialized value $readme in at 1.upload.pl line 87.
readline() on unopened filehandle at 1.upload.pl line 87.
-------cat 1.upload.pl
#!/usr/bin/perl
# Simple example that displays the data associated with
# the "readme" file field in a multiform/form-data request.
use strict;
use warnings;
use CGI::Lite;
my $cgi = CGI::Lite->new;
# Die if the directory is invalid (i.e doesn't exist, can't
# read or write to it, or is not a directory).
$cgi->set_directory ("/tmp") or die "Directory doesn't exist.\n";
# Set the platform. "Unix" is the default. The method accepts
# platforms in a case insensitive manner, so you can pass
# "UNIX", "Unix", "unix", etc.
$cgi->set_platform ("Unix");
# Set the buffer size to 1024 bytes (1K). This is the default.
$cgi->set_buffer_size (1024);
# Let's change the way uploaded files are named!
$cgi->filter_filename (\&my_way);
# Tell the module to return filehandles.
$cgi->set_file_type ('handle');
# We want CGI::Lite to perform EOL conversion for all files that have the
# following MIME types:
#
# application/mac-binhex40
# application/binhex-40
#
# so, we use the add_mime_type method. In addition, we don't want
# files of MIME type: text/html to be converted. I'm sure you wouldn't
# want to do that in real life :-)
$cgi->add_mime_type ('application/mac-binhex40');
$cgi->add_mime_type ('application/binhex-40');
$cgi->remove_mime_type ('text/html');
# Let's go ahead and parse the data!
my $data = $cgi->parse_form_data;
print "Content-type: text/plain", "\n\n";
if ($cgi->is_error) {
my $error_message = $cgi->get_error_message;
print <{readme};
print <) {
print;
}
# Make sure to close the file!
$cgi->close_all_files;
}
exit (0);
sub my_way
{
my $file = shift;
$file =~ tr/A-Z/a-z/; # Upper to lowercase
$file =~ s/(?:%20)+/_/g; # One or more spaces to "_"
$file =~ s/%[\da-fA-F]{2}//g; # Remove all %xx
return ($file);
}