[16803] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4215 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 3 18:05:54 2000

Date: Sun, 3 Sep 2000 15:05:27 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968018726-v9-i4215@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 3 Sep 2000     Volume: 9 Number: 4215

Today's topics:
    Re: $LIST_SEPARATOR bug?? <gellyfish@gellyfish.com>
    Re: $LIST_SEPARATOR bug?? <gellyfish@gellyfish.com>
    Re: $LIST_SEPARATOR bug?? <flavell@mail.cern.ch>
    Re: $LIST_SEPARATOR bug?? <flavell@mail.cern.ch>
        A Challenge <got1toomany@trojans.com>
    Re: A Challenge (Marcel Grunauer)
    Re: cgi-perl <Peter@Berghold.Net>
        cookies and SSI's <jpryan@cis.tamu.edu>
    Re: creating an enviroment variable <ship@long.eecom.gatech.edu>
    Re: Deleting tempfile after use <gellyfish@gellyfish.com>
    Re: dont refresh <gellyfish@gellyfish.com>
    Re: dont refresh <bart.lateur@skynet.be>
        fileupload issue <andreas@happy3d.net>
    Re: fileupload issue <jpryan@labs.tamu.edu>
    Re: fileupload issue <jpryan@labs.tamu.edu>
    Re: fileupload issue <jpryan@labs.tamu.edu>
        Getting a range of rows with DBI <nospam@jsoft.xs4all.nl>
    Re: Hashref infix misunderstood? (Soren Andersen)
    Re: hello world? <gellyfish@gellyfish.com>
    Re: hello world? sendkeys@my-deja.com
        help with forking joekind@my-deja.com
    Re: help with forking <brian+usenet@smithrenaud.com>
    Re: How do I manipulate each element of an array? <palincss@his.com>
    Re: How do you use setuid in perl (Colin Keith)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 3 Sep 2000 13:21:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <8otfnp$7e4$1@orpheus.gellyfish.com>

On Sat, 2 Sep 2000 12:24:39 +0200 Alan J. Flavell wrote:
> On Sat, 2 Sep 2000, Keith Calvert Ivey wrote:
> 
> (in a news posting tagged as iso-8859-1):
> 
>> I don't think you can blame Redmond for this one.  Using `` for
>> double quotes is a Unix thing, in my experience.  Microsoft
>> quoting would have been something like $^T 
> 
> dollar caret T??
> 

Er, $ (Two characters) I guess - tin will display these (non iso8859-1) 
chars as '?'

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


------------------------------

Date: 3 Sep 2000 13:43:44 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <8oth20$7fg$1@orpheus.gellyfish.com>

On Fri, 1 Sep 2000 14:07:55 -0700 Larry Rosler wrote:
> In article <8op1e5$c42$1@nnrp1.deja.com> on Fri, 01 Sep 2000 19:52:47 
> GMT, Steven Merritt <smerr612@mailandnews.com> says...
> 
> ...
> 
>> Try $" = '';
> 
> I would prefer to use
> 
>       $" = "";
> 
> so the value assigned doesn't appear anything like one double-quote.
> 

Dodgy screen font I would say :) In the font

   -misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso8859-1

I have in this terminal the double quote is two shorter very close vertical
strokes whereas the single quote is definitely diagonal with a hint of a
bobble at the top (as you might do in handwriting) and there is significant
space between them when typed together. In the console font however the
double quote is slanted making one more similar to two single quotes 
although to my eye there is sufficient space between them so as to make
them distinguishable.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


------------------------------

Date: Sun, 3 Sep 2000 21:17:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <Pine.GHP.4.21.0009032107590.18361-100000@hpplus03.cern.ch>

On 3 Sep 2000, Jonathan Stowe wrote:

[in the font...]
> I have in this terminal the double quote is two shorter very close vertical
> strokes whereas the single quote is definitely diagonal with a hint of a
> bobble at the top (as you might do in handwriting) 

[Excuse short offtopic digression, but...]

Well, you might like the look of it that way, but after much argument
over the years the ASCII apostrophe is supposed to be a
left-right-neutral kind of thing, as is the ASCII quote (unicode has
separate code points for the "handed" opening/closing forms).  See the
reference charts at Galactic^W Unicode HQ

