[7426] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1051 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 19 20:17:29 1997

Date: Fri, 19 Sep 97 17:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 19 Sep 1997     Volume: 8 Number: 1051

Today's topics:
     Re: '0': string or number? you make the call! <rootbeer@teleport.com>
     Re: bitwise xor of strings <rootbeer@teleport.com>
     Re: Call remote perl script in another script <sriram@weblogic.com>
     Re: Client/Server over serial line... <sriram@weblogic.com>
     Compiling perl 5.004_01 and failed sockets (Mark Doyle)
     Re: Confusion with chop/chomp (Steve Lamb)
     Convert To Currency <nada@zilch.com>
     Does Perl Have C's fflush function? <Jonathan.O.Nichols@ast.lmco.com>
     Re: entering debugger programmatically? <rootbeer@teleport.com>
     Executing Shell commands in Perl wchrist@flagmail.wr.usgs.gov
     Re: FILEHANDLE test wierdness (Andrew M. Langmead)
     Hash table reference in regex <bruno_pagis@aur.alcatel.com>
     Re: Help with file I/O problems. <rootbeer@teleport.com>
     Re: HELP! Problems with memory allocation w/PERL <rootbeer@teleport.com>
     Re: HELP: Approaches to storing perl objects in RDBMS <sriram@weblogic.com>
     Re: Linux Perl Bug ? <rootbeer@teleport.com>
     Re: No Sys::Syslog (perl5.004, Solaris 2.5.1) <rootbeer@teleport.com>
     NT 4 and PERL Resources here... (Viper)
     out on a limb ... Re: homogenous/nonhomogenous list tes rbush@up.net
     Re: passing Perl objects across the network <sriram@weblogic.com>
     Re: Perl <=> C Server <rootbeer@teleport.com>
     Re: Perl to Java Compiler? <rootbeer@teleport.com>
     Re: REGEXP: Quickie Newbie Inquiry <sriram@weblogic.com>
     Re: spell check? <rootbeer@teleport.com>
     Re: Web Statistics (Burt Lewis)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 19 Sep 1997 16:21:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Gloudon <jgloudon@bbn.com>
Subject: Re: '0': string or number? you make the call!
Message-Id: <Pine.GSO.3.96.970919161846.21537O-100000@julie.teleport.com>

On 19 Sep 1997, Jason Gloudon wrote:

> The string "0", or a numeric zero value 0 is false in Perl.
> Anything else, including the string "00" or "0.0" is not false.

The empty string is also false. And, to my way of thinking, undef is a
distinct false value, so to me there are just four possible false values.

      0
     ''
     '0'
    undef

(And, if you want to be quite picky, you could argue that 0.0, the
floating point zero, is distinct from 0, the integer zero.) Everything
else is logically true. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 16:13:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ralph Stirling <stirra@wwc.edu>
Subject: Re: bitwise xor of strings
Message-Id: <Pine.GSO.3.96.970919160700.21537M-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Ralph Stirling wrote:

> Bitwise exclusive-or on strings does not seem to work as
> advertised in Prog Perl 2nd Ed. page 88.  

Nope. It's working, it's just not doing what you thought it would.

>         $b = "0101";
>         $c = "0011";

>         print "(1) $b ^ $c=",$b ^ $c,"\n";

> (1) 0101 ^ 0011=				# WRONG

For those people who can't see ASCII control characters ( :-)  that line
includes a null character, a control-A, another control-A, and another
null character. Perl is xoring the hex values 30313031 and 30303131 to get
the hex value 00010100, a four byte string, which is what it's printing
out. Those characters don't show up on most screens.

    sub dumphex {
	print join(" ", map unpack("H*", $_), @_), "\n";
    }
    $b = "0101";
    $c = "0011";
    dumphex $b ^ $c;

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 16:31:18 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
Subject: Re: Call remote perl script in another script
Message-Id: <34230B46.D8DE3AB9@weblogic.com>

> I have two Perl scripts which are on two servers (I have to place
> them on two servers), say site1-perl and site2-perl. I want to run
> site1-perl as a cron job and call site2-perl in site1-perl, let
> site2-perl query a database and then return the results to 
> site1-perl.

Do site1 and site2 have a common filesystem? If so, you can just
use require to load site2-perl into site1-perl.

If they don't share a common filesystem, you could use sockets
to transfer data. Take a look at the URL below, go to the examples
link, download the examples and go to the Networking section. You 
will find a message passing library and an RPC library that will
make it considerably easier to make it a client-server system.

