[8569] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2185 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 26 10:22:24 1998

Date: Thu, 26 Mar 98 05:01:22 -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 Mar 1998     Volume: 8 Number: 2185

Today's topics:
    Re: - Limiting the length of a list on a page..... - <James@cydaps.nospam.co.uk>
    Re: An easy question......? <reccmo@sc03.sctp.dk>
    Re: babelfish.altavista web client (enjoy) (Matija Grabnar)
    Re: Challenge your programming skill (Bart Lateur)
        Communication between processes? <lisak@atrey.karlin.mff.cuni.cz>
        Days of the Week <strepsil@very.net>
    Re: FileHandle - I really wish it had a 'file_name' met <zenin@archive.rhps.org>
    Re: Going Rates for PERL Programming??? (MercuryZ)
    Re: grepping on an array (John Stanley)
    Re: hash vs hash ref (Bart Lateur)
        Imagin Counter problem  in WIn95 <leegaram@hanmail.net>
        MacPerl fake 'exec'? (Greg Dunn)
    Re: need regexp help (Tad McClellan)
    Re: Need sorting routine in Perl (Gabor)
        nested program/system calls from perl on NT <rlm@triax.com>
        noetebook /perl-cgi module ??? <cheops@robiomat.com>
    Re: Perl to read  spreadsheet files scott@softbase.com
        Perl/Java integration / socket programming <noemail@noemail.com>
    Re: Perl/Java integration / socket programming <zenin@archive.rhps.org>
    Re: Please Help, Win95/NT4.0 Serial Port Usage Question <jimbo@soundimages.co.uk>
    Re: PROPOSAL: The Perl Dictionary <ebohlman@netcom.com>
    Re: PROPOSAL: The Perl Dictionary (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: PROPOSAL: The Perl Dictionary (Tad McClellan)
    Re: regular expression (Abigail)
    Re: regular expression (Craig Berry)
    Re: Remote Host Redirection <amar@iss-gmbh.de>
    Re: SMTP <sbekman@iil.intel.com>
        Socket problems in Win95. <erhmiru@erh.ericsson.se>
    Re: Unlink on WinNT/95 scott@softbase.com
        Using Oraperl with different version of Oracle <evpretty@ibm.net>
    Re: Using Oraperl with different version of Oracle <zenin@archive.rhps.org>
    Re: verifying email address -- how? <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 26 Mar 1998 09:53:55 +0000
From: James <James@cydaps.nospam.co.uk>
Subject: Re: - Limiting the length of a list on a page..... -
Message-Id: <Om51CCAzWiG1Ew+b@cydaps.co.uk>

On Wed, 25 Mar 1998, Randal Schwartz wrote:


>>>>>> "Martin" == Martin Vorlaender <martin@RADIOGAGA.HARZ.DE> writes:
>
>Martin> That's exactly what Randal Schwartz presents in his
>Martin> WebTechniques column #2 at
>Martin> http://www.stonehenge.com/merlyn/col02.html
>
>Nope.  I said "error 404" at that address.
>
>Perhaps you meant column 2 under:
>
>       http://www.stonehenge.com/merlyn/WebTechniques/
>
>print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
>## legal fund: $20,990.69 collected, $186,159.85 spent; just 159 more days
>## before I go to *prison* for 90 days; email fund@stonehenge.com for details
>


That is the one! Excellent, thanks Randal!

Cheers


James




------------------------------

Date: 26 Mar 1998 09:41:15 GMT
From: Christian Mondrup <reccmo@sc03.sctp.dk>
Subject: Re: An easy question......?
Message-Id: <6fd7rr$1soi$1@news.net.uni-c.dk>

David C. McCall <cyberman@sonoma.edu> wrote:
: For PERL or CSH or SH,
: What would be the easiest way to traverse down a filesystem and locate
: occurances of foo, then replace a line in each foo like with sed -e
: "s;blah;balh;".....

: I know this must be simple but somehow I'm not getting the basics.....
: thanks ahead of time....dmc

find <root_of_your_fs> -type f -name foo -exec perl -p -i.bak \
-e "s/blah/balh/" -print

--
Christian Mondrup, Computer Programmer
Scandiatransplant, Skejby Hospital, University Hospital of Aarhus
Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark
Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07


------------------------------

Date: 26 Mar 1998 12:50:12 GMT
From: matija@rzenik.arnes.si (Matija Grabnar)
Subject: Re: babelfish.altavista web client (enjoy)
Message-Id: <6fdiu4$faj$1@kanja.arnes.si>

In article <35180766.BB4ADDA3@shopcfn.com>,
Dan Boorstein  <dboorstein@shopcfn.com> wrote:
>for kicks i tried:
>
>http://www5.awa.com/~jonathan/nph-babel.cgi?
>lang=pt&phrase=There%27s+more+than+one+way+to+do+it%2e
>
>based on the results i would like to recommend:
>
>MTTOTTOTTOTTTOTTTOTTTOTHTOTOWOTMI
>
>as a new perl slogan.
>
>i think it will make for easier translation back into portugese,
>thereby fostering a closer connection to perl developer base in
>portugal. ;)