http://charts.unicode.org/Charts/U0000.gif  and
http://charts.unicode.org/Charts/U2000.gif

The traditional Unix usage of back-tick as an opening quote and
apostrophe as a closing quote is still widely observed in its
particular niche, but in general is deprecated as a typographical
usage, as far as I understand it.

As for distinguishing between them on the screen, this should be
much easier on a computer (highlighting or copy/pasting) than on
a printed sheet, no?

HTH ;-)



------------------------------

Date: Sun, 3 Sep 2000 21:28:08 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <Pine.GHP.4.21.0009032118480.18361-100000@hpplus03.cern.ch>

On 3 Sep 2000, Jonathan Stowe wrote:

> Er, $^T (Two characters) I guess -

That 8-bit control character which you put into your posting is still
being presented to me as caret-T.

(If you meant it to be a displayable character then your news
header might have said windows-1252 [please accept my apologies in
advance for making such a heinous suggestion] whereas in fact it said
ISO_8859-1.)

>  tin will display these (non iso8859-1)chars as '?'

Seems fairynuff too.  I was only trying to make the point that
sticking the erroneous character into a news posting doesn't get us
much further.  What you see is not necessarily what they/we get.

But as the subsequent discussion showed - the previous poster (KCI)
knew that very well, and was using it as a demonstration of the
problem.

