[13292] in Perl-Users-Digest
Perl-Users Digest, Issue: 702 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 2 11:07:28 1999
Date: Thu, 2 Sep 1999 08:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 2 Sep 1999 Volume: 9 Number: 702
Today's topics:
Re: -F/foobar/ on #! line <crdevilb@mtu.edu>
A concatenation problem... <willmurat@my-deja.com>
Checking complex structures <rhomberg@ife.ee.ethz.ch>
Re: Converting strings to arrays question <rhomberg@ife.ee.ethz.ch>
Re: CPAN.pm <randy@theoryx5.uwinnipeg.ca>
Re: Doing a reverse lookup with ping? (Larry Rosler)
Equivalence <sg@midwal.ca>
General Question, Win98 and Win32 modules... (Peter Wilford)
How to make a split to a path filename??? <abel.almazan@ogilvyinteractive.es>
Re: How to make a split to a path filename??? <espen@nextel.no>
Re: How to make a split to a path filename??? <gellyfish@gellyfish.com>
Re: How to make a split to a path filename??? (Larry Rosler)
Re: IPC::open2 duplicates output (Bill Moseley)
Re: is the mtime time between date1 and date2? <matthew_j_forder@notes.seagate.com>
Re: JavaScript recieving variables from Perl <norbert.ehreke@deutschehyp.de>
Re: Logical operators ("willow")
Need your help here. <dazimi@yahoo.com>
newbi needs help <mtg82814@ratheon.com>
Re: Perl vs. Samba <andy@aholmes.u-net.com>
Re: Perl wrapper on NT <wyzelli@yahoo.com>
Re: Perl5 sendmail (Greg Bacon)
Porting 'select' system call from UNIX to NT <ls@hss.hns.com>
Q: How to communicate with the serial port? <mhudritsch@processlink.ch>
Re: reference to a partial array <rick.delaney@home.com>
Regex's, null, and the "&&" operator <gvalley@mitre.org>
Re: SEARCH and REPLACE (Larry Rosler)
Re: Simulating Carriage Returns (Larry Rosler)
Re: Size in Pixels with PERL <julien.quint@xrce.xerox.com>
Re: sticky undef $/ <rick.delaney@home.com>
Re: That Cargo Date Code ( was Re: Y2K) <wyzelli@yahoo.com>
Re: Tracking progress of a Net::FTP download (Bill Moseley)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Sep 1999 14:33:44 GMT
From: Colin R. DeVilbiss <crdevilb@mtu.edu>
Subject: Re: -F/foobar/ on #! line
Message-Id: <7qm1s8$b93$1@campus1.mtu.edu>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
> > the error returned is:
> > syntax error at foo.pl line 3, near BEGIN
> >
> > commenting the BEGIN {} block just moves the compile error to ``chomp''.
> I don't get this error on my version of Perl:
> This is perl, version 5.004_04 built for sun4-solaris
> What is your version of Perl?
5.005_03--sorry for forgetting to post it the first time.
Colin
------------------------------
Date: Thu, 02 Sep 1999 14:35:17 GMT
From: William <willmurat@my-deja.com>
Subject: A concatenation problem...
Message-Id: <7qm1v4$i74$1@nnrp1.deja.com>
Hi All,
I'm a newbie... I just only want to add "<" and ">" in the beginning and
in the end of a string. But, for some reason, just don't works... Look
this code piece:
$a = "\<$_[0]\>";
or
$a = "\x3c$_[0]\x3e";
or
$a = "\<" . $_[0] . "\>";
But don't works at all... In fact, I skip this problem by using another
solution, but this don't go out my mind. How can I solve this?
Thanks!!
William Murat - Programmer
Plugue Internet - Rio de Janeiro - Brasil
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 14:52:40 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Checking complex structures
Message-Id: <37CE7318.F9F8BB19@ife.ee.ethz.ch>
Hi
I'm using some complex data structures. I use hash keys as identifiers
for elements of a structure, like in C:
$object->{Date}->{Day}="Monday";
I rather quickly found out that the autovivification (sp?) is not very
helpful for fixed hashes:
$object->{Daet}->{Days}="Tuesday"; # No error, but not the desired
result :-(
Next thing, require 5.005, use arrays as pseudohashes
$objext = [{Date=>1, Size=>2}, $reftodate, $size];
$object->{Daet} #run time error
This at least gives me run time errors when a key is not defined.
Now, what I'd like to have is some checking of all bareword hashkeys at
compile time. If I use a Bareword as hashkey, chances are that entry is
somewhere put explicitly in a hash.
Is there anything like this?
I'm thinking of something like:
use strict hashkeys;
use hashkeys qw(foo); #defines 'foo' as possible bareword hashkey
my %blops = (bar=>4, foobar=>3);
#defines 'bar' and 'foobar' as possible bareword hashkeys
$this->{bar}{dings} #COMPILE ERROR: even though the content of
# $this->{bar} is not known, 'dings' is not allowed as bareword key.
IMO Compile time errors would make it easier to find spelling errors in
structure element names.
- Alex
------------------------------
Date: Thu, 02 Sep 1999 14:01:45 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
To: Ilya <ilya@speakeasy.org>
Subject: Re: Converting strings to arrays question
Message-Id: <37CE6729.6610FBC6@ife.ee.ethz.ch>
Ilya wrote:
>
> Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
> > Ilya <ilya@speakeasy.org> writes:
>
> >> Nope.... I don't want to take the values of %input_params. They merely
> >> represent something. i.e. if $input_params{$key} eq 1 I want to take @value,
> >> not $value and do something with it.
>
> > What do you mean?
> > What is @value? What do you suspect it should contain?
>
> > The following
>
> > for my $value (values %input_params) {
> > ....
> > }
>
> > iterates through the values of your hash, ONE by ONE. $value will
> > point to each value in each iteration. There is no @value.
>
> Well, @value comes from another subroutine.
If I'm piecing this together correctly, you have
- a number of arrays (let's call them @array1, @array2 etc.)
- a hash %input_params, that says for each hash if it shouldd be
included or not:
%input_params = (array1=>1, array2=>0, array3=>1) to include array1 and
array3 but not array2
You can then use
for my $varname (keys %input_params) {
push @data, eval('@'.$varname) if $input_params{$varname};
}
Let me know if this is about what you're looking for.
- Alex
------------------------------
Date: 2 Sep 1999 14:18:43 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: CPAN.pm
Message-Id: <7qm103$h68$1@canopus.cc.umanitoba.ca>
In comp.lang.perl.misc, Bill Moseley <moseley@best.com> wrote:
> ActiveState on Win98
> Running perl -MCPAN -e shell and doing an install or r or anything,
> really spits out a bunch redefined errors (below). Any ideas what's
> needed to fix it?
Hi,
I also get these warnings, but things work fine with them.
The perldiag manpage (perldoc perldiag) has a suggestion on how
to suppress them. However, they appear to be specific to
certain Win32 perls.
> I also tried to update CPAN by 'install Bundle::CPAN' but ended up
> (along with all the redefined errors) with:
> CPAN: Archive::Tar loaded ok
> Removing previously used \.cpan\build\CPAN-1.50\.
> Couldn't find a Bundle file in \.cpan\build\CPAN-1.50\. at
> C:/perl5/lib/CPAN.pm line 1717
Not sure what may cause this, but you could grab the Bundle
file from CPAN and see what modules it recommends, and install
them individually. Note that recent versions of CPAN.pm can,
in most cases, detect and install dependencies automatically.
> One last question -- what do people recommend for gcc on the PC? The
> MingW32 setup?
For use with ActiveState's perl and XS-based modules, it's
better to use VC++ - gcc from, eg, cygwin or MingW32, isn't
compatable. If the price, or principle, are a deterrent, though,
either of these gccs can be used to build your own perl and install
modules.
ActiveState has the Perl Package Manager (ppm) system whereby
you can install prebuilt modules automatically, so for these
cases you don't need a C compiler. A list of the currently
available packages is at
http://www.activestate.com/packages/zips/
best regards,
Randy Kobes
--
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theoryx5.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: Thu, 2 Sep 1999 05:51:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Doing a reverse lookup with ping?
Message-Id: <MPG.123812c19b0c0a90989f0d@nntp.hpl.hp.com>
In article <37ce9845.2760956@news.netvision.net.il> on Thu, 02 Sep 1999
15:31:48 GMT, hoz <hoz@rocketmail.com> says...
> On Wed, 1 Sep 1999 05:13:01 -0400, "Tim" <orange_nurf@hotmail.com>
> wrote:
>
> >I would like to use something to do a reverse lookup on an ip.
>
> try using nslookup
If the external command 'nslookup' is available and works, the Perl
function 'gethostbyaddr', suggested yesterday by Jonathan Stowe, will
work cheaper and more portably.
Your answer adds no value.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 02 Sep 1999 14:50:11 GMT
From: SG <sg@midwal.ca>
Subject: Equivalence
Message-Id: <37CE8D16.78D83FE0@midwal.ca>
Dear Experts!
I like to create something like FORTRAN "equivalence" statement:
DIMENSION ARRAY(2)
EQUIVALENCE (ARRAY(1), A)
EQUIVALENCE (ARRAY(2), B)
In this case A and ARRAY(1) will point to the same memory location, so A
= 1 and ARRAY(1) = 1 are equal actions.
How can I create the same structure in perl?
Regards,
Serguei.
------------------------------
Date: Wed, 01 Sep 1999 13:52:24 GMT
From: psw@net1plus.com (Peter Wilford)
Subject: General Question, Win98 and Win32 modules...
Message-Id: <37cd25bf.6300332@news.net1plus.com>
Hi all,
I am a newbie with Perl, therfore I would like input from the experts;
For certain applications I am forced to use the Win9x platform (not my
choice). Unfortunately, to my knowledge it is not a true Win32
kernel, which leads me to believe that when I try to use Win32 modules
it fails... Am I correct in this assumption?
Here is the test program:
use Win32::NetResource;
$Type = RESOURCETYPE_DISK;
GetSharedResource(\@Resource,$Type);
And here is my debug screen:
Can't load 'C:/Perl/site/lib/auto/win32/NetResource/NetResource.dll
for module Win32::NetResource: load_file:A device attached to the
system is not functioning at C:/Perl/lib/DynLoader.pm Line 169.
at test.pl line 1.
BEGIN failed--Compilation aborted at test.pl Line 1.
Can you confirm this for me...
Thank you,
Peter Wilford
------------------------------
Date: Thu, 02 Sep 1999 13:32:48 +0200
From: Abel =?iso-8859-1?Q?Almaz=E1n?= <abel.almazan@ogilvyinteractive.es>
Subject: How to make a split to a path filename???
Message-Id: <37CE6060.CAE94517@ogilvyinteractive.es>
I want to make a split to a path filename like that:
$path =c:\dir1\dir2\filename.ext
I tried with:
@file2 = split (' \ ', $path);
and:
@file2 = split (/ \ /, $path);
but it doesn't works, because of a syntax error.
What can i do???
please answer me as quickly as possible
PD: Answer to my email address please
Thacks very much.
------------------------------
Date: Thu, 02 Sep 1999 15:12:49 +0200
From: Espen Myrland <espen@nextel.no>
Subject: Re: How to make a split to a path filename???
Message-Id: <37CE77D1.8863C72D@nextel.no>
You have to use something called an escape character:
my @file2 = split (/\\/, $path);
Abel Almazán wrote:
> I want to make a split to a path filename like that:
>
> $path =c:\dir1\dir2\filename.ext
>
> I tried with:
>
> @file2 = split (' \ ', $path);
>
> and:
>
> @file2 = split (/ \ /, $path);
------------------------------
Date: 2 Sep 1999 14:31:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to make a split to a path filename???
Message-Id: <37ce7c37_2@newsread3.dircon.co.uk>
Abel Almazán <abel.almazan@ogilvyinteractive.es> wrote:
> I want to make a split to a path filename like that:
>
> $path =c:\dir1\dir2\filename.ext
>
> I tried with:
>
> @file2 = split (' \ ', $path);
>
> and:
>
> @file2 = split (/ \ /, $path);
>
>
> but it doesn't works, because of a syntax error.
>
> What can i do???
>
@file2 = split /\\/,$path;
You might also want to look at the module File::Basename which has
methods for parsing filenames in a relatively cross-platform manner.
/J\
--
"Doctors, psychologists and animators have been called in to investigate"
- Channel 4 News
------------------------------
Date: Thu, 2 Sep 1999 06:36:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to make a split to a path filename???
Message-Id: <MPG.12381d1b23a1673b989f0f@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37CE6060.CAE94517@ogilvyinteractive.es> on Thu, 02 Sep 1999
13:32:48 +0200, Abel =?iso-8859-1?Q?Almaz=E1n?=
<abel.almazan@ogilvyinteractive.es> says...
> I want to make a split to a path filename like that:
>
> $path =c:\dir1\dir2\filename.ext
I hope the quotes that you omitted there were single-quotes.
> I tried with:
>
> @file2 = split (' \ ', $path);
>
> and:
>
> @file2 = split (/ \ /, $path);
Each of those would split on two successive space characters.
> but it doesn't works, because of a syntax error.
There are no syntax errors there, just semantic errors.
> What can i do???
1. Split on a backslash, which requires that it be escaped:
/\\/ or '\\'
2. Use forward slashes in your paths, and split on:
m!/! or '/'
> please answer me as quickly as possible
Will I get an extra-large tip for speedy delivery?
> PD: Answer to my email address please
Since you asked so nicely.
> Thacks very much.
De nada.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 2 Sep 1999 06:44:31 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: IPC::open2 duplicates output
Message-Id: <MPG.12381f197a32d4a9896f3@nntp1.ba.best.com>
Joerg Honerla (honerla@euenet.uni-duisburg.de) seems to say...
> It run's fine in the normal shell but if I start it as a cgi script,
> every output written before the open2 statement including the line
> "Content-type: text/html" was duplicated.
Didn't you ever learn to flush? ;)
> use FileHandle;
> use IPC::Open2;
STDOUT->flush; # flush STDOUT so child doesn't get copy
>
> some print statements included ....
>
> $pid = open2( \*Reader, \*Writer, "cat -u -n" );
> Writer->autoflush(); # default here, actually
> print Writer "stuff\n";
> $got = <Reader>;
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Thu, 02 Sep 1999 11:39:53 GMT
From: Matthew Forder <matthew_j_forder@notes.seagate.com>
Subject: Re: is the mtime time between date1 and date2?
Message-Id: <7qlnm8$afa$1@nnrp1.deja.com>
In article <rPEy3.76$rB5.4025@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <7qdn6h$f4c$1@nnrp1.deja.com>,
> Matthew Forder <matthew_j_forder@notes.seagate.com> writes:
> > I'm trying to write a script to do some archiving on my system. What
I
> > need is a way in perl to say "Does the mtime for this file fall
between
> > time x and time y?".
>
> # perldoc -f stat
>
> my $mtime = (stat '/path/to/file')[9];
> my $x = time - 42; # 42 seconds before now
> my $y= time - 2 * 42; # 84 seconds before now
>
> print "yeppers\n", if ( $x < $mtime && $mtime > $y );
>
Thanks, I'll give it a whirl.
> Not everything requires modules.
Yep, and I know Date::Manip is especially bloated.
> Note that the mtime may not be meaningful or available on your system.
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | Begin at the beginning and go on
till
> Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
> NSW, Australia |
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 2 Sep 1999 15:12:34 +0200
From: "Norbert Ehreke" <norbert.ehreke@deutschehyp.de>
Subject: Re: JavaScript recieving variables from Perl
Message-Id: <7qlta5$p5a2@intranews.dresdnerbank.de>
Hi David,
essentially you need to do the same thing that you do to
generate your HTML via PerlScript.
Try to paste this into your ASP after the usual HTML head and
title stuff:
<%@ LANGUAGE="PerlScript" %>
<%
print "<BODY ONLOAD=\"helloThere()\">";
my $sOutput='What´s the frequency, Kenneth?';
print "<SCRIPT LANGUAGE=Javascript1.2>";
print "function helloThere() ";
print "{ ";
print " var sJavaScriptVariable= new String(\" " . $sOutput . " \");";
print " alert ( sJavaScriptVariable );";
print "}";
print "</SCRIPT>";
print "</BODY>";
%>
I hope it helps.
-Norbert
David Yang schrieb in Nachricht <37b1c30e.0@news.advancenet.net>...
>
>how do I have JavaScript read variables from a Perl file. For example, I
>have a database of variables, how can I load those into JavaScript? Load
>them without rewriting the page would be the best but if that's not
possible
>that's ok....
>
>Thanks in advance,
>David
>
>
------------------------------
Date: Thu, 02 Sep 1999 04:56:06 -0800
From: chettah@msn.com ("willow")
Subject: Re: Logical operators
Message-Id: <pruz3.7298$C%.4859583@WReNphoon3>
I originally had the files opened for writing. I changed it to reading and
writing and got the same result. Maybe I should be referring to the file
name and not the filehandle?
Tara
-**** Posted from RemarQ, http://www.remarq.com/?a ****-
Search and Read Usenet Discussions in your Browser - FREE -
------------------------------
Date: Thu, 2 Sep 1999 09:25:07 -0400
From: "Lex" <dazimi@yahoo.com>
Subject: Need your help here.
Message-Id: <7qlu12$io7$1@clio.net.metrotor.on.ca>
Hi Everyone;
I need to run a batch job everyday at specified time with a date parameter
such as
startjob.bat 0831
for the 31th of August if that is the today's
date or
Startjob.bat 0901.
(The date should be the today's date).
I know that I can schedule the job to run at the specific time using the
'at' scheduler in NT but how can I automate the part where I have to type
the date everyday and of course I would like to use perl and also may be
utilizing the date modules.
Thanks very much for your support and please send reply's to
dazimi@oradev.csis.csd.metrotor.on.ca
------------------------------
Date: Thu, 02 Sep 1999 08:45:58 -0400
From: Michael Godfred <mtg82814@ratheon.com>
Subject: newbi needs help
Message-Id: <37CE7186.50952329@ratheon.com>
I have a form, that when submitted it brings up a new window which calls
a java applet. Is there a way to have the window controlling the applet
to be minimized automatically. I tried the javascript newsgroup to see
if they knew how to minimize a window, but all they told me was how to
close one.
Any help would be great.
-Mike
------------------------------
Date: Thu, 2 Sep 1999 15:39:27 +0100
From: "Andrew C. Holmes" <andy@aholmes.u-net.com>
Subject: Re: Perl vs. Samba
Message-Id: <z2wz3.1072$H5.125564@newsr2.u-net.net>
I also have ActivePerl for Win32 BUT I can create/open, write to and close a
SAMBA shared file. I would suggest you don't have the correct permissions,
is this script running as the same ID on the share ???
# Open a log file for directory synchronisation
open (LOGFILE, ">>z:\syncdir.log") || # Z is a SAMBA share on AIX4.3
die "Can't open log file\n";
Andy Holmes
Craig Barkhouse wrote in message ...
>I've got ActivePerl for Win32, build 519. I cannot seem to open any files
>on a shared drive. The server is an OpenServer 5 machine running Samba.
>I'm using the following Perl syntax:
>
>open(FILEHANDLE, "filename") or die("Could not open file");
>
>It doesn't matter if I open the file for input (as above), or output
>(prepending a ">" to the filename). The code fragment works on any local
>drive, or on a mounted NT drive. I have read and write permissions on the
>Samba drive. I have also tried using sysopen() with various mode flags,
all
>to no avail.
>
>Has anyone else encountered this problem? It definitely seems like a bug
in
>Perl, Samba, or both. I need to come up with a solution or workaround
ASAP.
>
>
>
------------------------------
Date: Thu, 2 Sep 1999 21:30:17 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl wrapper on NT
Message-Id: <lFtz3.4$Rm5.1194@vic.nntp.telstra.net>
elephant <elephant@squirrelgroup.com> wrote in message
news:MPG.12389b1551efe422989ca2@news-server...
> in NT there's no DOS Prompt .. there's no DOS .. if you want to know
> more about this - then you should probably ask in another forum - this
> is completely unrelated to Perl
>
> jason - elephant@squirrelgroup.com -
There is however a command prompt which is loosely equivalent, and for the
purposes of running the bat file mentioned, functions the same (ie start -
run - command)
Wyzelli
------------------------------
Date: 2 Sep 1999 14:49:34 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Perl5 sendmail
Message-Id: <7qm2pu$3ct$1@info2.uah.edu>
In article <37cd928b.608430136@wv-proxy>,
jcasey@workingventures.ca (John Casey) writes:
: [...]
: Isn't there a comparable perl module for PERL5 that compares to
: SENDMAIL, or am I over simplifying it.
You can get sendmail for NT now. <URL:http://www.sendmail.com/>,
or use one (or both) of the modules Kenneth suggested.
Greg
--
In an intellectually equal society, who will be the busboys?
-- Lenny Bruce
------------------------------
Date: 02 Sep 1999 18:03:54 +0530
From: Lokesh Setia <ls@hss.hns.com>
Subject: Porting 'select' system call from UNIX to NT
Message-Id: <lf1zchqyq5.fsf@archow.hss.hns.com>
Hi all,
I recently wrote a perl tcp/ip server in unix, which i have to now
port to agghhh... Windows NT. Most of the perl portion is portable
except for these three (at least):
1. Since the server handles multiple connections at the same time, i
chose to multiplex sockets using select() system call. What's the
equivalent in NT?
2. Since the data transferred is binary, I use sysread() instead of
<HANDLE> to read from the socket. Will it work unchanged in NT?
3. I needed to get system time accurate atleast upto milliseconds. I
currently use syscall(&SYS_gettimeofday, $buffer, undef); for this,
which is unportable. Kindly tell the equivalent function for NT perl.
Thanks in advance,
Lokesh Setia.
--
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ .--. | _/
_/ |o_o | | Name : Lokesh Setia _/
_/ |:_/ | | E-mail : spam@hss.hns.com (spam -> lsetia)_/
_/ // \ \ | Tel : 91-346666-2389 _/
_/ (| | ) | #include <sys/disclaimer.h> _/
_/ /'\_ _/`\ | Org : Hughes Software Systems _/
_/ \___)=(___/ | _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: Thu, 2 Sep 1999 16:38:02 +0200
From: "Marcus Hudritsch" <mhudritsch@processlink.ch>
Subject: Q: How to communicate with the serial port?
Message-Id: <7qm24t$lo9$1@news.imp.ch>
How can I communicate with the serail port ?
If possible in a platform independent way.
Thanks for any help.
Marcus
------------------------------
Date: Thu, 02 Sep 1999 12:05:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: reference to a partial array
Message-Id: <37CE6806.2C2035E1@home.com>
[posted & mailed]
John Lin wrote:
>
> Can we get a reference to a partial array?
No. You can get a reference to one scalar element of an array, but that
won't help you.
[snip explanation]
> It would cause a slow down if I want to process
> a very large array just in a read only manner.
Since the array is read only, you should not need any array ops. Pass a
reference to the array and an index to the first element.
sub readonly_recursive {
my ($arref, $i) = @_;
...
readonly_recursive($arref, $i + 1);
...
}
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Thu, 02 Sep 1999 09:55:40 -0400
From: Gary Valley <gvalley@mitre.org>
Subject: Regex's, null, and the "&&" operator
Message-Id: <37CE81DC.F155E6C7@mitre.org>
If I do the following:
$a = "someword";
if(( $c =~ /$d/ ) && ( $a =~ /word/ )) {
#this will get printed in this case
print "It's true!!!\n";
}
Then, the print statement is executed. But, if I flip the expressions
in the parenthesis then it's not. Like this:
$a = "someword";
if(( $a =~ /word/ ) && ( $c =~ /$d/ )) {
#this will *NOT* get printed in this case
print "It's true!!!\n";
}
Anyone know why null must be matched first?!?!?!
-gary
--
Gary Valley
The MITRE Coporation
Phone: (703)-883-3359
Fax: (703)-883-7978
gvalley@mitre.org
------------------------------
Date: Thu, 2 Sep 1999 06:13:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: SEARCH and REPLACE
Message-Id: <MPG.123817ce3859038c989f0e@nntp.hpl.hp.com>
In article <k0nbtblel3j.fsf@ido.phys.ntnu.no> on 02 Sep 1999 11:09:04
+0200, Joakim Hove <hove@ido.phys.ntnu.no> says...
> tvn007@my-deja.com writes:
> > Would someone help me with this:
> > I would like to change the following line from:
> >
> > sys "a-b" "c*a" "(xyz+b)"
> > test "xyxx*2" "abc+2" "fcy*2"
> >
> > to
> >
> > $sys = '$a-$b'; '$c*$a'; '($xyz+$b)';
> > $test = '$xyxx*2'; '$abc+2' ;'$fcy*2';
>
> This seems like a mission for your editor.
That might require a lot of typing. Why not let Perl do it?
#!/usr/bin/perl-w
use strict;
for ('sys "a-b" "c*a" "(xyz+b)"',
'test "xyxx*2" "abc+2" "fcy*2"') {
local $_ = $_;
s/ +/ = /;
s/([a-z]+)/\$$1/g;
s/"(?: +|$)/"; /g;
tr/"/'/;
print "$_\n";
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 2 Sep 1999 05:42:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Simulating Carriage Returns
Message-Id: <MPG.1238107fcc50f930989f0c@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7qlcb1$9u4$1@charm.magnus.acs.ohio-state.edu> on 2 Sep 1999
08:26:09 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.1237b39a1232e8e6989f0a@nntp.hpl.hp.com>:
> > If the number is fewer than four digits, the year will be 999 CE, which
> > is rather a bit before the Unix Epoch. localtime() cannot produce a
> > year before 1901 (1900 + $f[2]).
>
> a) What makes you think so?
Testing the combinations of perl 5.005_03 and OSes I have available
makes me think so.
On HP-UX 9.05 and 10.20, the range of the year is 1 to 138.
On Windows 95, the domain of the argument is 0 to (2 ** 31) - 1, so the
range of the year is 70 to 138.
> b) I think this is plain wrong with contemporary Perls on
> not-that-buggy OSes.
Your definition of 'contemporary Perls' never includes the 'stable'
release, and 'not-that-buggy OSes' seems to mean OS/2. I'm sure you
will let us know specifically which combination produces negatve values
for the year. It will not be one presented to the world as 'stable'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 02 Sep 1999 13:43:50 +0200
From: Julien Quint <julien.quint@xrce.xerox.com>
Subject: Re: Size in Pixels with PERL
Message-Id: <37CE62F6.F618C034@xrce.xerox.com>
Rodrigo Cortes wrote:
>
> How i can get the size in pixels of a image (jpg or gif)????
Use the package Image::Size available from CPAN:
Image::Size - read the dimensions of an image in several
popular formats
Julien
------------------------------
Date: Thu, 02 Sep 1999 11:50:29 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: sticky undef $/
Message-Id: <37CE6470.F5E18313@home.com>
[posted & mailed]
Eric Smith wrote:
>
> Oh I just saw that putitng the $/="\n"; _above the second open statement
> works.
>
> So there is the fix but I thought the $/ was set per file read, clearly
> not.
Not so clear. Any reads after you set it *will* be affected.
> eric@fruitcom.com (Eric Smith) posted in comp.lang.perl.misc
> >
> > Hi
> >
> > I have a for loop that nest two file reads thus:
> >
> > #!/usr/bin/perl -w
> > for $var(1..3){
> >
> > open ONE, "/home/eric/fill";
> > while (<ONE>) {
The first iteration of this loop will read one line because you haven't
set $/ and the default is "\n".
> > undef $/;
Now you've set readline to file slurp mode. So you will get at most one
more iteration of this loop which will slurp the rest of the file into
$_.
> > print "This is a line $_";
> > }
> > close ONE;
> >
> > open TWO, "/etc/passwd";
> > while (<TWO>) {
Since $/ is a global variable, it is still set to undef here. So the
first iteration of this while loop will slurp the entire file into $_.
Setting $/ to "\n" inside the loop would be too late since there will be
nothing left to read.
Moral: You rarely ever want to set $/ inside your while(<>) loop. The
exception is if you want to treat the first record differently from
subsequent records.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Thu, 2 Sep 1999 21:25:44 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: That Cargo Date Code ( was Re: Y2K)
Message-Id: <6Btz3.3$Rm5.1665@vic.nntp.telstra.net>
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:37ce4006_1@newsread3.dircon.co.uk...
>
> Where *does* it come from ? A quick search on altavista threw up:
>
> http://www.blur-online.com/programming/cgi/sendmail.htm
>
> http://forward.com.au/freebees/passperl.htm
>
> http://www.pangea.ca/~kolar/ftp/pstree
>
> http://www.erehwon.org/erehwon/anonftpstat.html
>
> (I particularly liked the cunning $year =~ s/^19// variation there )
Nothing like being creatively wrong!
>
> http://ssv1.union.utah.edu/~spencer/perlscripts/mrurl.pl.txt
>
>
> /J\
Always like reading your comments /J\ or is that "/J\\"
Sorta highlights one problem with open source and freeware... Anybody can
get it and use it, And since they don't pay for it they don't spend as much
time trying to learn it. And much of the 'reference' material comes from
clearly non credible sources. Still.. how hard is it really to RTFM?? Or
RTBF for that matter!
The other thread from finsol points to a high proportion of problems with
Perl compared to other languages, but I wonder what the actual proportion of
use for cgi scripts (the only comparison she made) is between C, C++, Perl
etc. Probably similar to the error proportions I would guess.
Wyzelli
------------------------------
Date: Thu, 2 Sep 1999 06:33:10 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Tracking progress of a Net::FTP download
Message-Id: <MPG.12381c708ddf84af9896f2@nntp1.ba.best.com>
cb (ecliptica.ww@nospam.virgin.net) seems to say...
> I'll have a mess about with it today, although I'm not sure I want to get involved
> in twiddling about with the guts of Net::FTP .... and certainly it does everything
> I want in terms of negotiating access with the remote host etc ... but most of what
> I'm trying to download consists of files of several megabytes, and some kind of
> progress checking is essential as the link is far from rock-solid.
Well, progress measurement is only something to keep you busy. If the
link fails, well, then you know that progress has stopped.
Really, LWP is easy to use, too.
> For some reason the remote server doesn't seem to understand the third parameter
> (offset from start of file) which $ftp->get() takes to enable restoration of broken
> downloads. Does anyone have previous experince of that, or am I making some
> elementary coding goof:
>
> $ftp->get($remote_file, $local_file, 1234567) or die "blah blah blah\n";
I do this in a program and it works great.
if ( $ftp->get( $_->{path}, $_->{file}, $_->{size} ) ) {
Try another FTP site to see if it's just the server you are trying, but
it's part of the FTP spec to work that way.
Maybe 1234567 is the wrong number?
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 702
*************************************