[7093] in Perl-Users-Digest
Perl-Users Digest, Issue: 718 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 10 17:17:12 1997
Date: Thu, 10 Jul 97 14:00:50 -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, 10 Jul 1997 Volume: 8 Number: 718
Today's topics:
Archive site needs perl assistance (ShadowMAC Administrator)
Calling Shell Program in Win NT <ranson@infoave.net>
cause browser to go to a url <jason.d.borneman@rose-hulman.edu>
CGI: Dos app. under Netscape WebServer - OS NT 3.51 <datatech@netvision.net.il>
Re: Checking for valid Email... (Nathan V. Patwardhan)
Re: Extracting Expressions (Tad McClellan)
Re: foreach array indices (Tad McClellan)
Re: Gen. a random no. (within range) (Shane)
Re: How to run another script with do and pass argument (Charles DeRykus)
Ignoring text between HTML tags or C comments (BurninUrGe)
Newbie Array pass by reference question <ashfield.matthew@miti.nb.ca>
Obtaining full path for a command quickly (CMSC 430)
Pattern Matching <jmscott@ainet.com>
Perl 5 in Microsoft Personal Web Server <serginho@alpha.hydra.com.br>
Re: Perl executing system commands on NT (Mark Nielsen)
Re: Perl is 20 times slower on Cray J90 than SGI! (Nick Pomponio)
Perl Object Database? (Giles Rider)
Re: Q: how can I use push with 2 dimension arry? <ajohnson@gpu.srv.ualberta.ca>
Re: reverse chop? (Rubinstein Dmitry)
Re: reverse chop? (M.J.T. Guy)
Seattle programmer: UNIX Internet/Database jobs@rabbitcreek.com
Setting Perl5 and Installing CGI.pm <ohhara@sws2.postech.ac.kr>
Setting Perl5 and Installing CGI.pm <ohhara@sws2.postech.ac.kr>
Re: shift on an empty array returns ( undef ) in a list <nnyxcu@ny.ubs.com>
Re: Trapping the output of the System command into a va (Mark Nielsen)
use //require <dantin@icp.grenet.fr>
Re: using array elements in regexps <usenet-tag@qz.little-neck.ny.us>
Re: while (<FILEHANDLE>) (Tim Smith)
Re: writing documents (and .pl's) to an user directory (Tim Smith)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Jul 1997 16:21:11 GMT
From: admin1@shadowmac.org (ShadowMAC Administrator)
Subject: Archive site needs perl assistance
Message-Id: <5q0dpn$o0k$1@blackice.winternet.com>
Mac archive site operating on a Sun Sparc box under the Solaris v2.5.x OS.
We are looking for a person or two to help us out with a few
filebase related scripts. The scripts we most need currently are as follows:
01. Parse textfiles in a specific dir for a data field, the field
contains the dir path which each file needs to be moved to, after each
file has been moved, change a different field from "received" to "new".
02. Parse each textfile in each directory in our filebase tree into
index files.
03. Compile index files from the whole filebase into allfiles listings.
04. Parse allfiles listing and compile the newfiles listings and newfiles
link's.
This would all be run once nightly 1-2-3-4...
Each textfile has 50 fields of textual data, each field seperated by
EOLs, each field has a specific line designation and max character length.
ShadowMAC is a freebie site, so we are looking for anyone willing to
donate a little time and effort for these scripts to help us grow our
filebase better.
--
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
| Mac file archives, you want Mac archives? |
| Then stop by ShadowMAC for a look around! |
| |
| anonymous ftp in via: ftp.ShadowMAC.org /pub |
| or set your web browser to: http://www.ShadowMAC.org |
| ShadowMAC's IP address is: 198.174.169.112 |
| Email: Admin@ShadowMAC.org |
| |
| Supporting the Mac in all its incarnations; |
| Mac (680x0), Newton, PowerBook, PowerBook, |
| PowerMac (PPC Mac), and Mac clones! |
| |
| Freely supporting the Mac! |
| |
| S h a d o w M A C |
| Twin Cities, Minnesota USA |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
------------------------------
Date: Thu, 10 Jul 1997 12:08:23 -0500
From: Ranson <ranson@infoave.net>
Subject: Calling Shell Program in Win NT
Message-Id: <33C51707.4A@infoave.net>
Trying to figure out how to call a shell program in Win NT. from cgi
script - perl5
The script I am writing needs to call a shell program, I know how to do
this in UNIX but cant find info for NT.
--
Thank you,
Ranson
------------------------------
Date: Thu, 10 Jul 1997 14:48:48 -0500
From: "Jason D. Borneman" <jason.d.borneman@rose-hulman.edu>
Subject: cause browser to go to a url
Message-Id: <33C53C9F.EF3E3320@rose-hulman.edu>
I don't know whether this belongs in this newsgroup or a cgi newsgroup.
Sorry if it belongs in cgi.....
What command to I 'print' to a web browser to get it to go to a
specified URL? I know there is something that you can put inside a
print and have it redirect the browser to a given value, but I have
forgotten it and I am new enough to this that I cannot figure it out
myself.
Thanks for any help,
jason borneman
--
Jason Borneman
Class '00 Computer Science
E-Mail: jason.d.borneman@rose-hulman.edu
WWW: http://www.rose-hulman.edu/~bornemjd/
ICQ#: 1157284
"When I am King you will be first against the wall
with your opinions which are of no consequence at all."
-Radiohead 'Paranoid Android'
------------------------------
Date: 10 Jul 1997 11:09:21 GMT
From: "datatech" <datatech@netvision.net.il>
Subject: CGI: Dos app. under Netscape WebServer - OS NT 3.51
Message-Id: <01bc8d21$94187800$4d65cbc7@dtk08w95>
Hi all,
I try to run a simple CGI under the Netscape Web Server in a WinNT 3.51
plataform.
The Perl script run a batch file that execute an "Arj" Dos command in order
to compress a file. The point is that the script success only while the
file is not grater than aprox 300KB.
The script run well outside the WebServer.
I'll greatly appriciate if anyone can help me in this issue.
Thanks
- DavidK
------------------------------
Date: 10 Jul 1997 13:33:07 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Checking for valid Email...
Message-Id: <5q2oaj$147@fridge-nf0.shore.net>
Brandon Wilkins (wilkins@digitaldaze.com) wrote:
: How do I go about checking if a email address is basically valid (In
: form...)?
You check Dejanews for the answer to this frequently asked question,
and use the examples you find there to answer your question.
http://www.dejanews.com
query for comp.lang.perl.misc valid address
or
query for comp.lang.perl.misc validating mail address
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 7 Jul 1997 23:28:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Extracting Expressions
Message-Id: <9mfsp5.ntd.ln@localhost>
Dan Wright (dan@electronet.net) wrote:
: I am trying to use a global substitution on a file to reformat its contents
: from plain text into HTML on the fly.
: The file has lines like this:
: This is Headline 1
: ------------------------------------
: This is the text that may be several lines or even...
: Another paragraph.
: This is Headline 2
: -------------------------
: More text.
: Even more text.
: I want to make it look like:
: <TR><TD BGCOLOR=WHITE>This is Headline 1</TD></TR>
: <TR><TD>This is the text that may be several lines or even...<BR>
: Another paragraph.</TD></TR>
: <TR><TD BGCOLOR=WHITE>This is Headline 2</TD></TR>
: <TR><TD>More text.<BR>Even more text.</TD></TR>
: Currently I have:
: $wholefile = s/\w+\-+/<TR><TD BGCOLOR=WHITE>$1</TD></TR>/g;
^^
^^
This variable will hold whatever was matched by the first parenthesized
part in the regex.
Uh oh! You don't _have_ any parenthesized part in the regex...
: I have never used PERL to replace expressions, only exact matching. I can't
: find an example of what I'm trying to do anywhere??
: Your help would be appreciated.
How's this? (It makes several assumptions about the format of your
data though...)
------------------------------------------------------------------------
#! /usr/bin/perl -w
$_="This is Headline 1
------------------------------------
This is the text that may be several lines or even...
Another paragraph.
This is Headline 2
-------------------------
More text.
Even more text.
";
s!(.*)\n # substitute for any line that:
-+\n # is followed by a line of hyphens and
\n # followed by a blank line
!<TR><TD BGCOLOR=WHITE>$1</TD></TR>\n!gx; # do the headlines
s!\n\n!\n!g; # delete blank lines
s!( # remember what chars were matched
(?: # grouping to describe lines that do not start with a tag
^ # beginning of line
[^<] # any character that is not an open angle bracket
.* # zero or more of any char (except newline)
\n # a newline
) # stop the grouping that describes a line
* # zero or more such lines
^ # beginning of line
[^<] # any character that is not an open angle bracket
.* # zero or more of any char (except newline)
) # stop remembering the chars matched
\n # don't include newline for last such line
!<TR><TD>$1</TD></TR>\n!mgx;
s!([^>])\n!$1<BR>\n!g; # any line that doesn't end with a tag
# gets a <BR>
print;
------------------------------------------------------------------------
: Thank you,
You're welcome ;-)
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 10 Jul 1997 12:34:17 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: foreach array indices
Message-Id: <pe63q5.dj4.ln@localhost>
Eric Kissinger (erick@servtech.com) wrote:
: in a 'foreach (@array)' command, is it possible to find out what
: indice
: the array is at when a condition is met?
If you want the index, then use a construct where you know the index ;-)
for ($i=0; $i<@array; $i++) {
print "the index is '$i'\n" if $array[$i] =~ /something/;
}
: is there a variable the contains the current indice during the foreach
: loop iteration?
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 10 Jul 1997 17:24:19 GMT
From: zatezalo.2@osu.edu (Shane)
Subject: Re: Gen. a random no. (within range)
Message-Id: <33c51961.267399034@achilles.medctr.ohio-state.edu>
Doug Seay <seay@absyss.fr> wrote:
>P.M.Wong wrote:
>>
>> I would like to generate a random number (whole number)
>> But it has to fall within a certain range that i specify
>> like, 10< n < 20
>> Are there any statement in perl to do it ?
>
>&range_rand(10,20) should give you what you want. Since this is
>untested, you should verify that it does what you want.
>
>
> sub range_rand($$)
> {
> my ($min,$max) = @_;
> rand($max - $min) + $min;
> }
>
>- doug
>
>PS - Maybe you should verify that $min and $max are numeric.
I ran this - it works. However, it seems to generate
the same random number each time it's run. If I put it in a loop,
it will generate different numbers. BUT, run the program again,
and the same numbers are generated. Anyone know how the seeding works?
(btw - this was run a RHL4.1 P200 box, and a RHL4.1 486 w/ RPM
perl-5.003-8.
#!/usr/local/bin/perl
#
for $i(1..10) {
$x=range_rand(10,20);
print "random=$x\n";
}
exit;
sub range_rand($$) {
my ($min, $max) = @_;
print "Random low=$min high=$max\n";
return (int(rand($max - $min) + $min));
}
Output was run twice:
[shane@smaug mysrc]$ ./math.pl
random=11
random=15
random=14
random=15
random=11
random=19
random=16
random=12
random=15
random=11
[shane@smaug mysrc]$ ./math.pl
random=11
random=15
random=14
random=15
random=11
random=19
random=16
random=12
random=15
random=11
--
zatezalo.2@osu.edu
http://www.ecaetc.ohio-state.edu/shane
------------------------------
Date: Thu, 10 Jul 1997 17:53:29 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: How to run another script with do and pass argument?
Message-Id: <ED4717.2MI@bcstec.ca.boeing.com>
In article <33C429A6.680230E5@taligent.com>,
Deyoung Hong <hong@taligent.com> wrote:
> I want to invoke another Perl script from a Perl script.
> Using the statement
>
> do 'another.pl';
>
> works fine but I can't pass argument like
>
> do 'another.pl 3';
>
> How do I do this, other than using the 'system' or 'open' command which
> may invoke a different perl?
>
You can set @ARGV, e.g:
@ARGV = qw/arg1 arg2/;
do 'another.pl';
Then, another.pl can simply access @ARGV.
HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.forget_it.com # remove you know what
------------------------------
Date: 10 Jul 1997 16:37:50 GMT
From: burninurge@aol.com (BurninUrGe)
Subject: Ignoring text between HTML tags or C comments
Message-Id: <19970710163700.MAA20941@ladder02.news.aol.com>
I'm trying to write a PERL 5 CGI that, upon the click of a button, reloads
the current page, but makes all words in my array @glossary links to files
of the same name. However, I don't want to touch the text inside < and >
and also ignore and text between <a href="..."> and </a>. This is only the
fourth script I've tried to write and so far I *love* Perl but am worried
I'm getting a little too ambitious (My own limitations, not the language).
Please e-mail me any help you can give, thanks.
The script so far:
#!/perl5/bin
open(MYFILE, ">test2.html");
while(<>)
{
$_;
@_=split /(<,>)/, $_;
@terms=(necktie,cyberspace,"Web site",law);
foreach $str (@_) {
foreach $term (@terms) {
$url = join '',"dirstruct",$term,".html";
$str =~ s/$term/<a href="$url">$term<\/a>/g;
}
print MYFILE "$str";
}
}
print $url;
close(MYFILE);
exit(0);
------------------------------
Date: 10 Jul 1997 19:00:22 GMT
From: "mashfiel" <ashfield.matthew@miti.nb.ca>
Subject: Newbie Array pass by reference question
Message-Id: <01bc8c99$cf0dbc00$3e080a0a@mashfiel.miti.nb.ca>
Hi all,
Well, as the subject line says I'm a newbie. That said, here's the problem.
I've been creating a program, and after getting it to work, I decided to
'tune' it, by using the 'use strict' statement, (yep, everything was global
before! ) Anyway, I have it all working but for one part. The problem
arises when I go to pass an array to a sub which will then edit it. Since
my program will probably not make sense, I've taken a microcosmic view of
my problem and present it here, in a very simple bit of code:
#!/usr/local/bin/perl
use strict;
{
my @Array = ();
{
my $i = 0;
for (;$i<5; $i++)
{
&Initialise($i, \@Array);
}
}
&printArr(@Array);
}
sub Initialise{
my ($index, @subArr) = @_;
@$subArr[$index] = $index;
}
sub printArr{
my @array = @_;
my $i = 0;
for (;$i<5;$i++){
print "hello\n";
print $array[$i], "\n";
}
}
When I run this program I receive the following message:
Global symbol "subArr" requires explicit package name at test2.pl line 17.
I know it has something to do with how I'm passing my array the Initialise
sub procedure, but I've read the man page (perlref & perlsub) and FAQ, and
either I'm dense (most likely scenario :) or I'm just not reading the right
part. Anyway, I've been wasting too much time on this most likely simple
problem, so any help/advice would be greatly appreciated,
Thanks for your time
Matt
ashfield@matthew@miti.nb.ca
------------------------------
Date: 10 Jul 1997 16:04:58 -0400
From: cwt02@csc.umd.edu (CMSC 430)
Subject: Obtaining full path for a command quickly
Message-Id: <5q3f9a$qur@marple.umd.edu>
Given a command somewhere in my path directories, I would like to get
its complete path (example: cat -> /usr/bin/cat) without the overhead of
starting a 'which' process. The latter technique would look something
like this:
$full_path_of_command = chop(`which $command_name`);
Is there an easy way to do this? Or if not, can someone point me to
some code which can do this (probably by explicitly looking in all
$ENV{'PATH'} directories) since I'm too lazy to write it myself?
Dave Rivers
------------------------------
Date: Thu, 10 Jul 1997 10:15:22 -0700
From: "Joseph M. Scott" <jmscott@ainet.com>
Subject: Pattern Matching
Message-Id: <33C518AA.76B3@ainet.com>
Pattern matching ( regex's ) are something I'm still trying to build up
on. ( Mastering Reg Ex is on my list of books to soon buy, but I need
finish some others first. ) I've been asked to split up some data that
is quoted and separated by commas, but so can have commas in the
quotes. I figure split with a nice regex will do the trick, but I'm
having some doubts on the best way to do this.
Sample line of data would look something like this:
"Somewhere","Some, else, anywhere","3456","987","21345"
my thought was to split /\",\"/ and that seems to do the trick, unless I
somehow ( I',m told it shouldn't ever happen, but I've heard that one
before ) I end up with an item in quotes that had nothing but a comma in
it, that would look something like this:
"Somewhere else","here",",","there","anywhere,adsf,asdf 123"
then I run into a problem using the pattern above. In English I guess
it would be something like, match every "," unless the first " matched
has a , in front of it.
I would appreciate any comments, I've got my Programming Perl book out,
and I'm trying to re read the pattern matching info to see what the best
approach is.
-=joseph
jmscott@ainet.com=-
------------------------------
Date: 10 Jul 1997 12:57:27 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Perl 5 in Microsoft Personal Web Server
Message-Id: <01bc8d31$429c8880$6875e7c8@Term104>
Hi! I install in my network (at my home) the Microsoft Personal Web
Server. I saw that it has a scripts directory, and a counter example in
this directory, but this counter's .DLL, and I know Perl like a CGI
language. Then I install Perl 5 for Win32 and Perl is running perfetcly. I
say this because I can run Perl Script from DOS Prompt window (perl <
myperlfile.pl). But, If I put a .pl file in the scripts directory of PWS,
The PWB tell that the scripts directory isn't a read directory, and I'd
denied access to .pl file. But I don't want to read it, I'd like that PWS
run the Script using the Perl Interpreter (I put in the first line of my
script #! /perl/bin/perl.exe). Does anyone could help me ? Thanks in
advance !
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@usa.net
--------------------------------------------
------------------------------
Date: 10 Jul 1997 15:05:25 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Perl executing system commands on NT
Message-Id: <5q3bpl$e6l$1@auto.med.ohio-state.edu>
I usually have to put quotes around the system call like
system "cls";
or I use
system ("cls");
I also found system and exec to work funny sometimes in NT.
Mark
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: 10 Jul 1997 16:44:49 GMT
From: npomponi@cmd.gatech.edu (Nick Pomponio)
Subject: Re: Perl is 20 times slower on Cray J90 than SGI!
Message-Id: <5q33i1$60l@smash.gatech.edu>
Brett Denner <Brett.W.Denner@lmtas.lmco.com> writes:
[snip]
+and the following C program (compiled with "cc prog.c -o prog"):
+ void main()
+ {
+ int i; float a;
+ for (i=0; i <= 1000000; i++)
+ { a = 0; }
+ }
Is it possible that the C compilers are optimizing the loop-invariant
assignment { a = 0; } by moving it out of the loop? You could
check this by either changing the assignment to an increment or declaring
'a' as volatile.
Nick Pomponio
------------------------------
Date: 10 Jul 1997 17:50:19 GMT
From: giles@quickquote.com (Giles Rider)
Subject: Perl Object Database?
Message-Id: <5q37cr$lbu$1@news.greatbasin.net>
Does anyone know of a commercially available Object database that
supports/is compatible with Perl objects? If so, please e-mail
me: giles@quickquote.com
Thanks much
------------------------------
Date: Thu, 10 Jul 1997 10:40:24 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Q: how can I use push with 2 dimension arry?
Message-Id: <33C50268.53BE53A1@gpu.srv.ualberta.ca>
Fabrizio Pivari wrote:
!
! Hi,
!
! I read perl documentaion but I'm not be able to solve this problem:
! how can I use push to create a 2 dimension array?
! For exampl:
! @data= {["A","B","C"],[1,2,3]);
! or push @data, ...?
push @data,(["A","B","C"],[1,2,3]);
then to push elements onto either of those in @data:
push @{$data[0]},"D";
push @{$data[1]},4;
regards
andrew
------------------------------
Date: 10 Jul 1997 15:34:11 GMT
From: dimrub@nsof.co.il (Rubinstein Dmitry)
Subject: Re: reverse chop?
Message-Id: <5q2vdj$sdm$1@lnews.actcom.co.il>
the count (eglamkowski@mathematica-mpr.com) wrote:
: Is there any trivial way to remove the first character of a string?
: Right now I am using:
: while (<>) {
: @line = split;
: print "substr($line[0], 1, length($line[0] - 1))\n";
: }
: but I feel like there should be an easier way... ;-)
Yes, there is.
$var =~ s/^.//;
^. matches the first character of the string.
--
Dmitry Rubinstein
dimrub@math.tau.ac.il
http://www.math.tau.ac.il/~dimrub
------------------------------
Date: 10 Jul 1997 16:51:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: reverse chop?
Message-Id: <5q33ve$a47@lyra.csx.cam.ac.uk>
In article <5q19t0$97o$3@info.uah.edu>, Greg Bacon <gbacon@CS.UAH.Edu> wrote:
>
>In article <33C27DF2.578@mathematica-mpr.com>,
> the count <eglamkowski@mathematica-mpr.com> writes:
>: Is there any trivial way to remove the first character of a string?
>
>$str =~ s/^.//s;
It's almost certainly more efficient to write
substr($str,0,1) = '';
Regular expressions aren't the solution to _all_ the problems of the universe.
Mike Guy
------------------------------
Date: Wed, 09 Jul 1997 21:13:14 -0600
From: jobs@rabbitcreek.com
Subject: Seattle programmer: UNIX Internet/Database
Message-Id: <868500561.21003@dejanews.com>
CONTACT: jobs@rabbitcreek.com
POST DATE: 7/10/97
Want to work on cool programming projects for high-end clients in a
fun work atmosphere? Good pay. Freelance, part-time and full-time
positions available.
Intermediate to Advanced level Perl/C++ programmer needed for
a Seattle-based Internet commerce consulting firm. If you have some or
all of the desired skills and experience, please send us your resume,
along with your salary requirements.
Desired Skills/Experience:
Object-oriented Perl, relational database (mSQL and up),
SQL, Apache, Solaris/Linux
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 8 Jul 1997 07:07:35 GMT
From: Taeho Oh <ohhara@sws2.postech.ac.kr>
Subject: Setting Perl5 and Installing CGI.pm
Message-Id: <5psovn$j3e@news.postech.ac.kr>
use Perl 5 in Linux (redhat 4.1).
But after commanding "perl -v" , I got this message.
----------------------------------------
warning: setlocale(LC_CTYPE, "") failed.
warning: LC_ALL = "(null)", LC_CTYPE = "(null)", LANG = "ko",
warning: falling back to the "C" locale.
This is perl, version 5.003 with EMBED
Locally applied patches:
SUIDBUF - Buffer overflow fixes for suidperl security
built under linux at Apr 22 1997 10:04:46
+ two suidperl security patches
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
----------------------------------------
What does that means first three lines (warning)?
And I can't use CGI.pm
If I execute a perl program in command line which is using CGI.pm,
this message will appear.
----------------------------------------
warning: setlocale(LC_CTYPE, "") failed.
warning: LC_ALL = "(null)", LC_CTYPE = "(null)", LANG = "ko",
warning: falling back to the "C" locale.
Can't find string terminator "END_OF_AUTOLOAD" anywhere before EOF at CGI.pm line 645.
BEGIN failed--compilation aborted at ./file-upload.cgi line 168.
----------------------------------------
Someone told me that this error is common error message.
Someone told me to recopy CGI.pm.
But the result is same.
What's wrong?
help me!!!
------------------------------
Date: 8 Jul 1997 07:15:48 GMT
From: Taeho Oh <ohhara@sws2.postech.ac.kr>
Subject: Setting Perl5 and Installing CGI.pm
Message-Id: <5pspf4$j3e@news.postech.ac.kr>
So I reinstall perl but the result is same.
And I can't complie CGI.pm
perl Makefile.PL
make <- I can't do. There are too many error. (Couldn't install XXX)
make install
------------------------------
Date: Thu, 10 Jul 1997 15:38:57 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
Subject: Re: shift on an empty array returns ( undef ) in a list context, not an empty list?
Message-Id: <33C53A51.780A@ny.ubs.com>
Ivan Kohler wrote:
>
> Hello,
>
> Took me quite some time to track down a bug caused by my misunderstanding of
> the shift command. In a scalar context, when shift'ing an empty array,
> shift returns the undefined value, as expected. In a list context, however,
> I was assuming (wrongly) that shift on an empty array would return an empty
> list. Instead, it returns a list with one scalar value (undef).
>
> I searched through the perl-porters' archive, and couldn't find anywhere
> where a decision was made one way or the other with regards to this
> behavior. My question is twofold; One, would it be desirable to modify the
> behavior of shift so that it does return an empty list (and, I suppose, how
> would I go about proposing such a thing), and two, can anyone think of a
> less "kludgy" way to emulate my desired behavior than what I'm currently
> using:
>
> {
> my($temp) = shift @array;
> $temp ne undef ? $temp : ();
> }
>
2. How about
@target = @array ? shift @array : ();
? _Slightly_ more simple.
1. Arrays are lists of scalars. Shift returns one element from the list,
therefore its return vaule is a scalar (undef if there are zero elements).
It would be very convoluted and inconsistent to have it behave otherwise.
For instance, assigning a scalar variable to an array variable results in the
array having one element, the value of which is the value of the scalar; e.g.:
$x = 6;
now saying
@x = $x;
is equivalent to saying
@x = (6);
If the the scalar variable is undefined, then the resulting array after the
assignment has one element, undef.
This is also the result you get if you assign the result of shift on an
empty array to another array; i.e., if neither $x nor @x is defined, then both
@y = shift @x;
and
@y = $x;
give the same result: $y[0] == undef.
IMHO, this consistency is probably better for all of us in the long run than the
special behavior you would like to see.
> TIA for any input!
>
> Ivan Kohler
> VoiceNet Staff
> ivan@voicenet.com
> "I may not have the world to give to you
> but maybe I have a tune or two." -JG/RH
------------------------------
Date: 10 Jul 1997 15:02:11 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Trapping the output of the System command into a variable
Message-Id: <5q3bjj$e5k$1@auto.med.ohio-state.edu>
I had to make a batch file with the command
perl PerlScript.pl %1 %2
so that the msdos-prompt like window of perl doesn't hang around when
it executes a program and quits.
In article <q4lo3tgt33.fsf@rsunx.crn.cogs.susx.ac.uk>,
Stephen Eglen <stephene@cogs.susx.ac.uk> wrote:
>> Any body can suggest me how to Trap the output from system command into
>> a variable.
>
>try using the backquotes notation:
>$output = `cmd arg1 arg2`;
>
>Cheers, Stephen
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: Thu, 10 Jul 1997 14:37:37 +0200
From: Joelle D'Antin & Nicolas Gregoire <dantin@icp.grenet.fr>
Subject: use //require
Message-Id: <33C4D791.496E@icp.grenet.fr>
What's the difference between
use '/users/,,,/lib.pm
and
require '/users/,,,/lib.pm.
Thanks you
------------------------------
Date: 10 Jul 1997 18:36:02 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: using array elements in regexps
Message-Id: <eli$9707101356@qz.little-neck.ny.us>
Tad McClellan <tadmc@flash.net> wrote:
> From the Perl FAQ:
> "How do I efficiently match many regular expressions at once?"
> Which answers exactly this question...
Hmmm. It tells me that one of the possiblites is to get the
experimental Regexp extension from CPAN and use that, also
mentioning that it might be overkill.
I have got a scoring script that takes files averaging 300 lines,
and passes successive pairs of lines through about 400 regular
expressions, some quite complicated. It is, as you might imagine,
nearly as slow as molasses.
I think the expansion thing could help, but the only regexp
thing I found there (Devel:RegExp version 0.1) doesn't seem
happy at all with perl 5.004.
So is there a newer version I overlooked?
Elijah
------
does not want to hack perl source himself at this time
------------------------------
Date: 10 Jul 1997 13:07:35 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: while (<FILEHANDLE>)
Message-Id: <5q3fe7$s7s@web.azstarnet.com>
In article <33C53B92.41C6@sed.nist.gov>,
Jack Coursey <jcoursey@sed.nist.gov> wrote:
>Try to teach myself Perl out of a poor book for those new to the
>language
You really, really should get a decent book. If it's a poor book it's
a poor book. If it doesn't explain simple concepts well, how could
it explain the complex concepts well? Get the Programming Perl book,
2nd edition, and read the first two chapters straight through. Borrow
from a friend or from the library if you can't afford the book. Or
just go to the bookstore and sit on the floor reading it - it's that
imperative (because "iff the line input operator is the only thing inside
the conditional of a while loop, the value is automatically assigned to
the special variable $_", page 53).
Tim
------------------------------
Date: 10 Jul 1997 12:32:56 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: writing documents (and .pl's) to an user directory
Message-Id: <5q3dd8$h5a@web.azstarnet.com>
In article <33C4D377.26BB@esg.nl>, Maarten Reumer <meert@esg.nl> wrote:
>The redirect works, but the saving into the directory doesn't. The
>directories are accesible and writable. Can anybody help me on this?
Perl can help you, if you check the return codes.
$form{'save'} =~ s#user/#$user/#;
open (FILE, ">$form{'save'}")
|| die("Content-type: text/plain\n\ncan't open > $form{'save'}: $!\n");
print FILE "$form{'text'}\n";
close FILE;
if ($form{'save'} =~ /\.pl$/) {
chmod 0755, $form{'save'}
|| die("Content-type: text/plain\n\ncan't chmod 0755 $form{'save'}: $!\n");
} else {
chmod 0644, $form{'save'}
|| die("Content-type: text/plain\n\ncan't chmod 0755 $form{'save'}: $!\n");
}
Checking the return code (especially of an open()) is essential to figuring
out why things don't work. Ik hoop dat alles goed gaat ermee. Anders moet
je me terug schrijven.
Tim
------------------------------
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 718
*************************************