[12784] in Perl-Users-Digest
Perl-Users Digest, Issue: 194 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 19 21:07:16 1999
Date: Mon, 19 Jul 1999 18:05:11 -0700 (PDT)
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, 19 Jul 1999 Volume: 9 Number: 194
Today's topics:
Re: !(Local file detection) (Abigail)
Re: !(Local file detection) <cassell@mail.cor.epa.gov>
Re: $_ question (restated concisely) <dan@tuatha.sidhe.org>
[ANNOUNCE Ima::DBI 0.10] <stupid@pobox.com>
Re: [Q] In-Browser technology (Cameron Laird)
ANNOUNCE: Champaign-Urbana Perl Mongers Meeting Thu Jul (Daniel S. Lewart)
Re: Any idea why this won't work? <flavell@mail.cern.ch>
Re: cgi entry form (Abigail)
Re: FTP and HEAD (Anno Siegel)
Re: How to compare fields (Abigail)
how to execute aliased command from Perl script?(+) <artem@slac.stanford.edu>
Re: How to remove a char from end of file (Abigail)
Re: How to simulate shell variable parsing in Perl? (Anno Siegel)
Re: lexical $_ with threads question? <dan@tuatha.sidhe.org>
Re: Listing Files (Jerome O'Neil)
Re: Listing Files <anonymous@web.remarq.com>
Need help with my socket loop! <dbohling@pacbell.net>
Re: negate regex? (Eric Bohlman)
Re: negate regex? <tchrist@mox.perl.com>
Re: New Page (Abigail)
Re: padding a DNS number <webmaster@mendonet.com>
Re: padding a DNS number (John Stanley)
Re: padding a number (John Stanley)
Re: PERL Q'S ANSWERED! (Abigail)
Re: Programming problem (Abigail)
Re: split() <nick.sanders@lineone.net>
Re: TPJ/Earthweb junk mail? (brian d foy)
Re: using perl to talk to a modem (Frank da Cruz)
Re: Variable limitations <dan@tuatha.sidhe.org>
Re: weird getc behaviour (Eric Bohlman)
Re: which release supports qr/(?{...})/ (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Jul 1999 18:32:10 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: !(Local file detection)
Message-Id: <slrn7p7dao.oqh.abigail@alexandra.delanet.com>
Steve Laybourn (laughingotter@foxinternet.net) wrote on MMCXLVIII
September MCMXCIII in <URL:news:3793850F.D2501831@foxinternet.net>:
.. Hello again!
.. Well, the means suggested to me for detecting local files on a hard
.. disk before upload didn't work...variants and permutations of the
.. filename, -e, -s, and -r didn't work at all...
Didn't work at all; that's a clear description of your problem! I wish
more people were that clear! Yeah, it can happen. But if you do this
and that instead, it will work.
.. There is another problem we've been having...this may sound
.. out-of-context, and perhaps it is, but here goes...
.. We have just hired a new server to host our site, but there seems to
.. be some rather severe limitations being imposed...
"Being imposed"? Why did you hire a new server than?
.. One, the server is in SoCal and I am in Seattle. So, because of this,
.. I cannot have Telnet access.
Yeah, those bloody routers in Oregon that refuse to route packages
containing Telnet protocol information. Someone should do something
about that. Perhaps you should sell Oregon to Japan.
.. Two, according to one of their server techs, I cannot have both FTP
.. and the chmod command because the Solaris 2.6 FTP doesn't support chmod
.. from FTP clients.
.. Without either of these, I cannot get Perl scripts to run.
Oh, of course you can. "perl -w <file-with-script>" works fine.
.. Should I be seeking a new server or is there a workaround to this
.. rather nasty problem?
Well, that isn't a Perl question, is it? It seems you have started paying
for a service you aren't content with. Take it up with the people you
are paying, or leave.
Abigail
--
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
for (s;s;s;s;s;s;s;s;s;s;s;s)
{s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
-----------== 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: Mon, 19 Jul 1999 17:24:04 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: !(Local file detection)
Message-Id: <3793C1A4.7CEE1BA4@mail.cor.epa.gov>
Abigail wrote:
> [big snip]
> .. One, the server is in SoCal and I am in Seattle. So, because of this,
> .. I cannot have Telnet access.
>
> Yeah, those bloody routers in Oregon that refuse to route packages
> containing Telnet protocol information. Someone should do something
> about that. Perhaps you should sell Oregon to Japan.
Hey! We Oregonians want to clarify that point. We only re-route
packets from California, just as we chase away Californians
who come up here. He should just route those packets through
Idaho and Nevada.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 20 Jul 1999 00:32:09 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: $_ question (restated concisely)
Message-Id: <dsPk3.15880$y92.9390@news.rdc1.ct.home.com>
Derek Sherlock <derek_sherlock@hp.com> wrote:
> Hi,
> In thread-enabled perl, $_ is a lexical variable, so says man
> perldelta. And foreach loops implicitly localize the iterator, so says
> the camel book.
> So how come I get this output from this script?:
Because there's massive amounts of magic heaped upon $_ and @_ in threaded
perl. Unfortunately it's a bit misleading to say that $_ and @_ are now
lexical--they are (and we have the scratchpad entries to prove it :) but
the heaps 'o magic tend to obscure that fact.
Dan
------------------------------
Date: Mon, 19 Jul 1999 20:24:41 -0400
From: Michael G Schwern <stupid@pobox.com>
Subject: [ANNOUNCE Ima::DBI 0.10]
Message-Id: <190719992024416750%stupid@pobox.com>
Ima::DBI 0.10 has just been released to CPAN featuring more performance
improvements, but...
THIS IS STILL ALPHA SOFTWARE! THINGS ARE CHANGING RAPIDLY!
At this point I say its alpha because I'm still not happy with the
interface and it may change at any time (also, its not complete).
Otherwise, it appears to be free of bugs and I am personally using it
for production software. User Beware.
I've squeezed more performance out of Ima::DBI. The speed of calling
the sql_* method has pretty much been doubled and is now about twice as
fast as DBI::prepare_cached().
BTW Ima::DBI currently lives in
CPAN/authors/id/MSCHWERN/Ima-DBI-0.10.tar.gz or
http://www.pobox.com/~schwern/src/Ima-DBI-0.10.tar.gz
Revision history for Perl extension DBI::Ima.
0.10 Mon Jul 19 20:04:04 EDT 1999
- Updated TODO list
- Added COPYRIGHT and licensing
- Performance improvement by drastically reducting # of calls to
DBI::prepare_cached
0.09 Tue Jul 13 23:59:56 EDT 1999
- Major performance improvement by drasticly reducing # of
calls to DBI::connect_cached.
0.08 Wed Jun 30 16:16:16 EDT 1999
* Spaces in names of statements and database (sql_ and db_) are
now translate to underscores.
NAME
Ima::DBI - Database connection caching and organization
SYNOPSIS
# Class-wide methods.
__PACKAGE__->set_db($db_name, $data_source, $user,
$password);
__PACKAGE__->set_db($db_name, $data_source, $user,
$password, \%attr)
;
__PACKAGE__->set_sql($sql_name, $statement, $db_name);
# Object methods.
$dbh = $obj->db_*; # Where * is the name of the db
connection.
$sth = $obj->sql_*; # Where * is the name of the sql
statement.
$rc = $obj->commit; #UNIMPLEMENTED
$rc = $obj->commit(@db_names); #UNIMPLEMENTED
$rc = $obj->rollback; #UNIMPLEMENTED
$rc = $obj->rollback(@db_names); #UNIMPLEMENTED
$obj->clear_db_cache; #UNIMPLEMENTED
$obj->clear_db_cache(@db_names); #UNIMPLEMENTED
$obj->clear_sql_cache; #UNIMPLMENTED
$obj->clear_sql_cache(@sql_names); #UNIMPLMENTED
$obj->DBIwarn;
$dbh->clear_cache; #UNIMPLEMENTED
# Modified statement handle methods.
$rv = $sth->execute;
$rv = $sth->execute(@bind_values);
$rv = $sth->execute(\@bind_values, \@bind_cols);
$row_ref = $sth->fetch;
@row = $sth->fetch;
$row_ref = $sth->fetch_hash;
%row = $sth->fetch_hash;
$rows_ref = $sth->fetchall;
@rows = $sth->fetchall;
$rows_ref = $sth->fetchall_hash;
@tbl = $sth->fetchall_hash;
$sth->clear_cache; #UNIMPLEMENTED
DESCRIPTION
Ima::DBI attempts to organize and facilitate caching and
more efficient use of database connections and statement
handles.
19/Jul/1999 perl 5.005, patch 03 1
DBI(3) User Contributed Perl Documentation DBI(3)
One of the things I always found annoying about writing
large programs with DBI was making sure that I didn't have
duplicate database handles open. I was also annoyed by
the somewhat wasteful nature of the prepare/execute/finish
route I'd tend to go through in my subroutines. The new
DBI->connect_cached and DBI->prepare_cached helped alot,
but I still had to throw around global datasource,
username and password information.
So, after a while I grew a small library of DBI helper
routines and techniques. Ima::DBI is the culmination of
all this, put into a nice(?), clean(?) class to be
inherited from.
etc, etc, etc...
------------------------------
Date: 20 Jul 1999 00:30:27 GMT
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: [Q] In-Browser technology
Message-Id: <BE2245BA1DCDAE31.8804258C1F60F9A7.2EB4BCD57DBA05D1@lp.airnews.net>
In article <932337314.611.103@news.remarQ.com>,
Vladik <reason@shadow.net> wrote:
>Hello,
>Sorry for cross-posting, but
>my question is really to the people on the news groups
>who know about Eiffel, Python and Perl.
>
>Basically,
>We are to develop a web client (a program that
>can be ran witting a web browser) for our otherwise n-tier
>cross-platform system, our research department gave the
>recommendation and actually a prototype of the client
>in MS ASP (active server pages) and, I think but not
>sure, blended with Visual Basic. Talk about bias...
>But this means that it can only run in MS IE and not
>in Netscape, also it limits the number of platforms not only
>for the client on which web browser runs, but also for
>the web server (MS platforms only, because web server with
>active pages can only run there)
>There is some talk about Java, but our web client
>will also be ran via Serial links (not T1 connections)
>on relatively inexpensive systems -- therefore Java is
>something to look into but it may be slow.
>So I am set on a quest to find something
>that
>a) can be executed within IE or Netscape,
>b) be faster and overall more resource friendly then JavaScript technology
>c) supports OO programming
>d) does not depend on the platform on which web server is running.( if the
>web server is running NT or UNIX (sun, linux)
>
>I have found one thing that almost satisfies the requirements:
>it is based on Oberon-2 programming language and so far sounds
>VERY promising.
> The reason why I am still looking is because
>there are more books and internet support for Python,Perl and Eiffel
>then for Oberon (this will be a factor when presenting the proposal
>to the management). The other problem is that there is plugin
>for this technology available for NT and Mac platforms (for both
>IE and Netscape) and is not available for UNIX platforms (which means that a
>web browser can not be ran on UNIX). There is source code,
>though.
>If interested: http://caesar.ics.uci.edu/juice/
>
>So, finally, my question is is there a technology
>I am looking for available for either Perl or Eiffel or Python
.
.
.
No.
That's the short answer. Slightly longer is this: I
don't understand--although I'm sufficiently intrigued
to answer.
Let's first dispose of the part of my reply where I
pick nits from your description:
1. "We are to develop a web client (a
program that can be ran witting a
web browser) ..." evokes to me a
plugin. Is a plugin (supposing a
sufficiently potent one exists)
exactly what meets your require-
ments, or is there a point I'm
missing?
2. "... a prototype of the client
in MS ASP (active server pages)
and, I think but not sure, blended
with Visual Basic ..." I have no
definite idea of what you're say-
ing here. Is it that your
customer has a picture of the
visual appearance of the desired
deliverable? What is there about
the ASP prototype that does *not*
meet the requirements? Is VB
blended on the server or client
side? Does it matter? Is it really
VB, or VBScript?
3. Are you aware that *lots* of browsers
read pages served as ASP? You can
use ASP without requiring IE.
4. "... Java ... may be slow." Lots of
things may be slow. The market-lead-
ing browsers are definitely pigs, by
my standards, but they've already
been mandated, according to your
description.
Technical point: Java applets work
well for me. Invariably, when I hear
people complain about the size of
Java applets, they're really com-
plaining about ancillary images.
Java executable classes themselves
are admirably compact, in my experi-
ence.
5. Of what resource is JavaScript not
sufficiently conservative? Do you
seriously have performance problems
with it? There are plenty of aspects
of JavaScript that deserve scorn,
but, unless I have a specific issue,
I happily use it to accomplish real
work on the client side.
6. How much client-side programming are
you doing? Why does object-orienta-
tion there matter to you?
7. What technologies do you want that
*do* link client and server platform
compatibility? I can't make this
constraint informative in the context
of everything else you've written.
8. What's the part about Juice that you
like--is it the promise of superior
performance? Do Franz and Kistler
truly make source available? I
hadn't noticed that. In any case, if
I thought it'd help with one of my
projects, I'd write them directly.
I'm fond of Oberon, and I wish Juice
well. I don't understand your inter-
est in it.
It sounds as though you're involved in quite an ambi-
tious project, of the sort I like. I wish you well.
I suspect you'll do well to clarify several of your
requirements; this will make it much more inviting for
comp.lang.* readers to help you.
--
Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com +1 281 996 8546 FAX
------------------------------
Date: 19 Jul 1999 23:49:43 GMT
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: ANNOUNCE: Champaign-Urbana Perl Mongers Meeting Thu Jul 22
Message-Id: <7n0din$8dc$1@vixen.cso.uiuc.edu>
Champaign-Urbana Perl Mongers,
Our July meeting will be:
Thu Jul 22 19:00 CDT
Papa Del's
206 E Green St
Champaign, IL
We will be in the non-smoking area. I will wear my Perl t-shirt.
See y'all,
Daniel Lewart
Champaign-Urbana Perl Mongers Fearless Leader
d-lewart@uiuc.edu
http://cmi.pm.org/
------------------------------
Date: Tue, 20 Jul 1999 01:13:02 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Any idea why this won't work?
Message-Id: <Pine.HPP.3.95a.990720010654.9246A-100000@hpplus03.cern.ch>
On Mon, 19 Jul 1999, John Straumann wrote:
> I have a CGI that accepts input from a text field, and I want to be able
> to hard code the input using a line like this:
>
> <form method="GET" action="/cgi-bin/example.cgi?input=test">
>
> But this will not work.
Quite right, it won't and can't, but this is not a Perl language
question.
> Does anyone know why?
42?
What are you trying to achieve?
Maybe you simply need a hidden INPUT item. But the Perl language is not
interested in that, so try an HTML or CGI group. (Unfortunately the
HTML asylum has currently been taken over by its inmates, so one can't
really recommend using that until they have tired of their squabbles.)
------------------------------
Date: 19 Jul 1999 18:35:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi entry form
Message-Id: <slrn7p7dh0.oqh.abigail@alexandra.delanet.com>
gqc2017@my-deja.com (gqc2017@my-deja.com) wrote on MMCXLVIII September
MCMXCIII in <URL:news:7mvvqs$6ar$1@nnrp1.deja.com>:
%% I am trying to create a cgi form which has a few required fields. If
%% the user omit these fields and click on the Submit button, the form must
%% be redisplayed again with an error message at the top. Do anyone know
%% how to do this?
Well, you check what the browser sends back, and if certain fields
are missing, you would create an error message, and a new form and
send that to the browser.
Please try, and if you have some more specific questions than "please
write this code for me", come back and ask again.
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: 20 Jul 1999 00:35:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FTP and HEAD
Message-Id: <7n0g93$p73$1@lublin.zrz.tu-berlin.de>
<wired2000@my-deja.com> wrote in comp.lang.perl.misc:
>Hi,
>
>I want to setup a script which will take as input a list of ftp sites:
>ie: ftp://USERID:PASSWD@hostname.com:PORT
>
>And will connect to the site and just CHECK (something similar to the
>HEAD method with web requests) if a file exists and can be downloaded
>without actually downloading. Best example I can think of is like an
>FTP checked, where it will scan a list of ftp sites if the file to be
>downloaded is valid or not.
>
>I'm trying to do it with LWP::Simple, but unfortunetly, the Timeout
>method does not work and the script can take up to 5 minutes to scan
>for those FTP sites which timeout. Can anyone think of a good way to
>implement this? If your going to suggest Net::FTP, please let me know
>how to implement the idea of just getting the HEAD or checking if its
>valid, as I'm stuck :(
Have you looked into the documentation for Net::FTP? I'd expect
that $ftp->dir( '/path/to/file') would give some indication whether
the remote file exists.
Anno
------------------------------
Date: 19 Jul 1999 18:37:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to compare fields
Message-Id: <slrn7p7dl2.oqh.abigail@alexandra.delanet.com>
Tom Kralidis (tom.kralidis@ccrs.nrcanDOTgc.ca) wrote on MMCXLVIII
September MCMXCIII in <URL:news:37939659.67816C0A@ccrs.nrcanDOTgc.ca>:
|| What's the best way to compare two given fields in a text file,
|| outputting the differences, after reading in the file from the command
|| line?
That depends on your definition of 'difference'. What is the difference
between "a blue fish" and "19.2857" ?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== 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: Mon, 19 Jul 1999 19:57:31 -0400
From: Artem Trunov <artem@slac.stanford.edu>
Subject: how to execute aliased command from Perl script?(+)
Message-Id: <3793BB6B.1CED6E51@slac.stanford.edu>
for example, if "ll" is an alias for "ls -al"
then
system ("ll") ;
or
$status=`ll`;
will return error: "Cant exec: no suxh file or directory";
Cheers, Artem.
------------------------------
Date: 19 Jul 1999 18:38:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to remove a char from end of file
Message-Id: <slrn7p7dms.oqh.abigail@alexandra.delanet.com>
Dariush (dazimi@yahoo.com) wrote on MMCXLVIII September MCMXCIII in
<URL:news:7n00l2$5ib$1@clio.net.metrotor.on.ca>:
// Hi everyone;
//
// How can I remove a character form the end of a file. looks like an ascii
// char. A square bracket.
// How Can I remove this character.?
Open the file. Seek to the end. Truncate to one position before. Close the file.
Details are found in the manual.
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== 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: 19 Jul 1999 23:10:19 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to simulate shell variable parsing in Perl?
Message-Id: <7n0b8r$p31$1@lublin.zrz.tu-berlin.de>
<bayla@gatewayinternet.com> wrote in comp.lang.perl.misc:
First of all... please trim your quotes to what you are referring
to, and place your comments *after* the quoted text.
>you can do :
>while(<F1>){
> if ($_ =~ /key parm1 parm2 parm3 therest/){
> ....use variables as required
> }
>}
How would the code above put parts of the current line into any
variables to be "use(d) as required"?
You don't need $_ =~ .... $_ is the default pattern match space.
>this is the similar equal sign =~ so the above is saying while the line
>is similar to these words...do this.
=~ is a binding operator that lets pattern matching operations work
on something else than $_. Calling it the "similar equal sign" is
more than a bit misleading.
> If you don't know what the
>parameters will say in advance you can check while $_ is not !~ /#/
>process the variables.
Trying to make sense of that sentence, it seems you are going to
throw away all lines that contain "#" anywhere. Are you sure
that's what the original poster wants?
[quoted text snipped]
Anno
------------------------------
Date: Tue, 20 Jul 1999 00:40:09 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: lexical $_ with threads question?
Message-Id: <JzPk3.15883$y92.9390@news.rdc1.ct.home.com>
Derek Sherlock <derek_sherlock@hp.com> wrote:
> Hi,
> Thanks. That explains it. Sort of.
> But, despite the paragraph you quoted, experimentation shows that
> you CAN local() $_. The effect on visibility and lifetime seems
> to be identical to that of local()'ing a true global, except that
> it does not use the global namespace (i.e. it remains separate &
> distinct from $main::_). But the local()'d value is still visible
> to subroutines you call, so the localization is temporal (like
> local()), and not lexical (like my()).
What's happening is that you've got a lexical $_ (the default one) and a
package $_, which you've local()'d. Your second example here:
> use Thread;
> local $a;
> $a = 'hey';
should really have a my before the $a to match the $_ example.
Also, we really ought to be catching the write to $main::_ and affecting
the current thread's $_, but that's apparently not happening. (Since $_
*is* $main::_ in non-threaded perl, threaded perl ought to behave the
same)
> This is wierd stuff!
> I've also experimented with separate threads, and am convinced
> that the sort-of-lexical sort-of-global $_ really is thread
> safe.
Yep. When a thread is started it gets its own version of $_ with the value
of $_ as it stood when the thread was started.
I should point out that it *is* possible to affect another thread's $_,
but you need a reference to it to do that.
> I hope $_ does some day become a true per-thread global, as you
> suggest it might. It would make all of this stuff much less
> confusing!
Yep, no doubt.
> I wish there were a thread-centric perl book available.
It'd probably be best to wait until threads settle down and get out of the
alpha/beta stage before a book is written. And this all may (probably
will) change with Topaz, since the current threading model is fairly
inefficient.
Dan
------------------------------
Date: 19 Jul 1999 23:10:47 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: Listing Files
Message-Id: <7n0b9n$6fo$2@brokaw.wa.com>
In article <932424514.5244@www.remarq.com>,
Ashish Kadakia <anonymous@web.remarq.com> writes:
> Hi, I would like to list all the files starting with the
> root directory..
> Can anyone point me how to do that?
find / -print;
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.i-filezone.com
------------------------------
Date: Mon, 19 Jul 1999 17:00:20 -0800
From: Ashish Kadakia <anonymous@web.remarq.com>
Subject: Re: Listing Files
Message-Id: <932432425.6381@www.remarq.com>
that's on UNIX system.
I want to on NT system, with Perl and put the list into an
array.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 19 Jul 1999 18:04:04 -0700
From: Daniel <dbohling@pacbell.net>
Subject: Need help with my socket loop!
Message-Id: <3793CB04.31D9F189@pacbell.net>
Hi all. I'm trying to adapt the unix domain client/server found
in the
camel book. I'm simply trying to get the client and server to "chat" at
this point. They connect to one another just fine and will send single
messages but if i try to make them loop while reading from STDIN (on
client) to STDOUT (on server) it just sits. I assume it has something to
do with buffering?
Also is it possible to have two loops running at the same time?
Maybe
more clearer -- is there a non-forking, non-shell, non(cmd &) way to
launch a loop within a singular perl program that can get STDIN and
STDOUT while another loop does likewise?
I guess i mean a subroutine that runs parrallel with the main program.
Here's my code -- okay the camel book's, but butchered by me...And
thanks for even looking at it!
=======================client=================================
#!/usr/bin/perl -w
use diagnostics;
use CGI qw(param);
use Socket;
use strict;
#$| = 1;
my ($rendezvous, $linein, $lineout);
$rendezvous = shift || '/home/httpd/html/img/streamsocket';
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) || die "Socket: $!\n";
connect(SOCK, sockaddr_un($rendezvous)) || die "Connect: $!\n";
print SOCK "Connected here";
print STDOUT "Connected here\n";
while ($linein = <SOCK>) {
print STDOUT $linein;
}
#while ($lineout = <STDIN>) {
# print SOCK $lineout;
#}
#$linein = <SOCK>;
#print $linein;
close SOCK;
exit 0;
=====================server===========
#!/usr/bin/perl -w
use diagnostics;
use CGI qw(param);
use Socket;
use strict;
#######################this is the server -- we only want one to feed
numerous clients and to clean up the disk
#######PREPARE USER DEFINED FUNCTIONS
sub logmsg;
#######BEGIN BODY
#$| = 1;
my $NAME = '/home/httpd/html/img/streamsocket';
my $uaddr = sockaddr_un($NAME);
my $proto = getprotobyname('tcp');
socket(Server, PF_UNIX, SOCK_STREAM, 0) || die "Socket: $!\n";
unlink($NAME);
bind(Server, $uaddr);
listen(Server, SOMAXCONN);
logmsg "Server started on $NAME";
my $waitpid = 0;
my $paddr;
#$SIG{CHLD} = \&REAPER; ###IF I FORK IS THIS A LOOPING FORMULA ALLOWING
THE REST OF PROGRAM TO CONTINUE?
for ( ; $paddr = accept(Client,Server); ) {
logmsg "connection on $NAME";
my $in;
print Client "Hey there bonehead\n";
#print Client $in;
while ($in = <STDIN>) {
#print STDOUT "$in\n";
print Client "$in\n";
}
}
################################SUBROUTINES FROM HERE ON DOWN
#sub REAPER {
#$waitpid = wait;
#$SIG{CHLD} = \&REAPER;
#logmsg "reaped $waitpid" . ($? ? "with exit $?" : "");
#}
########LOGMSG
sub logmsg {
open(LOG, ">>/home/httpd/html/img/logserver.txt"); #GONNA HAVE TO FLOCK
HERE|| die "Cant do any logging because: $!\n";
print LOG "$0 $$: @_ at ",scalar localtime, "\n";
print STDOUT "$0 $$: @_ at ",scalar localtime, "\n";
}
------------------------------
Date: 20 Jul 1999 00:15:16 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: negate regex?
Message-Id: <7n0f2k$420@dfw-ixnews16.ix.netcom.com>
Daniel_P_Kirkwood (dankirk@lucent.com) wrote:
: I want to be able to store multiple regex's in a list, for example, and
: have them applied to a list of files, but I want each of the regex's to
: be able to say whether it's to be applied using =~ or !~ without extra
: work by the driving program..
:
: Here's a contrived example: @filters = ( qr/^foo/, !qr/bar/, qr/baz/)
: Meaning, I want everything in my list that starts with foo, then
: everything that doesn't have bar, etc.. Obviously, this isn't correct
: syntax, but you get my meaning...
You're probably better off storing them as anonymous subs, e.g.
@filters=(sub {/foo/}, sub {!/bar}, sub {/baz/});
This assumes that all the matches are against $_; if not, you'll need to
wire in the appropriate variable name.
------------------------------
Date: 19 Jul 1999 18:23:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: negate regex?
Message-Id: <3793c179@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Daniel_P_Kirkwood <dankirk@lucent.com> writes:
:Is there a way in a regex to negate the result ala !~ or "grep -v"? I've
:looked at looking at negative assertions, but they're not general
:enough..
:
:I want to be able to store multiple regex's in a list, for example, and
:have them applied to a list of files, but I want each of the regex's to
:be able to say whether it's to be applied using =~ or !~ without extra
:work by the driving program..
From Chapter Six of the Ram Book:
True if either C</ALPHA/> or C</BETA/> matches, like
C</ALPHA/ || /BETA/>:
/ALPHA|BETA/
True if both C</ALPHA/> and C</BETA/> match, but may overlap,
meaning that C<"BETALPHA"> should be ok, like C</ALPHA/ && /BETA/>:
/^(?=.*ALPHA)(?=.*BETA)/s
True if both C</ALPHA/> and C</BETA/> match, but may not overlap,
meaning that C<"BETALPHA"> should fail:
/ALPHA.*BETA|BETA.*ALPHA/s
True if pattern C</PAT/> does not match, like C<$var !~ /PAT/>:
/^(?:(?!PAT).)*$/s
True if pattern C<BAD> does not match, but pattern C<GOOD> does:
/(?=^(?:(?!BAD).)*$)GOOD/s
--tom
--
Adding manpower to a late software project makes it later
------------------------------
Date: 19 Jul 1999 18:15:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: New Page
Message-Id: <slrn7p7cb4.oqh.abigail@alexandra.delanet.com>
S.L. de Vries (devries-devries@wxs.nl) wrote on MMCXLVIII September
MCMXCIII in <URL:news:3793672F.21870060@wxs.nl>:
:: Hi,
::
:: Finally, my page is presentable.
:: I'd love to hear your comments.
:: My emailadres is: visitorstc@softhome.net
That's not what your article says.
:: My url is: http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It claims my browser doesn't support HTTP/1.1, and it's suggesting to
use browsers that do use HTTP/1.1. However, my browser supports more
of HTTP/1.1 than the suggested browsers, and did it a lot sooner as well.
Which means, your page sucks. Of course, you suck as well, cause there's
no point in posting the fact you managed to create "My First Webpage" in
this group.
Please consider no longer posting to usenet.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== 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: Mon, 19 Jul 1999 16:48:35 -0700
From: Jon Hollcraft <webmaster@mendonet.com>
Subject: Re: padding a DNS number
Message-Id: <3793B953.1EB0@mendonet.com>
I R A Darth Aggie wrote:
>
> On Mon, 19 Jul 1999 10:38:41 -0700, Lauren Smith <laurens@bsqaure.com>, in
> <7mvnri$pcs$1@brokaw.wa.com> wrote:
>
> + > How do you pad a number with a single '0' (zero)?
>
> + $num *= 10;
>
> It really does pay off to test you code to see if it does what you claim it
> will...
Couldn't agree more. This doesn't work, but it doesn't crash either.
I want to pad a DNS out to 12 digits.
from configs:
$envremadd=$ENV{'REMOTE_ADDR'}; # DNS of visitor internet access
part of a sub:
{ # convert remote address into 12 digits
@$nets = split(/\./, $envremadd);
foreach $net(@nets)
{
('001' .. '255'); #add leading zeros
}
$envremadd2 = join (@nets); #concatenate the 12 digits
yadda yadda
}
Your suggestions are invited.
Jon
------------------------------
Date: 20 Jul 1999 00:04:22 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: padding a DNS number
Message-Id: <7n0ee6$rfi$1@news.NERO.NET>
In article <3793B953.1EB0@mendonet.com>,
Jon Hollcraft <webmaster@mendonet.com> wrote:
>Your suggestions are invited.
If you can't extract from the thread on how to pad a number at least one
way of doing it, then repeating it again won't be helpful at all.
------------------------------
Date: 19 Jul 1999 23:29:29 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: padding a number
Message-Id: <7n0ccp$qcs$1@news.NERO.NET>
In article <slrn7p79cv.hmg.fl_aggie@thepentagon.com>,
I R A Darth Aggie <fl_aggie@thepentagon.com> wrote:
>On 19 Jul 1999 19:29:54 GMT, John Stanley <stanley@skyking.OCE.ORST.EDU>, in
>Lauren's Method: $num *= 10; # is a scaling factor
>James' Method: printf "%.2d\n",$num; # padding, but for a narrow set of $num
>
>+ $num = 100;
>+ Lauren's Method: 1000
>+ James' Method: 1000
>
>Is that a fact? Did you test my snippet? Let's test it:
>
>% perl
>
>$num=100;
>printf "James' Method: %.2d\n",$num;
You left out the $num *= 10; that was part of your first example.
Here is the code as you presented it the first time:
]% perl
]$num=0;
]$num *= 10;
]print q|Lauren's Method: |,$num,"\n";
]printf "James' Method: %.2d\n",$num;
If your "James' Method" does not print a number that is ten times the
original value of $num as set in the first line, YOU did something
wrong.
>Methinks ye have posted to quickly.
Methinks you forgot some code from your own snippet.
>+ $num = 1.2345;
>+ Lauren's Method: 12.345
>+ James' Method: 12
>
>Once more, with feeling:
Feel it all you want, but if you change the code you use then you ought
to expect that the answers might be different. Flaming someone because
you are running a different snippet than what you posted is worse than
hiding your code.
------------------------------
Date: 19 Jul 1999 18:17:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: PERL Q'S ANSWERED!
Message-Id: <slrn7p7cei.oqh.abigail@alexandra.delanet.com>
Tim Herzog (therzog@knotech.com) wrote on MMCXLVIII September MCMXCIII in
<URL:news:therzog-1907990142000001@therzog-host105.dsl.visi.com>:
__ In article <37924696.7B37@removethisitem.allexperts.com>, Steve
__ <director@removethisitem.allexperts.com> wrote:
__
__ >Have a CGI/Perl question you'd like answered? Here's a site that will
__ >answer them for free!
__
__ Oh good: I've been paying way too much for the support in this forum.
That reminds me. I've to start billing people I respond to.
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: 19 Jul 1999 18:47:39 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Programming problem
Message-Id: <slrn7p7e7p.oqh.abigail@alexandra.delanet.com>
Oliver Ertl (oe@sob-online.net) wrote on MMCXLVIII September MCMXCIII in
<URL:news:37938901.CB09EB5E@sob-online.net>:
{} Hello,
{}
{} why is the following perl program not working.
Because it is completely and utterly wrong.
Here's the correct program.
#!/opt/perl/bin/perl -w
use strict;
my $count = shift;
my $n = int (($count + 6) / 7);
goto (qw(LABEL0 LABEL1 LABEL2 LABEL3
LABEL4 LABEL5 LABEL6)) [$count % 7];
{
LABEL0: print "Sunday\n";
LABEL6: print "Monday\n";
LABEL5: print "Tuesday\n";
LABEL4: print "Wednesday\n";
LABEL3: print "Thursday\n";
LABEL2: print "Friday\n";
LABEL1: print "Saturday\n";
redo if -- $n > 0;
}
__END__
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: Mon, 19 Jul 1999 16:15:21 +0100
From: Nick Sanders <nick.sanders@lineone.net>
Subject: Re: split()
Message-Id: <37934107.69685323@lineone.net>
Because you are splitting a string by spaces and the first thing it sees
is spaces so $words[0] = "" and the rest is as expected
Nick
skyfaye@my-deja.com wrote:
> Hi,
>
> Can someone tell me why the split function splits the string into 3
> elements instead of 2?
>
> $line = " Boston 87"; # All the white spaces are spaces
> @words = split(/\s+/, $line);
> $size = @words;
> print "size of words = $size\n";
>
> OUTPUT
> -------
> size of words = 3
>
> Thanks,
> Hung
>
------------------------------
Date: Mon, 19 Jul 1999 19:36:04 -0400
From: brian@pm.org (brian d foy)
Subject: Re: TPJ/Earthweb junk mail?
Message-Id: <brian-ya02408000R1907991936040001@news.panix.com>
In article <ORWANT.99Jul19165100@rising-sun.media.mit.edu>, orwant@media.mit.edu posted:
> In article <x7vhbgfsn7.fsf@home.sysarch.com> Uri Guttman <uri@sysarch.com> writes:
> jon, i am sorry to hammer you, but ya could been a contendah!!
>
> Hammer away. I'm going to continue to do my job and edit Perl articles.
Jon is cool. Earthweb is not.
Jon is still cool. Don't hammer Jon. Hammer Earthweb. write to
the publisher to voice your displeasure: Mike Green <mgreen@earthweb.com>.
let him know that absentee publishers aren't cool and that he should
listen to his editors.
and, now that TPJ is big money, they should start paying real money
for articles.
as dha told me earlier today:
Earthweb bites,
but Perl programmers bite back.
--
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: 20 Jul 1999 00:09:07 GMT
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: using perl to talk to a modem
Message-Id: <7n0en3$8u5$1@newsmaster.cc.columbia.edu>
In article <7mv9t3$3q$1@coranto.ucs.mun.ca>,
Ray Wadman <rwadman@morgan.ucs.mun.ca> wrote:
: hi, i hope someone can help. i need to to know the best way to
: to use perl to communicate with a modem on fbsd 2.2.7
: (what i have to do is use perl to talk to a modem and send out a
: page (the numvber is a pager system) and inform when a critcal host
: goes down.)
:
: does anyone know how to do this or know of a resource?
:
If it doesn't have to be Perl, you might want to take a look at C-Kermit,
which can send both numeric and alphanumeric (TAP/IXO) pages by modem.
See:
http://www.columbia.edu/kermit/pagers.html
about sending pages, and:
http://www.columbia.edu/kermit/ck70.html
about C-Kermit 7.0, now in Beta test, soon to be released.
Also see:
http://www.columbia.edu/kermit/ckscripts.html
for samples of the scripting language.
- Frank
------------------------------
Date: Tue, 20 Jul 1999 00:41:58 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: Variable limitations
Message-Id: <qBPk3.15885$y92.9390@news.rdc1.ct.home.com>
Abigail <abigail@delanet.com> wrote:
> dan@tuatha.sidhe.org (dan@tuatha.sidhe.org) wrote on MMCXLVIII September
> MCMXCIII in <URL:news:7Juk3.15683$y92.9051@news.rdc1.ct.home.com>:
> @@
> @@ Well, that's not *entirely* true. No matter how much memory I've got, perl
> @@ won't allocate a scalar larger than 4G. Whether that's a sane thing to do
> @@ is another question entirely... :-)
> But, but, but, what if I want to interface Perl with Sybase 11.9.3, which
> can use up to 4 Tb of RAM?
> 4 Gb is just peanuts....
Yep. <sigh> Sucks to have languages with such small and arbitrary limits,
doesn't it? :-)
Oh, well, at least with 64-bit perl the limit'll be raised, though how
long until 2^64 bytes just isn't enough? Damn these computers and their
troublesome failings...
Dan
------------------------------
Date: 20 Jul 1999 00:08:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: weird getc behaviour
Message-Id: <7n0elj$420@dfw-ixnews16.ix.netcom.com>
Thomas Ruedas (ruedas@geophysik.uni-frankfurt.de) wrote:
: Hello,
: here's a problem with getc which I can't understand. I'm writing a Perl
: script to extract \cite commands from a LaTeX file. This is a short test
: version:
: #!/usr/local/bin/perl5
Missing a -w.
: $infile=$ARGV[0];
: $outfile=join("-",("cite",$infile));
The idiomatic way to do this is:
$outfile="cite-$infile";
: open (OUTFILE,">$outfile");
: open (INFILE,"$infile");
No tests that either file was opened successfully.
: while ($char = getc INFILE) {
This is what's causing your problem. If getc() returns a '0' or a
whitespace character, you'll drop out of the loop. Perl's stream IO
functions return undef when the input runs out; test for that instead:
while (defined($char=getc INFILE)) {
: print $char;
: }
: close (INFILE);
: close (OUTFILE);
: exit;
------------------------------
Date: 19 Jul 1999 18:19:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: which release supports qr/(?{...})/
Message-Id: <slrn7p7ci2.oqh.abigail@alexandra.delanet.com>
Phil R Lawrence (prlawrence@lehigh.edu) wrote on MMCXLVIII September
MCMXCIII in <URL:news:7mvgbg$vkq@fidoii.cc.Lehigh.EDU>:
:: I want to use (?{...}) in my regexes, but it seems unsupported in my version
:: (5.00404). Which release begins support for this feature?
5.005
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\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: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 194
*************************************