all the best (f'ups prophylactically set)



------------------------------

Date: Sun, 03 Sep 2000 16:55:06 GMT
From: James Bond <got1toomany@trojans.com>
Subject: A Challenge
Message-Id: <9205rssmbg6g53m5goha4cvhb9qari0djf@4ax.com>

I came accross the following script. It was essentially designed to
display the contents of a directory on a web page. The writer said
he designed it for an ftp site.

Although I like the script as is, I can't do what I really want with
it. I'd like to be able to display the contents of multiple dirs.

I'm new to perl (not a programmer by any stretch), and I've tried
anything I can think of. I always end up killing the script, or only
seeing the contents of one dir.

Any takers????

here is the script:

#!/usr/local/bin/perl
########################################################
#                     FTPex 0.9b2                      #
#               By Thomas Tsoi 05.8.99                 #
#                webmaster@cgi.com.hk                  #
########################################################
#                                                      #
# CGI.com.hk:                                          #
#   http://www.cgi.com.hk/                             #
#                                                      #
# #################################################### #
#                                                      #
# You can distribute this script and use it freely as  #
# long as this header is not edited in the script.     #
#                                                      #
########################################################

########################################################
# URL of this script
$script    = "http://www.astronomy.org.hk/perl/ftpex/FTPex.cgi";

########################################################
# Base absolute path and base URL, $basedir SHOULD point to $baseurl
$basedir   = "/home/astronom/public_ftp";
$baseurl   = "ftp://astronomy.org.hk";

########################################################
# Header and Footer files
$header    = "/home/astronom/public_html/perl/ftpex/header.txt";
$footer    = "/home/astronom/public_html/perl/ftpex/footer.txt";

########################################################
# URL to images directory, relative or absolute
$imagedir  = "images";

########################################################
# File types with their own images, the images should be named
[type].gif
@filetypes = ("avi", "bmp", "gif", "html", "jpg", "mov", "mpeg",
"swf", "txt", "zip");

########################################################
# To enable internal text viewer, set to 1, or 0 otherwise
$textviewer= 1; 

########################################################
# File types which uses the internal text viewer
@texttypes = ("txt", "msg", "ini");

# END OF CONFIG
########################################################
########################################################
# By the way, to Perl programmers:
# I'm not quite familiar with directory handling
# I used a quite silly method to determine which is a dir 
# and which is a file (but it works, of course)
# If you have a better method, please email me

($action, $vir_path) = split(/&/, $ENV{'QUERY_STRING'});
$vir_path =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

if ($ENV{'QUERY_STRING'} ne "") {
	if ($vir_path =~ /^\.\./ || $vir_path =~ /\/\.\.\// ||
$vir_path =~ /\.\.$/) {
		print "Content-type: text/html\n\n";
		print &header;
		print "<font size=3 face=arial><b>You are not allowed
to access a higher level directory with ..</b></font>\n";
		print &footer;
		exit;
		}
	else {
		$path = "$basedir/$vir_path";
		}
	}
else {
	$path   = $basedir; 
	$action = "browse";
	}

$thisdir = ($vir_path eq "") ? "" : "$vir_path/";
($action eq "browse") ? &browse : &get;

###############
sub browse {

print "Content-type: text/html\n\n";

opendir(BASE, $path);
@names = readdir(BASE);
closedir(BASE);

foreach $name (@names) {	
	$isdir = opendir(DIR, "$basedir/$thisdir$name");
	if ($isdir == 1) {
		push(@dirs, $name) unless ($name eq '.' || $name eq
'..');
		}
	else {
		push(@files, $name);
		}
	closedir(DIR);
	
	(undef, undef, undef, undef, undef, undef, undef,
	$size, undef, $modified, undef, undef, undef) =
stat("$basedir/$thisdir$name");
	($min, $hr, $day, $mon, $yr) =
(localtime($modified))[1,2,3,4,5];
	$min = "0$min" unless $min >= 10;
	$hr  = "0$hr"  unless $hr  >= 10;
	$day = "0$day" unless $day >= 10;
	$mon = "0$mon" unless $mon >= 10;
	$filesize{$name} = $size;
	$last_mod{$name} = "$mon/$day/$yr $hr:$min";
	}

print &header;

$thisdir =~ s/ /\%20/g;

print "<table border=0 cellspacing=1 width=80%>\n";
print "<tr>\n";
print "<td align=center width=50%><font size=2
face=arial><b>Name</b></font>\n";
print "<td align=center width=30%><font size=2 face=arial><b>Last
Modified</b></font>\n";
print "<td align=center width=20%><font size=2 face=arial><b>Size
(Bytes)</b></font>\n";
print "</tr>\n";

print "<tr>\n<td colspan=3>\n";
print "<font size=2 face=arial><b>\n";
if ($vir_path ne "") {
	$temp = $vir_path =~ tr#/#/#;
	if ($temp > 0) {
		$pardir = "?browse&".substr($vir_path, 0,
rindex($vir_path, "/"));
		}
	else {
		$pardir = "";
		}
	print "<img src=\"$imagedir/up.gif\" align=\"absbottom\"><a
href=\"$script$pardir\">Parent Directory</a>\n";
	}
print "</b></font>\n";
print "</td>\n</tr>\n";

foreach $dir (sort @dirs) {
	$dir_url = $dir;
	$dir_url =~ s/ /\%20/g;
	print "<tr>\n<td>\n";
	print "<font size=2 face=arial><b>\n";
	print "<img src=\"$imagedir/dir.gif\" align=\"absbottom\"><a
href=\"$script?browse&$thisdir$dir_url\">$dir</a></b></font>\n";
	print "</td>\n";
	print "<td align=right><font size=2
face=arial><b>$last_mod{$dir}</b></font></td>\n";
	print "<td align=right><font size=2
face=arial><b>$filesize{$dir}</b></font></td>\n";
	print "</tr>\n";
	}

foreach $file (sort @files) {
	$ext = substr($file, rindex($file, "\.")+1);
	$type = "file";
	foreach $filetype (@filetypes) {
		if (lc($ext) eq $filetype) {$type = $filetype;}
		}
	$file_url = $file;
	$file_url =~ s/ /\%20/g;
	print "<tr>\n<td>\n";
	print "<font size=2 face=arial><b>\n";
	print "<img src=\"$imagedir/$type.gif\" align=\"absbottom\"><a
href=\"$script?get&$thisdir$file_url\">$file</a></b></font>\n";
	print "</td>\n";
	print "<td align=right><font size=2
face=arial><b>$last_mod{$file}</b></font></td>\n";
	print "<td align=right><font size=2
face=arial><b>$filesize{$file}</b></font></td>\n";
	print "</tr>\n";
	}
print "</table>\n";

print &footer;

}

sub get {

if ($textviewer) {
	$ext = substr($vir_path, rindex($vir_path, "\.")+1);
	foreach $type (@texttypes) {
		if ($type eq $ext) {
			$flag = 1;
			}
		}
	if ($flag) {
		print "Content-type: text/html\n\n";
		print &header;
		open(FILE, "$basedir/$vir_path");
		print "<font face=Courier size=2>\n";
		$line = join("<br>", <FILE>);
		$line =~ s/ /&nbsp;/g;
		print $line;
		print "</font>\n";
		close(FILE);
		print &footer;
		exit;
		}
	}
	
print "Location: $baseurl/$vir_path\n\n";
}

##############################
# Return the Header contents
sub header {
open(HEAD, $header) or die("Cannot open $header");
@lines = <HEAD>;
close(HEAD);
return @lines;
}

##############################
# Return the Footer contents
sub footer {
open(FOOT, $footer) or die("Cannot open $footer");
@lines = <FOOT>;
close(FOOT);
return @lines;
}


------------------------------

Date: Sun, 03 Sep 2000 16:58:00 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: A Challenge
Message-Id: <slrn8r50ns.ge9.marcel@gandalf.local>

On Sun, 03 Sep 2000 16:55:06 GMT, James Bond <got1toomany@trojans.com> wrote:

>I came accross the following script. It was essentially designed to
>display the contents of a directory on a web page. The writer said
>he designed it for an ftp site.
>
>Although I like the script as is, I can't do what I really want with
>it. I'd like to be able to display the contents of multiple dirs.
>
>I'm new to perl (not a programmer by any stretch), and I've tried
>anything I can think of. I always end up killing the script, or only
>seeing the contents of one dir.
>
>Any takers????


I'll send you my rate card.

Or did you have a specific Perl question?


-- 
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . .  <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


------------------------------

Date: Sun, 03 Sep 2000 17:14:09 GMT
From: "Peter L. Berghold" <Peter@Berghold.Net>
Subject: Re: cgi-perl
Message-Id: <BFvs5.39682$e11.308314@news1.rdc1.nj.home.com>

Unfortunately what you have provided does not give enough information to
make an informed diagnosis. Are you behind a firewall? What in your
environment has changed? Has someone mucked with the .PMs that you are
including?

Just a few of the questions that come to mind.

--
+----------------------------------------------------------------------+
| Peter L. Berghold                   http://www.berghold.net          |
| "Those who fail to learn from       Peter@Berghold.Net               |
| history are condemned to repeat it."                                 |




------------------------------

Date: Sun, 3 Sep 2000 15:51:05 -0500
From: "James Ryan" <jpryan@cis.tamu.edu>
Subject: cookies and SSI's
Message-Id: <8oudjr$skl$1@news.tamu.edu>

OK, I need some help.  I have designed a site that tracks users with cookies
and by IP addresses...

This is my circumstance:  all of the HTML files are SHTML, and each SHTML
file runs a script via server-side-include that displays a navigation panel
if the user is logged in.  how do I access the client's cookie data from a
script that is run as an SSI?  I know that it is an environment variable; I
can access

$ENV{'REMOTE_ADDR'}and get an IP address
-but not-
$ENV{'HTTP_COOKIE'}

Anybody know how I can access $ENV{'HTTP_COOKIE'} from an SSI?

james ryan






------------------------------

Date: Sun, 3 Sep 2000 14:17:58 -0400
From: "Pun H. Shiu" <ship@long.eecom.gatech.edu>
To: Aitor Garcia <a58289@yahoo.com>
Subject: Re: creating an enviroment variable
Message-Id: <Pine.GSO.4.21.0009031416580.24581-100000@long.eecom.gatech.edu>


Putting the following line at the end of the
script

exe $ENV{'SHELL'}

will create a subshell.

pun

On Tue, 22 Aug 2000, Aitor Garcia wrote:

> Hello everybody;
> 
> I'm a Perl newbie and I've got a little
> question.
> I want to create a new enviroment variable
> and set a value to it.
> I have tried the following code but it does
> not work.
> 
> #!/usr/bin/perl
> $ENV{"USE_NC"} = "1";
> 
> Can anyone help me with this ?
> 
> Best Regards,
> 
> Aitor
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> 



------------------------------

Date: 3 Sep 2000 13:06:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Deleting tempfile after use
Message-Id: <8oterc$7ch$1@orpheus.gellyfish.com>

On Sun, 3 Sep 2000 21:09:48 +1000 James R wrote:
> Using Blat to send mail on an NT machine, I need to create a temp file with
> the form-mail data.
> 
> This works fine, but the temp file doesn't get deleted after the script is
> finished.
> 
> I am using the following line, which I thought would do the trick, but
> apparently not.
> 
>      open(MAIL,">$WIN_TEMPFILE");
>      various stuff...
>      unlink $WIN_TEMPFILE;
> 
> (a) Should this work?
> 

On windows you can't delete an open file, had you checked the success of
the unlink and printed $! on failure you would have got a message like
'Permission denied'.  You need to close the file first.  You should also
check the success of the file open.


> (b) Are there any other ways to do it safely?

You might be able to use the new_tmpfile() method from IO::File.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


------------------------------

Date: 3 Sep 2000 13:55:32 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: dont refresh
Message-Id: <8otho4$7gf$1@orpheus.gellyfish.com>

On 02 Sep 2000 13:10:35 EDT Abigail wrote:
> joerg pfeiffer (j.pfeiffer@roadtv.de) wrote on MMDLIX September MCMXCIII
> in <URL:news:39B132C7.64F0792C@roadtv.de>:
> {} hi,
> {} I have a js script that starts with
> {} location.href='http:192.168.1.1/cgi-bin/roadtv/wahl.cgi?welcherort=SydneyHits';
> {} 
> {} the perlscript "wahl.cgi"
> {} 
> {} wahl.cgi has to do only one thing:
> {} open a file, add something, close the file, but should NOT refresh the
> {} page in the Browser.
> {} but, if I dont put a print command in my perl script, I get an "enternal
> {} server error".
> {} with print, everything works fine.
> 
> I guess that was a typo, and you meant "eternal server error".
> 

Ah, the eternal server error of the soul, similar to the server error
at the end of the universe I believe.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


------------------------------

Date: Sun, 03 Sep 2000 20:25:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: dont refresh
Message-Id: <9gc5rsgaeb4a3t3ti2606mi39m3383baa7@4ax.com>

joerg pfeiffer wrote:

>wahl.cgi has to do only one thing:
>open a file, add something, close the file, but should NOT refresh the
>page in the Browser.

Look up return status code #204.

	<http://www.w3.org/Protocols/HTTP/HTRESP.html>

and for example, questions Q4.21 and Q4.22 at
<http://docs.ns.gatech.edu/languages/perl/perl-cgi-faq.html>

Oh, and next time you have similar questions, go to a more appriate
forum, such as <news:comp.infosystems.www.authoring.cgi>.

-- 
	Bart.


------------------------------

Date: Sun, 3 Sep 2000 23:10:47 +0200
From: "Shagma" <andreas@happy3d.net>
Subject: fileupload issue
Message-Id: <qezs5.3985$Yi4.74863@news1.online.no>

I am using input type=file in a form for a upload script.
It works fine, but I alså want the filename.

The code:
$nameoffile1 = $wwwH->param('FILE1');
returns the filename and the filepath.

How can I just get the filename, and not the filepath.?

I have tried to remove it with the;
$varname=~ s/<ThingToBeRemoved>//;
But without luck.

Any sugestions?
:))




