[8362] in Perl-Users-Digest
Perl-Users Digest, Issue: 1979 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 26 10:14:09 1998
Date: Thu, 26 Feb 98 07:00:33 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Feb 1998 Volume: 8 Number: 1979
Today's topics:
@array troubles <mrao@nospam.com>
Can I open a filehandle on a scalar? <luis@utdallas.edu>
canned reply script (Tom Grydeland)
Re: CGI.pm a part of Perl (was Re: Cookies) (Richard Bellavance)
Re: Changing From address in Mail (John Stanley)
Re: convert a string to a number <tchrist@mox.perl.com>
Re: Cookie with Perl <tchrist@mox.perl.com>
Re: Counting number of replaces <tchrist@mox.perl.com>
Re: DBD/oracle, and LD_LIBRARY_PATH <fh@lwscpm.de>
extract part of a string (eichner)
Re: extract part of a string <marty@marty.net>
Failure to run Benchmark.pm on Win32 <i-janlun@microsoft.com>
Hand over regexp to a subroutine <rene.eberhard@r3.ch>
Re: Hand over regexp to a subroutine <friedman@uci.edu>
Re: Help with SYSTEM command? <barnett@houston.Geco-Prakla.slb.com>
Re: HELP: Perl and Msql DBI <fty@utk.edu>
Help:What is current directory in Perl CGI? <craig@skybound.demon.nl>
Re: ICQ within a PERL <dbt4game@ms1.palmary.net.tw>
Re: Killfile Triage (peter caffin)
Re: Killfile Triage (peter caffin)
Lexical scoping of variables Frank@but_dont_use_this.address
Re: Newbie question. Do you recommend moving from C? <hillr@bellsygma.co.uk>
not require drive letter in NT Registry <nospambruce_wheeler@hp.com.nospam>
order of a character (eichner)
Re: order of a character <dboorstein@shopcfn.com>
Re: order of a character <friedman@uci.edu>
Re: Outputting background color <marty@marty.net>
performance : is "eq" fast & efficient ? (Charles Bueche)
Re: performance : is "eq" fast & efficient ? (Tom Grydeland)
Problem compiling OLE.pm module <Paula.Pop@baltimore.twntpe.cdc.com>
Reading files <krisvg@netit.be>
Re: Reading files <jk0101@medtronic.com>
rename() problem with IIS (Tero Pelander)
Re: Replacement of characters <r.goeggel@atos-group.de>
Re: The Ineffable Tom C. <lyonsj@bgnet.bgsu.edu>
Re: Unwanted Character Displays (Tom Grydeland)
Re: using a Module (Gabor)
Re: Using flock? <ebriel@mcny.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Feb 1998 09:41:37 -0500
From: Mukund Rao <mrao@nospam.com>
To: Chipmunk <rjk@coos.dartmouth.edu>
Subject: @array troubles
Message-Id: <Pine.SOL.3.95.980226093917.14904A-100000@shakti.cc.trincoll.edu>
Hello. I'm receiving a web-form submission containing multiple words:
$ITEM = $in{'ITEM'}; # $ITEM contains "hello there"
I would like to extract just the 1st word or just the 2nd word, and am
trying to do so via this method:
@array = $ITEM;
print $array[1]; # which should print out "there".
However, I am only able to print out contents of $array[0] which contains
"hello there". Could you please give me some advice as to how to break up
$ITEM into an array and extract the elements as above. I don't think my
syntax is working properly.
Thank you -- please address email to me as "mrao@trincoll.edu"
On Wed, 25 Feb 1998, Chipmunk wrote:
: [posted and mailed]
:
: Douglas Cordero wrote:
: >
: > I came up with this, but it doesn't work:
:
: Is this your real code?
:
: > foreach $A1 (@array1) {
: ^^^
:
: > $found = 0;
: > foreach (@prodata) {
: > if (m/$A/) {
: ^^
:
: > $found = 1;
: > last;
: > }
: > }
: > if( $found == 0 )
: > { die "MISSING DATA\n" }
: > }
:
: You have two different variables there. The -w switch would have alerted you
: to this.
:
: --
: _ / ' _ / rjk@coos.dartmouth.edu
: ( /)//)//)(//)/( chipmunk@m-net.arbornet.org
: / http://www.ziplink.net/~rjk/
: It's funny 'cause it's true ... and vice versa.
:
:
------------------------------
Date: Thu, 26 Feb 1998 08:26:31 -0600
From: "Luis J. Martinez" <luis@utdallas.edu>
Subject: Can I open a filehandle on a scalar?
Message-Id: <6d3u5e$6km@sjx-ixn6.ix.netcom.com>
I want to open a filehandle on a scalar string rather than a file, so I can
do file operations on it. Is there a way to do this?
------------------------------
Date: 26 Feb 1998 10:32:59 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: canned reply script
Message-Id: <slrn6fah6r.v6e.Tom.Grydeland@mitra.phys.uit.no>
I've written a script to generate canned replies to FAQs. It'll grep
the headlines of the pods for the term given as argument.
I'd appreciate any suggestions, particularly for improvement or better
wording.
#!/usr/bin/perl -w
# canned_reply: a script to generate RTFM messages
# Copyright (c) 1998 Tom Grydeland <Tom.Grydeland@phys.uit.no
# All rights reserved
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
use Config;
$" = '';
@num = qw/ zero one two three four five six seven eight nine ten /;
($me = $0) =~ s%.*/%%;
$word = shift or die "$me: Usage: $me <term>\n";
chdir "$Config{installprivlib}/pod" or die "Can't chdir: $!";
opendir POD, "." or die "Can't open dir: $!";
@ARGV = grep {/\.pod$/} readdir POD or die "No pods: $!";
closedir POD;
# open HEAD, "<$ENV{HOME}/pub/tekst/headlines" or die "Huh?: $!";
@hits = map{ /^=head.*$word/oi ? "$ARGV: $_" : () } <>;
print <<"END_OF_FILE" if @hits;
Some questions are asked more often than others. These are called
"Frequently Asked Questions", abbreviated FAQ.
In many cases, to avoid answering the same questions over and over,
some helpful soul compiles a list of such questions with authoritative
answers. It is commonly considered a minimum effort to search for such
a list and consult it before posting your problem to the newsgroup
-- especially if you're a beginner, since your problem is then even less
likely to be new. --
With your copy of perl, you should have received extensive
documentation, and the Perl FAQ is part of this documentation.
A search for the word "$word" in the headlines of the FAQ pages gives
@{[ @hits<10 && "only ",
$num[@hits] || scalar @hits,
" hit", @hits>1 && "s"]}:
@hits
END_OF_FILE
__END__
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 26 Feb 1998 09:09:00 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: CGI.pm a part of Perl (was Re: Cookies)
Message-Id: <6d3t1s$4m@ocean.CAM.ORG>
In article <34f528af.3187407@news.tornado.be>,
Bart Lateur <bart.mediamind@tornado.be> wrote:
>
>Somehow I have difficulty to see "strict" as a module.
>
Maybe (just maybe) you should look at strict.pm again... It doesn't do much,
but it certainly is a module !
Richard.
--
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: 26 Feb 1998 13:00:29 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Changing From address in Mail
Message-Id: <6d3p1d$l0v$1@news.orst.edu>
In article <6d2k30$37d$2@comdyn.comdyn.com.au>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>He's using mail, not sendmail. But, options to either have nothing to
>do with perl.
When he said "to the mail command", he wasn't specific which of the
"mail commands" he was using. Zmail, Mail, mail, mailx, smail, sendmail
are all "mail commands". I was pointing out that he certainly could
do what he wanted, with the correct "mail command".
------------------------------
Date: 26 Feb 1998 14:29:22 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: convert a string to a number
Message-Id: <6d3u82$kr6$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, mg@pcg.net (Maxine G.) whose name
shall be written in the annals of spam avoiders,
writes:
:I'm afraid this may be one of those really obvious beginner questions, but
:here goes:
:How do I convert a string containing numeric data to a numeric variable? In
:other words, if I have $x = "0123", I want $y = 123.
You don't.
% man perldata
That's somewhat like asking how you say "taco" in Spanish.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Down that path lies madness. On the other hand, the road to hell is
paved with melting snowballs. --Larry Wall in <1992Jul2.222039.26476@netlabs.com>
------------------------------
Date: 26 Feb 1998 14:34:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Cookie with Perl
Message-Id: <6d3uh4$kr6$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Martin" <koala1998@hotmail.com> writes:
:I have written a perl script to expire a cookie. But when i pressed the
:back button on the browser, the cookie is set back to its origianl value.
:Anyone experienced that? Can somebody help?
Sure, people on a newsgroup pertaining to the web. This one, you
will soon notice, does not. Also, read Abigail's do con the
back button and its futility.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
MAGIC* xmg_magic; /* linked list of magicalness */
--Larry Wall, from sv.h in the v5.0 perl distribution
------------------------------
Date: 26 Feb 1998 14:32:44 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Counting number of replaces
Message-Id: <6d3uec$kr6$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Alex Schajer <schajer@dircon.co.uk> writes:
:Is there anyway to count how many time a regexp replace has occurred
See the perlop manpage under the description for s///, where it
clearly explains the return value. The tr/// operator might
also avail you, as might a visit to the perlfaq6 manpage, which
covers pattern matching.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
OK, enough hype.
--Larry Wall in the perl man page
------------------------------
Date: Thu, 26 Feb 1998 11:12:00 +0100
From: Frank Haefemeier <fh@lwscpm.de>
Subject: Re: DBD/oracle, and LD_LIBRARY_PATH
Message-Id: <34F53FF0.6C158A1A@lwscpm.de>
John D Groenveld wrote:
>
> In article <6crcvh$2a3$1@delphi.et.tudelft.nl>,
> T.J. Nijweide <tobias@socrates.et.tudelft.nl> wrote:
> >DBD::Oracle was installed on a system with oracle in /oracle, and
> >most other systems have oracle in /someotherhierarchy/oracle.
>
> Relink DBD::Oracle with -R/someotherhierarchy/oracle/product/7.3.3/lib
Or create a special mount point from /someotherhierarchy/oracle to /oracle
(if you have root permissions). In my opinion, it is the better solution
because you have a virtual
access point to you oracle installation independend from your real
installation.
Bye
Frank
------------------------------
Date: Thu, 26 Feb 1998 10:29:48 GMT
From: eichner@gmx.de (eichner)
Subject: extract part of a string
Message-Id: <34f54305.5695529@news.uni-augsburg.de>
Hi,
the following string is given:
$data = "data1 data2 data3";
How can I access one part of this string? For example I need the part
"data2" from the string above.
Are there any stringcopy routines?
Thanks for any help
Michael
------------------------------
Date: Thu, 26 Feb 1998 03:02:36 -0800
From: Marty McKolskey <marty@marty.net>
Subject: Re: extract part of a string
Message-Id: <34F54BCC.AF617CCC@marty.net>
Try this:
$data = "data1 data2 data3";
@data = split(/ /,$data); # splits $data on space
$data2 = $data[1]; # $data2 now equals "data2"
If you know $data is going to have a fixed length, you can also use
substr to pull out the part you need.
Maybe not the quickest solution, but it certainly works.
Marty
--
my $name = 'Marty';
my $email = 'marty@marty.net';
last;
eichner wrote:
>
> Hi,
>
> the following string is given:
>
> $data = "data1 data2 data3";
>
> How can I access one part of this string? For example I need the part
> "data2" from the string above.
>
> Are there any stringcopy routines?
>
> Thanks for any help
>
> Michael
------------------------------
Date: Thu, 26 Feb 1998 11:01:58 -0000
From: "Jan Lundberg" <i-janlun@microsoft.com>
Subject: Failure to run Benchmark.pm on Win32
Message-Id: <6d3i39$7ie@news.microsoft.com>
Could someone please tell me why I keep getting this message when trying to
run any function from the Benchmark module:
"times not implemented at C:\PERL\lib/Benchmark.pm line 274."
Howcome this function is not implemented?? Does it have to do with the fact
that I'm running perl on Win32?
Thanks for any answers,
Jan
------------------------------
Date: Thu, 26 Feb 1998 13:45:57 +0100
From: "Rene G. Eberhard" <rene.eberhard@r3.ch>
Subject: Hand over regexp to a subroutine
Message-Id: <6d3o09$mvu$1@news.eunet.ch>
Hi
I wanted to know how I can handover a regexp to a subroutine.
Is it possible to do the following?
package->callSub(/^whatever/oi, @list);
sub callSub {
my($self, $regexp, @list) = @_;
print "hello\n" if ($list[0] =~ $regexp);
}
Thanks in advance.
Rene
------------------------------
Date: 26 Feb 1998 14:38:38 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: Hand over regexp to a subroutine
Message-Id: <6d3upe$mba@news.service.uci.edu>
[mailed, posted]
In article <6d3o09$mvu$1@news.eunet.ch>,
Rene G. Eberhard <rene.eberhard@r3.ch> wrote:
<Hi
<
<I wanted to know how I can handover a regexp to a subroutine.
<Is it possible to do the following?
<
<package->callSub(/^whatever/oi, @list);
<
<sub callSub {
< my($self, $regexp, @list) = @_;
< print "hello\n" if ($list[0] =~ $regexp);
<}
Not exactly like this, no. However, you could pass your pattern in
as a scalar
sub func
{
my $pat = shift;
my $item = shift;
return 1 if $item =~ /$pat/;
}
or you could use eval
sub func
{
my $pat = shift; # $pat = '/^some stuff/oi';
my $item = shift;
return 1 if eval qq{ \$item =~ $pat };
}
or, if you're going to be using the same pattern a lot, you could
eval a whole function
sub makeFunc
{
my $pat = shift;
my $code = qq{ sub { return $pat; } };
my $ref = eval $code;
die "bad pattern" if $@;
return $ref;
}
my $coderef = makeFunc('/some string to match/i');
if (&$coderef) { do stuff }
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Thu, 26 Feb 1998 08:09:52 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Help with SYSTEM command?
Message-Id: <34F577B0.C80D39BF@houston.Geco-Prakla.slb.com>
James R. McDonald wrote:
>
> I'm working on a PERL program on VMS and one of the things
> I'd like the program to be capable of is to copy a file.
> I have the new file name as a variable, ie $newfile and
> I figured on using the system command to do it, but instead
> the program is copying the file and naming it $newfile.
>
> ie:
>
> $newfile=newdata.txt;
> system('copy oldfile.txt $newfile');
>
' quotes = variables are not interpolated
" quotes = variables are interpolated
$a = '$newfile' # sets $a equal to the string $newfile
$a = "$newfile" # sets $a equal to the value of scalar $newfile
Second option:
use File::Copy;
copy('oldfile.txt', $newfile);
> How can I get PERL (or VMS) to interpret the string $newfile
> when doing the copy command?
>
> Thanks in advance,
> Jim McDonald
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
* Schlumberger Geco-Prakla (281) 596-1434 (Office Number) *
* 1325 S. Dairy Ashford (281) 596-1807 (Fax) *
* Houston, TX 77077 *
------------------------------------------------------------------------
------------------------------
Date: Thu, 26 Feb 1998 09:17:54 -0500
From: Jay Flaherty <fty@utk.edu>
To: Keith Ruskin <ruskin@groucho.med.yale.edu>
Subject: Re: HELP: Perl and Msql DBI
Message-Id: <34F57992.A9A18EF5@utk.edu>
Keith Ruskin wrote:
> Hi, all. I'm wondering if someone can help me spot a (probably
> obvious) problem with calling DBD:mSQL from perl. This program
> compiles just fine, and the first query is successful. When it tries
> to do the second query, it dies with this error:
>
> Can't call method "fetchhash" without a package or object reference at
> /home/httpd/cgi-bin/vlsubmit line 69.
>
> # load the cgi library
> require "/usr/local/lib/cgi-lib.pl";
> # Msql datbase interface library
> use Msql;
You are not using the DBI /DBD interface. You are using the Msql interface
> # First, connect to database server
> $hostname = "";
> $databasename = "www-vl";
> my $dbh = Msql->connect($hostname,$databasename);
always check for errors:my $dbh = Msql->connect($hostname,$databasename)
or die "unable to connect to database\n";
> # Check for repeat submissions (First query)
> $Query = "select SHORTDESC from HOTLIST where URL = '$URL'";
> my $sth = $dbh->query ($Query);
again check for errors:my $sth = $dbh->query ($Query);
or die "unable to submit query: $query\n";
> %row = $sth->fetchhash;
> &repeat_sub if (%row);
I think you need to close the statement handle ($sth). Not sure how you do it from
the mSQL interface but using DBI you say:$sth->finish;
> # Now get the next UID... (Second query)
> $Query = "select MaxUID from UIDs where TableName = 'SUBMISSIONS'";
> $sth = $dbh->query($Query);
> %row = $sth->fetchhash;
again close the statement handle:$sth->finish;
> $MaxUID = $row{'MaxUID'} + 1; # Increment by one and save for next time
> $Query = "Update UIDs Set MaxUID = '$MaxUID' where TableName = 'SUBMISSIONS'";
> $sth = $dbh->query($Query);
again:$sth->finish;
You should look into using DBI. Go to:
http://www.hermetica.com/technologia/DBI
You'll need to grab the latest version of the DBI module as well as the msql-mysql
module (DBD)
jay
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: Thu, 26 Feb 1998 12:10:08 +0100
From: Craig <craig@skybound.demon.nl>
Subject: Help:What is current directory in Perl CGI?
Message-Id: <34F54D90.6B6C@skybound.demon.nl>
Hi,
I wrote a Perl CGI script, but the current directory when searching for
files is not the scripts directory, but the directory of the web server.
Is this always so?
Is it possible to retrieve the current directory?
Greetings,
Craig Manley.
------------------------------
Date: Thu, 26 Feb 1998 22:15:21 +0800
From: ",u&bD5'Y" <dbt4game@ms1.palmary.net.tw>
Subject: Re: ICQ within a PERL
Message-Id: <34F578F9.728E758A@ms1.palmary.net.tw>
> Is there anyway of sending a message to an ICQ number from within a perl,
> and then getting back confirmation that the ICQ was actually on-line.
Ask ICQ.com
------------------------------
Date: Wed, 25 Feb 1998 04:49:42 GMT
From: nospam_synic@omen.net.au (peter caffin)
Subject: Re: Killfile Triage
Message-Id: <34f3a2b6.925899@news.omen.net.au>
bart.mediamind@tornado.be (Bart Lateur) did cunningly address to
news.software.readers..
:Richard Caley <spt@cstr.ed.ac.uk> wrote:
:
:>So, people who put requests not to be spammed in their headers should
:>be killed but people like me who have applied some spamproofing should
:>not. I'm not clear on the logic here.
:
:Because you shovel the trouble of dealing with spam, into the shoes of
:those people trying to send you an e-mail reply. Having to manually edit
:e-mail addresses, bouncing mail, you know.
I simply do not see what the fuss is about. Sighting nospam_ masks in From:
headers during a reply is trivial (unless you happen to be writing a spam-bot
which does your replying for you).
Spammers have abused the original practice of using the correct
username@host.domain in the From: so now people add this sort of thing to
their .sig (either outright or 'masked'). Cause and effect. Get into the habit
of reading a posting to the end of the .sig before you're going to reply (a
good practice in any case, yes?). Deal.
--: _ ___ _ _ _
_oo__ |_|_ |__ _ | | _ |_|_' _ mailto:synic@omen.net.au
//`'\_ | (/_|(/_| .|. |_(_|| | || | http://www.omen.net.au/~synic
/
------------------------------
Date: Wed, 25 Feb 1998 04:49:55 GMT
From: nospam_synic@omen.net.au (peter caffin)
Subject: Re: Killfile Triage
Message-Id: <34f4a2ec.979854@news.omen.net.au>
Eli the Bearded <*@qz.to> did cunningly address to news.software.readers..
:If I send you mail, and it bounces, chances are very good that I will
:never even read the bounce to see who's mail it was, let alone resend.
Whereas if I receive a bounce message, I read it to find out:
(a) Who didn't get my email,
(b) Why they didn't get my email (system down? misspelled domain?),
(c) What I need to do to get the message through.
:It is not my responsibility to prove to you my mail is not spam.
It is if you want it read ;-). I mean, really.. Why bother going to the effort
of writing email if you can't be bothered making sure it gets there?
--: _ ___ _ _ _
_oo__ |_|_ |__ _ | | _ |_|_' _ mailto:synic@omen.net.au
//`'\_ | (/_|(/_| .|. |_(_|| | || | http://www.omen.net.au/~synic
/
------------------------------
Date: 26 Feb 1998 10:55:16 +0100
From: Frank@but_dont_use_this.address
Subject: Lexical scoping of variables
Message-Id: <yo9yayywv0b.fsf@nym.sc.philips.com>
Hello!
I just fall into some state of not understanding. I tried to access a
lexical scoped variable from an outer routine:
#!/bin/perl -w
use strict;
sub my_sub(){
my($privat);
$privat='hello';
}
print $my_sub::privat;
A snippet from perlsub seems to explain this:
...
Unlike dynamic variables created by the "local" statement, lexical
variables declared with "my" are totally hidden from the outside
world, including any called subroutines (even if it's the same
subroutine called from itself or elsewhere--every call gets its own
copy).
...
Now my problem of understanding:
#!/bin/perl -w
use strict;
my($secret_var);
$secret_var=' HUPS ??';
&do_ls();
sub do_ls(){
print '$secret_var', $secret_var,"\n";
}
results in: $secret_var HUPS ??
I thought up to now, that there is a magical master subroutine(perhaps
called main), which gets started, when I execute my perl script. In
this master subroutine I call &do_ls(); There seems to be an exception
for the lexical scoping, so that I can access the $secret_var in a
called subroutine. Why? And which keyword describes this exception, so
that I can find this in the documentation?
regards
Frank
P.S. My email address is intentionally incorrect. Please don't use it.
------------------------------
Date: Thu, 26 Feb 1998 13:11:34 +0000
From: Roger Hill <hillr@bellsygma.co.uk>
Subject: Re: Newbie question. Do you recommend moving from C?
Message-Id: <34F56A06.4138CBDD@bellsygma.co.uk>
lvirden@cas.org wrote:
> According to Mark Daku <daku@nortel.ca>:
> :Case in point perl. With the upcoming release of perl and it's follow
> :ups you will see a language that truly is multi platform. With features
>
> What specific features are you thinking of that are in the upcoming release
> of perl that makes it multi-platform?
>
> :I must admit I'm looking for the C++ killer. Java still has the potential.
> :Perl does too. Perl is in the lead for me at this point. But I'm biased
>
> I can't imagine a scenario where perl becomes a C++ killer ...
>
> --
> Larry W. Virden <URL:mailto:lvirden@cas.org> ICQ: 5744965
> <URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
> Unless explicitly stated to the contrary, nothing in this posting
> should be construed as representing my employer's opinions.
I can only quote my own experience. I have written a perl/tk applet that
interacts with communications systems over a LAN using Sockets, X.25 etc. It
was originally written to run under HP-UX. It now works on Linux, Win95, NT
(and would run on the Mac if perl/Tk existed on the Mac).
How much code did I have to change to achieve this level or portability?
Not a single line!
Now I'll admit that I'm not doing hard stuff like Database access (But even
there I have another app that uses the sams script between a laptop running
Linux and mysql and an HP-UX box running Oracle, only the login strings are
different)
My experience of perl portability has been very positive.
Roger Hill
------------------------------
Date: Tue, 24 Feb 1998 16:36:44 -0800
From: Bruce Wheeler <nospambruce_wheeler@hp.com.nospam>
Subject: not require drive letter in NT Registry
Message-Id: <34F3679C.3A2@hp.com.nospam>
We have a share that contains perl and the libraries for NT.
However, not everyone uses the same drive letter for this share.
I would like to be able to access perl and the libraries by
executing from this share, unfortunately perl dies with
Can't locate Exporter.pm in @INC at s.pm line 3.
BEGIN failed--compilation aborted at cs1.ps line 1
if I remove the drive letter with regedit from
PRIVLIB:REG_SZ:E:\perl\lib
Any suggestions? Thanks.
------------------------------
Date: Thu, 26 Feb 1998 12:16:33 GMT
From: eichner@gmx.de (eichner)
Subject: order of a character
Message-Id: <34f65a77.11697239@news.uni-augsburg.de>
Hi,
I have a string that look like that (with the print command):
data1 data2 data3
It looks like there is a space between data1, data2 and data3. But
there are'n any spaces between it. The split command doesn't split the
string between the spaces if I search for spaces. ( split(/ /,....) )
Now I want to know what character is really between data1, data2 and
data3.
Can anyone help.
Thanks for your help
Michael
------------------------------
Date: Thu, 26 Feb 1998 09:17:46 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: order of a character
Message-Id: <34F5798A.4EF3649D@shopcfn.com>
eichner wrote:
>
> data1 data2 data3
>
> It looks like there is a space between data1, data2 and data3. But
> there are'n any spaces between it. The split command doesn't split the
> string between the spaces if I search for spaces. ( split(/ /,....) )
>
you may be dealing with tabs instead. if this is the case then
split ' ', $_; should help you out. though it looks similar to
what you tried it actually emulates splits default behavior of
splitting on any whitespace. as far as seeing what the characters
are, you want the 'ord' function. maybe something like this:
$_ = 'data1 data2 data3';
for (split '') {
print "$_ => ", ord, "\n";
}
good luck,
--
#!/usr/bin/perl -w -- 2 for 1 dan boorstien <dboorstein@shopcfn.com>
# my first Just another Perl hacker,
seek DATA,0,0;{$_=<DATA>,/!/&&redo}print join(' ',(split)[3..6])__END__
# my second Just another Perl hacker,
------------------------------
Date: 26 Feb 1998 14:42:10 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: order of a character
Message-Id: <6d3v03$mhd@news.service.uci.edu>
In article <34f65a77.11697239@news.uni-augsburg.de>,
eichner <eichner@gmx.de> wrote:
<Hi,
<
<I have a string that look like that (with the print command):
<
<data1 data2 data3
<
<It looks like there is a space between data1, data2 and data3. But
<there are'n any spaces between it. The split command doesn't split the
<string between the spaces if I search for spaces. ( split(/ /,....) )
<
<Now I want to know what character is really between data1, data2 and
<data3.
Gee, could it be a tab? (forget what it's called in German, sorry).
In any case, you can get tabs and spaces in your split by using the
\s, which matches any whitespace (except newlines, except when...).
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Thu, 26 Feb 1998 03:43:04 -0800
From: Marty McKolskey <marty@marty.net>
Subject: Re: Outputting background color
Message-Id: <34F55548.E5A51B53@marty.net>
Mike Stok wrote:
> Qunice <q.e.d@usa.net> wrote:
> >Can an HTML background color be invoked from a print command?
> >Example:
> > print "<html><head><title></title></head>\n";
> > print "<body><center><h1>text</h1></center>\n";
> >Is there a way to include "background="#000000" after "<body" in the
> >above?
> Yes, you can use some other quotes around the string to be printed, as
> you're not interpolating any variables you could use single quotes
> print '<body background="#000000"><h1>text</h1>', "\n";
>
> or you can use the \ to escape a " in a string enclosed in "" e.g.
>
> print "<body background=\"#000000\"><h1>text</h1>\n";
More importantly, the code should be:
"<body bgcolor=\"#000000\" background=\"image.gif\" text=\"#FFFFFF\"
...>
bgcolor is for colors; background is for tiles/images.
Not that this has anything to do with perl....
:)
Marty
--
my $name = 'Marty';
my $email = 'marty@marty.net';
last;
------------------------------
Date: Thu, 26 Feb 1998 10:32:18 GMT
From: Charles.Bueche@swisscom.com (Charles Bueche)
Subject: performance : is "eq" fast & efficient ?
Message-Id: <34f543bc.13101537@news.unisource.ch>
Hi all,
I have to read a test file until I reach a record
which match (eq) a certain string. My question relate
to the eq or // speed. My strings are about 500 chars
long.
I assume the compare algorythm exit as soon as
it found a difference. Am I on the right side ?
I have had a look at Perl source, but I must confess
I didn't get very far.
Should I use the regex // or is eq better ?
TIA, Charles
------------------------------
Date: 26 Feb 1998 10:41:40 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: performance : is "eq" fast & efficient ?
Message-Id: <slrn6fahn4.v6e.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 26 Feb 1998 10:32:18 GMT,
Charles Bueche <Charles.Bueche@swisscom.com> wrote:
> Should I use the regex // or is eq better ?
Don't take anybody's word for it.
use Benchmark;
> TIA, Charles
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Thu, 26 Feb 1998 19:15:35 +0800
From: Paula Pop <Paula.Pop@baltimore.twntpe.cdc.com>
Subject: Problem compiling OLE.pm module
Message-Id: <34F54ED7.144436D7@baltimore.twntpe.cdc.com>
I am trying to compile the libwin32-1.0 module package with
perl5.004_04 under Visual C++ 4.0. The other modules are going fine
(except for Internet, of course), but I can't get past the following
errors in the OLE.pm module:
------------------------------------------------------------------
F:\src\libwin32-0.10\OLE>nmake
Microsoft (R) Program Maintenance Utility Version 1.60.5270
Copyright (c) Microsoft Corp 1988-1995. All rights reserved.
mkdir blib
mkdir blib\lib
mkdir blib\lib\Win32
mkdir blib\arch
mkdir blib\arch\auto
mkdir blib\arch\auto\Win32
mkdir blib\arch\auto\Win32\OLE
mkdir blib\lib\auto
mkdir blib\lib\auto\Win32
mkdir blib\lib\auto\Win32\OLE
mkdir blib\man3
cp Enum.pm blib\lib\Win32/OLE/Enum.pm
cp Variant.pm blib\lib\Win32/OLE/Variant.pm
cp Const.pm blib\lib\Win32/OLE/Const.pm
cp OLE.pm blib\lib\Win32/OLE.pm
F:\perl\bin\perl -If:\perl\lib -If:\perl\lib
F:\perl\lib\ExtUtils/xsubpp
-typemap F:\perl\lib\ExtUtils\typemap -typemap typemap OLE.xs >xstmp.c
&&
F:\perl\bin\perl -If:\perl\lib -If:\perl\lib -MExtUtils::Command -e mv
xstmp.c OLE.cpp
cl.exe -c -MD -DWIN32 -O -DVERSION=\"0.06\"
-DXS_VERSION=\"0.06\"
-IF:\perl\lib\CORE OLE.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 10.00.5270 for
80x86
Copyright (C) Microsoft Corp 1984-1995. All rights reserved.
OLE.cpp
OLE.xs(479) : error C2065: 'FUNCFLAG_FNONBROWSABLE' : undeclared
identifier
OLE.xs(507) : error C2065: 'VARFLAG_FRESTRICTED' : undeclared identifier
OLE.xs(509) : error C2065: 'VARFLAG_FNONBROWSABLE' : undeclared
identifier
OLE.xs(816) : error C2059: syntax error : ')'
OLE.xs(819) : error C2039: 'VT_DISPATCH' : is not a member of
'tagVARIANT'
OLE.xs(819) : error C2051: case expression not constant
OLE.xs(821) : error C2039: 'IDispatch' : is not a member of 'tagVARIANT'
OLE.xs(821) : error C2039: 'pDispatch' : is not a member of 'tagVARIANT'
OLE.xs(823) : error C2039: 'pVariant' : is not a member of 'tagVARIANT'
OLE.xs(824) : error C2446: '=' : no conversion from 'struct IDispatch *'
to 'int
' (new behavior; please see help)
OLE.xs(826) : error C2446: '=' : no conversion from 'struct IDispatch *'
to 'int
' (new behavior; please see help)
OLE.xs(829) : error C2065: 'AddRef' : undeclared identifier
OLE.xs(830) : error C2664: 'CreatePerlObject' : cannot convert parameter
2 from
'int' to 'struct IDispatch *' (new behavior; please see help)
OLE.xs(849) : error C2664: 'CreatePerlObject' : cannot convert parameter
2 from
'int' to 'struct IDispatch *' (new behavior; please see help)
OLE.xs(1025) : error C2664: 'CreatePerlObject' : cannot convert
parameter 2 from
'int' to 'struct IDispatch *' (new behavior; please see help)
OLE.xs(1297) : error C2664: 'CreatePerlObject' : cannot convert
parameter 2 from
'int' to 'struct IDispatch *' (new behavior; please see help)
OLE.xs(1349) : error C2664: 'CreatePerlObject' : cannot convert
parameter 2 from
'int' to 'struct IDispatch *' (new behavior; please see help)
OLE.xs(1909) : error C2051: case expression not constant
OLE.xs(1921) : error C2059: syntax error : ')'
OLE.xs(1926) : error C2039: 'VT_UNKNOWN' : is not a member of
'tagVARIANT'
OLE.xs(1926) : error C2051: case expression not constant
OLE.xs(1929) : error C2039: 'LastOleError' : is not a member of
'tagVARIANT'
OLE.xs(1929) : error C2039: 'GetOleObject' : is not a member of
'tagVARIANT'
OLE.xs(1929) : error C2039: 'data' : is not a member of 'tagVARIANT'
OLE.xs(1929) : error C2064: term does not evaluate to a function
OLE.xs(1929) : error C2039: 'pDispatch' : is not a member of
'tagVARIANT'
OLE.xs(1930) : error C2065: 'QueryInterface' : undeclared identifier
OLE.xs(1939) : error C2065: 'SafeArrayCreateVector' : undeclared
identifier
OLE.xs(1939) : error C2064: term does not evaluate to a function
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
-------------------------------------------------------------------------------------
Following is my perl info:
C:\MSDEV\INCLUDE>perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 04) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32
uname=''
hint=recommended, useposix=true, d_sigaction=undef
bincompat3=undef useperlio=undef d_sfio=undef
Compiler:
cc='cl.exe', optimize='-O', gccversion=
cppflags='-DWIN32'
ccflags ='-MD -DWIN32'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -subsystem:windows'
libpth=C:\MSDEV\lib
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.l
ib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock3
2.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
libc=msvcrt.lib, so=dll
useshrplib=undef, libperl=undef
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags='', lddlflags='-dll'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under MSWin32
Compiled at Feb 25 1998 20:08:11
%ENV:
PERL5DB="BEGIN{require 'f:\Program Files\ActiveState Perl
Debugger\PerlDB.pl
'}"
@INC:
f:\perl\lib\site
f:\perl\lib
f:\perl\lib
f:\perl\lib\site
f:\perl\lib\site
.
-------------------------------------------------------------------------------------
Thanks for any help.
Regards,
Jake
------------------------------
Date: Thu, 26 Feb 1998 14:49:53 +0100
From: Kris Van Gompel <krisvg@netit.be>
Subject: Reading files
Message-Id: <34F57301.4BEECC61@netit.be>
Hi,
I don't know perl very good. Now at this moment, I've the problem that I
want to read a whole file in one variable. So after that I can do some
replacements on the whole document instead of doing it line by line.
Someone told me that I have to user $| but I don't know how to use it...
I read manuals but I don't understand. Can anybody help me please?
Thanks in advance
Kris
--
Kris Van Gompel
System Manager Net it be
Posthoflei 3
2600 BERCHEM
-------------------------------------
tel : 03/286.04.34
fax : 03/286.04.70
email : krisvg@netit.be
url : http://www.netit.be
-------------------------------------
------------------------------
Date: 26 Feb 1998 14:32:57 GMT
From: "John W. Komp" <jk0101@medtronic.com>
Subject: Re: Reading files
Message-Id: <6d3uep$t53$2@gazette.corp.medtronic.com>
Kris Van Gompel <krisvg@netit.be> wrote:
: I don't know perl very good. Now at this moment, I've the problem that I
: want to read a whole file in one variable. So after that I can do some
: replacements on the whole document instead of doing it line by line.
: Someone told me that I have to user $| but I don't know how to use it...
: I read manuals but I don't understand. Can anybody help me please?
Kris,
Per Programming Perl, 2nd Edition, page 132:
undef $/;
$_ = <>;
Undef'ing $/ removes any EOL terminator. Now the file will be
completely read in one pass.
-John
SB Industries
--
****************************************************
This morning I shot six holes in my freezer
I think I've got cabin fever
Somebody sound the alarm
- J. Buffett
****************************************************
------------------------------
Date: 26 Feb 1998 15:47:26 +0200
From: tpeland@utu.fi (Tero Pelander)
Subject: rename() problem with IIS
Message-Id: <6d3rpe$5m3@antares.utu.fi>
I have a problem with Perl for Win32 (build 315) when using it with IIS 4.0.
Using PerlIIS of the same relase doesn't seem to affect the situation.
If you can solve my problem please help.
If I write a script that uses rename() it won't work under IIS.
When running it on command prompt (as non-administrator) the script works
as expected. The www-user IUSR_IINES has full control of the directory
that is used.
Using web browser I get following output from the example:
Rename returns: 0
and the file x.txt exists.
When starting the script from command prompt I get:
Rename returns: 1<br>
and file y.txt exists.
--- perl example ---
#### HTTP headers
print "Content-type: text/html\nCache-Control: no-cache\n\n";
$infile = "x.txt";
$outfile = "y.txt";
# Create the new file
open( IN, ">$infile" );
print IN "this is a test file\n";
close( IN );
print "Rename returns: ",rename( $infile, $outfile ),"<br>\n";
------------------------------
Date: Thu, 26 Feb 1998 15:05:22 +0100
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: Replacement of characters
Message-Id: <6d3sra$mam$1@news.pop-stuttgart.de>
>$buffer = "He%28Mike%29 is a good teacher.";
>
>I want to replace %28 to ( and %29 to )
>However, when I execute the following command:
>
>$buffer =~ tr/%28/(/;
>$buffer =~ tr/%29/)/;
>
See to perlre;
especially
tr///
s///
.
HTH Ronald
------------------------------
Date: Thu, 26 Feb 1998 09:49:12 -0500
From: Jen Lyons <lyonsj@bgnet.bgsu.edu>
Subject: Re: The Ineffable Tom C.
Message-Id: <Pine.SGI.3.95.980226094640.2777B-100000@sigma.bgsu.edu>
On 25 Feb 1998, Art Cohen wrote:
> shaker@netusa1.net wrote:
>
> : (1) There are folks who do not get access past the firewall, at their places
> : of work.
>
> If they have Perl, they have the documentation. They come in the same
> package.
Before I say this, I would like to make it clear that I, personally, think
there is no excuse for not reading the documentation. However, I do have
an account (admittedly on a private Linux box) where the guy removed
almost all the Perl documentation (and most other documentation, too)
because he doesn't believe in reading instructions, and feels they're a
waste of space. Now, I doubt that anyone will be in this situation *and*
have a firewall, but I thought I'd put in my two cents anyway. :)
Jen
Pascal: A programming language named after a man who would turn over in his
grave if he knew about it.
------------------------------
Date: 26 Feb 1998 10:22:21 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Unwanted Character Displays
Message-Id: <slrn6fagir.v6e.Tom.Grydeland@mitra.phys.uit.no>
On Wed, 25 Feb 1998 16:09:56 -0600,
bfredett@sprynet.com <bfredett@sprynet.com> wrote:
> my $headline = open IN, "headline.txt" || die $!;
You need parentheses for that to work:
my $headline = open(IN, "headline.txt")|| die $!;
or you can use the low-precendence "or":
my $headline = open IN, "headline.txt" or die $!;
Why don't you use -w? You'd have gotten the warning:
Read on closed filehandle <IN> at xxx line yyy.
> Thanks in advance,
HTH,
> Brian
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 26 Feb 1998 13:04:38 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: using a Module
Message-Id: <slrn6faqju.bla.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Naama Kraus <naamah@haifa.vnet.ibm.com> wrote :
# Hi!
# I have a module residing in a non standard directory. I would like to
# use it in a perl
# program (use MyModule). How can I teach perl to look for my module in
# that directory?
# Thanks in advance,
# Naama.
use lib "path";
gabor.
--
If you want to see useful Perl examples, we can certainly arrange
to have comp.lang.misc flooded with them, but I don't think that
would help the advance of civilization. :-)
-- Larry Wall in <1992Mar5.180926.19041@netlabs.com>
------------------------------
Date: Thu, 26 Feb 1998 09:26:27 -0500
From: Eric Briel <ebriel@mcny.com>
Subject: Re: Using flock?
Message-Id: <34F57B92.101B5074@mcny.com>
Will flock work on a FileHandle object?
------------------------------
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 1979
**************************************