[7030] in Perl-Users-Digest
Perl-Users Digest, Issue: 655 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 24 20:17:33 1997
Date: Tue, 24 Jun 97 17:00:22 -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 Tue, 24 Jun 1997 Volume: 8 Number: 655
Today's topics:
Re: a string to an array <sibsib@hotmail.com>
Re: Can't find *** in @INC ....Help Please (Matthew Burnham)
Re: CGI.pm not displaying text properly <damon@netserver.stanford.edu>
Re: Checking a string for "@' and "." <sibsib@hotmail.com>
Re: Checking a string for "@' and "." <ajohnson@gpu.srv.ualberta.ca>
Re: checking for blanks <rootbeer@teleport.com>
Re: checking for blanks <hartje@etech.hs-bremen.de>
Connect in Perl under NWS 3.01 <serginho@alpha.hydra.com.br>
Discussion board? <s.fruehwacht@str.daimler-benz.com>
Re: distributed objects in perl <gcancio@mail.cern.ch>
Re: help with perl compiler <rootbeer@teleport.com>
Re: HELP!!!! Problem with reading & writing to file <rootbeer@teleport.com>
Re: long file rename to 8.3 <sfairey@adc.metrica.co.uk>
Need a script that checks SUID = ROOT <sdcote@lci.net>
Re: Need a script that checks SUID = ROOT <merlyn@stonehenge.com>
Perl and C-kermit <bromberek@cems.umn.edu>
Re: perl and perl5 <sibsib@hotmail.com>
Re: perl script on WinNT (Shelle)
Re: Perl script retrieving URL's <merlyn@stonehenge.com>
Re: Possible typo in FileHandle module (M.J.T. Guy)
Re: POssibly Dumb Question: qq() and qw()... (Tim Smith)
Re: Q: List/scalar context with methods (M.J.T. Guy)
Re: regex question <sibsib@hotmail.com>
RFC: Xlib.pm (Brian Wheeler)
Re: SShell Windoww in Win95 disappes (Scott McMahan)
Re: SShell Windoww in Win95 disappes <rootbeer@teleport.com>
sysread & \x1A <feelgood@online.ee>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Jun 1997 16:04:35 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: a string to an array
Message-Id: <33B02853.E986F94@hotmail.com>
Jason D. Borneman wrote:
> I'm pretty new to the perl language, but have come to love it. I just
> have one question. Is it possible to convert a string to an array of
> letters. Like converting "HELP" to (H,E,L,P)? If so, how cna I do
> this.
Check out 'split' in the Perl manual or the Camel book.
For example, on page 220 of Camel II, you'll see:
@chars = split //, $word;
which seems to solve your problem.
Scott
--
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net
------------------------------
Date: Tue, 24 Jun 1997 18:06:48 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Can't find *** in @INC ....Help Please
Message-Id: <33afe6a9.22396076@194.72.192.4>
Joseph Allen Dane <jdane@hawaii.edu> wrote:
>use lib 'path\to\the\directory';
So that's how you do it! I thought that there must be a way - I was
trying all sorts like usr dir::dir::lib etc!
--
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/
------------------------------
Date: Tue, 24 Jun 1997 10:51:10 -0700
From: Conrad Damon <damon@netserver.stanford.edu>
To: michael_drons@ins.com
Subject: Re: CGI.pm not displaying text properly
Message-Id: <33B0090E.794B@netserver.stanford.edu>
Mike,
What were you hoping to get? That seems exactly right. Here's the output
(you can run it from the command line or View Source with your browser
to see it):
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>A cgi program</TITLE>
</HEAD><BODY BGCOLOR="white"><BODY>
hello mike
welcome to the perl test page
</BODY>
</BODY></HTML>
Remember, a return is just white space in HTML. Using the perl debugger
(perl -d) might help. It works great with the CGI module.
Conrad
-----------
Mike Drons wrote:
>
> I am using IIS 3.0 and the lastest CGI.pm to allow my NT server
> to run perl scrits. I have created a simple perl script......
> #perl_test.pl
> use CGI;
> $wp=new CGI;
> $user_name=$wp->param('user');
> print $wp->header;
> print $wp->start_html (
> -title=>'A cgi program',
> -BGCOLOR=>'white');
> print "<BODY>\n";
> print "hello $user_name\n";
> print "welcome to the perl test page\n";
> print "</BODY>\n";
> print $wp->end_html;
>
> when I connect via the web I get the following output :
>
>
> hello mike welcome to the perl test page
>
> Does anybody know why??
>
> Please CC me at michael_drons@ins.com when replying. Thanks.
>
> Mike Drons
------------------------------
Date: Tue, 24 Jun 1997 15:41:55 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Checking a string for "@' and "."
Message-Id: <33B02303.8C935565@hotmail.com>
Dean Hollister wrote:
> Can anyone point me to the required code to check whether or not a
> string has BOTH the "@" and "." characters in it?
if ( index($string, '@') + index($string, '.') > -2 ) {
# you didn't set the '$[' variable, did you?
print "Got both!\n";
}
Sure, you could use a regex, but why bother. ?
On the other hand, if you're trying to verify e-mail addresses,
you need to do a little more than this...
Scott
--
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net
------------------------------
Date: Mon, 23 Jun 1997 09:10:11 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Checking a string for "@' and "."
Message-Id: <33AE83C3.5364E7CB@gpu.srv.ualberta.ca>
Mattias Lvnnqvist wrote:
>
> Dean Hollister wrote:
> >
> > Hello,
> >
> > Can anyone point me to the required code to check whether or not a
> > string has BOTH the "@" and "." characters in it?
> >
> > Using Perl 5.
> >
>
> One easy way is:
>
> $_=$string_to_check;
> if ((/@/)&&(/./) {
>
> }
>
you'll want to backwack that dot in the second one.
regards
andrew
------------------------------
Date: Tue, 24 Jun 1997 11:30:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ed Lufker <elufker@swcp.com>
Subject: Re: checking for blanks
Message-Id: <Pine.GSO.3.96.970624112529.3042X-100000@kelly.teleport.com>
On 24 Jun 1997, Ed Lufker wrote:
> I have the need to check for blanks or alphanumeric data in $_,
What do you mean by "blanks or alphanumeric data"? Do you mean...
you want to check for blanks, as opposed to alphanumeric
data?
you want to check that your data are either blanks or
alphanumeric, as opposed to anything else?
And what do you mean by "blanks" and by "alphanumeric"? Do you mean...
a blank is any whitespace?
a blank is all whitespace?
alphanumeric data is nothing but letters and digits?
alphanumeric data has some letters or digits?
alphanumeric data has both letters and digits?
As you can see, there's more than one possible interpretation of what
you're asking for. But you can probably do what you want with something
listed in perlfunc or perlop. If you don't see something helpful in those
manpages, write again. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 24 Jun 1997 20:13:57 +0200
From: "Dr. Michael Hartje" <hartje@etech.hs-bremen.de>
Subject: Re: checking for blanks
Message-Id: <33B00E65.77E9@etech.hs-bremen.de>
Ed Lufker wrote:
> I have the need to check for blanks or alphanumeric data in $_,
> how would a line like that look in perl.
>
> I have something like this:
> $i[$x]=($_);
> if ($i[$x] == " ") I don't know what to put in the " ".
> Everything I have tried gives an error.
look at Pattern and RegExpr in the Manual. Did You? Ahh, ok.
Why so complicated?
try
/\s/;
# then $` gives You the left, $' the right of the whitespace
or try this small program:
#!perl -n
/\s/;
print ("\nFound left of white space >$`<, found right >$'<\n");
and use it with the standard input.
hope this helps
Michael
--
Hochschule Bremen Labor fuer Hochspannungstechnik
Prof. Dr. Michael Hartje Neustadtswall 30; 28199 Bremen
Telefon: +49 421 5905-444 FAX: +49 421 5905-476
mailto:hartje@etech.hs-bremen.de http://www.hs-bremen.de
------------------------------
Date: 24 Jun 1997 19:42:42 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Connect in Perl under NWS 3.01
Message-Id: <01bc80d7$29877b40$6875e7c8@Term104>
Hi All. I'm trying to connect a SMTP server using a Perl Script. I'm using
Perl 5 under Novell Web Server 3.01 (Perl5.NLM) in a Novell Intranetware
4.11 netware. The problem is that the Perl Documentation of Novell is
fewer...See this descrition :
socket(domain, type, protocol) : Creates a socket in the specified domain
of the specified type using the specified protocol and returns a descriptor
that can be used in later system calls operating on sockets.
Without examples ou things like this...May anyone here give an example
about how to connect a server in a specific port ?
Thanks for any help!
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@usa.net
--------------------------------------------
------------------------------
Date: Fri, 20 Jun 1997 15:47:36 -0700
From: Silvia Fr|hwacht <s.fruehwacht@str.daimler-benz.com>
Subject: Discussion board?
Message-Id: <33AB0888.3D40@str.daimler-benz.com>
I want to programm a discussion board for an intranet. So I'm looking
for
a perl script, something like hypernews, but I need it for NT 4.0
Any ideas?
Silvia Fruehwacht
s.fruehwacht@str.daimler-benz.com
------------------------------
Date: Tue, 24 Jun 1997 17:53:47 GMT
From: German Cancio Melia <gcancio@mail.cern.ch>
To: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: distributed objects in perl
Message-Id: <Pine.GSO.3.95a.970624194650.19778R-100000@asis-w3>
Sorry, as I split up my mail in two pieces maybe one got lost.
I include my original posting (somehow corrected):
Is anybody here who has already tried to access perl 5 object from outside
a perl script (eg. from tcl?)??
I have a complex object model structure in perl and I'm trying to write a
graphical interface in tcl (Tcl/Tk, not Perl/Tk). For this purpose, I can
a) rewrite all the data structure in tcl, which would be very painful or
b) try to write a script which instantiates the objects and executes the
requested methods connecting to the tcl script (via eg. a socket).
So I would have a client process, written in Tcl/Tk, and a server, written
in Perl, which waits for the client.
This could be like:
(Request by Tcl client script)
MyRemotePerlClass:[#object_id] method_name @parameter_array
(Answer by Perl server script)
@result_array
if #object_id is missing (a unique id within the class) we would have a
class method (eg. for instantiating a new object).
This example is very simple and easy to implement. But what happens if I
want to have complex data types for the parameters/return values, eg.
returning other objects?
I'm not very sure on how to do it, and maybe somebody already tried it!
Thank you for your help!
german
------------------------------------------------------
German Cancio Melia IT - DIS CERN - 1211 Geneve 23
Phone: +41 2276 79801 mail: German.Cancio@cern.ch
------------------------------------------------------
------------------------------
Date: Tue, 24 Jun 1997 16:09:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: static@nrv.net
Subject: Re: help with perl compiler
Message-Id: <Pine.GSO.3.96.970624160834.24884M-100000@kelly.teleport.com>
On Tue, 24 Jun 1997, joe foley wrote:
> i was wondering if anyone could offer any help installing/running the
> perl compiler. i found the release notes missing a few details.
If you find out anything helpful which isn't in the documentation, please
submit a documentation patch to improve it. That will help other people in
your situation. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 23 Jun 1997 11:09:20 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ray Vella <rayvella@total.net>
Subject: Re: HELP!!!! Problem with reading & writing to file
Message-Id: <Pine.GSO.3.96.970623110656.9838P-100000@kelly.teleport.com>
On Fri, 20 Jun 1997, Ray Vella wrote:
Newsgroups: comp.lang.perl
If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use comp.lang.perl.misc (and other valid Perl newsgroups)
instead.
news:news.announce.newgroups
> the 2nd and subsequent lines contain a space
> at the beginning.
Oh, did you print "@array" where you meant to print @array?
> print PA "@list";
Yes, it looks like you did. :-)
(You also opened a file without checking for success, but of course you
know better than to do that in real code, so I won't give you a hard time
about that.) Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 24 Jun 1997 15:30:03 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: long file rename to 8.3
Message-Id: <33AFD9EB.6956@adc.metrica.co.uk>
Tim Smith wrote:
>
> In article <33AFCCC9.6201@adc.metrica.co.uk>,
> Simon Fairey <sfairey@adc.metrica.co.uk> wrote:
> >next if !/^(........).*\.(...)$/;
>
> substr might be easier on the eyes ;-).
>
> Tim
Following a side conversation with someone I stupidly thought was the
original poster ( look at the sender's name as well as the subject line
) I realised that regardless of which method you use you will run into
problems with files like:
xxxxxxxxxxxxxx.dat
and
xxxxxxxxyyyyyy.dat
overwriting each other, so some care should be taken when implementing
the solution otherwise it will be bye bye files if you are not careful.
Simon 'I generally don't think of every contingency!!' Fairey
------------------------------
Date: Mon, 23 Jun 1997 08:19:43 -0400
From: "Stephan D. Cote" <sdcote@lci.net>
Subject: Need a script that checks SUID = ROOT
Message-Id: <33AE69DF.6230@lci.net>
I was wondering if anyone has a perl script that would scan a file
system and check which files were suid = root.
I want to perform a security scan to see if there are any over-empowered
processes / users out there.
Any Suggections?
--
---[Stephan D. Cote, CCP]------[ Sr. Network Engineer ]---
Data Engineering, LCI International Inc.
4650 Lakehurst Court, Dublin, OH 43016
---[ (614) 798-6000 ]-------------------------------------
------------------------------
Date: 23 Jun 1997 07:49:35 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: Need a script that checks SUID = ROOT
Message-Id: <8cyb81bchs.fsf@gadget.cscaper.com>
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:
Russ> [ Posted and mailed. ]
Russ> Stephan D Cote <sdcote@lci.net> writes:
>> I was wondering if anyone has a perl script that would scan a file
>> system and check which files were suid = root.
Russ> Don't use Perl. Use find. That's what find's for.
Russ> find / -xdev -perm +4000 -print
Although Perl find2perl-generated code can outrun some O/S find(1)
code, especially over NFS, because of some slick tricks that were
adopted only later in vendor software. For the record, that'd
look like:
find2perl / -xdev -perm +4000 -print | perl
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 435 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 24 Jun 1997 18:10:10 -0500
From: Bruce Bromberek <bromberek@cems.umn.edu>
Subject: Perl and C-kermit
Message-Id: <33B053CD.75F7@cems.umn.edu>
I'm trying to communicate with a rs232 serial device via perl5. After
reading past discussions in dejanews, it appears that the best way is to
use ckermit to communicate with the device (BTW- I tried the direct open
/dev/ttyd2 method and just can't the term settings right, I can either
send commands and the reply from the device is munged or I can get good
replys but only send one command.)
So my questions:
1) Do I really need to use Comm.pl to interface with ckermit? Can I
accomplish the same thing by using IPC::Open2? (I know try it, but see
below)
2) How do I get ckermit to send my commands (like "\xff\x41") to my box
?
(Please no responses saying get the Using C-Kermit book. I want the
book, the university has it but its 'missing', local bookstores have it
'on order', all of which doesn't help me this week. I'd kill to get the
book but have no idea who to start with)
3) Does anyone have a snippet of code showing either of the methods in
#1
ANY help would be appreciated.
Bruce Bromberek
------------------------------
Date: Tue, 24 Jun 1997 16:23:19 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: perl and perl5
Message-Id: <33B02CB7.96649022@hotmail.com>
mike mah wrote:
> #!/usr/local/bin/perl and
> #!/usr/local/bin/perl5
> will the same version of perl call?
Try this simple test:
/usr/local/bin/perl -v
[OS returns some stuff]
/usr/local/bin/perl5 -v
[OS returns some stuff]
Now see if the same stuff was returned by both. :-)
Scott
--
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net
------------------------------
Date: Tue, 24 Jun 1997 23:23:36 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: perl script on WinNT
Message-Id: <5opkto$1bc_002@interaccess.interaccess.com>
"Miko3aj Morzy" <kola@cs.put.poznan.pl> wrote:
>on Unix machines every script begins with #!/usr/bin/perl or whatever
>the path to the interpreter is. How does this line look like on Windows
>NT machine (assuming interpreter perl386.exe)? I still get 500 server
>error and I would appreciate your help.
>Please help me- I'm getting more and more desperate
> Kola
That line being in there shouldn't make a bit of difference on your system.
On mine I usually, just for "comfort" sake change it to #!perl.exe , but it's
not utilized and doesn't cause an error if I don't change it or take it out.
What you DO need to make sure you have done, is to doublecheck that:
1) You have associated the ".PL" extension with the Perl binary source
(Mine is C:\PERL\BIN\PERL.EXE but your's might be different); Also
take the time to associate your ".CGI" extension while you're at it to
save time and trouble later if you hit a series of files called CGI
instead of PL.
2) Your registry has recored the necessary paths; Your's will be MUCH
different than mine (Since I am on Win95) or I would give you an
example -- It's in TFM.
Luck to you.
Michelle ----,-'-(@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michelle Feigen ----,-'-(@ shelle@interaccess.com
MEAN PEOPLE SUCK!
http://homepage.interaccess.com/~shelle/
http://homepage.interaccess.com/~shelle/grafx/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 24 Jun 1997 16:37:56 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: obp@onlinebp.com
Subject: Re: Perl script retrieving URL's
Message-Id: <8c7mfjincb.fsf@gadget.cscaper.com>
>>>>> "Ivo" == Ivo Bieleveldt <obp@onlinebp.com> writes:
Ivo> Does anyone of a perl script that allows you to retrieve WWW pages. I
Ivo> want to make a list of URLS, store these URL's in a seperate file.
Ivo> Then I want to let the Perl script retrieve the first URL and store
Ivo> the output in a seperate file and so on until the last URL.
Ivo> I haven't found an application like this.
That's probably because it's trivial to write:
#!/usr/bin/perl
use LWP::Simple;
while (<DATA>) {
my ($url, $file) = split;
getstore($url, $file) or warn "Could not get $url\n";
}
__END__
http://www.stonehenge.com/ stonehenge_home_page.html
http://www.stonehenge.com/merlyn/ merlyn_home_page.html
http://www.stonehenge.com/merlyn/WebTechniques/ merlyn_wt_index.html
http://www.perl.org/ perl_institute.html
There. No fuss, no muss.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 433 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 24 Jun 1997 18:04:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Possible typo in FileHandle module
Message-Id: <5op27j$31m@lyra.csx.cam.ac.uk>
In article <867165718.21104@dejanews.com>, <m.hunt@elsevier.co.uk> wrote:
>I had a problem with the FileHandle module using the
>following piece of code (from Programming Perl and the
>FileHandle pod):
>
>use FileHandle;
>
>$fh = new FileHandle;
>if ($fh->open "< file") {
> print <$fh>;
> $fh->close;
>}
>
>Which I could only make work if I changed the if line to:
>
>if ($fh->open("< file")) {
>
>(note added parentheses)
>
>Is this a typo in the man page or am I missing something
>subtle?
It's a typo. Method calls using the -> syntax must always have () round
their arguments (unlike the "indirect object" syntax).
Mike Guy
------------------------------
Date: 22 Jun 1997 15:34:28 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: POssibly Dumb Question: qq() and qw()...
Message-Id: <5ok99k$a8t@web.azstarnet.com>
In article <prof-ya02408000R2206971247570001@snews.zippo.com>,
professor katz <prof@katz.com> wrote:
>I see this a lot: qq{} and qw{} and qq() and qw()...
Read the perlop man page. Look for "Quote and Quotelike Operators".
Tim
------------------------------
Date: 24 Jun 1997 12:06:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Q: List/scalar context with methods
Message-Id: <5ood7d$jse@lyra.csx.cam.ac.uk>
Kevin Zwack <kevinz@model-t.stortek.com> wrote:
> After
>studying "the book", I was able to come up with this:
>
>if (scalar(@{[$Q->param('foo')]}) == 3) ...
>
>which works but hurts my eyes to read. Is there any
>simpler or more elegant means of doing this?
Note that the above code still creates an unwanted array - it's just that
it's anonymous instead of named. You also don't need the scalar(), since
the LHS of == provides a scalar context.
An alternative method which avoids an array copy (sort of) is
if ( (()=$Q->param('foo')) == 3) ...
Not 100% elegant, but ...
Note that that won't work on Perl versions before 5.004, as there was a
bug in assigning to (). For older Perls, you'll have to assign to
(undef) instead.
Mike Guy
------------------------------
Date: Tue, 24 Jun 1997 16:20:25 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: regex question
Message-Id: <33B02C09.A9D44BA@hotmail.com>
Dan Pfefferkorn wrote:
> How can I do a pattern match where the pattern is quoted, i.e., where it
> will match correctly if I type $test in stdin?
Use the 'quotemeta' function. It quotes all regex metachars.
Scott
--
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net
------------------------------
Date: 23 Jun 1997 13:31:56 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: RFC: Xlib.pm
Message-Id: <5oltsc$1o5$1@dismay.ucs.indiana.edu>
I'm currently writing an Xlib clone in perl. So far, it'll let you write
programs like this:
use Xlib;
$display=Xlib->new("localhost:0");
$window=$display->CreateWindow($display->{'screen'}->[0]->{'root'},
0,0,
100,100,
1,
16,
0,
0,
2,0);
$display->MapWindow($window);
sleep 20;
$display->DestroyWindow($window);
$display->Bell;
Which will create a window, show it for 20 seconds, erase it, and then
ring the display's bell.
I've also got events, errors, etc. built in. I'm about half-way done with
the requests, so there's still alot to do before its ready for the public.
The nice thing about this module is that it only requires IO::Socket. The
system doesn't need to have Xlib installed.
After Xlib is done, it should be pretty easy to write a perl-based toolkit
on top of it. Window managers would be nice too....very nice :)
Any thoughts? Is this a silly idea?
If you're interested in seeing the code as is, send me mail!
--
Brian Wheeler
bdwheele@indiana.edu
------------------------------
Date: 24 Jun 1997 13:10:45 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: SShell Windoww in Win95 disappes
Message-Id: <5ooh0l$csr$2@mainsrv.main.nc.us>
Rafal S. Konopka (rafalk@hyde.park.uga.edu) wrote:
: I browsed through all the FAQ's available, but I couldn't find a satisfactory
: answer. If I run a perl perogram byy double clicking on the actual script,
: the shell window appears with the outpout, and then disappears. Yes, I
: know, somebody in one of the FAQ's DID say that perl is not meant to be
: run lie that, but ut DOES run, The thing is I cannot see the output.
: Does it mean that I can only run perl in the DOS shell window?
Generally, double-clicking a Perl program in Explorer is a waste
of time. If the program outputs anything interesting, or takes
command line arguments*, running it from Explorer is dumb.
You won't see the output and can't give it arguments.
Perl is a command line tool, and you should use it from the
command line. I don't know why anyone would want to run the program
from Explorer.
Scott
* I would be remiss not to plug http://www.skwc.com/essent, which has
my program that allows you to give command line arguments to programs
from Explorer!
------------------------------
Date: Tue, 24 Jun 1997 12:04:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: SShell Windoww in Win95 disappes
Message-Id: <Pine.GSO.3.96.970624120218.3042d-100000@kelly.teleport.com>
On Tue, 24 Jun 1997, Pat Sullivan wrote:
> If you modify the script to set $exitwait=1 (near the biginning of the
> script), then add the following at the end of the script, the script
> will pause unitl you hit return:
>
> if( $exitwait ) {
> print "Hit <return> to exit...";
> $foo = <STDIN> ;
> }
What does that method gain over this?
print "Hit <return> to exit..."; <STDIN>;
Besides not storing a useless value in $foo, of course. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 24 Jun 1997 20:39:40 +0300
From: Jan-Erik Moon <feelgood@online.ee>
Subject: sysread & \x1A
Message-Id: <33B0065C.7E73@online.ee>
what should i do so that perl's command sysread won't stop reading from
file when there is a byte 1A (terminator, means EOF, but it's not EOF
yet, it is just binary file). and another question. is that possible to
make something like that (i mean to give function a parameter):
&message("This is a message line");
sub message($messie) {
print "The message is: $message\n";
}
--
Jan-Erik Moon alias Feelgood
Fidonet - 2:490/223
E-Mail - feelgood@online.ee
WWW - http://www.bayside.net/users/feelgood/
------------------------------
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 655
*************************************