[6742] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 367 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 24 23:07:18 1997

Date: Thu, 24 Apr 97 20:00:20 -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           Thu, 24 Apr 1997     Volume: 8 Number: 367

Today's topics:
     Re: Any graphic module available? <cphillip@kerr.phys.utas.edu.au>
     Re: C++Builder means Future. <mbracey@interaccess.com>
     Re: cc/make Problems Compiling Perl Modules Under IRIX  <scotth@sgi.com>
     Re: cc/make Problems Compiling Perl Modules Under IRIX  <bugaj@bell-labs.com>
     complex datatype notation <sfink@cs.berkeley.edu>
     Re: Counting in a global search (Tad McClellan)
     flock in SCO version (Michael Putch)
     Getting E-Mail Address Thorugh CGI <anil@inta.net.au>
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <garrigue@safran.kurims.kyoto-u.ac.jp>
     Re: Ousterhout and Tcl lost the plot with latest paper (Jon S Anthony)
     Perl Programmer Wanted (Steve Kohler)
     Re: Preferred style of "named parameter" subroutine arg <senelson@negentropy.com>
     Read from Serial port on LINUX <dveldhui@ionet.net>
     Socket Problem? Installing Perl on AIX4.1.4 scip4154@nus.sg
     Re: switch and if <sfink@cs.berkeley.edu>
     Re: URL for good PERL manual (brian d foy)
     Re: Verifying URL's <NOSPAMsib@worldnet.att.net>
     Re: Verifying URL's <tchrist@mox.perl.com>
     Re: Who will win?  Borland or Microsoft or Programmers? <hgilkey@cs.clemson.edu>
     Windows95, emacs and perldb alperin@mpi.com
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 25 Apr 1997 11:58:03 +1000
From: Chris Phillips <cphillip@kerr.phys.utas.edu.au>
To: gis84514@cis.nctu.edu.tw
Subject: Re: Any graphic module available?
Message-Id: <Pine.GSO.3.94.970425115309.20534B-100000@kerr.phys.utas.edu.au>


> 
> gis84514@cis.nctu.edu.tw (fish) writes:
> > 
> > I use perl to write CGI programs, it will process some data and then
[snip]
> > I know pgperl, but it require fortran compiler....

Not entirely true. If you are running Linux just download the
binaries (from a sunsite mirror for eg).

pgperl will also compile with f2c or g77. This is what is used on
Linux and there is no reason to think it would not work on other unix
varieties.

I highly recommend pgperl and it sounds like it is well suited to
what you want to do.

Cheers
Chris Phillips

-------------------------------------------------------------------
Department of Physics, Radio Astronomy Group, University of Tasmania
email: Chris.Phillips@phys.utas.edu.au
Phone:  (03) 62262405 (Work),  (03) 62485285 (Telescope)
        (03) 62278324 (Home),  (03) 62262410 (Fax)





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

Date: Thu, 24 Apr 1997 19:47:21 -0500
From: Mark Bracey <mbracey@interaccess.com>
Subject: Re: C++Builder means Future.
Message-Id: <335FFF19.4B8A@interaccess.com>

Darin Johnson wrote:
> 
> I doubt this.  From what I've heard, it's along the lines of Delphi,
> which does NOT write code for you in any significant amount.  All it
> does is stick appropriate calls to library functions in your code.
> And it sticks it in the right place.  But it's hardly writing code for
> you.  It's a GUI builder, with database support.
> 

You don't consider creating a derived class for every form you create by
putting in declarations for the various components you place on the
screen as class member declarations.  Or how about creating class member
functions for every event that you write a handler for.  Or how about
the fact that it removes those declarations that don't have any code
created for you.  Or how about the ability to generate frameworks for
various application types (MDI,SDI, Win95).

I have yet to see it put in calls to library functions, and I have used
it about 12 hours a day for the last year. Are you sure you aren't
talking about something else?

Mark


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

Date: 24 Apr 1997 18:10:31 -0700
From: Scott Henry <scotth@sgi.com>
Subject: Re: cc/make Problems Compiling Perl Modules Under IRIX 6.3 (& perhaps with gmake & gcc & the IRIX libraries...)
Message-Id: <yd8g1wf3o1k.fsf@hoshi.engr.sgi.com>