------------------------------

Date: Sun, 03 Sep 2000 16:44:52 -0500
From: James Philip Ryan <jpryan@labs.tamu.edu>
Subject: Re: fileupload issue
Message-Id: <39B2C654.CAFE521F@labs.tamu.edu>

$cgi should be $CGI, my bad

james

James Philip Ryan wrote:

> Use cgi-lib.pl...
> It will parse the file whether or not it is binary or ascii and save it
> in a hash called $cgi.
>
> ex: an upload field called "file"
>
> require "cgi-lib.pl";
> &parse_Multi();   # the parse function for cgi-lib
>
> $fileName = $CGI{'file'}->{'filename'};   # file name
> $fileContents = $CGI{'file'}->{'Contents'};   # file contents
> $fileSize = length ($CGI{'file'}->{'Contents'});   # file size
>
> good luck...
>
> -james r
>
> Shagma wrote:
>
> > I am using input type=file in a form for a upload script.
> > It works fine, but I alså want the filename.
> >
> > The code:
> > $nameoffile1 = $wwwH->param('FILE1');
> > returns the filename and the filepath.
> >
> > How can I just get the filename, and not the filepath.?
> >
> > I have tried to remove it with the;
> > $varname=~ s/<ThingToBeRemoved>//;
> > But without luck.
> >
> > Any sugestions?
> > :))



