[12395] in Perl-Users-Digest
Perl-Users Digest, Issue: 5995 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 14 20:07:22 1999
Date: Mon, 14 Jun 99 17:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 14 Jun 1999 Volume: 8 Number: 5995
Today's topics:
Re: csv database w/ PERL <jeff@vpservices.com>
Re: examples <rootbeer@redcat.com>
Re: examples <cassell@mail.cor.epa.gov>
Re: File Uploading via html form <cassell@mail.cor.epa.gov>
Re: From Perl, Getting Dates from Sysbase. <mpeppler@peppler.org>
Re: help using large memory from perl perrin@primenet.com
Re: I need help making a search program <crt@highvision.com>
Re: Increment counter by Decials? <wyzelli@yahoo.com>
Re: Insidious 'use constant' syntax bit me <rootbeer@redcat.com>
Re: MacPerl and sending records to filemaker: apple eve (Paul J. Schinder)
Re: Match pattern - urgent <cassell@mail.cor.epa.gov>
Re: Need this code tightened <rootbeer@redcat.com>
Re: Need this code tightened (Larry Rosler)
Newbie wants to know: How would you do this? (Ken Bass)
Re: overwrite "print" ? <tchrist@mox.perl.com>
Re: Polling a file? <wyzelli@yahoo.com>
Re: Python to perl convertor <cassell@mail.cor.epa.gov>
Re: regex to replace quotes delimited by quotes. (Larry Rosler)
Script tolook at hotfolder and gunzip files on NT <dutch@mindspring.com>
Typing productivity software (Tim Gallati)
Re: What can and should not be done in Perl <rootbeer@redcat.com>
Re: What can and should not be done in Perl <neil@pacifier.com>
Re: Writing to a pipe...?? <tchrist@mox.perl.com>
Re: XS: Overriding errno? (Elf Sternberg)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Jun 1999 22:34:26 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: csv database w/ PERL
Message-Id: <376582DE.A0EC7BFA@vpservices.com>
classic_catering@my-deja.com wrote:
>
> I have a csv database file that I am trying to interface with my PERL
> script.
There is a perl module called DBI which handles CSV databases really
well. You can read about it at
http://www.symbolstone.org/technology/perl/DBI/
If you are on some platform other than windoze, you can download DBI and
a group of files called DBD:CSV from that address and the included
readme files and documents will explain installation and usage. If you
are on windoze, this address will tell you how to download and install
it:
http://www.vpservices.com/jeff/dbi-win32-faq.html
> Any help would be greatly appreciated as I am still new to PERL.
You are apparently also still new to newsgroups, you posted this message
*5* times under two different titles. That is very rude, please don't
do that. But OTOH, you get extra bonus points from Tom Christiensen for
correctly calling the files you work with CSV files, rather than "comma
delimited data". :-)
--
Jeff
------------------------------
Date: Mon, 14 Jun 1999 16:04:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: examples
Message-Id: <Pine.GSO.4.02A.9906141603280.6999-100000@user2.teleport.com>
On Mon, 14 Jun 1999, Lucas Hernandez wrote:
> I'm trying to find out how to create a html code able to call a pearl
> script under windows platform..
Check the docs, FAQs, and newsgroups about HTML, browsers, servers, and
CGI programming. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jun 1999 16:59:09 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Lucas Hernandez <hernal@champint.com>
Subject: Re: examples
Message-Id: <3765974D.7E4C16FB@mail.cor.epa.gov>
[courtesy cc to poster]
Lucas Hernandez wrote:
>
> Is it there an example source of cgi code for windows platform..?
> I'm trying to find out how to create a html code able to call a pearl script
> under windows platform.. any help or hints will be appreciated.
You may want to start at:
http://www.lies.com/begperl/
and work through those examples. Then you'll want to read through
the extensive docs which come with ActiveState Perl [note: it's
'Perl', not pearl which is a graphics language]. These docs
also come in a tasty HTML flavor which ActiveState even drops
onto your Start Menu for extra convenience.
Be sure to look at all the docs for CGI.pm, which is probably
the best way for you to get into serious CGI scripting. You
may want to buy Lincoln Stein's book too.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 14 Jun 1999 16:15:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: File Uploading via html form
Message-Id: <37658D17.ECD7BC6D@mail.cor.epa.gov>
[courtesy cc to poster]
Cameron Dorey wrote:
> [snip of mg's text]
>
> The code to all of the examples in the book is listed at Lincoln's
> website (actually Wiley's)
> http://www.wiley.com/compbooks/stein/source.html. I figure from this
> it's fair game to copy.
Well, the OED is on-line if you know where to go, but I'm pretty
sure that has a copyright or trademark or *something*. :-)
I'm not too comfortable with the inference:
readable -> free-to-copy-at-will
But perhaps I'm just a stick in the mud.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 14 Jun 1999 16:10:12 -0700
From: Michael Peppler <mpeppler@peppler.org>
Subject: Re: From Perl, Getting Dates from Sysbase.
Message-Id: <37658BD4.7FEC3174@peppler.org>
quanlay@my-deja.com wrote:
>
> I'm using sybperl to read table data from Sybase. However, when I get
> data from a date field it seems to convert it.
>
> In Sybase: 1998-12-09 08:13:43.936
> Retrieved: Dec 9 1998 8:13:43:936AM
>
> How do I stop this from converting or at least let me convert it back
> to the original form when I'm writing it to another table.
If you write it to another table you should be able to simply use that string.
Sybase will understand it just fine.
The output format of dates is defined by the locale (if you are using
Sybase::CTlib) or by using the CONVERT() function in your select call.
See the Sybase documentation for details.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: Mon, 14 Jun 1999 21:29:48 GMT
From: perrin@primenet.com
Subject: Re: help using large memory from perl
Message-Id: <7k3s80$47e$1@nnrp1.deja.com>
In article <slrn7m1fnh.fpt.rodgerd@wnl121.wnl.co.nz>,
rodger.donaldson@wnl.co.nz wrote:
> On Wed, 09 Jun 1999 13:14:35 -0400, Bill Jones <bill@fccj.org> wrote:
>
> >Linux doesn't access more than 128MB swap space; defining
> >more is a waste...
>
> Do *try* to keep up. You're only 5 or so years out of date.
Well, the swap works fine. But this did turn out to be a problem with
Linux on Intel hardware. It doesn't seem to be possible to use more
than 1GB of RAM for a single process on this platform, even if you get
the OS to recognize more RAM. Oh well, time to re-write everything...
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 19:19:16 -0400
From: "Casey Tweten" <crt@highvision.com>
Subject: Re: I need help making a search program
Message-Id: <7k4374$4p1@news.icubed.com>
Sir, I apologize. I am unable to find the time to write your script.
Actually, I never bothered to attempt to write one for a newsgroup before,
and always felt bad when people said "did you read the documentation".
However, since I now have a stable and demanding job, I realize that writing
scripts for anyone isn't as easy and carefree as I thought it was. I can
write them for the Yahoo! Clubs I belong to, but those are easy questions,
usually 15 minute programs.
So, you can hire someone to write this for you, and I bet they would, sorry
for the inconsiderate response. If that is what it seems like. I am really
a nice guy, I swear! Just busy.
--
+-----------------+
| Casey R. Tweten |
+--------------+--------+--------+--------------+
| * KiskiNet ISP | HighVision Associates |
| * HighVision Studio | Web Developer |
| * ISP-ProServices | www.highvision.com |
| * CityBuilder.com | crt@highvision.com |
+-----------------------+-----------------------+
| <joke>This is 100% virus free code</joke> |
+-----------------------------------------------+
RJ Marlatt <rjmarlatt@email.msn.com> wrote in message
news:edDm5Qft#GA.160@cpmsnbbsa05...
: Hey I need to make a search program that will search a big log file for
: multiple words and I don't know how
: if you could help that would be great.
: -Richard
: Richard@Marlatt.com
:
:
:
------------------------------
Date: Tue, 15 Jun 1999 08:38:48 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Increment counter by Decials?
Message-Id: <3Yf93.114$hR4.36969@vic.nntp.telstra.net>
Trent <trent@jps.net> wrote in message news:3765f095@news1.jps.net...
> Nothing in Deja,
> Nothing found in FAQ.
>
> Is it possible to increment a counter
> by anything other than 1?
>
> if (($customerdata[25] =~ /sold/i) && ($customerdata[4] =~
/$salesperson/i)
> || ($customerdata[24] =~ /$salesperson/i)){
> $saw_sold{$salesperson}++;
> }
>
> I need to increment the counters by (.5) for each match found, instead
> of just by (1).
>
> Manipulating the count after sorting the keys doesen't work in this case.
>
> Is there a way?
>
> Thanks for any pointers,
> Trent
>
>
Umm $count = $count + .5 ???
Wyzelli
------------------------------
Date: Mon, 14 Jun 1999 16:12:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Insidious 'use constant' syntax bit me
Message-Id: <Pine.GSO.4.02A.9906141610350.6999-100000@user2.teleport.com>
On Mon, 14 Jun 1999 jboes@qtm.net wrote:
> why aren't constants in 'require'd files
> visible to the requiring code?
They are, but not at compile time. The key is that the compiler has to see
the constant declaration before it sees the constant in use. Normally,
require happens at runtime, but you could use a BEGIN block to load the
constants earlier. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jun 1999 23:39:10 GMT
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MacPerl and sending records to filemaker: apple events?
Message-Id: <yog93.765$S2.48000@iad-read.news.verio.net>
In <'x'campbell-lange-1106992332280001@campbell-lange.easynet.co.uk> 'x'campbell-lange@easynet.co.uk (Rory C-L) writes:
[snip]
>I was hoping to do something like this from Perl:
>
> foreach $subject (sort(keys%search)) {
> MacPerl::DoAppleScript(<<END_SCRIPT);
> tell application "Filemaker"
> create new record with data {"$subject","$search{$subject}"}
> end tell
> END_SCRIPT
> }
>
>This doesn't work. In fact I haven't had much success doing anything more
>complicated that "choose folder with prompt xyz" or display dialog "OK"!
>when calling Applescript from MacPerl. I'd be grateful for some advice.
Have you tried the AppleScript by itself, inserting values in place of
$subject and $search{$subject}? You might be running into AppleScript
compilation problems or something.
>Also (apologies for all the questions), is there a way to precompile an
>applescript into MacPerl? I imagine that this would significantly speed up
>the script I'm attempting above.
No, but you can send Apple Events directly from MacPerl. In fact, you
should be looking at Chris Nandor's beta of Mac::Glue, which may give
you the control you want over Filemaker directly from MacPerl. Check
his web site, http://pudge.net/macperl/
>Should I be calling MacPerl from Applescript in the first place?
> (as in Chris' pod example:
> tell application "MacPerl"
> return ,
> "Days until the year 2000: " & (Do Script "
> use Time::Local;
> $d1 = timelocal(0,0,0,1,0,100);
> $d2 = ($d1 - time()) / 60 / 60 / 24;
> MacPerl::Reply(int($d2))
> ")
> end tell
> )
>
>Then again, should I be using Apple Events?
>The Filemaker Apple Event guide describes the following for creating a new
>anything:
>
> Send:
> Event ID 'crel', kAECreateElement
> Class ID & Constant 'core' kAECoreSuit
> Parameters:
> keyAEData 'data' (Data for new element)
> keyAEInsertHere 'insh' (location of element)
> keyAEObjectClass 'kobc' (Element class to create)
> keyAEPropData 'prdt' (the initial data for the element's properties)
> Reply:
> keyAEResult '----' (The object specifier for the new event)
>
> Chris also suggests in his pod tutorial suggests one get hold of
>aete.converter. Where can I get this?
> I have to admit that I got lost pretty early on in the AE tutorial.
>Thanks for any responses
>--
>Rory Campbell-Lange
>The Campbell-Lange Workshop
>Remove the 'x' to reply
>--
>please remove the 'x' to reply
--
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov
------------------------------
Date: Mon, 14 Jun 1999 16:11:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Anzej Becan <anzej@skavt.net>
Subject: Re: Match pattern - urgent
Message-Id: <37658C3D.4ED0CE84@mail.cor.epa.gov>
[courtesy cc to poster]
Anzej Becan wrote:
>
> > > I tried with split, but I don't find the right match pattern:
> > i would use substr().
> Thanks, I tried with substr() and results are exactly the same as I want.
Good.
> Now I have another question :-)
> Can I include in my script external file somewhere from web. I tried with:
> $ext_file="http://www.somewhere.com/doc/file.dat";
> but I got error message.
> A also read some perl books but I nowhere find this answer.
That's because this isn't a Perl question. The problem is that
you're thinking of a URL as being the same as a file in a
filesystem. You can open() and close() files in your local
filesystem, but that doesn't cover the HTTP protocol. So you
need something which addresses the HTTP protocol in order to
read a file off the web. Try LWP::Simple, which is probably
already on your system. The get() function does what you want.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 14 Jun 1999 16:09:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need this code tightened
Message-Id: <Pine.GSO.4.02A.9906141605480.6999-100000@user2.teleport.com>
On Mon, 14 Jun 1999 tbsmith@deltacom.net wrote:
> if ($miles <= 30) {
> $30{$_} = $miles;
> } elsif ($miles <= 60) {
> $60{$_} = $miles;
In general, variable names other than ones starting with a letter are
reserved for Perl's own use. It's probably better to choose a different
name for your hashes, even though this works today.
> $miles is different distances. Here I just categorize them. Later I'll
> be printing out the lowest numbered hash with stuff in it. (The closest
> locations in a certain radius). I pass the lowest hash like this:
>
> if (%30) {
I think you want an array of hash(ref)s. Check the perlref, perllol, and
perldsc manpages. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jun 1999 16:14:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need this code tightened
Message-Id: <MPG.11cf2c95a41384b6989bdf@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7k3lbe$1fn$1@nnrp1.deja.com> on Mon, 14 Jun 1999 19:31:58
GMT, tbsmith@deltacom.net <tbsmith@deltacom.net> says...
> if ($miles <= 30) {
> $30{$_} = $miles;
> } elsif ($miles <= 60) {
> $60{$_} = $miles;
> } elsif ($miles <= 90) {
> $90{$_} = $miles;
> } elsif ($miles <= 120){
> $120{$_} = $miles;
> }
>
> $miles is different distances. Here I just categorize them. Later I'll
> be printing out the lowest numbered hash with stuff in it. (The closest
> locations in a certain radius). I pass the lowest hash like this:
>
> if (%30) {
> print "The location(s) within a 30 mile radius
> around your zip code:<p>\n";
> for (sort { $30{$a} <=> $30{$b} } keys %30) {
> $line = $_;
> $low_miles = $30{$_};
> &print_primary(30)
> }
> } elsif (%60) {
...
> } else {
> print "There were no locations closer than 120
> miles to your zip code.\n";
> }
>
> There's gotta be another way to do it, with much less code.
You are trying to make use of the names of several hashes, instead of
using a real two-dimensional data structure. This is Bad.
The following code does about the same as yours, except that the
comparisons against multiples of 30 are '<', not <='. You can fix that
yourself if it is really important.
By the way, the doubtful usefulness of zip codes for geographical
purposes has been rather thoroughly hashed out here by Mark-Jason
Dominus. For the most recent posting, see
http://x27.deja.com/[ST_rn=ps]/getdoc.xp?AN=483261603.1
#!/usr/local/bin/perl -w
use strict;
my %hash;
for (<DATA>) {
my ($miles, $name) = /(\d+)\s+(.+)/ or next;
$hash{30 * (1 + int($miles/30))}{$name} = $miles;
}
my $min = (sort { $a <=> $b } keys %hash)[0];
if ($min <= 120) {
print "The location(s) within a $min mile radius
around your zip code:<p>\n";
for (sort { $hash{$min}{$a} <=> $hash{$min}{$b} }
keys %{$hash{$min}}) {
print "$_: $hash{$min}{$_}\n";
}
} else {
print "There were no locations closer than 120
miles to your zip code.\n";
}
__END__
175 bax
35 foo
55 foo bar
35 bar
150 quux
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 14 Jun 1999 23:23:02 GMT
From: Barista@End.Of.Universe (Ken Bass)
Subject: Newbie wants to know: How would you do this?
Message-Id: <37658a86.10998384@nntp1.ba.best.com>
(First, thanks to all who responded to my earlier request. I got a lot
of very helpful information, and very little arrogance :-) ).
Being a newbie to perl and all of the other web stuff, I have become
overwhelmed trying to understand it all. I know that what I want to do
is possible, but I just need someone to help me wade through
everything and point me to the right stuff, and in the right, general
direction. TIA:
I would like to design a "personalized" home page for our site. The
page would have three frames: the top will be a site navigation bar,
with links to specific areas of our site; the left side will have more
dynmanic stuff, like links that might change daily, etc. The third
frame will be the "content" frame.
What I want is to have the left frame also to contain links
personalized for a specific person. I already have a user database set
up and can access it from a perl script. I would like to some how use
cookies to identify the user, read the pre-selected links from the
database, and list them in the left frame. I think I know how to do
that (although I'm still confused about using cookies, with different
frames). What I am really confused about, though, is how a user can
request a link be added to his "personalized" list? It would be nice
if by clicking on a button on the top frame, whatever link is in the
third frame would be written to the database, and then the left frame
would get updated.
If anyone could give me some ideas about how this would be done, and
maybe perhaps a little code, I would greatly appreciate it.
TIA, again.
ken bass
kbb@SoftSteps.com
------------------------------
Date: 14 Jun 1999 17:03:19 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: overwrite "print" ?
Message-Id: <37658a37@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
info@java.seite.net writes:
:yes, i read the german translation of the camel book
Thought so. :-)
:sprichst du deutsch? weil du das mit "|berschreiben/|bergehen" weisst...
:larry wall spricht ja auch deutsch, weil seine mutter aus deutschland
:kam... sprechen alle perl-gurus deutsch? ist das eine wichtige grundlage
:um perl weiter zu entwickeln? ;-)
No, not all of us, and just enough to be dangerous. :-) I believe that
Larry and I have about the same amount of German language, which is a
tad more than nothing, but infinitely less than enough. My father's
maternal grandfather was a German immigrant, but I am more English by
blood than anything else, followed by Danish. My languages are English,
Spanish, and French, in that order, with some facility in Italian and
in Portuguese, plus diminishing bits of German and Latin thrown in at
all the wrong place just to muddle my mind.
:"|berschreiben" is the correct expression in german, "uebergehen" means
:something slightly different (to ignore somebody), the direct
:translation of "override" would be "|berreiten" which is not really a
:german expression (maybe it could be used when a horse rides over
:somebody..... !?)
I didn't mean to imply that "|bergehen" would have been a correct
translation, but it's one thing an English speaker might have grabbed
at. It looks like "|berstimmen" might have been slightly better.
I talked to the German translator for the Camel about this, and came
to the conclusion that "overwrite" and "override" are not too totally
far apart in meaning -- in this particular case.
:is there a reason why [print] can't be overridden?
Yes, the indirect object ("dative") component is the reason.
Remember that
print FHem "stuffen"; # :-)
and
print "stuffen";
are both permitted. There's no way to get at the dative part above
from user code. This is considered a flaw.
:and: is there any trick to simulate the overriding of "print"?
Call it directly? No, no good tricks.
Oh wait: tie a filehandle. Have a nice day. :-)
:mhh, if i can override "CORE" then i should be able to override
:"CORE::print"..!?
I'd be rather surprised if it were to work.
:but -surprise!- it doesn't work.....
Ahah!
--tom
--
"memento mori" - "Remember you will die."
------------------------------
Date: Tue, 15 Jun 1999 08:37:28 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Polling a file?
Message-Id: <PWf93.113$hR4.37036@vic.nntp.telstra.net>
Mitch <portboy@home.com> wrote in message news:3764FB7C.DB02AEF2@home.com...
> I need to continually "poll" a file to see when that particular file has
> been changed. I've searched through the perldocs and various Camel
> books, and haven't found an example. The only way I figured this could
> be done was to look at the modification times. However, I have a
> fundamental question. If I open the file for reading, and do nothing to
> it, does the modification time change or only the access time? Also,
> how can I constantly poll a file to see if it has changed, and if so
> throw some message to the user?
>
> Thanks, .mitch
>
Check Stats on the file occasionally like so:-
@filestats = stat ($Filename);
$moddate = $filestats[9];
then do stuff... based on files stats
Check the FAQ and DOCS on the stat function
Wyzelli
------------------------------
Date: Mon, 14 Jun 1999 16:44:34 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: zephaar@my-deja.com
Subject: Re: Python to perl convertor
Message-Id: <376593E2.BC07C902@mail.cor.epa.gov>
[courtesy cc to poster]
zephaar@my-deja.com wrote:
>
> Has anyone developed a convertor for translating python scripts
> into perl? I have a whole bunch (about 30) scripts of sizes ranging
> from 100 to about 600 lines each and would like to convert them
> into perl.
This doesn't sound too productive to me. Python does a lot
of things differently from Perl, and it has different ideas about
the programmer interface. Somehow I doubt that any sort of
translator would do a halfway decent job of writing idiomatic
[read 'efficient'] Perl code based on the original Python
program.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 14 Jun 1999 16:30:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regex to replace quotes delimited by quotes.
Message-Id: <MPG.11cf30545be83787989be0@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7k3lfi$1gj$1@nnrp1.deja.com> on Mon, 14 Jun 1999 19:34:10
GMT, Vicuna <vicuna@my-deja.com> says...
> Greetings.
>
> Task: strings must have delimiting quotes but also maybe quotes within
>
> my $example = '123 "She said: "What you say""';
> my $example2 = ' "sometimes " there is a stray";
Want you this string to terminate?
> all quotes between outer most quote must be replaced by two quotes;
> $example = '123 "She said: ""What you say"""';
> $example2 = ' "sometimes "" there is a stray";
>
> My work:
>
> s/"(.*)"/$_=$1;s|"|""|g;'"'.$_.'"'/e;
>
> Challenge: more elegent solution? Perhaps wrong am I?
Yoda are you?
In input assuming one no more than one quotation, trivially nicer-
looking these solutions might be, your taste depending on:
s/"(.*)"/$_ = $1; s|"|""|g; qq{"$_"}/e;
s/"(.*)"/"${$_ = $1; s|\"|\"\"|g; \$_}"/;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 14 Jun 1999 20:02:16 -0400
From: "Dutch McElvy" <dutch@mindspring.com>
Subject: Script tolook at hotfolder and gunzip files on NT
Message-Id: <7k44nb$sob$1@nntp8.atl.mindspring.net>
Hi I am a newbie to perl but would like to write a script to look at a
specific directory on an NT server and when gzipped files hit there for the
gunzip application to run and unzip the files and then move those unzipped
files into another specific directory.
Any suggestions would be appreciated.
Thanks,
dutch@mindspring.com
------------------------------
Date: Mon, 14 Jun 1999 23:14:30 GMT
From: tgallati@mainnet.com (Tim Gallati)
Subject: Typing productivity software
Message-Id: <37658cd0.3134312@news2.mainnet.net>
If you do a lot of repetitive typing, check out Perfect Keyboard Lite.
I use it everyday and consider it my most useful program.
It launches when you boot your computer and creates a file of
frequently used phrases, paragraphs, e-mail addresses, URLs and
macros. They are activated in any application by typing a short
abbreviation.
Free 30 day trial.
http://www.tricksandtrinkets.com/pk
------------------------------
Date: Mon, 14 Jun 1999 16:17:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: What can and should not be done in Perl
Message-Id: <Pine.GSO.4.02A.9906141616420.6999-100000@user2.teleport.com>
On 14 Jun 1999, Neil wrote:
> I am interested in hearing what things -- small and large -- that
> people have done in Perl. And I am interested in what things should
> not be done in Perl and why.
This is in the FAQ. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jun 1999 16:29:49 -0700
From: Neil <neil@pacifier.com>
To: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: What can and should not be done in Perl
Message-Id: <Pine.BSI.4.02.9906141628010.27077-100000@pacifier.com>
Yes, I saw it in the FAQ, I but thought a more in depth discussion with
specifics would be interesting.
Neil
On Mon, 14 Jun 1999, Tom Phoenix wrote:
> On 14 Jun 1999, Neil wrote:
>
> > I am interested in hearing what things -- small and large -- that
> > people have done in Perl. And I am interested in what things should
> > not be done in Perl and why.
>
> This is in the FAQ. Cheers!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
------------------------------
Date: 14 Jun 1999 17:42:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Writing to a pipe...??
Message-Id: <37659370@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Mitch <portboy@home.com> writes:
:How can I write one byte to a file named (uhhhh) /cpipe that will be
:acting as a pipe?
% man mkfifo
MKFIFO(1) OpenBSD Reference Manual MKFIFO(1)
NAME
mkfifo - make FIFOs
SYNOPSIS
mkfifo [-m mode] fifo_name ...
DESCRIPTION
mkfifo creates the FIFOs requested, in the order specified,
using mode 0666 modified by the current umask(2).
The options are as follows:
-m mode
Set the file permission bits of newly-created directories
to mode. The mode is specified as in chmod(1). In symbolic
mode strings, the ``+'' and ``-'' operators are interpreted
relative to an assumed initial mode of ``a=rw''.
mkfifo requires write permission in the parent directory.
The mkfifo utility exits 0 on success or >0 if an error occurred.
SEE ALSO
mkdir(1), rm(1), mkfifo(2), mknod(8)
STANDARDS
The mkfifo utility is expected to be IEEE Std1003.2-1992
(``POSIX.2'') compliant.
HISTORY
The mkfifo command appeared in 4.4BSD.
4.4BSD January 5, 1994 1
% man perlipc | egrep -ni 'fifo|named pipe'
8: perlipc - Perl interprocess communication (signals, fifos,
13: old Unix signals, named pipes, pipe opens, the Berkeley
219: A named pipe (often referred to as a FIFO) is an old Unix
225: To create a named pipe, use the Unix command mknod(1) or
233: && system('mkfifo', $path) )
235: die "mk{nod,fifo} $path failed";
238: A fifo is convenient when you want to connect a process to
239: an unrelated one. When you open a fifo, the program will
243: file be a named pipe that has a Perl program on the other
249: accidentally removed our fifo.
252: $FIFO = '.signature';
272: unless (-p $FIFO) {
273: unlink $FIFO;
274: system('mknod', $FIFO, 'p')
275: && die "can't mknod $FIFO: $!";
279: open (FIFO, "> $FIFO") || die "can't write $FIFO: $!";
280: print FIFO "John Smith (smith\@host.org)\n", `fortune -s`;
281: close FIFO;
1214: instead of a simpler named pipe? Because a named pipe
--
X-Windows: It could be worse, but it'll take time.
--Jamie Zawinski
------------------------------
Date: 14 Jun 1999 23:03:00 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: Re: XS: Overriding errno?
Message-Id: <7k41n4$u7l$1@brokaw.wa.com>
In article <slrn7m7hhi.39s.shirsch@pii.fast.net>
shirsch@adelphia.net (Steven N. Hirsch) writes:
>In article <7jgv13$ac1$1@brokaw.wa.com>, Elf Sternberg wrote:
>> I tried both and ended up going with a third option. *Grin*
>>I did, however, end up using the SvNOK_on() hack. That is *so* cool!
>For those of us who've missed the start of this thread, what is the
>"SvNOK_on" hack?
When digging into Perl on the C side, you have more access
over the structures that define what a SV (scalar variable) has in it.
The most common example of the SvNOK_on hack is $! (errno); it can be
treated as a number *and* as a string. You can say something like
if ($! == 7) { print $! }
and Perl will accurately compare treat $! as a number for the purpose
of comparison, but will print "Argument List Too Long" because $! is
also a string.
SvNOK_on is one of the macros that allows this to happen. An
SV contains flags that describe what it is: float, integer, string, or
other; with the Sv?OK_on macros, after you've set the interior fields
of an SV, you tell the interpreter that it's OK to treat this SV as a
number and a string; otherwise, the interpreter atod's all SVs that
are strings and sprintf's all numbers to their string representations
if you play mix 'n match with your treatments.
Elf
--
Elf M. Sternberg, rational romantic mystic cynical idealist
If you're so smart, why aren't you naked?
A.A 1493 http://www.halcyon.com/elf/
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5995
**************************************