Hope this helps.


- Sriram 


________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com 
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/


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

Date: Fri, 19 Sep 1997 16:00:32 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: Mark Nottingham <mnot@mnot.cyber.com.au>
Subject: Re: Client/Server over serial line...
Message-Id: <34230410.6E15988C@weblogic.com>

> Unfortunately, serial connections are my achilles heel. Are there any good
> tools for getting data over a serial connection reliably from perl? Is it
> just a simple matter of open()ing a bi-directional pipe to the devices?
> 

Serial interfaces and other devices (including keyboards) do not
have OS independent interfaces, so a generic Perl solution 
doesn't exist. If you have a Unix system, however, it should simply 
be a matter of talking to the right device (Famous last words!)

- Sriram 


________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com 
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/


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

Date: 19 Sep 1997 21:45:18 GMT
From: doyle@aps.org (Mark Doyle)
Subject: Compiling perl 5.004_01 and failed sockets
Message-Id: <5vurpe$13c$1@sun20.ccd.bnl.gov>

Hi,

We are trying to compile perl 5.004_01 on a Sequent machine running Dynix/ptx 
4.2.1  -- everything seems to go fine but during make test, the following 
three errors occur:

lib/io_sock.......Unsupported socket function "getprotobyname" called at 
 ../lib/IO/Socket.pm line 474.
FAILED on test 1
lib/io_udp........Unsupported socket function "getprotobyname" called at 
 ../lib/IO/Socket.pm line 474.
FAILED on test 1
lib/socket........Unsupported socket function "socket" called at 
 ./lib/socket.t line 18.
FAILED on test 1

Yet the configure script correctly identifies that the machine supports BSD 
networking and HAS_SOCKET is uncommented in config.h. Is there some other 
configure parameter that would also prevent the sockets from working?

Any help appreciated.

Cheers,
Mark


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

Date: 19 Sep 97 21:45:16 GMT
From: morpheus@calweb.com (Steve Lamb)
Subject: Re: Confusion with chop/chomp
Message-Id: <slrn625tco.orq.morpheus@death.calweb.com>

On Fri, 19 Sep 1997 08:47:09 -0700, Tom Phoenix <rootbeer@teleport.com> wrote:
>When you chomp($remainder) , you're affecting it. When you calculate $dest
>from $remainder later, you're going to get a different value for $dest,
>won't you? If that makes $dest different than $channel, then that behavior
>is what I'd expect.

    OK, let's run the logic on what is happening.

$remainder = "#bottest :blahblahblah\n"
chomp($remainder);
($dest, $remainder) = split(/ /,$remainder,2);

    OK?  $dest should now be "#bottest" and $remainder should be
":blahblahblah".  However, that data fails the if ($channel eq $dest) test.
Now, if I move the chomp after the check, which means that $dest is still
"#bottest" and $remainder is ":blahblahblah\n" it works.  It is only when I
chomp/chop before that check that it fails.

>Maybe. Can you see the newline that may or may not be chomped off? :-) 

    Yes.

print("-$dest-\n");

output:
-#bottest-

not:
-#botttest
-

    Besides, there never was a newline after the channel name in $dest. 
There is always data after that field.  It isn't the part that is getting
chomped!

>Why not just chomp $line in the first place? (Or change the split to drop
>newlines as well.) 

    The former because it is not needed in call case.  In fact, unless the
message is directed at the bot it isn't needed at all.  As for the latter. 
This is my 2nd big self-assigned project in perl so I'm learning.

    I'll most likely place the chomps as far inside the loops as I can to
save some time there.  But the whole idea that it works in one location and
not the other has me quite miffed.

    So far I've gotten three responses and none have explained why moving
that one line causes a portion of the string that isn't even near the
newline to fail.


-- 
             Steve C. Lamb             | Opinions expressed by me are not my
    http://www.calweb.com/~morpheus    | employer's.  They hired me for my
CC: from news not wanted or appreciated| skills and labor, not my opinions!
---------------------------------------+-------------------------------------


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

Date: Fri, 19 Sep 1997 16:32:47 -0700
From: "Jim Durbin" <nada@zilch.com>
Subject: Convert To Currency
Message-Id: <5vv24q$c6k@mtinsc05.worldnet.att.net>

I need to be able to display a number as currency with commas and cents...
$##,###.##
I'm relatively new to Perl and I can't seem to find a reference to this
format anywhere.
The closest I can come is this:

format STDOUT =
$@#####.##
$cashvalue
 .