------------------------------

Date: Sun, 03 Sep 2000 16:42:46 -0500
From: James Philip Ryan <jpryan@labs.tamu.edu>
Subject: Re: fileupload issue
Message-Id: <39B2C5D6.18CBA0DE@labs.tamu.edu>

Use cgi-lib.pl...
It will parse the file whether or not it is binary or ascii and save it
in a hash called $cgi.

ex: an upload field called "file"

require "cgi-lib.pl";
&parse_Multi();   # the parse function for cgi-lib

$fileName = $CGI{'file'}->{'filename'};   # file name
$fileContents = $CGI{'file'}->{'Contents'};   # file contents
$fileSize = length ($CGI{'file'}->{'Contents'});   # file size

good luck...

-james r

Shagma wrote:

> I am using input type=file in a form for a upload script.
> It works fine, but I alså want the filename.
>
> The code:
> $nameoffile1 = $wwwH->param('FILE1');
> returns the filename and the filepath.
>
> How can I just get the filename, and not the filepath.?
>
> I have tried to remove it with the;
> $varname=~ s/<ThingToBeRemoved>//;
> But without luck.
>
> Any sugestions?
> :))



------------------------------

Date: Sun, 03 Sep 2000 16:55:46 -0500
From: James Philip Ryan <jpryan@labs.tamu.edu>
Subject: Re: fileupload issue
Message-Id: <39B2C8E2.7F173CB8@labs.tamu.edu>

