[10297] in Perl-Users-Digest
Perl-Users Digest, Issue: 3893 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 5 13:57:30 1998
Date: Mon, 5 Oct 98 09:01:37 -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, 5 Oct 1998 Volume: 8 Number: 3893
Today's topics:
regex help (Randy Jae Weinstein)
Re: regex help <matt@whiterabbit.co.uk>
Re: RFC: "Build'n'Play" installation tool droby@copyright.com
Re: RFC: "Build'n'Play" installation tool <eashton@bbnplanet.com>
Search for forwardslash...how? <kchunt@mail.hac.com>
Re: Sending and receiving data to/from a weather server <burt.adsit@gte.net>
sort question? <gkassyou@newbridge.com>
Split question - retain the pattern? (A.J. Norman)
Re: Split question - retain the pattern? <erhmiru@erh.ericsson.se>
Re: Survey Script droby@copyright.com
Sys::Syslog problems <alexis@danae.demon.co.uk>
WIN32::ODBC update/suggestion francisb@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Oct 1998 14:08:49 GMT
From: rw263@is7.nyu.edu (Randy Jae Weinstein)
Subject: regex help
Message-Id: <6v5b5h$lbf$1@news.nyu.edu>
The below two snippets of code should do the SAME thing, however the
first works and the later one doesn't. What is wrong with my regex in
the second?
--- This WORKS: ----------------------------
if (($a =~ /\//) && ($b =~ /\//)) {
($tempA,$junk) = split(/\//,$a);
($tempB,$junk) = split(/\//,$b);
print "($tempA : $tempB)\n";
}
--------------------------------------------
--- This DOESN'T: -------------------------
if (($a =~ /(.*)\//) && ($b =~ /(.*)\//)) {
print "($1 : $2)\n";
}
--------------------------------------------
Please respond via email, since I don't check this newsgroup often.
THANKS!
Cheers,
=| __ __ T | Randy Jae
=| | .\/. | O M |
*--\ \/ /--* O A | NYU College of Dentistry
| / __ \ T N | Randy Jae Weinstein Lehigh University
| |_| |_| H | rw263@is7.NYU.EDU
--==>> http://Pages.NYU.EDU/~rw263/
------------------------------
Date: Mon, 05 Oct 1998 16:37:57 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: Randy Jae Weinstein <rw263@is7.nyu.edu>
Subject: Re: regex help
Message-Id: <3618E7D5.E2CB972B@whiterabbit.co.uk>
Incorrect usage of $1 and $2.
in this expression -
$a =~ s/(.*?)\/(.*)//;
$1 will be the contents of the first set of parenthises, and $2 the
second. Since you are using two separate regexps, $1 is overwritten by
the second, and $2 is blank - there are only one set of parenthises in
the regexp.
Matt
--
Randy Jae Weinstein wrote:
>
> The below two snippets of code should do the SAME thing, however the
> first works and the later one doesn't. What is wrong with my regex in
> the second?
>
> --- This WORKS: ----------------------------
> if (($a =~ /\//) && ($b =~ /\//)) {
> ($tempA,$junk) = split(/\//,$a);
> ($tempB,$junk) = split(/\//,$b);
> print "($tempA : $tempB)\n";
> }
> --------------------------------------------
>
> --- This DOESN'T: -------------------------
> if (($a =~ /(.*)\//) && ($b =~ /(.*)\//)) {
> print "($1 : $2)\n";
> }
> --------------------------------------------
>
> Please respond via email, since I don't check this newsgroup often.
> THANKS!
>
> Cheers,
> =| __ __ T | Randy Jae
> =| | .\/. | O M |
> *--\ \/ /--* O A | NYU College of Dentistry
> | / __ \ T N | Randy Jae Weinstein Lehigh University
> | |_| |_| H | rw263@is7.NYU.EDU
> --==>> http://Pages.NYU.EDU/~rw263/
--
Matt's daily comic strip
Porridge and Fartcakes
http://www.whiterabbit.co.uk/cartoons
------------------------------
Date: Mon, 05 Oct 1998 13:50:28 GMT
From: droby@copyright.com
Subject: Re: RFC: "Build'n'Play" installation tool
Message-Id: <6vair4$ien$1@nnrp1.dejanews.com>
In article <3617E4F4.692232B3@bbnplanet.com>,
Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> wrote:
> Steffen Beyer wrote:
>
> > Moreover this CD-ROM is planned to include a tool for automatically
> > installing Perl and most of the modules from CPAN (some subsets have
> > also been defined) called "Build'n'Play", or "BnP" for short.
>
> Cool concept, but the name makes me cringe. How about 'Compile 'n' Go'?
>
'Shake 'n' Make'.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 05 Oct 1998 15:51:57 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: RFC: "Build'n'Play" installation tool
Message-Id: <3618E8A5.65595D07@bbnplanet.com>
Jim Brewer wrote:
> Well, not to be rude but how about "Dump 'N Go"? You know, Dump the
> CD-ROM to disc 'N Go get a cup of coffee?? Just a thought.
For a woman of my obvious distinction I doubt that I could use such a
product as it has a certain taint to it. What about "Pop 'n' Go"? as in
"Pop that sucker in cd n gooo baby gooo. Or "Mount 'n' Go"? Mount that
puppy and go to town...*mwwhaahaahaa* but I digress....
e.
As I was lying there with my eyes closed, just after I'd
imagined what it might be like if in fact I never got up
again, I thought of you. I opened my eyes then and got
right up and went back to being happy again.
I'm grateful to you, you see. I wanted to tell you. -R. Carver-
------------------------------
Date: Mon, 05 Oct 1998 08:31:26 -0700
From: Kenneth Hunt <kchunt@mail.hac.com>
Subject: Search for forwardslash...how?
Message-Id: <3618E64E.BCAC308C@mail.hac.com>
I want to split a UNIX pathname at the forward slashs. How can I split
this line:
IMUX/C-BAND/COMDEV/0962-12/un012_O.B._Isolation#1.xls>
into this line
IMUX C-BAND COMDEV 0962-12 un012_O.B._Isolation#1.xls
Bare in mind that the path has all kinds of characters in it, but I only
want to split at the forward slash. How do I do that?
--
------------------------------------------------------
Kenneth Hunt
SC S12 V321 Rm. C233
office: 364-7755 pager: 715-0600
------------------------------------------------------
------------------------------
Date: Mon, 05 Oct 1998 10:18:41 -0400
From: Burt Adsit <burt.adsit@gte.net>
To: vincent@psnw.com
Subject: Re: Sending and receiving data to/from a weather server?
Message-Id: <6vak5v$b3v$1@news-2.news.gte.net>
I found a NOAA weather module done by Mark Solomon (Thanks Mark). I use
it on my astronomy club's web site. Everyone goes to the weather page,
gets the current lunar phase (a GIF from the Naval Observatory) and
local weather complete with forecast.
http://www.seva.net/~msolomon/wx/dist/WeatherNOAA.pm.html
http://www.featurefarm.com/mas/mas_weather.html (my implementation)
Burt Adsit
V. M. Padua wrote:
>
> Disclaimer: Newbie
>
> I'm working on a tcl/tk script that calculates the lunar phases of the
> moon by calling a Perl script that will returns those answers.
>
> I'd like to include in the interface of the program an option where the
> user can select from about ten different airports/cities and when they
> hit the calculate button to find the lunar phases it will return the
> solutions as provided by the Perl script but will also find the current
> temperature in the city the user had selected.
>
> Now what I'm looking for are some pointers on how to query a weather
> server with a selected city and return the current temperature in that
> airport/city using Perl. Now I'm not a Perl programmer (I didn't even
> write the Perl script the program calls) and I've checked some of the
> FAQ's and figured that I'd probably have to do something with CGI, but
> I'm looking for an example or discussion regarding a similar problem.
>
> I'm willing to submit the tcl/tk script and perl script if anyone would
> like to take a look at those.
>
> Thanks for any help and time,
>
> .mitch
------------------------------
Date: Mon, 05 Oct 1998 11:31:27 -0400
From: George Kassyousef <gkassyou@newbridge.com>
Subject: sort question?
Message-Id: <3618E64F.365D40F1@newbridge.com>
This is a multi-part message in MIME format.
--------------603EF7E5F7DA990F7F17C74D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
How can I sort a value which is made up of integers and characters?
Ex. 9012354500G
9034988988F
9012354500G
9030940934E
after sort:
9030940934E
9034988988F
9012354500G
9012354500G
Thx.
--------------603EF7E5F7DA990F7F17C74D
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for George Kassyousef
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: George Kassyousef
n: Kassyousef;George
org: Newbridge Networks
email;internet: gkassyou@newbridge.com
title: Software Engineer
tel;work: 599-3600 x1630
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------603EF7E5F7DA990F7F17C74D--
------------------------------
Date: 5 Oct 1998 15:41:26 +0100
From: nja@le.ac.uk (A.J. Norman)
Subject: Split question - retain the pattern?
Message-Id: <6valqm$d12@owl.le.ac.uk>
I'm writing a script to parse text, and want to be able to split a block
of text (an e-mail message for instance) into sentences. I can do
something like this:
@lines = <INFILE>;
$text = join(" ", @lines);
@sentences = split(/[?.]\s+/, $text);
This puts the entire message into one variable, and then splits it on a
question mark or full stop followed by whitespace. But it eats the
question mark or full stop - is there any way I can use split so that
the splitting pattern is retained? I'd like to be able to change this:
How are you
today? I am
fine.
to this:
How are you today?
I am fine.
not this:
How are you today
I am fine
--
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/
------------------------------
Date: 05 Oct 1998 17:07:07 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: Split question - retain the pattern?
Message-Id: <lazpbb3v50.fsf@erh.ericsson.se>
nja@le.ac.uk (A.J. Norman) writes:
> I'm writing a script to parse text, and want to be able to split a block
> of text (an e-mail message for instance) into sentences. I can do
> something like this:
>
> @Lines = <Infile>;
> $text = Join(" ", @Lines);
^-- should be join
> @Sentences = Split(/[?.]\S+/, $text);
^-- should be split
[...]
how about:
push @Sentences,$& while($text =~ /.+?[?.]/sg);
in place of split? It should give what you want.
Regards,
Michal
------------------------------
Date: Mon, 05 Oct 1998 13:45:27 GMT
From: droby@copyright.com
Subject: Re: Survey Script
Message-Id: <6vaihn$i5c$1@nnrp1.dejanews.com>
In article <36177807.4A98BC5E@whiterabbit.co.uk>,
Matt Pryor <matt@whiterabbit.co.uk> wrote:
> Firstly, in order to keep this message remotely on-topic, the script
> discussed below is available for download after it has executed.
That's pretty tenuous, but perhaps educational...
>
> We're forming a new company (hooray!), and are a bit stuck for a name.
> I've come up with a few suggestions and am now conducting an online
> survey for people's opinions and suggestions.
>
> The intial form is displayed via a SSI which reads from the names
> already suggested and gives the opportunity to vote for them.
>
> The CGI program then does a simple tally for each vote, and displays the
> results in a pleasing way. A cookie is then stored to prevent duplicate
> votes from the same user.
>
Perhaps you want to check on the success of that cookie operation. Or someone
thoroughly unscrupulous might stuff your ballot-box. ;-)
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 05 Oct 1998 14:10:42 GMT
From: Alexis Huxley <alexis@danae.demon.co.uk>
Subject: Sys::Syslog problems
Message-Id: <f0cy1u.1vy@danae.demon.co.uk>
Hi
I'm having problems using openlog, syslog and closelog. I have the following
Perl script:
#!/usr/bin/perl
use Sys::Syslog;
# set some variables
$progname = 'test-script';
$priority = 'err';
$facility = 'local0';
# the perl way
openlog($progname, 'pid', $facility);
syslog($priority, 'perl way');
closelog();
# the shell way
system("logger -i -t $progname -p $facility.$priority 'shell way'");
As you can see, the facility and priority are identical in both the perl
way and shell way blocks, so /etc/syslog.conf issues are out. However, the
perl one produces no log message in the log files, and the other does.
None of openlog, syslog or closelog return usable return codes (according to
documentation and to sources). The program results in no screen output from
errors. But still, only the shell way line appears. Anyone shed some light?
I'm running:
danae$ perl -v
This is perl, version 5.004_04 built for i386-linux
I did use Linux's strace program to help, but there was nothing that leaped
out as being obviously amiss.
Anyone offer any assistance please?
Alexis Huxley
alexis@danae.demon.co.uk
------------------------------
Date: Mon, 05 Oct 1998 13:28:02 GMT
From: francisb@my-dejanews.com
Subject: WIN32::ODBC update/suggestion
Message-Id: <6vahh2$gsq$1@nnrp1.dejanews.com>
I noticed that whenever my SQL() call contained a constant or function, the
results of the Data() call were comming back wrong. For example, "Select 0,
Name, convert(char(8),ECG_DateTime,108)" would return the results of the
convert, in this case a date string in both the first and third result fields.
It turns out that even a simple "select 0, Name, 10" would return "10, name,
10" in the result set. The problem lies in the fact that the updateResults
subroutine in odbc.pm is not designed to handle fields that do not have an
associated column name. I have made the following change to assign temporary
field names to any such field.
sub updateResults{
my ($self, $Error, @Results) = @_;
undef %{$self->{'field'}};
ClearError($self);
if ($Error){
SetError($self, $Results[0], $Results[1]);
return ($Error);
}
# in case there are any fields that have no names, give them names
$fieldnum = 0;
foreach(@Results){
if (@Results[$fieldnum]==""){
@Results[$fieldnum]= $fieldnum."fldsub";
}
$fieldnum++;
}
@{$self->{'fnames'}} = @Results;
foreach (0..$#{$self->{'fnames'}}){
s/ +$//;
$self->{'field'}->{${$self->{'fnames'}}[$_]} = $_;
}
return undef;
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3893
**************************************