[12385] in Perl-Users-Digest
Perl-Users Digest, Issue: 5985 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 14 10:07:21 1999
Date: Mon, 14 Jun 99 07:00:23 -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 Mon, 14 Jun 1999 Volume: 8 Number: 5985
Today's topics:
Accessing Win32 library functions from Unix cliff_lang@my-deja.com
Re: Afraid to ask about Y2K! (Mitchell Morris)
another href extraction question! slmlambert@my-deja.com
Re: another href extraction question! (brian d foy)
Re: another href extraction question! <jpeterson@office.colt.net>
Decoding Binaries from NewsGroups [ Again ] <thomas@bibsyst.no>
Re: Decoding Binaries from NewsGroups [ Again ] <gellyfish@gellyfish.com>
Re: Decoding Binaries from NewsGroups [ Again ] zenin@bawdycaste.org
Re: DIFF BETWEEN PERL & CGI (Abigail)
Re: Dynamic Regular Expression <cschmitz@stud.informatik.uni-trier.de>
Re: File Locking <msanders@thetangledweb.net>
Re: File Uploading via html form <camerond@mail.uca.edu>
I have a question about 5.16 and IIS 4.0 <rollo_lawson@yahoo.com>
Re: I need help making a search program crt@highvision.com
Re: Is Javascript better than Perl? <spike1965@worldnet.att.net>
Match pattern - urgent <anzej@skavt.net>
Re: Match pattern - urgent (brian d foy)
Re: msql interface (brian d foy)
Opening list of files in active perl <hamptonk@bible.org>
Re: PERL for Win32 vs Active Perl <gellyfish@gellyfish.com>
Re: simple math question! Why doesn't the * multiply t (Kvan)
Re: Sort log (Twarren10)
Re: Sort log <jpeterson@office.colt.net>
Re: Sort log <paul.bunkham@synetica.com>
Re: Sort log <gellyfish@gellyfish.com>
trouble with this script , plz take a look <office@asc.nl>
Re: trouble with this script , plz take a look <jpeterson@office.colt.net>
Re: Verify User Input <jpeterson@office.colt.net>
Re: Verify User Input <gellyfish@gellyfish.com>
Re: Verify User Input <ianmorty@nortelnetworks.com>
Re: Verifying date data <thollowe@opentext.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Jun 1999 11:30:01 GMT
From: cliff_lang@my-deja.com
Subject: Accessing Win32 library functions from Unix
Message-Id: <7k2p3l$mhv$1@nnrp1.deja.com>
I need to access Admin functions in Win32 & Win32API like
"Win32::NetAdmin".
I need to accesses user lists, add/remove users, access logfiles, ...
standard admin stuff. My problem is when I install these modules, the
libraries are looking for standard header files "windows.h" and such -
which
I don't have.
Is there a place I can get these?
Is there another way I should approach this? I don't want to kick it
off
from NT unless there is no other way.
TIA, Cliff
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 14 Jun 1999 12:25:33 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <slrn7m9t5s.jp8.mgm@unpkhswm04.bscc.bls.com>
In article <7jspcn$2c4$1@nnrp1.deja.com>, finsol@ts.co.nz wrote:
[snip]
>
>Why don't the Perl faction act more responsibly and offer suggestions as
>to how Y2K audits are best done on Perl applications, the types of
>problems found, the types of environments more likely to exhibit
>problems, the percentage of problems found to lines of code checked, how
>many problems were found through application testing as opposed to code
>checking?, how many problems were found in supposedly remediated code?,
>how were these problems found? etc. etc.
I don't know how things work in your neck of the woods, but around here we
programmers usually expect to be recompensed for our time. In this case,
however, I'll put on my instructor's hat and pass along a few tidbits.
The best way to audit code written in Perl is to find several people who are
experienced in both Perl and code auditing and have them audit the code
(duh). This is, by the way, the same way you would audit code written in any
language ... Perl isn't magic in this regard.
I would further suggest that anyone who can't or won't consult documentation
is, by definition, not experienced in code auditing. In order that they may
get some experience, you could apprentice them to an experienced auditor and
have the team conduct code walkthroughs.
The basic process of code review is as follows:
(1) Print a copy of the code in question (onto paper, no less) for each
member of the review team.
(2) Each team member should, on their own time, familiarize themselves with
the code under review.
(3) At the scheduled time, the team should meet in a single location, where
they will all read through the code as a group activity. Whenever a question
arises about the appropriateness of some code construct, the recorder should
make an annotation on his printed copy of the code under review.
(4) At the completion of the review, the responsible parties (i.e.
programmers) would be given a copy of the recorders annotated printout. These
responsible partied would then rewrite the code or provide a justification
for it's existence (in writing, usually). This becomes supplemental
documentation to the code for the purposes of review.
(5) Return to step 1.
I would hope you can see how reading documentation is a necessary concomitant
to the code review process.
That will be $5, please, for educational services rendered.
In the last review of Perl code that I wrote, there were zero errors.
Consequently, all the error counts in your listed categories were also zero.
Hope this helps.
That will be $5, please, for surveying services rendered.
>
>And, why don't some of the Perl coders come clean about when it was they
>discovered the booby-trap code problem? I know why. No-one likes to
>admit that they make mistakes, in particular egotistical computer
>programmers. That is why you hear programmers squeal "We had to do it
>that way!' whenever Y2K is mentioned. That must be the biggest lie
>ever! They seem to have the world believing them though.
In your case, you could just "find . -type f -print | xargs grep -l
localtime" and complain about each result printed. Since it appears you
aren't doing anything but churning the panic anyway, this should be a
tremendous time savings to you.
That will be $5, please, for consulation services rendered.
>
>The comment about 'deja.com' is an example of how narrow some
>programmers' views of the computing world really is - they cannot
>comprehend that the world of computers is vast and we can only hope to
>know a small part of it. Thus the adage "The more you learn the more you
>realise you don't know". Some of these Perl coders have a lot to learn -
>perhaps the hard way. Most of them only know one computer language and
>only one computing environment - and they think they know it all!
>
Deja.com (a.k.a. DejaNews) is the mechanism whereby these usenet postings are
archived. That is, they represent the collective documentation of the history
of discussion ... i.e. the project notebooks. Once again, reading the
documentation is both helpful and highly suggested. Otherwise, you will be
condemned to making the same decisions over and over again until you
recognize that you need to write it down so you can move on to new topics.
That will be $5, please, for time-motion analysis services rendered.
>They also are ignorant of how the programs they write fit into the
>organisation as a whole and just how dependant those organisations maybe
>on a computer application. They rarely are able to grasp the wider
>picture and can see it only in terms of their code, their application
>and their computer. IT departments are frequently cut-off from the rest
>of the organisation and have very little loyalty to it as IT personnel
>have very little understanding of the business issues. So, programmers
>are apt to down-play the impact of Y2K as they see it as a technical
>problem - they may have no idea of the impact to an organisation should
>their application be unable to function for a day, a week or a month.
Thank you for your analysis of all companies over all the face of the planet.
Surely your intellect must be towering to so grasp that these are all
universal truths. I humbly prostrate myself before you.
Sarcasm is always free.
>
>For those who are interested in Y2K problems that can occur in Perl &
>other programming languages, check out:
>
>http://www.y2kinfo.com/journal/features/0499_amona.html
>
>http://www.y2kinfo.com/journal/features/0599_amon.html
>
>Steve, you are right in being wary of asking questions about Perl and
>Y2K. You have to put up with a lot of abuse if you question any of these
>arrogant programmers or cast any doubt on their beloved programming
>language. Perl coders seem to be the worst but C programmers aren't much
>better.
Ooooh ... you forgot to crosspost this to any C newsgroups. Maybe you should
read the documentation that came with your newsreader so you can avoid this
oversight in the future.
Irony is both free and tasty. And fat-free.
>
>Jocelyn Amon
>--
>Financial Solutions Limited
>http://www.ts.co.nz/~finsol/
HTH. HAND. IKYWMF. IYKWIM. AITYD.
+Mitchell
P.S. Thank you for your prompt payment.
--
Mitchell Morris
If you get all your information from local TV news, you end up knowing less
than if you just stayed home on the couch and drank gin from the bottle.
-- Garrison Keillor
------------------------------
Date: Mon, 14 Jun 1999 11:42:39 GMT
From: slmlambert@my-deja.com
Subject: another href extraction question!
Message-Id: <7k2pre$mq2$1@nnrp1.deja.com>
I am trying to extract 'a hrefs' from html files...yes I know the
answer is to use the Parser HTML::Parser but that is not available to
me.
The problem I have is that I have read the html code into one string,
and I wish to search it for all instances of a regexp. For each one
that is found I wish to copy it to and array.
The regexp that I am looking for is: /<a.href.*\/a>/ (i think).
Any help would be greatly appreciated,
Simon.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 08:52:03 -0400
From: brian@pm.org (brian d foy)
Subject: Re: another href extraction question!
Message-Id: <brian-ya02408000R1406990852030001@news.panix.com>
In article <7k2pre$mq2$1@nnrp1.deja.com>, slmlambert@my-deja.com posted:
> I am trying to extract 'a hrefs' from html files...yes I know the
> answer is to use the Parser HTML::Parser but that is not available to
> me.
how is that unavailable to you yet you can still write scripts?
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 14 Jun 1999 13:36:52 GMT
From: <jpeterson@office.colt.net>
Subject: Re: another href extraction question!
Message-Id: <Uz793.332$TM6.1814@news.colt.net>
brian d foy <brian@pm.org> wrote:
> In article <7k2pre$mq2$1@nnrp1.deja.com>, slmlambert@my-deja.com posted:
> > I am trying to extract 'a hrefs' from html files...yes I know the
> > answer is to use the Parser HTML::Parser but that is not available to
> > me.
> how is that unavailable to you yet you can still write scripts?
My guess is that you are a student who has been set this task as an
assignment, and told not to use HTML::Parser. In that case, do your own
homework. :-)
Alternatively, you are under the impression that only root can install modules.
That's not true, although some modules are a pain to install if you are not
root. I don't think HTML::Parser is one of them. Download HTML::Parser from
CPAN and read the instructions for what flags to set to install into your
user space. See also the -I flag for perl itself which allows you to alter the
search path for library files and modules.
Final appalling option - you are writing a CGI script on a server where the
careless admin has failed to install modules such as HTML::* despite their
obvious pertinence to CGI programming. Fear not. You can simply upload the
appropriate .pm files to your CGI space on the web server, and still make use
of the modules, although tweaking of include paths etc will be even more
necessary.
If you are on Win32 I surrender :-)
------------------------------
Date: Mon, 14 Jun 1999 01:04:03 +0200
From: Thomas Weholt <thomas@bibsyst.no>
Subject: Decoding Binaries from NewsGroups [ Again ]
Message-Id: <376438E3.40FD0B0A@bibsyst.no>
Hi,
I asked this question before, but got no asnwer.
Is there a module or simple code that decodes binary files from
newsgroups?
Thomas Weholt,
Norway
------------------------------
Date: 14 Jun 1999 13:23:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Decoding Binaries from NewsGroups [ Again ]
Message-Id: <3764f44b@newsread3.dircon.co.uk>
Thomas Weholt <thomas@bibsyst.no> wrote:
> Hi,
>
> I asked this question before, but got no asnwer.
>
Perhaps there was a good reason for this.
> Is there a module or simple code that decodes binary files from
> newsgroups?
>
What code of encoding - uuencode, Base64 .. ?
If there is a module that will do this then it will be available from
CPAN <http://www.perl.com/CPAN>.
--
"Philippa Forrester, presenter and would-be Smurf" - Howard Stableford,
Tomorrow's World
------------------------------
Date: 14 Jun 1999 13:32:49 GMT
From: zenin@bawdycaste.org
Subject: Re: Decoding Binaries from NewsGroups [ Again ]
Message-Id: <929367356.374629@thrush.omix.com>
Thomas Weholt <thomas@bibsyst.no> wrote:
: I asked this question before, but got no asnwer.
: Is there a module or simple code that decodes binary files from
: newsgroups?
Look for a program called "aub".
--
-Zenin (zenin@archive.rhps.org) "Hey, are you one of those Linux coders?"
"Nyet. Linux coder in next office."
"Good man. Ignore the screams."
--www.userfriendly.org
------------------------------
Date: 13 Jun 1999 21:55:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: DIFF BETWEEN PERL & CGI
Message-Id: <slrn7m8s92.bmf.abigail@alexandra.delanet.com>
dharmin98@my-deja.com (dharmin98@my-deja.com) wrote on MMCXII September
MCMXCIII in <URL:news:7k0ptp$4ae$1@nnrp1.deja.com>:
[] Hi, Could any one please tell me whats the difference between Perl &
[] CGI and where/how its used. Is it difficuilt to learn with no
[] experience in programming. what software does it use to write the
[] scripts.
It's the same difference as between a wheelbarrow and shyness.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 14 Jun 1999 13:41:47 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Dynamic Regular Expression
Message-Id: <7k30qr$li4$1@fu-berlin.de>
Pamela Goldfarb <pamelag@interlog.com> wrote:
: A user will supply a search criteria:
: word1 word2 - match if both word1 and word2 present
: word1 and word2 - same
: word1 or word2 - match if either present
: I want to create a perl script that can parse the input string and then
: search a file based on the search
: criteria.
The most flexible solution would probably be to create a string
containing code out of your user input and eval() it to get a
code reference, which you could apply to the data to be searched,
like this
$subtext = 'sub { $_ = shift; return (/a/ && /b/); }'
^^^ insert your stuff here
$coderef = eval $subtext;
while (<>) {
print if $coderef->($_);
}
HTH,
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
"It's God. No, not Richard Stallman, or Linus Torvalds, but God."
(By Matt Welsh)
------------------------------
Date: Mon, 14 Jun 1999 08:35:33 -0500
From: "Mike Sanders" <msanders@thetangledweb.net>
Subject: Re: File Locking
Message-Id: <gG793.13$XR3.234149@news1.i1.net>
Well Tom basically I just want perl to tell me if someone,(I know that
certain ps's ignore flocking anyway) is using particular files or not. I'm
getting data collisions on some scripts. I am working with XBase files and
Mr. Pazdziora's XBase module. I noticed the module uses a locking method
with in turn uses flock.
I went to the Perl docs and discovered that flock() should return true or
false. Provided of course that flock is implemented on the machine. With
that I thought this should do the trick but it doesn't.
while(!flock(FILEHANDLE,2)){
sleep 1
}
Do Stuff
or used this test
if(flock(FILEHANDLE,2)){
Do Stuff
}
>
>I don't see what LOCK_NB wouldn't address, but I'm also not
>entirely sure what the original querent really needed to know.
>
>--tom
>--
> I dunno, I dream in Perl sometimes...
------------------------------
Date: Mon, 14 Jun 1999 08:31:52 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: File Uploading via html form
Message-Id: <37650448.2B6CEAC@mail.uca.edu>
[cc'd to mg]
Marcel Grunauer wrote:
>
> [snip]
> If you are using Perl 5, there is CGI.pm, which is cgi-lib.pl's
> successor. It is well documented in itself, but there's also a book by
> the module's author: Official Guide to Programming with CGI.pm by
> Lincoln Stein.
>
> [snip]
> Specifically on p.152 of that book, the author gives an example of how
> to determine the file name and length of what the user tried to
> upload. So before saving the file somewhere on your server you could
> check the file's extension.
>
> I could type in the program, but I'd have to test it first to make
> sure there aren't any typos, and I'm not sure if it's ok to take a
> program 1:1 from a book.
The code to all of the examples in the book is listed at Lincoln's
website (actually Wiley's)
http://www.wiley.com/compbooks/stein/source.html. I figure from this
it's fair game to copy.
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Mon, 14 Jun 1999 05:12:15 -0800
From: Rollo Lawson <rollo_lawson@yahoo.com>
Subject: I have a question about 5.16 and IIS 4.0
Message-Id: <929365937.15960@www.remarq.com>
Iam having a problem with either active perl or IIS 4.0.
Here is my problem. About three months ago I wrote a
couple of scripts for my website at work. I wrote a few
counters a search routine and a couple of forms for sending
emailed responses. My company was using IIS 3.0 and all of
my scripts were working beautifully. Then my company
upgraded to IIS 4.0 and to Perl 5.16(active perl) from perl
5.01. Now the counters still work but the search routine
now returns zero matches and the Sendmail for windows
program that Iam using with the web based forms is not
sending out the e-mail. Is there a setting maybe that my
company is not setting properly or is the new version of
perl not interpreting my scripts properly. Here is a copy
of my search script. Please explain to me what the problem
could be.
HERE IS MY SEARCH SCRIPT!
#!/wintergreen/perl/bin/perl
#Marc's Search.pl
print "Content-type: text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs=split(/&/, $buffer);
#Split the Values
foreach $pair (@pairs)
{
($name,$value)=split(/=/,$pair);
$value =~tr/+/ /;
$value =~s/%(..)/pack("C",hex($1))/eg;
$FORM{$name}=$value;
}
$i=0;
$tempo = 0;
#print "Hello Marc";
foreach $file (</meiu/meiupawebsite/*.htm>)
{
print "$file";
open(HTML, $file);
undef $/;
$body=<HTML>;
$/="\n";
close(HTML);
if ($body=~/$FORM{key}/i)
{
($temp,$tempo)=split(/description\" CONTENT=\"/i,$body);
print "$tempo";
($first,$second)=split(/"/i,$tempo);
($third,$fourth)=split(/<\/title>/i,$body);
($fifth,$sixth)=split(/<title>/i,$third);
($seventh,$eighth)=split(/-ct/i,$body);
($ninth,$tenth)=split(/title=/i,$seventh);
#if($tenth)
push(@descrips, $first);
push(@titles, $sixth);
push(@doclist, $file);
}
}
$num = @doclist;
if ($num == 0)
{
print "<HTML><HEAD><TITLE>Zero results page</TITLE></head>";
print "<BODY LINK=\"#FF0000\" VLINK=\"#8C007B\">";
print "<Img src=
\"/meiu/meiupawebsite/media/meiu1175a.gif\"><br><br><center>
";
print "<font size=\"+2\" face=\"times\">Sorry, there were 0
matches for : </font>";
print " <font color=\"blue\" size=\"+1\">$FORM{key}";
print "</font></center><br><hr><br><br>";
print "<UL>\n <LI><a href"; print "=
\"http://changes.micro.lucent.com/meiu/meiupawebsite/meiusea
rch.html\">";
print "Click here to return to the Meiu search page and
modify your query</a>";
print "</body></html>";
}
else
{
print "<HTML><HEAD><TITLE>Your Search
Results</TITLE></HEAD>";
print "<BODY LINK=\"#FF0000\" VLINK=\"#8C007B\">";
print "<table><td width =\"350\" align=left><td>";
print "<font size=\"+0\" face=\"times\"><b>microelectronics
group";
print "</b></font></tr>";
print "<tr><TD WIDTH=640 COLSPAN=2><MAP NAME=
\"ImageMap1_MAP\">";
print "<AREA SHAPE=\"Rect\" COORDS=\"0,1,71,21\" HREF=
\"javascript:history.go(-1)\">";
print "<AREA SHAPE=\"Rect\" COORDS=\"79,-2,172,18\" HREF=
\"default.htm\">";
print "<AREA SHAPE=\"Rect\" COORDS=\"180,1,258,21\"";
print "HREF=\"http://www.micro.lucent.com\">";
print "<AREA SHAPE=\"Rect\" COORDS=\"262,0,332,21\"";
print "HREF=\"javascript:search.htm\">";
print "</MAP><IMG Name=\"ImageMap1\"";
print "SRC=
\"/meiu/meiupawebsite/media/btn_top_back_bar.gif\"";
print " Width=\"640\" Height=\"20\" Border=\"0\" Usemap=
\"#ImageMap1_MAP\"></TD>";
print "</TR>";
print "<tr><td width =\"460\">";
print "<Img src=
\"/meiu/meiupawebsite/media/meiu1175a.gif\"><td>";
print "</table><table width = \"85%\"><tr><td>";
print "<CENTER><img ";
print "src=
\"/meiu/meiupawebsite/media/icn_search.gif\"></center></tr><
BR>";
print "<tr><td><CENTER><b><font size=\"+2\" face=
\"times\">Your search ";
print "produced ";
print "<font color=\"red\">$num</font>";
print " match(es)</font></b><br><br></tr><tr>";
print "<td align=\"center\"><img ";
print "src=
\"/meiu/meiupawebsite/webarea/media/red_bar.gif\">";
print "</CENTER><P>";
print "<br><center>The following documents contain the
word: <B><font ";
print "color=\"blue\">$FORM{key}</font></B></center>
\n<P></table>\n";
print "\n";
$counter = 0;
$numberman = $counter +1;
$marc = "/meiu/meiuwebsite/";
print "<table>";
foreach $name (@doclist){
$temp = $name;
$numberman = $counter +1;
$temp =~s/.meiu.meiupawebsite./ /eg;
print "<tr><td width = \"70\">";
print "<td width = \"500\"><a href=\"$name\">$numberman. ";
print " $titles[$counter]</a><br>\n";
print "$descrips[$counter]\n<br>";
$name =~s/.meiu.meiupawebsite./ /i;
print "<i>$name</i><br><br></tr>";
$counter++;
}
print "</table>";
print "<BR><BR><HR>";
print "<table><tr><td width = \"540\">";
print "<FONT Size=\"2\" FACE=\"Arial\"><b>Content
Owner:</b></FONT>";
print "<FONT FACE=\"Arial\" Size=\"2\"> Scott Harkey
</FONT><A";
print " HREF=\"mailto:sharkey\@lucent.com\"><font size=\"2
\">";
print "sharkey\@lucent.com</font></A><font Color=\"#FF0000
\" Size=\"2\"> (<u>Post"; print "Entry)</font></u><br>";
print "<font size=\"2\"><b>Last modified:</b> 3/17/99<br>";
print "<b>Last Reviewed:</b> 3/17/99</font>";
print "<a href=
\"http://www.lucent.com/copyright.html\"><br><font ";
print "size=\"2\">Copyright</font></a>";
print " <font size=\"2\">1998 Lucent Technologies All
rights reserved</font>";
print "<td><img src =
\"/meiu/meiupawebsite/media/circlelogo.gif\">";
print "</tr></table>";
print "</BODY>\n</HTML>\n";
}
Rollo Lawson
rollo_lawson@yahoo.com
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
------------------------------
Date: Mon, 14 Jun 1999 11:27:44 GMT
From: crt@highvision.com
Subject: Re: I need help making a search program
Message-Id: <7k2ovd$mhc$1@nnrp1.deja.com>
Hey man, I messed up the code I sent yesturday, I am mostly sure that it
won't work at all.
I am going to work on it a bit more, and send a fixed copy.
Thanks for your patience.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 09:19:20 -0400
From: Terry Mealy <spike1965@worldnet.att.net>
Subject: Re: Is Javascript better than Perl?
Message-Id: <37650158.8D954650@worldnet.att.net>
I'm not an expert in Java, Javascript, or Perl, but I have used all
three. The following are my very biased opinions:
Java is a nifty language - And it seems that it is actually starting to
become cross-platform in more than theory as of the 1.2 release. I
think that it is a great language for developing applications
(spreadsheets, databases, etc.), but I would certainly hate to write a
simple in-house utility or process in Java.
Java plusses: "Cross-Platform", complex client-side processing, simple
to use (compared to C++). Free Java Development Kits from Sun!
Java minuses: Slow!
Javascript: You can do some fairly nifty things with Javascript, much
more than the "bits" like validation and cookies that you see on most
websites. Javascript has become the de facto language for DHTML, which
may become very importantant for Intranets, not just annoying web pages.
Javascipt plusses: Fairly easy to learn. Free! 85%+ of browsers can
adequately handle it.
Javascript minuses: Different implementations for different browsers.
Perl: The king of programming languages! The swiss-army chainsaw! This
is a language that will let you do almost anything! And not just
server-based processing! This language was cross-platform when Java
was only so in theory. Perl was designed to help programmers and
programmer wannabees (like me!) get the job done. I't doesn't stand in
your way!
Perl plusses: Very flexible. Free! Helps get useful programs done
fast. Not controlled by nasty-bad corporations. A very ENGAGING and
even "artful" language.
Perl minusses: Doesn't make the fastest or most efficient programs (Not
TOO bad, though.)
Darrick Wolfe wrote:
>
> Wellllll, for one... Java and JavaScript are 2 totally different things. Macrosheep
> wrote:
>
> > I'm doing a project for an Independent Study at WPI. I was wondering if anyone
> > had feedback concerning Java's pluses and minuses vs. Perl as a script
> > language?
> >
> > For example, do you think Java's more client-based processing is preferable to
> > Perl's server-based?
> >
> > Are script languages something that helps usability of the web, or are they
> > simply technological marvels that we do because we can, without realizing that
> > the average American has a slow internet connection and many have slow
> > computers (where Java can be quite annoying).
> >
> > Any feedback, positive or negative would be appreciated. Thanks.
> >
> > --Macrosheep
------------------------------
Date: Mon, 14 Jun 1999 14:48:46 +0200
From: "Anzej Becan" <anzej@skavt.net>
Subject: Match pattern - urgent
Message-Id: <7k2tqd$pi3$1@planja.arnes.si>
Hi!
Sorry for blackmailing post, it's realy urgent.
I should decode datas from fixed width record:
PEAR 14.220 14.400 14.317 20.898
APRICOT 33.320 34.190 33.863 5.853
SUNFLOWER SEED 2.104 2.105 2.104 135
I tried with split, but I don't find the right match pattern:
foreach $data(@data)
{
@field = split (/*****/, $data);
table_row_print;
}
Then I should handle results in print them in table. This part I know well
:-))
Thanks for any suggestions!
Anzej Becan
- - - - - - - - - - - - - - - - - - - - - - -
Ob Radoljni 58
2344 Lovrenc na Pohorju
SLOVENIA
++ 386 62 675082
- - - - - - - - - - - - - - - - - - - - - - -
anzej@skavt.net - http://www.skavt.net/~anzej
------------------------------
Date: Mon, 14 Jun 1999 09:24:11 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Match pattern - urgent
Message-Id: <brian-ya02408000R1406990924110001@news.panix.com>
In article <7k2tqd$pi3$1@planja.arnes.si>, "Anzej Becan" <anzej@skavt.net> posted:
> I should decode datas from fixed width record:
>
> PEAR 14.220 14.400 14.317 20.898
> APRICOT 33.320 34.190 33.863 5.853
> SUNFLOWER SEED 2.104 2.105 2.104 135
>
> I tried with split, but I don't find the right match pattern:
i would use substr().
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 14 Jun 1999 08:40:23 -0400
From: brian@pm.org (brian d foy)
Subject: Re: msql interface
Message-Id: <brian-ya02408000R1406990840230001@news.panix.com>
In article <3764E7D8.A80C46C2@geocities.com>, dansjohnson@geocities.com posted:
> I am an ok perl programmer that learns best by example. I need some
> source code showing some of the basic uses of the msql interface from
> perl. Need specifically select and update statements.
the interface doesn't care about the SQL part. you'll need to read
the msql docs for that. as for examples, the documentation has
plenty.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 14 Jun 1999 12:23:38 GMT
From: Hampton Keathley <hamptonk@bible.org>
Subject: Opening list of files in active perl
Message-Id: <3764F3FC.F6CAB946@bible.org>
Greetings,
Sorry for the duplicate post. I realized I forgot something in my
previous message.
I have used PERL for Win32 for a long time and recently downloaded
Active Perl.
I often write scripts to clean up or convert massive numbers of files in
a directory. All my scripts that process several files at once don't
work under
active perl.
First question is why?
Most important question: what do I do to the following script to fix it?
I typically use the following:
command line: perl script.pl *.txt
------------script----------------
foreach $file (@ARGV){
($fn,$ext) = split(/\./ ,$file);
die ("Cannot open input file $fn.$ext\n") unless (open
(INFILE,"$fn.$ext"));
die ("cannot open output file $fn.sgm\n") unless (open
(OUTFILE,">$fn.sgm")) ;
while (<INFILE>){
$line = $_;
$line =~ s/SEARCH/REPLACE STUFF/;
and other stuff here
print OUTFILE $line;
}
close (OUTFILE);
close (INFILE);
}
------------end-------------------
Thanks,
hampton
------------------------------
Date: 14 Jun 1999 14:23:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PERL for Win32 vs Active Perl
Message-Id: <37650268@newsread3.dircon.co.uk>
Hampton Keathley <hamptonk@bible.org> wrote:
> Greetings,
>
> I have used PERL for Win32 for a long time and recently downloaded
> Active Perl.
>
> I often write scripts to clean up or convert massive numbers of files in
> a directory.
> All my scripts that process several files at once don't work under
> active perl.
> First question is why?
An earlier distribution of Perl for Win32 emulated the Unix shell wildcard
expansion that is missing in the Microsoft Command interpreters - this
feature has been removed from later Perls.
> Most important question: what do I do to the following script to fix it?
>
See (for instance) my post:
<http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=485997734&fmt=text>
For more on this and a possible solution.
/J\
--
"The internet is like a car boot sale" - Jon Sopel, BBC News
------------------------------
Date: Mon, 14 Jun 1999 11:37:49 GMT
From: kvan@dis.dk (Kvan)
Subject: Re: simple math question! Why doesn't the * multiply two numbers?
Message-Id: <3764e69b.333009832@news.newsguy.com>
On Sun, 13 Jun 1999 21:43:53 -0400, "Ryan T. Rhea"
<ryan420@earthling.net> wrote:
>I have written the following script in perl. Everything works except
>the multiplication. What's going on?
That's a very good question. I copied the script verbatim with cut and
paste and ran it:
---
C:\Trinity> calc.pl 3 + 5
8
C:\Trinity> calc.pl 3 * 5
15
C:\Trinity>
---
In short, I found no problem with the script. This leads me to believe
that your problem is not the script, but your shell (this is also why
I deliberately tested it under WinNT). What you want to do, in order
to find the problem, is check what you're really doing. Print out
something like "$num1 $oper $num2 gives: " before the result.
For a better way of catching errors, rephrase the whole thing using
elsif:
if ($oper eq "+") {
...
}
# more elsifs.
elsif ($oper eq "*") {
...
}
else {
print "Error: Operator not recognized.\n";
}
HTH,
Kvan.
-------Casper Kvan Clausen------ | 'A *person* is smart. People are
---------<kvan@dis.dk>---------- | dumb, panicky, dangerous animals
| and you know it.'
| - "K" in Men in Black.
------------------------------
Date: 14 Jun 1999 12:32:26 GMT
From: twarren10@aol.com (Twarren10)
Subject: Re: Sort log
Message-Id: <19990614083226.22856.00001345@ng-fu1.aol.com>
No, this program is reading in a log file which is formatted like this:
furniture|10|Mon Jun 14 03:25:44 1999
clothes|17|Tue Jun 15 03:05:20 1999
automobile|1|Sat Jun 20 01:14:31 1999
I am sorting it so that the more times a term has been searched (the second
field number) comes up first. That would be clothes in the above example.
my problem is that in the date/time field
when it prints it out, all the dates are
Sat Jun 20 01:14:31 1999 when in the log of course they are different.
The way i'm printing it is the variables
$word $score and $tdate in a table for display.
The sort works, the word and score is printed correctly, the date/time is
printed, but always the same date, not different as in log file. My Code:
while (<FILE1> ) {
chomp;
($searchword, $score, $tdate) = split(/\|/);
$scores{$searchword} = $score;
}
close FILE1;
foreach $word (sort { $scores{$b} <=> $scores{$a} } keys %scores)
{
I'm really stumped on this one. is it somehow not getting every date field
as it goes through each line?
------------------------------
Date: Mon, 14 Jun 1999 13:29:28 GMT
From: <jpeterson@office.colt.net>
Subject: Re: Sort log
Message-Id: <Ys793.331$TM6.1814@news.colt.net>
Twarren10 <twarren10@aol.com> wrote:
> my problem is that in the date/time field
> when it prints it out, all the dates are
> Sat Jun 20 01:14:31 1999 when in the log of course they are different.
> while (<FILE1> ) {
> chomp;
> ($searchword, $score, $tdate) = split(/\|/);
> $scores{$searchword} = $score;
UMmmm.. you aren't doing anything with $tdate.. you overwrite it
each time in the while loop. So, the single date that you get in your
output is presumably the last date read in from the file. You'll need to
create another hash of dates such as:
$dates{$searchword} = $tdate;
> I'm really stumped on this one. is it somehow not getting every date field
> as it goes through each line?
If you can sort a hash by values you ought to be able to pick up a bug like
this :-)
------------------------------
Date: Mon, 14 Jun 1999 14:34:20 +0100
From: Paul Bunkham <paul.bunkham@synetica.com>
Subject: Re: Sort log
Message-Id: <376504DC.25FA5763@synetica.com>
I think what Jonathon wrote actually answered your question, did you try
the code he gave you?
> No, this program is reading in a log file which is formatted like this:
>
> furniture|10|Mon Jun 14 03:25:44 1999
> clothes|17|Tue Jun 15 03:05:20 1999
> automobile|1|Sat Jun 20 01:14:31 1999
>
> I am sorting it so that the more times a term has been searched (the second
> field number) comes up first. That would be clothes in the above example.
>
> my problem is that in the date/time field
> when it prints it out, all the dates are
> Sat Jun 20 01:14:31 1999 when in the log of course they are different.
>
The reason that all the dates are Sat Jun 20 01:14:31 1999, is because
that is the last date read in to $tdate, you need to store the date in
your hash along with the score like this:
while (<FILE1> )
{
chomp;
my ($searchword, $score, $tdate) = split(/\|/);
$scores{$searchword} = [$score,$tdate];
}
close FILE1;
(From Jonathon Stowe's post)
This means that each record will have its date associated with it. Try
it, honestly it works!
> foreach $word (sort { $scores{$b} <=> $scores{$a} } keys %scores)
> {
>
as a help, use this line in your foreach loop, above, once you have
modified your while loop:
print "$word|$scores{$word}->[0]|$scores{$word}->[1]\n";
and you should find that it looks as if you have just printed the
contents of your log file. You could use $_ instead of $word, and is
probably better style, but if your confused $word would be a better
option to keep track of what you are doing.
Hope this clears it up,
Paul.
--
*****************************************
Paul Bunkham
Developer
Synetica Knowledge Technologies
*****************************************
------------------------------
Date: 14 Jun 1999 14:29:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sort log
Message-Id: <376503bb@newsread3.dircon.co.uk>
Twarren10 <twarren10@aol.com> wrote:
> No, this program is reading in a log file which is formatted like this:
>
> furniture|10|Mon Jun 14 03:25:44 1999
> clothes|17|Tue Jun 15 03:05:20 1999
> automobile|1|Sat Jun 20 01:14:31 1999
>
> I am sorting it so that the more times a term has been searched (the second
> field number) comes up first. That would be clothes in the above example.
>
> my problem is that in the date/time field
> when it prints it out, all the dates are
> Sat Jun 20 01:14:31 1999 when in the log of course they are different.
>
> The way i'm printing it is the variables
> $word $score and $tdate in a table for display.
>
Yes and because you are overwriting tdate on every line you read from
your file and becuase you are apparently not saving it anywhere else then
then if you print out $tdate the only one you will get is the last one.
Try out my first suggestion - believe me that is what you want to do.
/J\
--
"While they're pumping, you're soaking them" - Speed Loader TV Advert
------------------------------
Date: Mon, 14 Jun 1999 14:39:08 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: trouble with this script , plz take a look
Message-Id: <7k2t8g$t1s$1@zonnetje.NL.net>
some way or the other , this is unable to run ..
i can't get the errors by redirecting STDERR to STDOUT
i can't get the logs , cause my isp won't let me
i've tried locating it in the faqs but haven't found it..
=[code]=
%invoer=&cgiparse();
$uit="uittest.txt";
open (UIT, ">>$uit") || die "Aaaaaaaaaaargh!!! : $!";
print UIT 'Time is now : ',scalar(localtime),"\n";
print UIT 'email : ',$invoer{mail},"\n";
close UIT;
=[end]=
cul8r
--
Bastiaan v/d Berg ; aka buZz
Internet Specialist
Account Software Consultancy
-[ http://www.asc.nl/ ]-[ office@asc.nl ]-
-[ http://huizen.ddsw.nl/bewoners/buzz/ ]-[ buzz@ddsw.nl ]-
------------------------------
Date: Mon, 14 Jun 1999 13:41:01 GMT
From: <jpeterson@office.colt.net>
Subject: Re: trouble with this script , plz take a look
Message-Id: <ND793.333$TM6.1814@news.colt.net>
Bastiaan S van den Berg <office@asc.nl> wrote:
> some way or the other , this is unable to run ..
> i can't get the errors by redirecting STDERR to STDOUT
> i can't get the logs , cause my isp won't let me
Please see www.he.net for sane service provision
> open (UIT, ">>$uit") || die "Aaaaaaaaaaargh!!! : $!";
This will not help you. die sends to STDERR, which in CGI programming ends
up in the http server error logs. Instead, you can still check for errors
with print. Make sure you have sent the content-type header - put at the
top of your script:
print "Content-type: text/plain\n\n";
Then, just use print instead of die. You error should appear in the browser.
------------------------------
Date: Mon, 14 Jun 1999 12:00:48 GMT
From: <jpeterson@office.colt.net>
Subject: Re: Verify User Input
Message-Id: <Q9693.327$TM6.1679@news.colt.net>
Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> Hi all,
> I am writing a script that will take requests for software patches and
> keep a log of these requests.
> The input form has several fields (names,dates,titles etc) and I am
> wondering if there are any other ways of verifying these inputs are
> correct e.g. the date is correct etc.
This is not _really_ specific to Perl. It is a design issue. You could write
a function that splits a date - "26/6/99" and checks it. But what if the user
is not from the UK (sic) and writes 6/26/99? Or if they write 26-june-1999 or
26.06.1999 ?
Maybe you really want three dropdown lists, one for day of month, one for
month, and one for year - that might result in reduced data entry error
far more than a load of fancy back end checking.
As for lots of if(){} constructs - I think that's OK, but you might want to
wrap it all up in a subroutine and stick it at the end of your script. There's
more than one way to do it...
What I would say is never underestimate the variety of valid responses. If
you _really_ want to limit user input, use interface widgets correctly.
There is nothing more evil than computer programs that consider - an invalid
character in names (piggott-smith), think that 3 letters is enough for a title
(Miss, Capt.), or for some mystical reason believe that no one has an address
longer than 32 characters.
------------------------------
Date: 14 Jun 1999 13:10:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Verify User Input
Message-Id: <3764f13e@newsread3.dircon.co.uk>
Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> Hi all,
>
> I am writing a script that will take requests for software patches and
> keep a log of these requests.
>
> The input form has several fields (names,dates,titles etc) and I am
> wondering if there are any other ways of verifying these inputs are
> correct e.g. the date is correct etc.
>
Larry Rosler posted a a date validation function just the other day see:
<http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=488608437&fmt=text>
>
> PS: I have also heard that you can get JavaScript to run when the user
> leaves a particular field in a form. Could this be used to call a
> validation routine ?
>
You will probably want to ask in comp.lang.javascript about that.
/J\
--
"I'm about to say a naughty word so if you're easily offended you can
fuck off now" - Daisy Donovan, The 11 O'Clock Show
------------------------------
Date: Mon, 14 Jun 1999 09:20:03 +0100
From: Ian Mortimer <ianmorty@nortelnetworks.com>
Subject: Re: Verify User Input
Message-Id: <3764BB33.397E6E6@nortelnetworks.com>
You mention drop down lists - this is OK but you still have the chance of a user
entering say the 31st day in Febuary or something like that (Perhaps I'm being
too fussy !)
You also mention that users might input dates in a different format. I hope I
have taken care of this by stating in the form that the date format must be
dd-mm-yy.
I'll probably stick with the if statements.
Thanks all the same,
Ian.
------------------------------
Date: Mon, 14 Jun 1999 07:42:19 -0400
From: "Skip Hollowell" <thollowe@opentext.com>
Subject: Re: Verifying date data
Message-Id: <7k2pnu$30iu@enews1.newsguy.com>
Have you ever tried to get authorization to install unofficial code onto a
governement production installation?
Please give me a a break and realize that the whole world can't always bend
the beauracracy to their wills every time.
I don't know who pays your salary, but in my world, the customer is always
right.
Abigail wrote in message ...
>
>So you distribute them as part of your product.
>
>What would you do if the customer said they haven't computers and
>are unwilling to buy them?
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5985
**************************************