Yeah, and as apparently every Italian knows, 
"There are more of the one-way for the farlo."

:-)
-- 
"My name is Not Important. Not to friends. 
    But you can call me mr. Important"  - Not J. Important 
Matija.Grabnar@arnes.si


------------------------------

Date: Thu, 26 Mar 1998 08:32:46 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Challenge your programming skill
Message-Id: <351a02cc.679806@news.tornado.be>

Hasan Diwan wrote:

>	Residents living close together have the same zip code. New
>York's upper west side (where my uncle lives) is 10019, however world
>trade centre is 10023.

I've been a little bref in my other post. Let me recapitulate. This is
this thread so far in short:

Kim Lo asked about finding "the closest customer name based on an input
zipcode. I have the data file containing zipcode, state, longitude and
latitude in a database already."

TomH proposed "it would be more accurate to get cartesian vectors to the
zipcode and customer from the center of the earth and take the dot
product between them (this gives the cosine of the earth central angle)"

to which Abigail replied that this would be unreliable when people live
in clusters: "Clusters of humans are sometimes called cities. If your
customers are clustered, your approach doesn't work well.".

But once you're inside a cluster, the original approach becomes
unreliable, as:

 - ZIP codes indicate an area, not one point in space. Large areas of
cities share the same ZIP-code, hence my remark. You could easily have
several customers with the same ZIP-code, or have two points physically
located very close together, but on different sided of a ZIP-code
border.
 - You really need the point with the easiest access, not the the
closest one in flying distance. What if both points are located on
either side of a longish lake?

I also must confess I had misread TomH's post. Now I see that he
mentioned the "dot product". I thought he had written "vector product",
wich would be a far more sensible approach, as the result is
proportional to the SINE of the angle. Of course it's a vector, but you
can easily take the length of that.

	Bart.


------------------------------

Date: Thu, 26 Mar 1998 09:16:13 +0100
From: Jan Liska <lisak@atrey.karlin.mff.cuni.cz>
Subject: Communication between processes?
Message-Id: <Pine.LNX.3.94.980326090036.14511A-100000@atrey.karlin.mff.cuni.cz>

Hi,

I'm writing some Perl wrapper for gnuchessr and I need to connect
gnuchess STDIN and STDOUT with my program. There's a problem with
buffering output (function Open2()), as Camel book said, and even CPAN
library Comm.pl (pseudoTTY) didn't work 
(in fact - following program
require 'Comm.pl';
Comm::Init();
$p=open_proc('cat -n');
print $p "line \n";
print scalar <$p>;


just wrote "line", even if I ran 'echo Hello!' instead of 'cat -n')

Any ideas || advices?

Thanks, Lisak


--
_______________________________________________________________
Somewhere, just out of the sight, the unicorns are gathering...
_______________________________________________________________
lisak@atrey.karlin.mff.cuni.cz | PGP key: finger lisak@atrey...
---------------------------------------------------------------
     Some think the Devil rules Halloween. They're wrong
-------------------------SFK CORNHOLIO-------------------------



------------------------------

Date: Wed, 25 Mar 1998 12:51:19 +1100
From: "Mike Barnes" <strepsil@very.net>
Subject: Days of the Week
Message-Id: <890790681.73936@satin.sensation.net.au>