Works but doesn't place commas in the number.  I could write my own code
that parses the number an inserts the commas where needed but there must be
a module or code sniplet out there that does this already.

Thanks,
-Jim
durbija@worldnet.att.net





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

Date: Fri, 19 Sep 1997 16:09:58 +0100
From: Jonathan Nichols <Jonathan.O.Nichols@ast.lmco.com>
Subject: Does Perl Have C's fflush function?
Message-Id: <342294DB.2D37@ast.lmco.com>

The subject says it all.  Can I flush an output buffer like I can in C
with the fflush function?


jon


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

Date: Fri, 19 Sep 1997 16:45:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Trebus <ktrebus@news.austx.tandem.com>
Subject: Re: entering debugger programmatically?
Message-Id: <Pine.GSO.3.96.970919164350.21537S-100000@julie.teleport.com>

On 19 Sep 1997, Ken Trebus wrote:

> Is there sny way to enter the debugger programmatically. I.E., issue a
> command in the Perl program that will cause it to enter the debugger?

    $DB::single = 1;	# See the perldebug(1) manpage for info

> I can't just run perl -d on the file because it is part of a big build
> process and perl is called many times. 

If you can't use -d, then you can't use the built-in debugger. :-( But you
can still use code (possibly from a module) which will put diagnostic
messages into a file or mail them to you, for example. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 17:11:59 -0600
From: wchrist@flagmail.wr.usgs.gov
Subject: Executing Shell commands in Perl
Message-Id: <874703414.2812@dejanews.com>

I have been trying to execute the following commands in Perl with no
success.  Can anyone help?

open HANDLE, "| taetm" or die "Can't run taetm: $!\n";
print HANDLE <<DONE;
quadplot FROMLIST=list.txt TITLE=test PROJ=SIMP LAT=(10.0,12.0)
LON=(130,170) KM=1.0 CLAT=11.0 CLON=150.o
exit
DONE

close(HANDLE);


taetm is a software package, and quadplot is an application that runs
under taetm.  Starting with FROMLIST, each item in capitals is a parameter
for quadplot, with the appropriate value listed, and all parameters are
supposed to be on the same line.  The exit call terminates the taetm
session.  I was able to do this same thing successfully in the past with a
different application for taetm.  I have put arbitrary print statements
after the open() call, and they appear in the output.  However, when I run
the ps -u command, no taetm process is being started.  Any suggestions on
what I am doing wrong?

Thanks.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 19 Sep 1997 21:48:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: FILEHANDLE test wierdness
Message-Id: <EGrz8D.J23@world.std.com>

mjbjr@primenet.com (Martin Brown) writes:

>Read on closed filehandle <RESULTS_DB_FH> at ./t1 line 132 (#1)
>    (W) The filehandle you're reading from got itself closed sometime
>before now.

As it has been said already, "-e" doesn't test for a filehandles
validity, it test whether the file pointed to by its argument exists.

If you call fileno() on a filehandle it will return undef if the
filehandle is not open. (Has never been opened or has been closed.)

if(defined fileno RESULTS_DB_FH) {
   print;
}
-- 
Andrew Langmead


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

Date: Fri, 19 Sep 1997 19:27:10 -0400
From: Bruno Pagis <bruno_pagis@aur.alcatel.com>
Subject: Hash table reference in regex
Message-Id: <34230A4C.979A701E@aur.alcatel.com>

Usage of hash table reference in a regular expression:

%map = (
        "UID" => "A",
         "PID" => "B");

$msg='<UID>:<PID>';
$msg =~ s/<(\w+)>/$map{\1}/g;
print "$msg\n";

I expect A:B but I've got :

Is it possible to do it in one line ?

Thanks for helping. BRUNO.
~


--
---------------------------------------------------------------
   \                      Bruno Pagis
 ___\o     ___o      ^_o  mailto:bruno_pagis@aur.alcatel.com
 \       _ |\ \     | \/  Phone:(919)850-5174 Fax:(919)850-6670
 /      / \|// \   /_\                 ___
/       \_/  \_/  /                    \ /
                                  A L C A T E L
---------------------------------------------------------------





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

Date: Fri, 19 Sep 1997 16:40:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Icepick <icepick@NOSPAMpclink.com>
Subject: Re: Help with file I/O problems.
Message-Id: <Pine.GSO.3.96.970919162410.21537Q-100000@julie.teleport.com>

On Tue, 16 Sep 1997, Icepick wrote:

> Newsgroups: comp.lang.perl, comp.lang.perl.misc

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

> I'm currently working on a program that reads in a file called "text" 
> and stores it in an @ array, one character per element, then XOR's each
> character with a value, then writes it all out to another file "output" 

You may be able to do this _much_ more efficiently by keeping everything
in one big scalar, since Perl can efficiently XOR one string with another.

> It's the begining of a simple crypto script I'm messing with. 

That's fine if you want to just play with crypto stuff, but if you have
real secrets you should use real crypto. There are Perl modules on CPAN to
help you use existing good algorithms. 

> My problem is that the output file is longer than the input file, and I
> can't figure it out. 

Sounds like an algorithmic error. :-)  Try printing some diagnostic
checkpoints along the way.

> open (INP, "text") || die "can't open \"text\""; # open the file (nicely)

Here's an easier (IMHO) and better (IMHO) way to write that line. Better
because it gives a helpful diagnostic message like "No such file" or
"Permission denied".

    $file = "text";
    open INP, $file or die "Can't open '$file': $!";

> $i=0;
> 
> while (defined ($p[$i]=<INP>)) {
>   $i++;
>  }

The Perl way to do that is like this.

    @p = <INP>;		# Easy, huh? :-)

> $lines=$i;              # number of lines of data

If you need that, then...

    $lines = @p;	# number of lines of data

> $len=0;
> 
> for ($i=0;$i<=$lines;$i++) {

I think you wanted < instead of <= in there, but it won't matter for us.

>  for ($j=0;$j<=length($p[$i]);$j++) {

Same here. (And I think this is where some of your extra characters are
coming from.)

>    $plain[$len]=ord(substr($p[$i],$j,1));    # convert to ascii
>    $len++;
>  }
> }

You're making a gigantic @plain list, with one element for each character,
but you're munging the lines together. Okay, if that's what you want...
:-)

    for (@p) {
	push @plain, unpack("C*", $_);
    }

