[9174] in Perl-Users-Digest
Perl-Users Digest, Issue: 2792 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 2 20:08:17 1998
Date: Tue, 2 Jun 98 17:00:27 -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, 2 Jun 1998 Volume: 8 Number: 2792
Today's topics:
Re: "1" Question <rootbeer@teleport.com>
[Q] system using grep <lentdm@cig.mot.com>
Re: Bug in NET::FTP or am I just stupid? <gbarr@ti.com>
Re: Counter or Pause function in Perl? (Martien Verbruggen)
Re: dead program processes?? <rootbeer@teleport.com>
Disabling garbage collection (Andrew Arensburger)
Eerie Explorer error on Randal's site (Neil Kandalgaonkar)
Re: Help in Proxy Server GET HTTP! (Martien Verbruggen)
Re: HELP ME PLEASE! <probavm@cat.com>
Re: Help on e-mail from PERL script. <opx1@rocketmail.com>
Re: Help with CGI and shell execution bbrelin@dnai.com
HELP: Parsing quoted strings (Mario D'Alessio)
Re: HELP: Parsing quoted strings (Mario D'Alessio)
Re: How can I get the userID to open certain pages <rootbeer@teleport.com>
Re: How do you kill a Windows NT process using Perl? <bowlin@sirius.com>
Re: looking for DROP DOWN CATEGORY MENU (Martien Verbruggen)
Re: map in void context regarded as evil - suggestion (Abigail)
Re: map in void context regarded as evil - suggestion <ljz@asfast.com>
Re: map in void context regarded as evil - suggestion <ljz@asfast.com>
Re: map in void context regarded as evil - suggestion <rra@stanford.edu>
Re: Newbe needs help with scripts... <syzygy@seanet.com>
san francisco perl users group first meeting! <lanier@shell6.ba.best.com>
smtpmail script for win32 (Carlo Espiritu)
Re: smtpmail script for win32 (Bob Trieger)
Re: smtpmail script for win32 <bowlin@sirius.com>
Re: String to hash utility anyone? (Martien Verbruggen)
Re: User System Info. (Martien Verbruggen)
Using DLL <feng@haas.berkeley.edu>
Re: very quick s/// question (Larry Rosler)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 02 Jun 1998 22:31:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: "1" Question
Message-Id: <Pine.GSO.3.96.980602143914.15370w-100000@user2.teleport.com>
On Tue, 2 Jun 1998, John Timotheou wrote:
> open (TOTAL, "<$totalTB");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> while (read TOTAL, $stuff, 20000)
> {
> @lines = split(/\n/,$stuff);
Of course, you may accidentally split a line between one read and the
next. Could that be a bug?
> @NUMdataTP = split(" ",$a);
You may want /\s+/ or another pattern in there, but I'm not sure.
> for ($i=0; $i<=$#NUMdataTP; $i++)
> {
> $count++;
> }
That's a funny way to write this:
$count += @NUMdataTP;
:-)
> @ATTRIBnum = split(" ",$string);
I never saw you assign anything to $string. If you have turned on
warnings, Perl will be able to warn you about anything suspicious you're
doing.
> for ($i=0; $i<=$#ATTRIBnum; $i++)
> {
> $countB++;
> }
$countB += @ATTRIBnum; # Or maybe just assignment, instead of +=
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 02 Jun 1998 18:18:28 -0500
From: "Dave M. Lent [I]" <lentdm@cig.mot.com>
Subject: [Q] system using grep
Message-Id: <35748844.3B1B@cig.mot.com>
The following line is putting my Perl program into an infinite loop.
system("grep -i -l -w $keyword $filename");
When I use this line the code works though:
system("grep -i -l -w Technical $filename");
Does anyone know why "system" will not accept the variable $keyword?
Thanks in advance for your help.
------------------------------
Date: Tue, 02 Jun 1998 17:24:56 -0500
From: Graham Barr <gbarr@ti.com>
To: Barry Roomberg <broom@voicenet.com>
Subject: Re: Bug in NET::FTP or am I just stupid?
Message-Id: <35747BB8.E27F27E9@ti.com>
Barry Roomberg wrote:
> Thank you to whoever wrote the ftp interface,
> it's a HELL of a lot nicer to do it this way than
> to send "expect" scripts to "ftp".
If you look in the documentation, you will find who wrote it :-)
--
Graham Barr <gbarr@ti.com>
Life would be so much easier if we could just look at the source code.
------------------------------
Date: 2 Jun 1998 22:45:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: trachier@crrel.usace.army.mil (Gary Trachier)
Subject: Re: Counter or Pause function in Perl?
Message-Id: <6l1v9s$7rp$1@comdyn.comdyn.com.au>
[Posted and Mailed]
In article <trachier-0206981327000001@trachier.crrel.usace.army.mil>,
trachier@crrel.usace.army.mil (Gary Trachier) writes:
> Martien,
>
>> /How can I sleep() or alarm() for under a second?
>
> Take a look at the Perl built-in select(ready file descriptors) for a
> higher-resolution sleep function.
Heh, well, thanks, Gary, but that above question was actually a
reference to the perl faq, part 8, where this question is answered.
I was merely trying to avoid the original poster's possible next
question, when he finds out that sleep() has a resolution of a second.
:)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Tue, 02 Jun 1998 23:44:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: dead program processes??
Message-Id: <Pine.GSO.3.96.980602164306.15370y-100000@user2.teleport.com>
On Tue, 2 Jun 1998, Maurits wrote:
> The scripts worked "fine" , how can it be than that the perl scripts are
> constantly running?
> I've used the exit; command, and doesn't a script terminates when finished?
Sure, they do terminate when finished. But maybe yours weren't finished.
Could you have had an infinite loop without realizing it? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 2 Jun 1998 21:59:44 GMT
From: arensb@umiacs.umd.edu (Andrew Arensburger)
Subject: Disabling garbage collection
Message-Id: <6l1skg$2fn$1@walter.cs.umd.edu>
Keywords: embed, C++, garbage collection
I know this must have been asked a million times, but I
couldn't find the answer in the man pages or perl.com.
I have a C++ program with an embedded Perl interpreter. It
also gives the Perl interpreter access to certain objects.
The problem I'm running into is that these objects are being
destructed twice: once by $MyClass::DESTROY when the Perl interpreter
exits, and once by MyClass::~MyClass after main() exits:
main()
{
MyClass myObject;
PerlInterpreter *my_perl;
[... build and initialize my_perl...]
// Export myObject to Perl
SV *curvar;
SV *ref;
curvar = perl_get_sv("myObject", TRUE); // Create $myObject
sv_setref_pv(curvar, "MyClass", &myObject);
// Bless $myObject into
// MyClass
perl_call("return 1;"); // Not a real function, but
// pretend I used perl_call_argv()
/*** $myObject gets destructed here ***/
exit(0);
/*** myObject gets destructed here ***/
}
The typemap for MyClass is taken straight from perlxs(1), section
"Using XS with C++", and the .xs file contains
MyClass *
MyClass::new
void
MyClass::DESTROY
This does the Right Thing, except for variables "imported" from
C++-land, which get destructed twice.
I tried bumping up the reference count on $myObject using
SvREFCNT_inc(curvar), in the hopes that it would enable me to
distinguish between MyClass:: objects created by Perl code from
MyClass objects imported from C++-land, but by the time
XS_MyClass_DESTROY sees it, every variable's reference count is 1
(why?).
Any ideas? I have several ideas, but ideally I'd like to get
this to work without either a) keeping track of which variables I've
exported, or b) adding extra bookkeeping fields to the classes I want
to export.
--
Andrew Arensburger, Systems guy Center for Automation Research
arensb@cfar.umd.edu University of Maryland
That which does not kill me makes me smarter, except for oxygen deprivation.
------------------------------
Date: 2 Jun 1998 23:27:37 GMT
From: neil@domingo.concordia.ca (Neil Kandalgaonkar)
Subject: Eerie Explorer error on Randal's site
Message-Id: <6l21p9$2pa$1@newsflash.concordia.ca>
In MS Explorer I tried to load the page on www.stonehenge.com that allows
you to donate to the Randal Schwartz defense fund.
Explorer threw up an error message saying:
"performed an illegal operation... will be terminated immediately". Eeek!
Then there was the helpful message suggesting I contact the vendors of
Explorer if the problem persists...
------------------------------
Date: 2 Jun 1998 23:03:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: Walid ALSAQAF <e78199@ceng.metu.edu.tr>
Subject: Re: Help in Proxy Server GET HTTP!
Message-Id: <6l20bf$7rp$4@comdyn.comdyn.com.au>
[Posted and Mailed]
[Removed comp.unix.questions from the Newsgroups]
In article <3572ABFD.16AD8E1B@ceng.metu.edu.tr>,
Walid ALSAQAF <e78199@ceng.metu.edu.tr> writes:
> Greetings all,
>
> I wrote a Perl script that downloads HTML files from HTTP servers using
> the 80 port, and everything went find. However, in one server, such a
> message appeared with the heading:
This question has nothing to do with perl or unix. Since somebody
still gave you an answer here, this is going to be for future
reference:
Questions about CGI, HTML, Web servers and HTTP (which this is),
should go to the groups that talk about them. Most of them can be
found in the comp.infosystems.www.* hierarchy.
Please, next time, before you post, make sure that you post a perl
question to a perl group, a unix question to a unix group, and a HTTP
question to a HTTP group.
Thank you,
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Tue, 02 Jun 1998 17:13:21 -0500
From: "Vincent M. Probasco" <probavm@cat.com>
Subject: Re: HELP ME PLEASE!
Message-Id: <35747901.B2545B7@cat.com>
I think the easiest way to do this might be to rename the files that you
don't want included in the
search and have some common combination of characters in all of those
file names.
For instance -
left__pagename.html
header__pagename.html
body__pagename.html
Here you can check for the double underscore. If the double underscore
is found then don't ouput
a link to that file.
You could check by saying
if (!($variable =~ "__"))
{
then print out the stuff here
}
In this example $variable would be the variable where the name of the
file is stored. Just remember
not to include a double underscore in any of the files that you want to
be viewed from the search.
Hope this helps some.
--
Vincent Probasco
Work Hours : 12:00-6:00p.m., Mon.-Fri.
------------------------------
Date: Tue, 2 Jun 1998 23:46:57 +0200
From: "Maurits" <opx1@rocketmail.com>
Subject: Re: Help on e-mail from PERL script.
Message-Id: <6l1s0t$sal11@reader3.wxs.nl>
Lance Hetlet wrote in message <35736AF9.56568A33@ptialaska.net>...
>I need help in e-mailing from my script. I have had it successfullye-mail
users, but the format is
>unprofessional as seen below. Can
>anyone direct me in the right directions (URL's, books, advice)
>to where I can give it the appearance of any regular e-maill message?
>
>tia.
>
>> >From hetlet Fri May 29 03:17 EDT 1998
>> Content-Type: text
>> Content-Length: 230
>>
>> <message>
>
>Lance Hetlet
>http://www.ptialaska.net/~hetlet
>
try this:
$sendmail = '/bin/sendmail';
$from = you@you.com';
$subject = 'Se bla bla';
open (MAIL, "|$sendmail -t -oi");
print MAIL <<_END_;
To: $email
From: $from
Subject: $subject
--->blank line here!!!!
message body here
_END_
;
close MAIL;
------------------------------
Date: Tue, 02 Jun 1998 22:44:26 GMT
From: bbrelin@dnai.com
Subject: Re: Help with CGI and shell execution
Message-Id: <6l1v8a$1qu$1@nnrp1.dejanews.com>
In article <Pine.GSO.3.96.980522225042.29458D-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>
> On Sat, 23 May 1998 braunb@my-dejanews.com wrote:
>
> > Subject: Help with CGI and shell execution
> When you're having trouble with a CGI program in Perl, you should first
> look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
> such problems. It's available on CPAN.
That's the first thing I checked. I'm still SOL on this. The problem
seems to be that this line:
my $returnval = 0xffff & system("/usr/ccs/bin/make passwd > /dev/null 2>&1")
causes my web server to return a "Document has no data" error.
Commenting this line out stops the error. I've made sure to set
$ENV{'SHELL'} to /usr/bin/sh so that the 2>&1 does the right thing by
redirecting stderr to stdout.
the program is also set as suid.
I assume that the "document has no data" error means that the system
call is returning some text and that the Apache web server doesn't
know what to do with it. Unfortunately, I don't know what it's returning
nor do I know why it's returning anything to the web server for processing
at all.
Braun Brelin
braunb@mcm.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 2 Jun 98 22:29:00 GMT
From: dalessio@manatee.cig.mot.com (Mario D'Alessio)
Subject: HELP: Parsing quoted strings
Message-Id: <dalessio.896826540@manatee>
Keywords: HELP: Parsing quoted strings
I writing a simple parser and I need to be able to parse quoted
strings. For example, let's say I want read the following line and
grab each quoted string:
values = "a string", "another string", "string is \"help\"", "third string";
I'd like to use a RE to pick up the strings in quotes. I first
tried something like:
$line = 'values = "a string", "another string", "string is \"help\"", "third string"';
@strings = $line =~ /"([^"]*?)"/g;
print 'STRINGS: ', join('%', @strings), "\n";
The output is
STRINGS: a string%another string%string is \%%third string
As can be seen, it doesn't handle backslashed quotes. I want the
output to be:
STRINGS: a string%another string%string is "help"%third string
or
STRINGS: a string%another string%string is \"help\"%third string
I read up on positive/negative lookahead assertion, but it states
in the "Programming Perl" book that it doesn't work for lookBEHIND
assertion. I tried it anyways, attempting to match an ending quote
only if it doesn't have a backslash behind it, and it doesn't work:
@strings = $line =~ /"([^"]*?)(?!\\)"/g;
This yields the same output as my first attempt.
I need some help with this one. Thanks.
Mario
**********************************************************
* ____ ____ ___ *
* __/\__ Mario D'Alessio ((oo)) //oo\\ /o o\ *
* \RUSH/ dalessio@cig.mot.com \__/ \__/ \_O_/ *
* |/\| Work: (847) 632-2323 Moe Larry Curly *
* 9am to 6pm Central Time *
* *
**********************************************************
------------------------------
Date: 2 Jun 98 22:39:35 GMT
From: dalessio@manatee.cig.mot.com (Mario D'Alessio)
Subject: Re: HELP: Parsing quoted strings
Message-Id: <dalessio.896827175@manatee>
Keywords: HELP: Parsing quoted strings
dalessio@manatee.cig.mot.com (Mario D'Alessio) writes:
>I writing a simple parser and I need to be able to parse quoted
>strings. For example, let's say I want read the following line and
>grab each quoted string:
>
> values = "a string", "another string", "string is \"help\"", "third string";
>
>I'd like to use a RE to pick up the strings in quotes. I first
>tried something like:
>
> $line = 'values = "a string", "another string", "string is \"help\"", "third string"';
> @strings = $line =~ /"([^"]*?)"/g;
> print 'STRINGS: ', join('%', @strings), "\n";
>
>The output is
>
> STRINGS: a string%another string%string is \%%third string
>
>As can be seen, it doesn't handle backslashed quotes. I want the
>output to be:
>
> STRINGS: a string%another string%string is "help"%third string
>
>or
>
> STRINGS: a string%another string%string is \"help\"%third string
>
>I read up on positive/negative lookahead assertion, but it states
>in the "Programming Perl" book that it doesn't work for lookBEHIND
>assertion. I tried it anyways, attempting to match an ending quote
>only if it doesn't have a backslash behind it, and it doesn't work:
>
> @strings = $line =~ /"([^"]*?)(?!\\)"/g;
>
>This yields the same output as my first attempt.
>
>I need some help with this one. Thanks.
I'm following up on my own post. I did this as a possible solution:
$line =~ s:\\":<QUOTE>:g;
@strings = $line =~ /"([^"]*?)"/g;
map( s:<QUOTE>:\\":g, @strings );
and my output is just what I wanted:
STRINGS: a word%another word%word is \"help\"%third word
However, I'd really like a solution (if possible) in the
RE itself since it will help me learn more about REs.
Thanks.
Mario
**********************************************************
* ____ ____ ___ *
* __/\__ Mario D'Alessio ((oo)) //oo\\ /o o\ *
* \RUSH/ dalessio@cig.mot.com \__/ \__/ \_O_/ *
* |/\| Work: (847) 632-2323 Moe Larry Curly *
* 9am to 6pm Central Time *
* *
**********************************************************
------------------------------
Date: Tue, 02 Jun 1998 23:40:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How can I get the userID to open certain pages
Message-Id: <Pine.GSO.3.96.980602163639.15370x-100000@user2.teleport.com>
On Tue, 2 Jun 1998, Andreas wrote:
> I have a restricted area ( htaccess), but
> after a user has logged in, I still can=B4t get the userID with it.
If your server isn't giving you the data it should, that's a bug in the
server. If it is giving you the data, what are you complaining about? :-)=
=20
Of course, if you think it's giving you the data but you don't know how
to read what it says, you should probably check your server's docs. If
you've read the docs and you're still unsure, the docs, FAQs, and
newsgroups about servers may be a good place to check next.
Hope this helps!
--=20
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 02 Jun 1998 15:44:37 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: ffinstad@globalsight.com
Subject: Re: How do you kill a Windows NT process using Perl?
Message-Id: <35748055.1EFB4A34@sirius.com>
ffinstad@globalsight.com wrote:
>
> To restart Apache on UNIX I'm doing ...
> How can I do the same thing on Windows NT?
>
> I'm using NT 4.0, Perl for Win32, and Apache 1.3b6.
use Win32::Service;
Win32::Service::StartService('', 'Apache') or
die "Could not start Apache";
sleep(20);
Win32::Service::StopService('', 'Apache') or
die "Could not stop Apache";
HTH -- Jim Bowlin
------------------------------
Date: 2 Jun 1998 22:58:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: looking for DROP DOWN CATEGORY MENU
Message-Id: <6l203b$7rp$3@comdyn.comdyn.com.au>
Please read the following information on how to choose a good subject
line:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
In article <6kvukl$hfs$1@supernews.com>,
michael@wwwebcrafters.com (michael) writes:
> I'm trying to find a drop down menu in which I can link the selected
> items to different URL's.
Perl doesn't have drop down menus, unless you are talking about the Tk
stuff, but somehow I doubt that. The mention of "link to .. URL's"
makes me wonder if maybe you are asking a question about HTML. If you
are, you should most likely ask that question in one of the groups in
the comp.infosystems.www.* hierarchy.
> Please e-mail to michael@wwwebcrafters.com
Nope. Post here, read here. Personal service is charged differently.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd. | negative.
NSW, Australia |
------------------------------
Date: 2 Jun 1998 23:07:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l20iq$esv$1@client3.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCXXXVI September
MCMXCIII in <URL: news:6l1hj4$2df$2@csnews.cs.colorado.edu>:
++ [courtesy cc of this posting sent to cited author via email]
++
++ In comp.lang.perl.misc, jdporter@min.net writes:
++ :So, you're fundamentally opposed to the ST?
++
++ That has a return value, which is used. It's clear when you say
++
++ @foo = map {}
++ sort {}
++ map {} @bar;
++
++ That that map is used for its return value is clear and obvious.
++ Using map to hide changing the contents of the target list because
++ you're too divinely functional to use a stone-age loop the way we dumb
++ old procedural-programmers do is just going to get you talked about.
But this still has the backwards logic.
++ Side effects suck.
s///, print and = are mainly used for their side effects.
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: 02 Jun 1998 19:30:23 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <ltyavfqt4g.fsf@asfast.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, Tom.Grydeland@phys.uit.no (Tom Grydeland) writes:
> :The major complaint about using C<map> in void context is that it
> :creates a (possibly large) return value which is then discarded.
>
> No, the major complaint is backwards logic confusing people.
>
> [ ... ]
>
> I can't see why people use
>
> map { s/foo/bar/ } @list;
> grep { s/foo/bar/ } @list;
>
> when they could more clearly write:
>
> for (@list) { s/foo/bar/ }
>
> Put the important thing first.
But maybe the `s/foo/bar/' is what's important in certain cases. Who
decides?
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: 02 Jun 1998 19:32:10 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <ltvhqjqt1h.fsf@asfast.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> lr@hpl.hp.com (Larry Rosler) writes:
> :The Blue Camel makes its preference for the latter quite clear (p. 97,
> :bottom) but still has this (p. 93, bottom):
> :
> :next unless ($dev, $ino, $mode) = stat $file;
>
> [ ... ]
>
> Let's not get arried away with this. The point is that writing loops
> that aren't loops is unnecessarily obfuscatory. I can call bar() at the
> end of my foo() function, or I can just goto &bar instead. But I don't.
But then where do you do your social drinking?
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: 02 Jun 1998 16:35:16 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <m3pvgr4bt7.fsf@windlord.Stanford.EDU>
Jonathan Stowe <Gellyfish@btinternet.com> writes:
> Does C<scalar keys %hash> carry any more or any less typographical
> information than <CODE>scalar keys %hash</CODE> ? It is left to an
> interpreting application to place its own typographical interpretation
> on either according to its requirements.
It's less intrusive. Count the number of characters of markup per amount
of text. If HTML were as light-weight as POD, I doubt anyone would
complain about it.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 2 Jun 1998 15:19:48 -0700
From: "Stuart Updegrave" <syzygy@seanet.com>
Subject: Re: Newbe needs help with scripts...
Message-Id: <6l1u8b$abj@news.microsoft.com>
. wrote in message ...
>I am a newbie just building my first site. I need a javascript (1.0) or a
>perl (for windows NT) script that will be able to insert a certain META
>tag in the HEAD of an HTML document, ONLY if the document is beeing read
>by Microsoft Internet Explorer (any version...). While other browsers are
>accessing this document nothing should happen. I know this is supposed to
>be a simple and short script, but I have just started learning and
>couldn't make it work.
<HEAD>
... stuff
<SCRIPT LANGUAGE="Javascript"><!--
if (navigator.appName == 'Microsoft Internet Explorer')
document.write('put your META tag here.');
// --></SCRIPT>
... more stuff
</HEAD>
>Please e-mail me any response.
Please read the comp.lang.javascript meta-FAQ:
* http://ugweb.cs.ualberta.ca/~thompson/programming/javascript/meta-FAQ.html
cheers,
~stuart
------------------------------
Date: Tue, 2 Jun 1998 15:17:25 -0700
From: "matthew d. p. k. lanier" <lanier@shell6.ba.best.com>
Subject: san francisco perl users group first meeting!
Message-Id: <Pine.BSF.3.96.980602151621.27533D-100000@shell6.ba.best.com>
hello all-
The San Francisco Perl Users Group is having its first meeting, and you're
invited!
our first meeting has been confirmed and booked. here's the info
when: tuesday, june 9, 7 pm until 8:30
where: intershop communications, 600 townsend at 7'th street, 5'th floor
what: discussion with tom phoenix, noted perl trainer and programmer
content: we will discuss with tom just about anything we want, though the
two scheduled topics are closures, taint checking, and the randal schwartz
case. all other perl questions will be graciously discussed.
what to bring: yourself, your copy of the camel book (if you're feeling so
inclined) and some small donation to help defray costs. this is not
required, but encouraged. Intershop has graciously given us this space
and has agreed to provide refreshments, so we should help them back.
i look forward to seeing you there. if you have additional topics which
you know you would like to discuss, let me know so that i can forward them
to tom phoenix so that he might be prepared...
PLEASE RSVP! PLEASE RSVP TO ME! THANKS!
i look forward to seeing you there!
matt =)
........................................................
: matthew d. p. k. lanier : sf perl user's group :
: matt@lanier.org : sfpug-request@pootpoot.com :
: matt@saturn5.com : http://www.pm.org :
........................................................
------------------------------
Date: 2 Jun 1998 22:49:36 GMT
From: cespirit@engr.csulb.edu (Carlo Espiritu)
Subject: smtpmail script for win32
Message-Id: <6l1vi0$7sp@hatathli.csulb.edu>
Does anyone know of a good Perl script for sending form mail? I've used
Unix based scripts before with Unix systems, but I seem to have a lot of
difficulty setting it up on a Windows NT web server. I need some help on
finding a working program as well as how to implement it....
I've used mail-lib.pl with formmail.pl and the script seems to work with
it processing the information and giving me a message that it has been
sent, but I never seem to receive the tests in any of the email directions
that I have assigned them to...
Carlo
cespirit@engr.csulb.edu
------------------------------
Date: Tue, 02 Jun 1998 22:57:50 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: smtpmail script for win32
Message-Id: <6l2048$sjj$1@ligarius.ultra.net>
[ posted and mailed ]
cespirit@engr.csulb.edu (Carlo Espiritu) wrote:
-> Does anyone know of a good Perl script for sending form mail? I've used
-> Unix based scripts before with Unix systems, but I seem to have a lot of
-> difficulty setting it up on a Windows NT web server. I need some help on
-> finding a working program as well as how to implement it....
-
If you're looking for help for a script you're writing, it doesn't get much
simpler than Net::SMTP.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-320-9895
and hang up when somebody answers "
------------------------------
Date: Tue, 02 Jun 1998 16:48:05 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Carlo Espiritu <cespirit@engr.csulb.edu>
Subject: Re: smtpmail script for win32
Message-Id: <35748F35.B711978B@sirius.com>
I just wrote one. It uses Net::SMTP. I will have it email itself to you.
-- Jim Bowlin
Carlo Espiritu wrote:
>
> Does anyone know of a good Perl script for sending form mail? I've used
> Unix based scripts before with Unix systems, but I seem to have a lot of
> difficulty setting it up on a Windows NT web server. I need some help on
> finding a working program as well as how to implement it....
>
> I've used mail-lib.pl with formmail.pl and the script seems to work with
> it processing the information and giving me a message that it has been
> sent, but I never seem to receive the tests in any of the email directions
> that I have assigned them to...
>
> Carlo
> cespirit@engr.csulb.edu
------------------------------
Date: 2 Jun 1998 22:55:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: String to hash utility anyone?
Message-Id: <6l1vsv$7rp$2@comdyn.comdyn.com.au>
In article <6kv8c7$h5d$1@malgudi.oar.net>,
"Eric Youngquist" <ewy@iti-oh.com> writes:
> $hash{dir1}{sdir1}{sdir11}=file11.txt
You might need to rethink your design. How are you going to deal with
multiple files in the same directory?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: 2 Jun 1998 23:06:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: User System Info.
Message-Id: <6l20i2$7rp$5@comdyn.comdyn.com.au>
In article <6l052o$eb3$1@nnrp1.dejanews.com>,
bobbybooby@my-dejanews.com writes:
> I'm sure that I have the totally wrong group, but I'll go for it anyway.
> I've seen a couple of postings related to using JavaScript and Java to obtain
Yep, you do have the wrong group, and I consider it very rude to still
post, even though you already knew that.
If you have questions about java, ask on a java group.
If you have questions about cgi or ssi, ask on one of the
comp.infosystems.www.* groups.
Only if you have a question about perl, you post here.
Martien
PS. You might want to think a bit about how all this actually works,
and where these things run. It seems you haven't understood the basics
of it at all yet.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The number of the beast is not 666. The
Commercial Dynamics Pty. Ltd. | number is 95, and it's awake.
NSW, Australia |
------------------------------
Date: Tue, 02 Jun 1998 16:21:13 -0700
From: patience <feng@haas.berkeley.edu>
Subject: Using DLL
Message-Id: <357488E9.20EC2C8B@haas.berkeley.edu>
Hi,
I do all my programming in Linux, mostly using Perl. But now I need to
write codes that would issue a series of calls to a DLL driver in Win95
environment. How should I approach this task? Which language do you
think I should use for this task?
Thanks a bunch! : )
- Patience
------------------------------
Date: Tue, 2 Jun 1998 15:44:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: very quick s/// question
Message-Id: <MPG.fde201edd049d1798968f@hplntx.hpl.hp.com>
In article <hj_c1.44$m4.801288@news3.voicenet.com>, hex@voicenet.com
says...
> Alex Barilo <hash@email.infotrade.co.uk> wrote:
...
> Running these two methods through Benchmark produces confusing (At least
> to me) results. Consider:
>
> #!/usr/local/bin/perl
> use Benchmark;
>
> $pattern = "a b c d e ";
>
> timethese(1_000_000, {
> 'regex' => ' $pattern =~ s/(\w)\s(?=\w)/$1\*$2/g',
> 'regex_o' => ' $pattern =~ s/(\w)\s(?=\w)/$1\*$2/go',
> 'procedural' => ' $pattern = join('*', split(/\s/, $pattern))'
> });
> __END__
> Benchmark: timing 1000000 iterations of procedural, regex, regex_o...
> procedural: 1 secs (-0.03 usr 0.00 sys = -0.03 cpu)
> (warning: too few iterations for a reliable count)
> regex: 28 secs (28.19 usr 0.00 sys = 28.19 cpu)
> regex_o: 30 secs (28.21 usr 0.00 sys = 28.21 cpu)
>
>
> I don't understand what's going on with 'procedural' here because it
> takes about 15 seconds to execute (By the very rough guess of me
> watching the system clock). I can only assume that the Perl interpreter
> itself is doing most of the work here, hiding it from my process (But
> then, why wouldn't it show in sys time?). Can anybody clue me in as to
> what the problem is?
...
It's always a good idea to run the Benchmark once with a print statement
for each case, so you can see what's going on. In this case,
'procedural' does nothing and prints nothing. See those single-quotes
around the asterisk? Change them to double-quotes, or change the outer
single-quotes to double-quotes, and the thing works, and the 'procedural'
choice takes significantly longer (YMMV).
Also, with the positive look-ahead assertions, $2 is null and the \*
should just be *, so the replacements are /$1*/g. The final 'o' is
unnecessary since nothing can get interpolated into the regex.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
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 2792
**************************************