i just realized what you were asking... here is what i did to get rid of
the file path

ex:  once again, using "file" as the file field

require "cgi-lib.pl";
&parse_Multi();

my @fileName = split(/[\\\/]/, $CGI{'file'}->{'filename'});
@fileName = reverse (@fileName);
$fileName = $fileName[0];


Shagma wrote:

> I am using input type=file in a form for a upload script.
> It works fine, but I alså want the filename.
>
> The code:
> $nameoffile1 = $wwwH->param('FILE1');
> returns the filename and the filepath.
>
> How can I just get the filename, and not the filepath.?
>
> I have tried to remove it with the;
> $varname=~ s/<ThingToBeRemoved>//;
> But without luck.
>
> Any sugestions?
> :))



------------------------------

Date: Sun, 3 Sep 2000 17:36:05 +0200
From: "Willem Joosten" <nospam@jsoft.xs4all.nl>
Subject: Getting a range of rows with DBI
Message-Id: <8otrbg$cvc$1@news.tudelft.nl>

Hi,

for a web database app I have to make a search result like output. So I need
to show rows 1-10 on the first page, 11-20 second etc etc. The problem is
the records in the database are not continuous so I can't just get the
correct rows with a select.

Any clues on how to tackle this problem?


Regards,

Willem Joosten





------------------------------

Date: 3 Sep 2000 13:04:00 GMT
From: soren@spmfoiler.removethat.wonderstorm.com (Soren Andersen)
Subject: Re: Hashref infix misunderstood?
Message-Id: <8oti80$ong$2@slb6.atl.mindspring.net>

kcivey@cpcug.org (Keith Calvert Ivey) wrote in 
<39a4499e.3692501@news.newsguy.com>:

>Your attack on people who tried to help makes it a lot less
>likely that people on this newsgroup will help you in the
>future, and unfortunately any apologies won't be seen by people
>who've already killfiled you.