>>>>> "S" == Stephan Vladimir Bugaj <bugaj@dnrc.bell-labs.com> writes:

S> The first module that bails on me is IO-1.15, and it does this:

S> kosciuszko 318# make test
S>         cc -c  -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000
S> -I/usr/local/include -DLANGUAGE_C -O     -DVERSION=\"1.15\"
S>  -DXS_VERSION=\"1.15\"  -I/usr/local/lib/perl5/IP22-irix/5.003/CORE 
S> IO.c
S> cfe: Warning 799: /usr/include/sys/time.h, line 66: 'long long' is not
S> standard
S> ANSI. (3.1.1)
S>  typedef signed long long stamp_t;

Well, that one is due to compiling "-ansiposix".  "-xansi" (the
default for the SGI compilers) would at least get rid of the
warning.  I've made that change for all my Perl builds (including
the ones we're shipping in IRIX-6.4 and later).  And when compiling
'-32', "long long" is still done as 2 32-bit ops.

S>  --------------------^
S> cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
S> Syntax
S> Error
S>  extern   sigjmp_buf    top_env ;
S>  --------------------   ^
S> cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
S> Empty
S> declaration specifiers (3.5)
S>  extern   sigjmp_buf    top_env ;
S>  --------------------   ^
S> *** Error code 1 (bu21)

I don't see anything obvious, unless it is an artifact of perl
bueing compiled with SGI compilers and you using the GNU compiler...

The only other thing that I can suggest (it's not clear if you did,
in fact do this) is to make sure to not rely on PATH, but to use the
full path to the perl you want to buld the module for. Ie:

        /usr/sbin/perl5.002 Makefile.PL

type of thing.

-- 
 Scott Henry <scotth@sgi.com> /  Help! My disclaimer is missing!
 IRIX MTS,                   /  GIGO *really* means: Garbage in, Gospel Out
 Silicon Graphics, Inc      /  http://reality.sgi.com/scotth/


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

Date: Thu, 24 Apr 1997 21:52:27 -0400
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: cc/make Problems Compiling Perl Modules Under IRIX 6.3 (& perhaps with gmake & gcc & the IRIX libraries...)
Message-Id: <33600E5B.78@bell-labs.com>

Addendum to my previous post:

I just tried compiling the IO-1.15 module at home on an SGI Indy R4000
running IRIX 6.2 
with the 6.2 IDO and it also fails, but it only complains about perl.h
not time.h as well.
(This machine doesn't have gcc on it yet, but I have no reason to belive
that installing it
would make anything any better...)

Here is what it reports:

[9:31pm]arakis-h:IO-1.15> make 
cp IO/Pipe.pm ./blib/lib/IO/Pipe.pm
cp IO/Select.pm ./blib/lib/IO/Select.pm
cp IO/File.pm ./blib/lib/IO/File.pm
cp IO.pm ./blib/lib/IO.pm
cp IO/Socket.pm ./blib/lib/IO/Socket.pm
cp IO/Seekable.pm ./blib/lib/IO/Seekable.pm
cp IO/Handle.pm ./blib/lib/IO/Handle.pm
      /usr/local/bin/perl -I/usr/local/lib/perl5/IP22-irix/5.003
-I/usr/local/lib/perl5 /usr/local/lib/perl5/ExtUtils/xsubpp  -typemap
/usr/local/lib/perl5/ExtUtils/typemap IO.xs >IO.tc && mv IO.tc IO.c
Please specify prototyping behavior for IO.xs (see perlxs manual)
        cc -c  -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000
-I/usr/local/include -DLANGUAGE_C -O     -DVERSION=\"1.15\" 
-DXS_VERSION=\"1.15\"  -I/usr/local/lib/perl5/IP22-irix/5.003/CORE  IO.c
14819:cc: rld: Warning: elfmap: running new 32-bit executable but
finding old 32-bit shared objects with matching DSO name in the search
path.  You may not have set the environment variables correctly, please
set LD_LIBRARY_PATH for old 32-bit objects, LD_LIBRARYN32_PATH for new
32-bit objects and LD_LIBRARY64_PATH for 64-bit objects -- continue
searching ...
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Syntax Error
 extern   sigjmp_buf    top_env ;
 --------------------   ^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Empty declaration specifiers (3.5)
 extern   sigjmp_buf    top_env ;
 --------------------   ^
