[13427] in Perl-Users-Digest
Perl-Users Digest, Issue: 837 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 17 22:17:23 1999
Date: Fri, 17 Sep 1999 19:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937620611-v9-i837@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 17 Sep 1999 Volume: 9 Number: 837
Today's topics:
Re: List files in a dir <tchrist@mox.perl.com>
Re: List files in a dir (Randal L. Schwartz)
Re: Making and using a DB. (Help!!!) <cassell@mail.cor.epa.gov>
Re: Need help in creating Submission Engine. (Abigail)
Re: PERL (cgi) and Databases -> How To? <cassell@mail.cor.epa.gov>
Re: Perl.exe has an interpreted mode? <bwalton@rochester.rr.com>
regexp odity with (?s-x:) <ltl@rgsun40.viasystems.com>
Re: Returning information from 'eval' (Abigail)
Re: Telnet scripting in Perl? <cassell@mail.cor.epa.gov>
Re: Telnet scripting in Perl? <cassell@mail.cor.epa.gov>
Re: Telnet scripting in Perl? <carvdawg@patriot.net>
Re: Telnet scripting in Perl? (Abigail)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Sep 1999 18:11:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: List files in a dir
Message-Id: <37e2d899@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, plsoucy@yahoo.com writes:
:Anybody could tell me how to list the files in a dir and print the
:result in an HTML format with PERL?
print "<PRE>", `ls $directory`, "</PRE>";
--tom
--
There is a need to keep from being locked into Open Systems. --IBM sales rep
------------------------------
Date: 17 Sep 1999 19:02:22 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: List files in a dir
Message-Id: <m1ogf1vuxd.fsf@halfdome.holdit.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> [courtesy cc of this posting mailed to cited author]
Tom> In comp.lang.perl.misc, plsoucy@yahoo.com writes:
Tom> :Anybody could tell me how to list the files in a dir and print the
Tom> :result in an HTML format with PERL?
Tom> print "<PRE>", `ls $directory`, "</PRE>";
That's missing HTML-encoding, however. If you want that too:
use HTML::Entities qw(encode_entities);
print "<PRE>", map(encode_entities($_), `ls $directory`), "</PRE>";
But *that* suffers if $directory has shell-significant characters, so
you'll want to either not invoke /bin/ls, or do something to make it
safer. One way:
use HTML::Entities qw(encode_entities);
if (opendir DIR, $directory) {
print "<PRE>";
print encode_entities($_), "\n"
for sort readdir DIR;
print "</PRE>";
}
Of course, *that* includes the dotfiles, which we can filter with a grep:
use HTML::Entities qw(encode_entities);
if (opendir DIR, $directory) {
print "<PRE>";
print encode_entities($_), "\n"
for sort grep !/^\./, readdir DIR;
print "</PRE>";
}
There. More solutions than you can shake a stick at. And who shakes
sticks anyway these days? :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 17 Sep 1999 17:39:26 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Making and using a DB. (Help!!!)
Message-Id: <37E2DF3E.F79CE30E@mail.cor.epa.gov>
Dheera wrote:
>
> Here is the exact address (DB_File and a bunch of others are available
> here):
>
> http://www.activestate.com/packages/zips/
But it will be better to use the ppm program to fetch them
and get them installed *properly*.
Read the win32perl FAQ on your hard drive to see how to
use ppm.
Type 'ppm help' at a command prompt to find out what the
options are.
Type 'ppm search DB' to get a list of available packages
with "DB" in their names.
Then type the appropriate thing using the ppm install
option. And voila!
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 17 Sep 1999 20:10:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Need help in creating Submission Engine.
Message-Id: <slrn7u5ppc.1j0.abigail@alexandra.delanet.com>
Captain Panic (forceconstant@yahoo.comNOSPAM) wrote on MMCCVIII September
MCMXCIII in <URL:news:7rta4b$83u$1@news.fsu.edu>:
;;
;; The company I work for wants me to see about creating a web based submission
;; tool that would allow people to submit their links to various web sites, and
;; then display the results. But I must confess I have no idea how to even
;; begin. If someone could just give me an idea how one would go about making
;; one of these.
That's not a Perl question, now is it?
I suggest you hire someone familiar with HTTP and CGI, and probably
HTML as well.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: Fri, 17 Sep 1999 17:27:00 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: PERL (cgi) and Databases -> How To?
Message-Id: <37E2DC54.4AE17026@mail.cor.epa.gov>
Jon S. wrote:
[snip]
> Nope, I'm such a newbie that I haven't quite figured out how to get
> the perl manpage. I started reading O'Reilly's "Learning Perl" 1
> month ago before I had access to a computer with Perl installed, and
> it talks about the manpages right at the beginning. But, I haven't
> tried to get them out yet. Now I know the command.
Then do yourself a favor. I'm assuming you have a win32
box based on your newsreader. If not, ignore this bit:
Go to www.activestate.com and get ActiveState Perl for win32
[build 519 now]. It installs itself with a double-click.
Answer the prompts, and get a nifty copy of the FAQ, the
ActivePerl [win32] FAQ, the docs, the module docs, the PPM
program to grab even more modules already prepped for you off
their site, and perldoc [which is a kludge but will do lots
of stuff for you, like reading the docs and searching the
FAQ based on keywords].
> I assume I issue "man perlfaq" at the telnet prompt, right? (I don't
> have my copy of "learning Perl" on me at the moment, but I know it
> talks about the man pages in the front.)
>
> Some newbies truly are newbies, not just coders and unix folks who've
> never tried perl before. Thanks for the warm welcome.
If you have no experience coding before and you're grappling
with Learning Perl, be aware that:
[1] there is a Learning Perl for Win32 Systems
[2] a nice tutorial to get you jumpstarted is at
http://www.netcat.co.uk/rob/perl/win32perltut.html
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 17 Sep 1999 21:58:04 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl.exe has an interpreted mode?
Message-Id: <37E2F1AC.1A52551D@rochester.rr.com>
Ken Hirsch wrote:
>
> revjack <revjack@radix.net> wrote:
> > Martien Verbruggen explains it all:
> > :In article <7q528s$t6a$1@news1.radix.net>,
> > : revjack <revjack@radix.net> writes:
> > :> I noted that "perl.exe" was cited, and MS software was used to post the
> > :> article, so I presumed an MS OS. Ctrl-Z exits perl.exe on those systems
> > :> without running the program; Ctrl-D submits the program and runs it.
> >
> > :On NT both ^D and ^Z will end the input for perl, but they do need to
> > :be followed by a return, which is slightly unnatural behaviour. ^Z is
> > :the normal EOF for NT and other MS products. I suspect the allowance
> > :of ^D and ^Z both is programmed as opposed to a shell thing. But I
> > :might be wrong.
> >
> > That's true for NT, thank you for the clarification.
> >
> > Under Win98, ^D runs the input, ^Z exits without running.
> >
> > I don't know what happens under Win95.
> >
> > I recommend that users of any Windows-based perl use ^D.
>
> On my Win98 system ^D does not terminate input, it is read as a normal
> character. ^Z does terminate input (no carriage return is needed). I am
> curious as to why your system behaves differently.
My Win95 system treats ^D as just another character, and ^Z terminates
input with no "Enter" keystroke required, but *only* if the ^Z is
entered at the start of a new line. If the ^Z is entered as the
second or subsequent character of a line, it is ignored *unless* two
in a row are typed, in which case the pair terminates the input.
It does also, per the text below, clobber the first line of output
after the ^Z, in all these cases. Pretty bizarre behavior, IMHO.
>
> Because of a bug (apparently in ActivePerl), the first line of output is not
> displayed after you do the ^Z.
> I am using binary Build 518 (perl 5.005_03).
>
> Try this from a DOS prompt under Win98:
> #!perl -w
> print "start\n";
> while (<>) {
> print;
> }
> print "This line is not displayed\n";
> print "However, this line is displayed\n";
--
Bob Walton
------------------------------
Date: 18 Sep 1999 00:56:25 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: regexp odity with (?s-x:)
Message-Id: <7runvp$6n3$1@rguxd.viasystems.com>
Observe:
$pattern = 'aa|bb';
$pattern_works = qr{
(
(?s:$pattern)
)}xo;
$pattern_dont = qr{
(
(?s-x:$pattern)
)}xo;
print "$1 from pattern_works\n" while "ccbbdd\n" =~ /$pattern_works/g;
print "$1 from pattern_dont\n" while "ccbbdd\n" =~ /$pattern_dont/g;
__END__
Try it please and let me know what you see. pattern_dont
gives me nothing with 5.005_03 on Solaris 2.5.1.
More straight-forward patterns work with both.
I think this is a bug. If it is something I have misread
in the documentation, please point me in the right direction.
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: 17 Sep 1999 20:27:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Returning information from 'eval'
Message-Id: <slrn7u5qp0.1j0.abigail@alexandra.delanet.com>
Helge Fredriksen (Helge.Fredriksen@sensewave.com) wrote on MMCCVIII
September MCMXCIII in <URL:news:7rtvhq$l5g$1@web.ost.eltele.no>:
\\
\\ To be able to mix perl variables and unix commands, i want
\\ to evaluate a command built within a string like this
\\
\\ eval "$status = `cmp " . $file1 . " " . $file2 . "`";
\\
\\ and then be able to read out what the status string contains.
\\ This does not work, and I have to substitue the real values
\\ of $file1 and $file2, which is not a very elegant, and do the
\\ statement without the use of eval.
Why the eval? What's wrong with:
$status = `cmp $file1 $file2`;
And note that `` doesn't give you the return status of the command, but
the output it generates.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== 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: Fri, 17 Sep 1999 17:32:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Telnet scripting in Perl?
Message-Id: <37E2DDB5.E593C45E@mail.cor.epa.gov>
WhilBone wrote:
>
> A friend of mine have set up a mail router/firewall on Linux. When I asked
> him today about adding a small script to send some telnet commands to the
> mail server to get it to release my mail he said that it could probably be
> done in perl.
>
> Unfortunately neither him or I know enough about perl to decide if this is
> possible or not.
[snip]
Check out the examples which are in the documentation for
the Net::Telnet module.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 17 Sep 1999 17:36:10 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Telnet scripting in Perl?
Message-Id: <37E2DE7A.2FC4DF3F@mail.cor.epa.gov>
Kragen Sitaker wrote:
>
> In article <7rtrqm$lt4$1@cubacola.tninet.se>, WhilBone <no_mail@to.me> wrote:
>
> I'm not going to respond to messages from people whose addresses are
> "no_mail@to.me". Neither, I hope, is anyone else.
Well, I did. He didn't ask for an e-mail response, so I
decided to let him have a hint. Even if mail_munging is a
no-no in Usenet. How will s?he learn if no one bothers to
say "Please don't do that anymore?"
Now, the people who insist on an e-mail response get nothing
from me.
And don't get me started on the people who post here insisting
on an e-mail reply but have an undeliverable e-mail address
in their header! Tom Christiansen has dealt with a couple...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 17 Sep 1999 21:32:27 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Telnet scripting in Perl?
Message-Id: <37E2EBAB.8075A692@patriot.net>
Yes, I know how to do this...it's easy. However, I can't send you the
script or anything else..your email address doesn't work...
------------------------------
Date: 17 Sep 1999 20:33:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Telnet scripting in Perl?
Message-Id: <slrn7u5r3j.1j0.abigail@alexandra.delanet.com>
WhilBone (no_mail@to.me) wrote on MMCCVIII September MCMXCIII in
<URL:news:7rtrqm$lt4$1@cubacola.tninet.se>:
?? A friend of mine have set up a mail router/firewall on Linux. When I asked
?? him today about adding a small script to send some telnet commands to the
?? mail server to get it to release my mail he said that it could probably be
?? done in perl.
??
?? Unfortunately neither him or I know enough about perl to decide if this is
?? possible or not.
So, did you check out Net::Telnet?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== 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: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 837
*************************************