(I could make that shorter, but it might waste memory.) This is why we say
that real Perl programmers don't use subscripts. :-)  But you don't want
that code because (as I mentioned earlier) you can xor more efficiently a
string at a time rather than a byte at a time. So, I'll stop here.

Have fun with Perl!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 16:16:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Yangmar <yangmar@aol.com>
Subject: Re: HELP! Problems with memory allocation w/PERL
Message-Id: <Pine.GSO.3.96.970919161416.21537N-100000@julie.teleport.com>

On 19 Sep 1997, Yangmar wrote:

> Can anyone shed some light on whether PERL deallocates memory as it
> sequentially processes records or does that need to be programmed into
> the script. 

Perl can't tell that you're not going to be using @big_list any more, so
you should wipe it out or let it go out of scope when you're done with it.
Is that what you're wondering? Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 15:27:51 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: Paul <paul@miraclefish.com>
Subject: Re: HELP: Approaches to storing perl objects in RDBMS
Message-Id: <3422FC67.5474FCAB@weblogic.com>

> 
> I want to use a RDBMS (mSQL) to store my application's Perl objects.
> 
> 1) Am I mad?

I wouldn't know ... but no, this question doesn't establish it :)

> 
> 2) Is there a standard architecture for this kind of implementation?
> How are insert, update and delete methods normally implemented?
> 
> 3) Is it going to be a lot simpler to use an OODBMS?

There is no standard architecture. A lot depends on what values
your objects contain, how they are connected to each other at 
run-time, and what your expectation is in terms of queries.