*** Error code 1 (bu21)

The LD_LIBRARY_PATH gibberish is, probably, either because SGI doesn't
like to ship upgrades all at once
(especially libraries - we've had other more critical problems with this
bad little habit of SGI's before) or because one of the installers
failed to set the path variables correctly.  (This particular warning
seems to be fairly benign, I haven't seen anything actually fail because
of it yet, and since the error is so similar to the O2 which has all the
right libraries and pathnames I don't think this is the problem here.)
    
So now compiling IO has failed on two machines, both complaining about
perl.h and one complaining about time.h.  Before I go and strip off this
install of Perl5.003 and build 5.004b and try it with that, I'm going to
wait to see if these postings generate any responses.

Thanks.

LL+P,
Stephan


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

Date: Thu, 24 Apr 1997 18:39:36 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
Subject: complex datatype notation
Message-Id: <33600B58.493E@cs.berkeley.edu>


When programming perl, I often want to comment my complex data
structures (lists of hashes of pairs of indexes and names, say). I've
developed somewhat accidentally a notation for specifying these things,
and would like to know if (1) anyone else has done this, (2) what people
think of my notation, and (3) whether any of the automatic data dumper
sorts of tools print things out in a related notation. In the long term,
it would be nice to have agreed-upon conventions for comments, although
many of you would probably prefer to just shoot people like me who use
things this wacky so frequently.

Anyway, here's what I use:

(x) : List of type x
(x, y) : Tuples (implemented as perl lists) of length 2, first element
being x, second y.
(x => y) : Lists of y whose indices can be thought of as x
{ x => y } : Hash tables with key type x, value type y (except note
below)
[ ... ] : Same as ( ... ), except a reference to the list
{ ... } : Anywhere but the top level, a reference to the hash table. At
the top level, either a reference or the hash itself, depending on its
context (the variable being described.)

Examples:
@people = (name) : List of names
%people = { name => picture_filename } : Assoc. array mapping names to
pictures
$people = { name => picture_filename } : Same as above, but a ref to the
array
$people = { name => [ age, salary, shoesize ] } : Getting the hang of
it?
@Rule = ( rule => [ lhs, (rhs) ] ) : An actual example from my code.
This is an array, indexed by rule number, of arrays whose first element
is an lhs (left-hand side of a grammar production, actually), and whose
remaining elements are the rhs symbols. (Using the notation, [ lhs,
(rhs) ] is equivalent to [ lhs, rhs1, rhs2, ... ], but this is shorter
and more clear.)

Another real example:
@ErrorDescs = ( stagenum => [ index => errstring ] )

I had a set of error messages, divided into stages (it was for checking
the output of a student's compiler, and they were allowed to abort after
detecting any error in a particular stage). Each stage contained a set
of error messages. I used the index into the array of error messages as
the identifier (which is why I named it index), and the array was of
strings representing the errors.

The 'base type' of the above is an array of references to arrays of
strings. Adding the semantic information into that, it's an array
indexed by stage number of references to arrays indexed by error indices
of error strings. You'll at least agree that my notation is more
comprehensible than the above description?

So am I being hopelessly convoluted and cryptic? Should I forget about
this and start using named fields for everything, and wrap things up as
objects, and all of that wonderful ADT stuff? Or would other people find
a common convention like this useful, in particular for understanding
other people's code? (I find it invaluable for writing my own, since
otherwise there's no way I can remember if it should be
$x->{'john'}->[0] or $x{'john'}->{0} or whatever.)


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

Date: Thu, 24 Apr 1997 16:00:38 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Counting in a global search
Message-Id: <mlhoj5.565.ln@localhost>


David Waring (dwaring@fhcrc.org) wrote:
: This seems like a very obvious problem, but I can't find the answer anywhere.

Did you, perhaps, look at the perlop man page, where m//g is described?

------------------
The C</g> modifier specifies global pattern matching--that is, matching
as many times as possible within the string.  How it behaves depends on
the context.  In a list context, it returns a list of all the
substrings matched by all the parentheses in the regular expression.
If there are no parentheses, it returns a list of all the matched
strings, as if there were parentheses around the whole pattern.
------------------


: If I search for a pattern in a globally can I find out how many times it
: matched?

Give it a list context, as the man page says, and then count the
elements in the list:

@matches = /(pattern)/g;

print scalar(@matches), " matches were found\n";



: I want to count the number of times a particular character is found in a
                                      ^^^^^^^^^^^^^^^^^^^^^^
: single word string.  


tr/// will be much faster for that:

$matches = tr/a/a/;              # replace 'a' with 'a'  ;-)

print "$matches were found\n";


: If this is possible, is it also possible in a
: substitution (s/ / /) context?

Nope.

It _is_ possible with s///g though ;-)
                          ^
                          ^

$matches = s/a/a/g;             # don't use regexs when you don't have to
                                # use tr/// for this particular one
print "$matches were found\n";


: Obviously this can be done looking at one character at a time, but I
: figured it must be possible in a single line.


: Thanks in advance

You're welcome, hope this helps.

--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Fri, 25 Apr 1997 00:29:23 GMT
From: putch@netcom.com (Michael Putch)
Subject: flock in SCO version
Message-Id: <putchE9640z.24t@netcom.com>



   Does anyone know the story behind why the flock function does not seem 
to have been implemented in Perl 4.x and 5.x for SCO?  I know the 
underlying functions exist.  Is this similar to the apparent problem with
flock in Solaris?  Is there a 5.x version somewhere where this has been 
fixed?



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

Date: Fri, 25 Apr 1997 10:24:45 +1000
From: Anil Gupta <anil@inta.net.au>
Subject: Getting E-Mail Address Thorugh CGI
Message-Id: <335FF9CD.22B2@inta.net.au>


Hi There..

I was wondering, whether it is possible to get someone's E-Mail address
without them having to give it to you?

Maybe somehow in Perl thorugh CGi?

If you know how I would greatly appreciate it.

Thanks.



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

Date: 25 Apr 1997 10:53:35 +0900
From: Jacques GARRIGUE <garrigue@safran.kurims.kyoto-u.ac.jp>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <l2enbzrhpc.fsf@safran.kurims.kyoto-u.ac.jp>

fox@c a t . n y u . e d u (David Fox) writes:

> In article <l2lo6d9i98.fsf@safran.kurims.kyoto-u.ac.jp> Jacques GARRIGUE <garrigue@safran.kurims.kyoto-u.ac.jp> writes:
> 
> ] Let's see a small example:
> ] 
> ] (TCL)
> ] button .b -text Hello -font {Times 12} -relief sunken
> ] 
> ] (LablTk)
> ] let b = Button.create parent:top text:"Hello" font:"Times 12" relief:`Sunken
> ] 
> ] Again, the syntax is not more difficult. Allegedly a little bit more
> ] verbose, but not really bothering. The difference is that everything
> ] that can be checked is checked at compile time (or even before, using
> ] the interactive editor):
> 
> I've been pondering this issue of scripting vs. programming, and the
> two communities they represent.  I think this example captures the
> conflict pretty well.  To someone writing a script, the subtle control
> and data structures are just extraneous and annoying: Create?  Of
> course, what else?  Parent:top?  Who cares?  The difference between
> the two examples is small in terms of the amount of text, but to the
> script writer the additions are just annoying.  Its like having to
> write "and" between each entry in your grocery shopping list.

Well, for parent:top, you care: in Tk, the parenting of widgets is
fixed. Tcl does that by name: writing button $w.b, like you often do
in Tcl, is the same thing as "let b = Button.create parent:w".

For create the need is clear again, this is to provide a neat module
structure. You could argue that one can do without it in a scripting
language, but as soon as your script is integrated in an application,
hard to avoid it, or you will have serious name space problems.

> The scripting community will always be much larger than the
> programming community, but you can't have one without the other.  So
> there is no point to getting the world to stop using simple languages.
> No offense, but its a little like trying to teach a pig to sing.  Its
> a waste of time and it annoys the pig.

You may have a point. Scripting languages will always be simpler than
programming languages, since they are more specialized, and do not
care about security.

But, the problem is that very often scripts grow in size, to a point
such that

 1) it becomes impossible to maintain them 

 2) speed arises as a real problem

If the goal of your script is limited enough that those two problem
will never happen, you are erfectly happy with scripting -- many
people are in this situtation.

But, if you bump eventually into one of these problems, you certainly
have better learn a programming language. In the medium term, this is
a good investment.

By the way, what I was pointing here is just that programming
languages can become very close to scripting ones, close enough that
the productivity argument does not go to the script side. No doubt,
nothing free: there is a learning cost.

	Jacques

---------------------------------------------------------------------------
Jacques Garrigue	Kyoto University      garrigue@kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>


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

Date: 25 Apr 1997 00:47:57 GMT
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <JSA.97Apr24204757@alexandria>

In article <E93EJr.IBr@research.att.com> ark@research.att.com (Andrew Koenig) writes:

> C++ built on C precisely so that it would appeal to the existing C community.
> As a result, support tools, a body of knowledge, and a community came along
> more readily than they would have if the language had been designed totally
> from scratch.  And that knowledge and community, and those tools, are among
> the main reasons why C++ is now in widespread commercial use and so many
> of the designed-from-scratch languages are not.

I would go further and say this is pretty much the _only_ reason why
C++ has such widespread use.  But, in the current context, this is
really just the same tired old claim that "C++ is better than X,
because C++ is more popular than X".  A claim that was always dubious
and which has certainly long since lost any plausibility that it might
have ever had.

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com



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

Date: 25 Apr 1997 02:14:51 GMT
From: skohler@mindspring.com (Steve Kohler)
Subject: Perl Programmer Wanted
Message-Id: <5jp42r$f8m@camel4.mindspring.com>


Wanted:  Perl Programmer, Atlanta, GA area.
Light perl programming for web sites.

Knowledge of Perl 4-5 needed. 10-20 hours per
week.  Flexible schedule. Your place or ours.

Steve Kohler
Apparel Exchange
404 296 8602
www.apparelex.com



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

Date: Thu, 24 Apr 1997 17:35:37 -0700
From: Steve Nelson <senelson@negentropy.com>
Subject: Re: Preferred style of "named parameter" subroutine args?
Message-Id: <335FFC59.11FE@negentropy.com>

I'm with you (method #1), except that I generally stick the keys
in quotes as well.  (I realize that this is usually not necessary, but I
think it's a good habit.)  On longer argument lists, I've been known to
leave a trailing comma; it looks somewhat ugly, but avoids frequent
errors that I was having when adding stuff to the end.  Generally, I
pass the args as an anonymous hash, since rumor has it that that's
slightly faster.  So:

       func({
        'Name'     => 'Fred',
        'Age'      => 23,
        'Birthday' => '12/31/69',
       });

Eryq wrote:
> 
> Up until now, I've been using mixed-case with a leading capital,
> like this:
> 
>         1. func(Name=>"Fred", Age=>33);
> 
> That seems to be the safest, because the leading capital ensures
> that I won't accidentally bump into a reserved word in the future.
> However, I've seen other styles:
> 
>         2. func(name=>"Fred", age=>33);
> 
>         3. func(-name=>"Fred", -age=>33);
> 
>         4. func(NAME=>"Fred", AGE=>33);
> 
> Is there a consensus, formal or informal, about what the preferred
> form is?   My perlstyle (5.002) manpage doesn't mention it.
> 
> Jes curious,
> --
>   ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
>  / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
> |  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
>  \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
>            |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: Thu, 24 Apr 1997 15:49:03 -0500
From: Doug Veldhuisen <dveldhui@ionet.net>
Subject: Read from Serial port on LINUX
Message-Id: <335FC73F.41C67EA6@ionet.net>

I am trying to write a perl script that will read data from a 
serial port on a Linux box.  What I need to do is just simply? 
read from the serial port and not write back.  The device that is
sending me my data is another unix box that is writing to ITS serial
port as a serial printer device.

Here is a copy of the script that I have so far:

#!/usr/bin/perl -w

use FileHandle;
use Fcntl;

sysopen(TTYPORT, "/dev/cua1", O_RDONLY | O_NOCTTY | O_NONBLOCK) or die
"problem here\n";

vec($rin, fileno(TTYPORT), 1) = 1;
while () {
    if (select($rout=$rin, undef, undef, undef)) {
        sysread(TTYPORT, $BUFFER, 80);
        print "Buffer contents:  $BUFFER\n";
     }
}


What happens is from the other computer I that I read from I do
an:  echo this is a test > /dev/tty3b.
Nothing shows on the linux box.  By putting some debug print statements
I find the script is stopping on the select statement.  So I figure
that I have something wrong there.

I do know that the serial connection between the two boxs is OK.  As
a test I ran KERMIT and the went to the other machine and did the
echo test and the output line appeared in the kermit screen.

Is what I am trying to do with PERL and serial i/o on a unix
box legal?  or am I trying to do something it wont do?


Doug Veldhuisen
Reda Pump
dveldhui@ionet.net


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

Date: Thu, 24 Apr 1997 21:11:48 -0600
From: scip4154@nus.sg
To: scip4154@nus.sg
Subject: Socket Problem? Installing Perl on AIX4.1.4
Message-Id: <861891670.5753@dejanews.com>


Recently I was trying to install perl 5.003 on an AIX machine.
I d/l the perl5.003.tar.gz file from a CPAN site, and after
unpacking, I ran the ./Configure first. I gave "gcc" (which is the
newest 2.7.2.2 version). And at one point where it prompted the
options(something like "-qmaxmem=8192..."), I entered "none", because
"-qmaxmem=8192..." are not valid options for my gcc. And the "make
depend" and then the "make" ran smoothly, although there were some
warnings about lacking the library "-lucb" or the like. Then I "make
test", and found all were ok except for 8 routines:

lib/anydbm.....FAILED on test 0
lib/filehand...FAILED on test 0
lib/ndbm.......FAILED on test 0
lib/odbm.......FAILED on test 0
lib/posix......FAILED on test 0
lib/safe.......FAILED on test 0
lib/sdbm.......FAILED on test 0
lib/socket.....FAILED on test 0
Failed 8/94 tests, 91.49% okay.

What I concern is the "socket" part, because I need to install IO and
libnet modules so that I could use LWP, but all these requre a good
socket modue installed. Any kind sole can tell me what might be wrong,
and what I could do to make this "socket" stuff running? I had tried
installing perl and LWP on a linux machine before but didn't have this
problem, so I guess it might be a platform-dependent problem.

Thanks for any help.

Regards

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


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

Date: Thu, 24 Apr 1997 19:30:27 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
To: Chris Pratt <chrisp@nafohq.hp.com>
Subject: Re: switch and if
Message-Id: <33601743.6380@cs.berkeley.edu>


> And here're my results:
> Benchmark: timing 100000 iterations of andswitch, if-then...
>  andswitch:  0 secs ( 1.18 usr  0.00 sys =  1.18 cpu)
>    if-then:  0 secs ( 0.45 usr  0.00 sys =  0.45 cpu)

But why limit yourself to just those two methods? :)

----

use Benchmark;

$x = 8;

$simple = { 1 => sub { $foo = "one\n" },
	    2 => sub { $foo = "two\n" },
	    3 => sub { $foo = "three\n" },
	    4 => sub { $foo = "four\n" },
	    5 => sub { $foo = "five\n" },
	    6 => sub { $foo = "six\n" },
	    7 => sub { $foo = "seven\n" },
	    8 => sub { $foo = "eight\n" },
	  };

timethese( 100_000, { 'if-then' => '

    if ($x == 1) { $foo = "one\n"; }
    elsif ($x == 2) { $foo = "two\n"; }
    elsif ($x == 3) {  $foo = "three\n"; }
    elsif ($x == 4) {  $foo = "four\n"; }
    elsif ($x == 5) {  $foo = "five\n"; }
    elsif ($x == 6) {  $foo = "six\n"; }
    elsif ($x == 7) {  $foo = "seven\n"; }
    elsif ($x == 8) {  $foo = "eight\n"; }
'

, 'andswitch' => '
  SWITCH: {
	($x == 1) and  $foo = "one\n", last SWITCH;
	($x == 2) and  $foo = "two\n", last SWITCH;
	($x == 3) and  $foo = "three\n", last SWITCH;
	($x == 4) and  $foo = "four\n", last SWITCH;
	($x == 5) and  $foo = "five\n", last SWITCH;
	($x == 6) and  $foo = "six\n", last SWITCH;
	($x == 7) and  $foo = "seven\n", last SWITCH;
	($x == 8) and  $foo = "eight\n", last SWITCH;
    }
', 'subhash' => '

&{{ 1 => sub { $foo = "one\n" },
    2 => sub { $foo = "two\n" },
    3 => sub { $foo = "three\n" },
    4 => sub { $foo = "four\n" },
    5 => sub { $foo = "five\n" },
    6 => sub { $foo = "six\n" },
    7 => sub { $foo = "seven\n" },
    8 => sub { $foo = "eight\n" },
}->{$x}}();

', 'preset' => '

&{$simple->{$x}}();

'});

__END__


Results:

 andswitch: 14 secs (10.52 usr  0.03 sys = 10.55 cpu)
   if-then:  9 secs ( 7.31 usr  0.02 sys =  7.33 cpu)
    preset:  7 secs ( 5.77 usr  0.03 sys =  5.80 cpu)
   subhash: 48 secs (43.77 usr  0.05 sys = 43.82 cpu)

Uh oh. That wasn't supposed to happen. The stupid sub ref method was
faster! Please, nobody take this as a justification to start using that
method. Although it does cast some serious doubts onto the claim that
it's all compiled to a jump table internally: my manual jump table is
faster than the internal one??? Can someone explain this? Awright,
where's a perl internals hacker when you need one?

(Note: I used a hash table ref for generality. I also tried using a
simple array, and it was consistently 5% *slower*! Huh???)


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

Date: Fri, 18 Apr 1997 18:48:29 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: URL for good PERL manual
Message-Id: <comdog-1804971848290001@nntp.netcruiser>

[redirected to comp.lang.perl.misc]

In article <5j147k$mn2@Holly.aa.net>, Mitchell Price <mprice@4dcomm.com> wrote:

> Is there a recommended place for downloadable PERL manual on the NET?

look for a local CPAN [1]. all sorts of good stuff there.


[1]
CPAN - Comprehensie Perl Archive Network.  find one through
<URL:http://www.yahoo.com>

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Thu, 24 Apr 1997 21:32:35 -0400
From: Scott Blanksteen <NOSPAMsib@worldnet.att.net>
Subject: Re: Verifying URL's
Message-Id: <336009B3.6FB5@worldnet.att.net>

> Is there a way to verify URL's in Perl?  For instance, let's say I
> have a form and someone submits a URL to my Perl script.  I want my
> script to check out and see if the URL is valid.  Is this possible?

Do you mean

1) The URL is of a valid format

or 

2) The URL exists and points to a page

For 1), see 
        <http://www.ny.fnx.com/abigail/Perl/url.html>

For 2), see 
        <http://www.stonehenge.com/merlyn/WebTechniques/col07.html>

In general, Clay Irving's Perl Reference, 
<http://www.panix.com/~clay/perl/>, is a good place to go after 
<http://www.perl.com/perl/index.html>.

Scott


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

Date: 25 Apr 1997 01:43:13 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Verifying URL's
Message-Id: <5jp27h$hdv$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, niksun@lconn.net (Niksun) writes:
:Is there a way to verify URL's in Perl?  For instance, let's say I
:have a form and someone submits a URL to my Perl script.  I want my
:script to check out and see if the URL is valid.  Is this possible?

Yes.

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

Fifty years of programming language research, and we end up with C++ ???
                                    --Richard A. O'Keefe


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

Date: Thu, 24 Apr 1997 19:34:32 -0400
From: "Harold C. Gilkey" <hgilkey@cs.clemson.edu>
Subject: Re: Who will win?  Borland or Microsoft or Programmers?
Message-Id: <335FEE08.209E@cs.clemson.edu>

Can someone explain to me just what this thread has to do with *UNIX
Security* ??

Just wondering ...



yuka@co.tokyo.jp wrote:
> 
> Actually Borland should vanish because their compilers are too good.  It
> make programming so easy that in 2 years their will be no need of
> programmers like myself. Think about it, after all their are finite
> amount of computer program human kind may need, like (WP dBase, Invoice,
> etc.)  It is expected that after few years their will be no more
> programs to write because Microsoft and other big companies will write


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

Date: Thu, 24 Apr 1997 21:27:12 -0400
From: alperin@mpi.com
Subject: Windows95, emacs and perldb
Message-Id: <33600870.5E4B@mpi.com>

I'm trying to run the perl debugger within emacs on 
Windows 95.   I'm able to run the debugger (using perl -d)
on the command line, but it takes an awfully long time
to run (30-60 seconds before getting the debugger prompt)

However, when I try to run from within emacs, emacs hangs.

Any ideas?
Thanks.
-Geoff Alperin


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

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

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