Anyone out there got a neat little snippet of code, or just a method I can
use to find out what day of the week a given date fell on?

I wouldn't have the faintest idea where to start, but that's mainly because
I haven't memorised all the rules from leap years/centuries...

Thanks in advance,
Mike.





------------------------------

Date: 26 Mar 1998 07:19:20 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: FileHandle - I really wish it had a 'file_name' method!
Message-Id: <890897129.277770@thrush.omix.com>

Iacchus Maladeus Mozart <IMMozart@poee.org> wrote:
	>snip<
: Couldn't you get the name of the file from the symbol table?
:
: For instance $file = $main::{$handle}
:   or something like that.

	No.

-- 
-Zenin
 zenin@archive.rhps.org


------------------------------

Date: 26 Mar 1998 09:51:18 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: Re: Going Rates for PERL Programming???
Message-Id: <6fd8em$2v2@argentina.earthlink.net>

In article <35179f1e.11959503@news>, wef@N0SPAM_wef.net says...
>
>Here's what my one and only client told me about the going rates for
>PERL/CGI scripting for the WWW.
>
>$45/hour for "tweaking" existing scripts.  Meaning the client wants ou
>to change a few lines in a 'formmail.pl' script for instance...
>
>$100/hour for custom scripting...  Meaning the client wants something
>entirely different than what he/she can find on the web...
>
>How do these rates compare....????
>
>JWefler
>wef@wef.net
>

non-competitive.....

MercuryZ



------------------------------

Date: 26 Mar 1998 07:32:30 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: grepping on an array
Message-Id: <6fd0ae$1gg$1@news.orst.edu>

In article <6fcnsa$dkj$1@plucky.netgazer.net>,
Monty Scroggins <monty@nospam.net> wrote:
>I use shift to pull the first element off of the array.
>I then search the array for certain strings.  The grep fails on
>the first element of the array.  

If you shift off the first element of the array, it is no longer in the
array. Of course the grep will fail to match the element that is no
longer there. If you want to include the first element in the grep,
don't shift it off.

>If I change the undef @array to
>@array=""; the grep functions properly!!

Even if you don't change the undef, the grep functions properly. It
won't match what isn't there. If you put the string "" as the first
element of the array before loading it, then you aren't shifting off the
first line from the file anymore. 

>Does anyone have an idea on why this behavior occurs??

Yes.



------------------------------

Date: Thu, 26 Mar 1998 08:32:50 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: hash vs hash ref
Message-Id: <351c0b29.2820673@news.tornado.be>

Tomas wrote:

>Could someone give me a simple reason why or when it is better to have
>a reference to a hash than just using the hash itself. For instance
>these both codes does the same.
>
>%hash = (name =>"Jason");
>print $hash{name};
>
>$hashref = {name =>"Jason};
>print $hashref->{name};

What are you proposing? That we drop normal hashes in favour of hash
references ONLY?

'Cos hash references actually have more uses than plain hashes.

I think you'll find that many (most?) people find plain hashes simpler
to grasp than hash references.

Bart Lateur
Gent (Ghent, Gand),
Belgium, 
Europe,
3rd planet from the sun.


------------------------------

Date: 26 Mar 1998 12:51:42 GMT
From: "garamlee" <leegaram@hanmail.net>
Subject: Imagin Counter problem  in WIn95
Message-Id: <01bd58b5$afbbfea0$dd61e8cb@easthill>

I use  apache  1.3b5  in Win95.
today  I programmed  perl  Image counter script ( It uses 'fly').
when I run my script  it dosen't work. 

I found  the problem is  that print() function is not work with STDOUT. 
namely  All GIF Image data is not printed. 

is there something i didn't know?

please help me...





------------------------------

Date: Wed, 25 Mar 1998 21:42:11 -0500
From: gregdunn@indy.net (Greg Dunn)
Subject: MacPerl fake 'exec'?
Message-Id: <gregdunn-ya02408000R2503982142110001@news.indy.net>

I've scoured the sample scripts and documents, but I'm unable to find a
suggested way to launch a Mac application from MacPerl; even the Apple
event docs aren't very helpful.  I don't want to run an AppleScript (I'm
replacing a couple of AppleScripts with a Perl script already!) and it's OK
if the Perl script goes away when the subsequent app launches.

Can anyone point me to a source of examples, or a place in the docs where I
can read more about this?

-- 
| Greg Dunn                        | "Information is not knowledge; |
| GregDunn@aol.com                 | knowledge is not wisdom;       |
| gregdunn@Indy.net                | wisdom is not truth."          |
| http://members.aol.com/gregdunn/ |              -- Frank Zappa    |


------------------------------

Date: Wed, 25 Mar 1998 16:18:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: need regexp help
Message-Id: <pqvbf6.g5d.ln@localhost>

benjamin j snyder (bens@chippewa.cis.ohio-state.edu) wrote:

: I am having trouble with a few things, mainly regexps.

: I have the following line:
: @id_info = split (/./,$value);
                    ^^^

dot (.) has a special meaning when used in a regex.

It matches any character (except a newline).

Split discards the separator characters that you specify in your regex.

Your regex above specifies that _every_ character is a separator
character, so they all get discarded.

   @id_info = split (/\./,$value);
                      ^
                      ^

: Now for the regexp.  The value of $value *SHOULD* be of the format aaa.nnnn  I 
: need to make sure there is only one '.' and 4 n's (number of a's doesn't 
: matter).  I thought about using the size of @id_info to determine if the number
: of '.'s is more than 1, but since I can't seem to get any value for @id_info 
: that got sh*t-canned right away.  


   if ($value =~ tr/.// > 1)
      {print "more than one dot in '$value'\n"}
   else
      {print "less than or equal to one dot in '$value'\n"}

[ tr/// does _not_ take a regex, so dot is not special there ]



: I also need to make sure that all of the 
: characters (other than the one allowable '.') are alphanumeric.

   if ( $value =~ /^[a-zA-Z0-9]+\.[a-zA-Z0-9]{4}$/ )
      {print '$value' is in the correct format\n"}
   else
      {print '$value' is not formatted correctly\n"}

[ match 'one or more' alphanumeric chars, a dot, then 4 
  more alphanumeric chars 
]


: I am a fledgling with regexps, and REALLY want to learn them, but can't seem to
: pick it up out of a book (I have Learning PERL and Programming PERL by 
: O'Reilly).  


Get "Mastering Regular Expressions", also published by O'Reilly.


: Could someone please let me know of a regexp I could use to do 
: this?  

See above.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 26 Mar 1998 12:06:19 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Need sorting routine in Perl
Message-Id: <slrn6hkh84.9j9.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Didiek <didiek@intouch.co.id> wrote :
# Hi,
# 
# Does anyone know how or where can I get a sample perl script for sorting
# numbers. I plan to build a link list and display them in a top referrer
# order basis. Just like top50 or top100 or whatever.

What's wrong with the built in 'sort'?

# Any information would be very appreciated.
# 
# Regards,
# Didiek


------------------------------

Date: Wed, 25 Mar 1998 15:59:53 -0800
From: Rich Morgan <rlm@triax.com>
Subject: nested program/system calls from perl on NT
Message-Id: <35199A79.70038370@triax.com>

I am on NT 4.0 patch release 3
using Perl 5.00307

It seems as if a.pl is invoked from the dos command window and
it calls b.pl with the back tick notation and b.pl calls
any other command line program with a back tick notation
the b.pl calls do not work.
I have tried calling date and time and other command line utilities
and they all return null standard out strings and a return code
of -1.

Is this a perl problem or an NT problem?
The same result occurs if I run a.pl as a cgi program under the IIS web
server.
Is there any way around this?

Rich Morgan


------------------------------

Date: Thu, 26 Mar 1998 08:25:00 +0100
From: "Gabor.V.Gulyas" <cheops@robiomat.com>
Subject: noetebook /perl-cgi module ???
Message-Id: <351A02CC.D8C9D75F@robiomat.com>


--------------779946B5CA48ECAC4B65DE38
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello ,

I'm looking for some "Note-book"-like  solutions using perl/cgi modules.

Are there any similar things in the Perl-World ???

       thank you every infos,
                                                    Gabor


--
############################################################################
#   Gabor V. Gulyas  |  RoBioMat | P-TEAM                                  #
# actual localization: via Matteotti, 10 |25034.ORZINUOVI(BS) | ITALY      #
# p/f  :(Italy)-30-941264 | mail : gabor@robiomat.com |cheops@robiomat.com #
# -------------------------------------------------------------------------#
#                    We  use 100% pure Linux/UNIX systems                  #
#                    LINUX == FREEDOM ! FREEDOM == POWER !                 #
############################################################################



--------------779946B5CA48ECAC4B65DE38
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hello ,

<P>I'm looking for some "Note-book"-like&nbsp; solutions using perl/cgi
modules.
<BR>Are there any similar things in the Perl-World ???

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thank you every infos,
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Gabor
<BR>&nbsp;
<PRE>--&nbsp;
############################################################################&nbsp;
#&nbsp;&nbsp; Gabor V. Gulyas&nbsp; |&nbsp; RoBioMat | P-TEAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #
# actual localization: via Matteotti, 10 |25034.ORZINUOVI(BS) | ITALY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #
# p/f&nbsp; :(Italy)-30-941264 | mail : gabor@robiomat.com |cheops@robiomat.com #
# -------------------------------------------------------------------------#
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We&nbsp; use 100% pure Linux/UNIX systems&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINUX == FREEDOM ! FREEDOM == POWER !&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #
############################################################################</PRE>
&nbsp;</HTML>

--------------779946B5CA48ECAC4B65DE38--



------------------------------

Date: 26 Mar 1998 13:45:30 GMT
From: scott@softbase.com
Subject: Re: Perl to read  spreadsheet files
Message-Id: <6fdm5q$72p$4@scully.new-era.net>

Russell Schulz (Russell_Schulz@locutus.ofB.ORG) wrote:
> (and yes, I see the OLE module, but that seems particular to
> Microsoft Excel files, and I haven't tried it.)

There's nothing particular to any specific program with OLE Automation,
you're just seeing examples written in Excel because it's a common
program with a semi-well-documented Automation interface. 1-2-3 97
supports Automation fully (although as far as I know it is the first
version to do so), but the problem is its interface is wholly
undocumented. You can choose from a wide variety of books on
Excel programming, but you can choose from 0 books on 1-2-3
programming.

What I'd do is import the 1-2-3 worksheet into Excel.  That would
solve all the problems.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

Date: Thu, 26 Mar 1998 18:02:29 +0800
From: LGC <noemail@noemail.com>
Subject: Perl/Java integration / socket programming
Message-Id: <351A27B5.1A7C@noemail.com>

I would need some programming help.  I suppose I could pay for the work
done.

I'd need to find a way to do the following :  have a perl script somehow
send a message to someone connected to the Internet so that that
person's computer beeps.

In other words, I need to notify people of events via the Internet, and
the notification request has to be generated by a perl script.

I suppose it would involve a perl script that opens a socket connection,
and sends a message on it.  On the other side, a java program is
listening on that socket and beeps when a message is received.

Unfortunately, I'm not enough of a good perl/java programmer to write it
myself.  Can someone write it for me ?

Please reply to    
jys@
hk.super.net


------------------------------

Date: 26 Mar 1998 12:28:12 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Perl/Java integration / socket programming
Message-Id: <890915660.684300@thrush.omix.com>

[posted & mailed]
LGC <jys@hk.super.net> wrote:
: I suppose it would involve a perl script that opens a socket connection,
: and sends a message on it.

	Untested, but you're not paying me either.  If you send me a pound
	of Peet's coffee (www.peets.com) I'll test it.  Never let it be said
	I don't work for beans. :-)

	#!/usr/local/bin/perl -w
	use strict;
	use IO::Socket;
	my $socket = IO::Socket::INET->new('some.user.host.system.com:1234')
	    or die qq(User not home?: $!);
	$socket->autoflush;
	$socket->print ("Here is a message!!!\n");
	$socket->close
	    or die qq(wtf close(): $!);

: On the other side, a java program is
: listening on that socket and beeps when a message is received.

	Sorry, I only drink Java, I don't write it unless I'm paid lots of
	money.

-- 
-Zenin
 zenin@archive.rhps.org


------------------------------

Date: 26 Mar 1998 07:17:21 +0000
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Please Help, Win95/NT4.0 Serial Port Usage Questions
Message-Id: <u1zvpq5tq.fsf@soundimages.co.uk>

jdmelton@oz.sunflower.org (J. Daniel Melton) writes:

> 
> I wish to use Perl 5.004 Standard for communication with a couple of
> RS232 devices on an Intel  Windows 95 platform. I wish to use Perl, I
> know there are other tools for the job.

I have been successful in reading and writing the serial port on Win NT 4 and writing the serial port on Windows 95. I have not been successful reading the serial port on Win 95. In order to use the serial ports i have first made a system call to the mode command to set the port parameters and then opened a file handle to the port. In order to read and write I have used sysread and syswrite rather than read and write which make use of buffered IO. Sysread and syswrite enable you to control the number of bytes transfered and to poll the serial port within a loop.

There has been a rumour of a Win 32 module for serial communications in development as we speak.

The above attempts at serial comms have been made using the GS port of 5.004_04 compiled on Win NT with MSVC 5. I cannot speak for the Activestate port.

HTH.
Jim Brewer


------------------------------

Date: Thu, 26 Mar 1998 07:09:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <ebohlmanEqEzvG.557@netcom.com>

Unapperling: esthetic shortcomings in Perl code.



------------------------------

Date: Thu, 26 Mar 1998 13:50:43 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <lassehp-2603981350430001@ra.imv.aau.dk>

In article <eli$9803251350@qz.little-neck.ny.us>, Eli the Bearded
<*@qz.to> wrote:

>------
>perl -e 's ssqqprint qq\0just another new york perl hacker\n\0see'

Bareword found where operator expected at -e line 1, near "s ssqqprint qq\0just"
        (Do you need to predeclare s?)
syntax error at -e line 1, near "s ssqqprint qq\0just another "
Backslash found where operator expected at -e line 1, near "n\"
Bareword found where operator expected at -e line 1, near "0see"
        (Missing operator before see?)
Execution of -e aborted due to compilation errors.

It seems perl is being perlturbed by your perlformance.

-Lasse


------------------------------

Date: Thu, 26 Mar 1998 06:14:40 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <grgdf6.jvf.ln@localhost>

Ed Finch (efinch@vais.net) wrote:
: Perl is going to take over the world. Therefore, the word perl and its
: derivitives are going to become part of everyday speech, just as "dude"
: is now. I propose the Perl Dictionary in order to establish - for those
: unfortunate enough not to know about perl - the proper use of the word.
: Sample entries:

[snip]

: More entries, anyone?



perl capita - "How do I capitalize all the words on one line?"
               (Perl FAQ, part 4)


perlchance - "How do I shuffle an array randomly?"
               (Perl FAQ, part 4)


perlennial - "Does Perl have a year 2000 problem?"
               (Perl FAQ, part 4)


perlversion - 5.004


perljury - All the newsgroup readers who judge whether or not to read
           your post based solely on what you put in the Subject header.




--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 26 Mar 1998 07:24:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regular expression
Message-Id: <6fcvs5$5nd$1@client2.news.psi.net>

8($J$Z6!*:2VE]$} (NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw) wrote on MDCLXVIII
September MCMXCIII in <URL: news:3NdUHd$94p@CHS.Dorm10.NCTU.edu.tw>:
++ 
++ 
++ hi there,
++ 
++ just a simple question: how can I write a perl script to identify
++ all strings of 0's and 1's that do not contain the substring 011  ?

unless (/[^01]/ || /011/) {
    # String with 0's and 1's, not containing 011.
}

++ and another one is to identify all strings of digits with at most one 
++ repeated digit. 

unless (/(\d).*\1/) {
    # No digit appears twice.
}



Abigail
-- 
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;
          print grep {$_{$_}} @_' < /usr/dict/words


------------------------------

Date: 26 Mar 1998 07:42:53 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regular expression
Message-Id: <6fd0tt$2bi$1@marina.cinenet.net>

8($J$Z6!*:2VE]$} (NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw) wrote:
: just a simple question: how can I write a perl script to identify
: all strings of 0's and 1's that do not contain the substring 011  ?

The single-regex way to test one string for your condition is 

  /^(?!.*011)[01]+$/

That is, make sure that '011' never occurs using negative lookahead, then
make sure that the entire string is composed of one or more 0s and 1s
only. 

Another, less efficient but perhaps interesting way to do this would be

  /^(0(?!11)|1)+$/

Translated this means one or more instances of either a 0 not followed by 
11, or a 1, together comprising the entire string.

An easier and more efficient two-regex approach is (presuming string to be
tested is in $_)

  ! /011/ && /^[01]+$/

And obviously, if you already know the string is all 0s and 1s, you can 
simply use

  ! /011/

and be done with it.

: and another one is to identify all strings of digits with at most one 
: repeated digit. 

Here's the best I've come up with.  The subroutine presumes its input is 
known to be a string containing only digits.  I've barely tested this, 
but it seems to work on all the test data I've tried.

  sub AtMostOneRepeat {               
    my $digits = join '', sort split //, shift;
    my @groups = $digits =~ /(\d)\1+/g;
    return @groups <= 1;
  }

The first line inside the subroutine takes the string apart into single
characters, sorts those characters, and joins the result; for example,
'3263192' would become '1223369'.  This places all repeated digits
adjacent to one another.  The next line forms a list of all repeated
digits.  The final line tests whether this list has one or less members,
satisfying your 'at most one repeated digit' requirement (as I understand
it, anyway).  It's quite possible your understanding of the requirement is
different; if so, let me know and I'll try to adjust accordingly. 

HTH...

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Thu, 26 Mar 1998 08:41:00 +0100
From: Amar Subramanian <amar@iss-gmbh.de>
To: wes@wesley.win.net
Subject: Re: Remote Host Redirection
Message-Id: <351A068C.4103@iss-gmbh.de>

Hello,

> Is there a script which will detect the originating IP of someone > browsing
> your web pages and, depending on their IP - or remote host,  > automatically
> redirect them to "disneyworld.com"?
> 
i don't know if there is any, but it is very easy to write one.
Do you want implement it as an cgi or an SSI ?

regards

	amar


------------------------------

Date: Thu, 26 Mar 1998 14:25:02 +0300
From: Bekman Stanislav <sbekman@iil.intel.com>
To: Remove spamoff to reply <angelo_sirigos@spamoff.medscape.com>
Subject: Re: SMTP
Message-Id: <351A3B0E.41C6@iil.intel.com>

Angelo Sirigos wrote:
> 
> I'm trying to create a simple mailer which connects to my mailserver and
> sends out a message to a specified email address.
> The script goes through beginning to end but doesn't send the message.
> I was wondering if anyone can possibly give me a hand.  below is the
> code.
> Thanks in advance for any help
 
Angelo,
Here the send_mail sub I wrote and use:
Put $debug =1 to see what actually happens
but first try to check if yout SMTP server is up
with 
telnet mailhost 25

replace the mailhost with your mailserver name, usually it's the same
name as a name of the machine you are running on

#
# Sends email by using the SMTP Server
#
sub send_mail{
  my ($from, $to, $subject, $body) = @_;

  use Net::SMTP;

    # set to 1 to enable debug mode
  my $debug = 1;

    # get the recipients for smtp to identify
  my $smtp_from = $from;
  my $smtp_to   = $to;

    # build the mail message
  my $mail_message = <<__END_OF_MAIL__;
To: $to
From: $from
Subject: $subject

$body

__END_OF_MAIL__

    # Set this parameter if you don't have a valid Net/Config.pm entry
for SMTP host
    # and uncomment it in the Net::SMTP->new call
    # my $smtp_server = 'smailhost.accessone.com';
    # my $backup_smtp_server = 'pulm2.accessone.com';

    # init the server
  my $smtp = Net::SMTP->new(
#                           $smtp_server,
                            Timeout => 60, 
                            Debug   => $debug,
                           );

    # I'm $smtp_from
  $smtp->mail($smtp_from) or warn ("Failed to specify a sender
[$smtp_from]\n");

    # Please Send the email to $smtp_to
  $smtp->to($smtp_to) or warn ("Failed to specify a recipient
[$smtp_to]\n");

    # Please send this data
  $smtp->data([$mail_message]) or warn ("Failed to send a message\n");

    # I'm over
  $smtp->quit or warn ("Failed to quit\n");

} #  end of sub send_mail


______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/		    
    
Linux receives a 'Product of the Year Award' for Best Technical Support
http://www.infoworld.com/cgi-bin/displayTC.pl?97poy.supp.htm


------------------------------

Date: 26 Mar 1998 13:35:40 +0100
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Socket problems in Win95.
Message-Id: <lasoo5iq8z.fsf@erh.ericsson.se>

Hello,

I've written a client and server applications. On the UNIX they work
fine. However, when I try to run the client on the Win95 (perl
5.003_07), it dies on socket:

socket:  at fpage.pl line 29.

The coresponding code is:

28: $porto = getprotobyname('tcp');
29: socket(SOCK, PF_INET, SOCK_STREAM, $porto) or die "socket: $!";

As you see $! is empty. Who knows what is going on? Any hint will be
appreciated.

I have winsock.dll version 4.00.950 dated 11-7-95 9:50.

Regards,

Michal


------------------------------

Date: 26 Mar 1998 13:49:01 GMT
From: scott@softbase.com
Subject: Re: Unlink on WinNT/95
Message-Id: <6fdmcd$72p$5@scully.new-era.net>

>While (-f counter.lock) {

This is baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad news. Suppose instance A
starts, locks the file, and there's a power failure. Your machine
reboots, but the lock file is there.  Then programs B, C, D, E, ....
all block on this while loop and spin their wheels forever. All locks
should have a reasonable wait period in them after which they give up
and delete the lock file.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

Date: Thu, 26 Mar 1998 12:09:15 +0000
From: Eric Pretty <evpretty@ibm.net>
Subject: Using Oraperl with different version of Oracle
Message-Id: <351A456B.2AE518F0@ibm.net>

I am using perl 5.004_003 on aix to access local oracle databases.
I have Oracle version 7.3.3 and 8.0.3 and I currently compiled the
DBD::Oracle module with the libraries of Oracle 7.3.3.

When I try to access a local DB with version 8.0.3, I got an error
message which tells me that I am using the wrong libraries to acces
Oracle.

Do you know any ways to access an Oracle DB with another version than
the one used to compile Oraperl ?

Or is it possible to compile several versions of Oraperl and decide at
run-time which version to use ?

Eric

evpretty@ibm.net




------------------------------

Date: 26 Mar 1998 12:20:07 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Using Oraperl with different version of Oracle
Message-Id: <890915176.294869@thrush.omix.com>

Eric Pretty <evpretty@ibm.net> wrote:
: Or is it possible to compile several versions of Oraperl and decide at
: run-time which version to use ?

	I think the newer Oracle libs can connect to older databases.  Have
	you tried building it with the newer libs and connecting to the
	older systems?

	Also, you really should consider switching to the DBI/DBD Oracle
	drivers. -There is an Oraperl emulation layer that makes moving
	over vary easy, and you get the (major) advantage of running perl 5
	instead of the vary outdated and buggy perl 4.  There are also no
	current plans to make perl year 2k compliant, and with year 2000
	comming up quick you could be in trouble. :-)

-- 
-Zenin
 zenin@archive.rhps.org


------------------------------

Date: 26 Mar 1998 09:59:24 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: verifying email address -- how?
Message-Id: <6fd8ts$i4b$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Yash Khemani <khemani@plexstar.com> writes:
:could you provide a suggestion about how to verify the validity of
:an email address?

Absolutely : you STOP TRYING.  You can't do it.
And then you go read the damned FAQ where I tell you why.

Mail the address supplied a unique cookie, and ask them to reply with 
some convolution of the cookie.  It they do it, you have a real
person.  Otherwise you don't.

YOU CANNOT VERIFY AN EMAIL ADDRESS.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

It is, of course, written in Perl.  Translation to C is left as an
exercise for the reader.  :-)  --Larry Wall in <7448@jpl-devvax.JPL.NASA.GOV>


------------------------------

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 2185
**************************************

home help back first fref pref prev next nref lref last post