If all you want is a safe store for your objects, you could use
one of the serialization mechanisms (Look at FreezeThaw or
DataDumper on CPAN, for example) to flatten an object, and simply
dump it into one column of a relational table. This gives you
transaction and multi-user support, but does not give you 
queries. (You can't say, "select all employees where name = 'Paul')

If you want the db to handle queries, you will have to split
up your object into multiple columns. This will give you the ability
to handle a query on attributes with primitive types (strings or
numbers)

In both cases you run into the problem where an object could
be pointing to some other object; the mere act of serializing
one object would end up pulling all other connected objects.
This is the kind of thing that OODBs address well, but I haven't
read anywhere of Perl objects transparently going to an oodb.
I doubt it can be done, but I'll be most happy to be corrected.
The biggest problem is that there is no standard advertised schema for 
a Perl object. That is, it is difficult even for a human to deduce 
the attributes supported by a class. C++ and Java advertise the list
of attributes supported by a class, so you at least have a starting 
point.

My book (see URL below) does have a chapter on Implementing Object
Persistence in Perl, where I have developed a package called
Adaptor which transparently takes an object hierarchy and 
dumps it into an RDBMS or flat-file ("adapts" the object to a 
persistent medium). The package requires that you supply some extra
meta-information, and gives you gives you transactions and query 
support on both. 

You can get the software free off the examples link in the book, but 
you will have to take a look at the book for an explanation of the 
code, and more importantly, the constraints.

Hope this helps.

--Sriram

________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com 
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/


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

Date: Fri, 19 Sep 1997 15:46:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Doug Seay <seay@absyss.fr>
Subject: Re: Linux Perl Bug ?
Message-Id: <Pine.GSO.3.96.970919154315.21537G-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Doug Seay wrote:

> Tom Phoenix wrote:
> 
> > If you want to be sure that Perl knows you've got strings, use harmless
> > quotes.
> > 
> >     "$num1" ^ "$num2"
> > 
> > Either one of these methods produces no unnecessary code in these
> > expressions, which is why I call them "harmless". Hope this helps!
> 
> TomC might not agree.  Sure, in the context of ensuring something is a
> string, the quotes are harmless, but it is a bad habit to pick up. 

It's a bad habit, I completely agree. As I said, it produces no
unnecessary code "in these expressions". In other expressions, it may do
something undesirable. But AFAIK there's no other way to stringify here
that wouldn't be just as undesirable elsewhere.

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 15:56:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kyle Barger <kbarger@haverford.edu>
Subject: Re: No Sys::Syslog (perl5.004, Solaris 2.5.1)
Message-Id: <Pine.GSO.3.96.970919154716.21537H-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Kyle Barger wrote:

> I was trying to use Sys::Syslog and it does not seem to be working. 

> The following code produces no errors, but it also doesn't log anything:
> 
>   #!/usr/bin/perl

Maybe if you turned on -w it would warn in some way. (But I'm not sure
that it would; it's just an idea to try.) 

As the docs say, you have to have a valid syslog.ph file for your system. 
Do you? 

Have you tried stepping through the Syslog code with the debugger? If you
find a place where it may be failing to return a diagnostic, you could
modify it to return one, then run perlbug to submit a patch. That would be
useful.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 22:31:29 GMT
From: lord_viper@accesscom.net (Viper)
Subject: NT 4 and PERL Resources here...
Message-Id: <3423fd2d.375760@news.accesscom.net>

http://www.4images.com/ntperl



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

Date: Fri, 19 Sep 1997 18:52:01 -0600
From: rbush@up.net
Subject: out on a limb ... Re: homogenous/nonhomogenous list test?
Message-Id: <874713013.14485@dejanews.com>

In article <Pine.GSO.3.96.970917125546.28240d-100000@julie.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
>
> On Wed, 17 Sep 1997, Raymond K. Bush wrote:
>
> > Is there an efficient way i can check to see if a list of names is
> > homogenous.  A 1-4 liner please.  Right now i am using a foreach and an
> > if but somehow this seems like the wrong way and slow
>
> It's hard to make it much more efficient than looping over every element,
> since you have to examine each one. You could code it in C, if you really
> need speed. I don't know that it would be much faster. (You could
> potentially make it a tied array which would "know" whether it had more
> than one genus of element, but this might not increase the overall speed.)
>

didn't i read someplace that the short circuit operators were faster than
if's?

couldnt i construct one large "short circuit" expression containing the
elemnts and then evaluate it?  Anyone with ideas about such a thing?

> > (ps i return when i find one entry not like the others)?
>
> Good method.
>
> > ps this link in the faq seems to be broken.
> > http://www.perl.com/CPAN-local/doc/FAQs/FAQ/perlfunc.html
>
> Could you please send that note to the FAQ maintenance address? Thanks.
>
> >       --- reply to rbush - at - up - dot - net ---
>
> I don't know why you're spelling it out in your .sig, since you included
> it properly in the headers... :-)
>
> --
> Tom Phoenix           http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
> Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
>               Ask me about Perl trainings!

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 19 Sep 1997 16:14:16 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: Bueche Charles <tgdbuch4@gd2.swissptt.ch>
Subject: Re: passing Perl objects across the network
Message-Id: <34230748.6E952CE4@weblogic.com>