That had occured to me .. I have been around on USENET for a while. Oh 
well!

   Regards,
     soren andersen

-- 
Using PNG-format images as Web BACKGROUNDs without
"breaking your Site" for silly older browsers:
http://www.wonderstorm.com/techstuff/
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


------------------------------

Date: 3 Sep 2000 20:47:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: hello world?
Message-Id: <8ou9s2$8tr$1@orpheus.gellyfish.com>

On Sun, 03 Sep 2000 11:38:14 GMT Mark wrote:
> And here is one without using any modules. 

And here is one without using Perl :

#!/bin/sh

echo 'Content-type: text/plain'
echo
echo 'Hello, World'


/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


------------------------------

Date: Sun, 03 Sep 2000 21:09:47 GMT
From: sendkeys@my-deja.com
Subject: Re: hello world?
Message-Id: <8ouemk$om$1@nnrp1.deja.com>

thank you

lserinol and Mark

i got the scrip working now that helpped me alot i got the error again
after using your script's so only other things that it could have been
was my location of perl and it was. the isp didnt tell me the right
location. what i get for not looking it up my self thank god for "which
perl" command in telnet :)  thank again!


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sun, 03 Sep 2000 16:52:19 GMT
From: joekind@my-deja.com
Subject: help with forking
Message-Id: <8otvk0$hk9$1@nnrp1.deja.com>

Hi, I want to use forking with my script.
I need to call the sub routine &getdata; 14 times.  This is where the
script connects to each website to get there content.  The problem is,
the script has to wait to connect to the first site before moving on to
the next and so on.  I want to use forking so that I can connect to all
of the sites at once.
So can I just have the child process call the sub &getdata; while the
parent process just waits for all of the children to finish before
moving on?  Also, can you provide me with the code to do this.

thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sun, 03 Sep 2000 14:07:15 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: help with forking
Message-Id: <brian+usenet-1B7D2A.14071503092000@news.panix.com>

In article <8otvk0$hk9$1@nnrp1.deja.com>, joekind@my-deja.com wrote:

> Hi, I want to use forking with my script.
> I need to call the sub routine &getdata; 14 times.  This is where the
> script connects to each website to get there content.

use LWP::Parallel

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


------------------------------

Date: Sun, 03 Sep 2000 16:11:10 GMT
From: Steve Palincsar <palincss@his.com>
Subject: Re: How do I manipulate each element of an array?
Message-Id: <39B27880.6212A04B@his.com>

Jakob Schmidt wrote:

> As usual with perl the solution is much simpler. the $_ in a foreach
> loop works as a reference to the arrayvalue so you just need
> 
> foreach ( @array ) { $_ or $_ = '&nbsp;' }
> 

Or, even more simply,

foreach (@array) {
   $_ ||= '&nbsp;';
}

?


------------------------------

Date: Sun, 03 Sep 2000 13:08:19 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: How do you use setuid in perl
Message-Id: <63ss5.4057$6A2.393103@nnrp4.clara.net>

In article <8oob50$gko$1@nnrp1.deja.com>, shobs11@my-deja.com wrote:
>setuid should do it, and I can get this working in C/C++ but I would
>like to use it within perl.
>Can anyone tell me how to do this?

Tell you how to do what?
  chown root.wheel filename.pl
  chmod u+s filename.pl

Perl is just the langauge that the script is written in, it doesn't "do" 
setuid. It changes its characteristics slightly when it is running a setuid 
program, in that it reaches under the counter and grabs the shotgun and makes 
you fix obvious security problems. But, its not perfect because of all the 
wierdness that humans want to do, so it shouldn't be considered 'secure', it 
is up to you to make your program 'secure'.

If you read the perlsec documentation that will describe alot of the 
situations that will trip you up if you don't know what to look for. When 
running setuid perl taints any external variable and you have to untaint it to 
be able to use it in certain operations like filenames or command executions.

But the docs are clearer than me. I think there are more docs for setuid CGI 
scripts on CPAN or perl.com.

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4215
**************************************


home help back first fref pref prev next nref lref last post