Bueche Charles wrote:
> 
> Hi all,
> 
> Is there some Perl module enabling easy object passing between
> networked machines ?
> 
> I know I can use the socket libs, but I would like a layer on top of
> it enabling stuff like :
> 
> client :
>     $h = connect(server, process);
>     send(@Perl_array, $h);
> 
> client :
>     $h = listen(server);
>      @Perl_array = receive($h);
> 
> The CPAN section 5 doesn't seem to have such a module. Any pointer
> welcome.
> 

Yes. I have written a message passing library and an RPC layer
on top of it for my new book (see URL below). Download these 
libraries from the examples link. 

The "server" says this:
 use RPC;
 RPC->new_server ("myname.foo.com", # substitue server host name
                  4354              # port on which server is listening
                 );
 RPC->event_loop();

 sub foo {
    print @_;  # This subroutine is called from another process
 }


The client says,
 use RPC;
 $conn = RPC->connect("myname.foo.com", 4354) || die;
 # Call foo() on server, and wait for return value.
 $retval = $conn->rpc("foo", @array); 

Hope this helps. 

(As soon as I get some breathing space I'll move all these
 modules to CPAN)

- Sriram 


________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com 
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/


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

Date: Fri, 19 Sep 1997 16:23:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Gary Mui <gmui@jpmorgan.com>
Subject: Re: Perl <=> C Server
Message-Id: <Pine.GSO.3.96.970919162236.21537P-100000@julie.teleport.com>

On 19 Sep 1997, Gary Mui wrote:

> Is it possible to have a perl program talk to a server written 
> in C that reads and writes normal C structures (as opposed
> to parseable text)?  

Perl doesn't care what language a server is written in nor what kind of
structures the server reads and writes. Perl will talk to any server that
C will talk to. Or are you asking something totally different?

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 16:04:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Piet Barber <pietb@nic.mil>
Subject: Re: Perl to Java Compiler?
Message-Id: <Pine.GSO.3.96.970919160054.21537K-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Piet Barber wrote:

> Tell me if I read this correctly:  I will be able to write a perl program
> (yes, I can do this :-) ).  Run it through a Larry Wall compiler, and then
> I've got a .class file which I could (in theory) use in an applet or a
> java application? 

Yes, basically, this may happen someday. That is, Perl may compile to java
bytecode (which is not the same as java sourcecode). You could then get
Perl to "run" on the Java Virtual Machine. I put that word in quotes
because there are some serious performance issues WRT regular expressions
and other things, which will have to be much slower than they are in
"true" Perl. 

But Larry Wall has said that the JVM is a platform to which Perl could be
ported.

> Does this mean I won't have to learn that silly JAVA language that
> everybody's howling about?

No. You never had to learn that language in the first place. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 19 Sep 1997 16:48:03 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: SPIRE demo account <dj_soler@pnl.gov>
Subject: Re: REGEXP: Quickie Newbie Inquiry
Message-Id: <34230F33.18136020@weblogic.com>

> How do I search for a line that contains only capital letters?  

Another way to say it is, "How do I search for a line that contains
anything that is not a capital letter (or some other desired 
punctuation)"? 

  unless /[^A-Z\s]/) { # unless it matches any non-capital or non-white
                       # space
      ...
  }


- Sriram 


________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com 
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/


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

Date: Fri, 19 Sep 1997 16:41:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nik Trivedi <nikhil@backlash.net>
Subject: Re: spell check?
Message-Id: <Pine.GSO.3.96.970919164109.21537R-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Nik Trivedi wrote:

> Is there a perl module that will spell check form data?  

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

Of course, you could call a program like ispell, if that's on your
machine. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 19 Sep 1997 22:50:51 GMT
From: burt@ici.net (Burt Lewis)
Subject: Re: Web Statistics
Message-Id: <5vuvkb$al2$1@bashir.ici.net>

Fire up you favorite Search Engine and search for Perl5.  There are tons of 
sites that point to archives, shareware, freeware, examples, tutorials, etc.

Burt Lewis
www.eastonmass.com 


In article <3422DEE1.62C8D3D2@nortel.ca>, nmahesh@nortel.ca says...
>
>Hi,
>I am a newbie at perl, hence this.
>Is there a module or a tool that I can use to analyse the hits on web
>pages? I would be highly obliged if you could point me in the right
>direction. ( I looked on CPAN, but couldn't find anything suitable... if
>there is, please attribute the above remark to my ignorance!!!) . The
>platform would be UNIX
>
>Apologize for the inconvenience,
>Thanks in advance
>
>Mahesh Narkar
>
>p.s.: please cc your reply to me email id: nmahesh@nortel.com
>



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

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

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