[6475] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 100 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 12 10:17:21 1997

Date: Wed, 12 Mar 97 07:00:25 -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           Wed, 12 Mar 1997     Volume: 8 Number: 100

Today's topics:
     Re: !!!help me please!!! <hlein@progressive-comp.com>
     Re: "My" ruminations (Andrew M. Langmead)
     2way socket communications <ldadams@mindspring.com>
     Re: ANNOUNCE:  IO::Format 0.02 (perl formats, object or <tchrist@mox.perl.com>
     ANNOUNCE: libnet-1.05 <gbarr@ti.com>
     Re: Does Llama book really cover perl 5? Yes! (Kent Perrier)
     Re: flock() problem <merlyn@stonehenge.com>
     GD.pm newFromGif problem (Dean Ashby)
     Re: Grep function question (Tad McClellan)
     grep question (Triantafyllos Marakis)
     Re: help with printing to a socket netkid@netcom.com
     Re: Interactive drawing alternatives in perl? (Bill)
     Re: Is possible in perl run a string like a piece of pr (brian d foy)
     Re: Is possible in perl run a string like a piece of pr (Honza Pazdziora)
     Re: ISBN/Checkdigit calculator <syer@mpa-garching.mpg.de>
     Re: Learning Perl's object-oriented features (Andrew M. Langmead)
     Re: Learning Perl's object-oriented features (Jay Flaherty)
     MacPerl5 <js@ix.heise.de>
     Re: Making sure 'perl -v' works (Bill)
     Re: On implementing tie <roderick@argon.org>
     Re: Q:How to turn off taint checking locally in a funct <roderick@argon.org>
     Re: What's a good Perl book? (Bradley Alan)
     Re: WWW, and grabbing input from a command (brian d foy)
     Re: year 2000 question (Dan Ellsweig (Enterprise Management))
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Mar 1997 13:37:53 GMT
From: Hank Leininger <hlein@progressive-comp.com>
Subject: Re: !!!help me please!!!
Message-Id: <5g6bji$s03@ns2.southeast.net>

Rajesh Gottlieb <rajeshg@ccwf.cc.utexas.edu> wrote:
> On Thu, 27 Feb 1997, Allen Joslin wrote:

> > 	I'm trying to learn enough perl to modify a script called WWWBoard (by
> > Matt Wright, who I've tried to contact -- unsuccessfully) in order to
> > hide any/all obtainable user info in the posted messages, to try to help
> > catch anonymous posters of obscene msgs.
> > 
> > 	I've found the $ENV 'REMOTE_HOST' but it only seems to take me back to
> > the users' host.  I can't seem to get the users' id/username.  Is that
> > possible?

That's extremely difficult, if not impossible, to do with standard HTTP
requests, since it's not something that's built into the protocol.  You can
insist that people log in when they first enter your board area, and/or
that they preregister accounts.  You can use the standard webserver-
supported methods of authing (look in your httpd's documentation about
 .htaccess and .htpasswd files), or by using cookies.  Either of those
should probably be asked in an httpd/CGI specific newsgroup; they're not
really perl questions.

If the incoming connection is from a UNIX machine which supports fingerd,
or (better) identd, you may be able to use these to at least guess who is
siting on the other end of the connection.  But, these will only work if
the remote admin is not too worried about the potential security issues
they raise, and for that matter, if the remote admin doesn't feel like
having his system lie to you.  This, again, is even farther from
comp.lang.perl.* ;)

> > 	Is there a list of $ENV somewhere?

Shorter (but somewhat less readable) than Raj's solution would be:

#!/usr/local/bin/perl

foreach (keys %ENV) { print "$_ $ENV{$_}\n"; };

TMTOWTDI.

> > 	What's the best way to identify a user of a site that's running perl
> > scripts?

See above.  There are a few methods to choose from, but none is entirely
reliable.  Cookies (much as I personally dislike them) are one of the 
best solutions in terms of giving you, the programmer, options you can do
stuff with.


Hank Leininger <hlein@progressive-comp.com>
Senior Systems Integrator
Progressive Computer Concepts, Inc
(800)580-2640


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

Date: Wed, 12 Mar 1997 12:09:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: "My" ruminations
Message-Id: <E6xJ3B.HBH@world.std.com>

mattera@ssga.ssb.com (Luigi Mattera) writes:

>  I recently slapped "use strict" into my Perl programs and watched
>them crash and burn due to variables not being declared.  Ok, that was
>no problem.  I found out that the correct way to do this was via the
>"my" keyword.

This may be nitpicking, but "strict" pragmatic module does not cause
perl to require variables to be declared. It requires all variables to
be localized with the my() operator, be referenced with its fully
qualified name, or be declared as being exempt from the detection with
the "use vars" pragma. There are a couple reasons why I make the
distinction.

First of all, I want to make sure you realize that "use strict" isn't
just there to turn perl into a B&D programming language. (Perl will
never be as exacting as Pascal or anything similar. If you want to be
subservient to your compiler, you need to find a language that will
play the dominant consensually.) It isn't there just to avoid typos in
variable names. (although it does that rather well.) The "strict
'vars'" feature of the "strict" pragma is designed to avoid the
problems of dynamic scoping.

Secondly, I want to make sure you realize that "my" isn't the only
solution to the diagnostics given by "use strict 'vars'".

>  This immediately caused me to have FORTRAN flashbacks.  FORTRAN has
>a keyword "common," which as you can guess by the name makes a
>variable common to an entire program, I.E. global.  Why is this a bad
>thing?  Well then, you haven't seen FORTRAN 77 code starting with
>*pages* of common declarations.  If someone asks you to debug one of
>these, you're better off shooting yourself on the spot.  My teacher
>suggest that we never ever use this ability.

>From what you are describing, it sounds like you are declaring every
variable at the top of your script. This violates many commonly
accepted programming practices. In general, you should declare a
variable in the smallest enclosing scope which you can. At the very
minimum, if a variable is only used inside a subroutine, delcare it
inside the sub. Also, for the most part, anything that a subroutine
needs should be passed via its argument list and its results should be
returned via the the subs return value. 

There should be very little need for globals.
-- 
Andrew Langmead


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

Date: Wed, 12 Mar 1997 08:56:58 -0500
From: Larry Adams <ldadams@mindspring.com>
Subject: 2way socket communications
Message-Id: <3326B62A.60C6@mindspring.com>

1. I read the camel book
2. I read the faq's
3. I read the perlipc
4. I read several other sources(Cross Platform Perl, ...)
5. If I missed what I need in the above, please point out my blindness

What I want to do (and I'm not an expert on programming with sockets):

machineA: server to take requests and pass back info
machineB: client to request items 1,2,3 from server
machineC: client to request items 3,4,5 from server

My biggest problem is in handling the 2way exchange. I have written
clients and servers basically mimicing the scripts in the above sources
and they work. Those are mostly reactionary from a basic level, and the
server automatically spits back some predetermined data. 

Can anyone point me to some examples - I don't mind experimenting with
samples (hacking if you will...) ?????

-Larry Adams



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

Date: 12 Mar 1997 14:47:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ANNOUNCE:  IO::Format 0.02 (perl formats, object oriented, footers)
Message-Id: <5g6fmh$1ro$3@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Sullivan Beck <beck@qtp.ufl.edu> writes:
:One thing I would like to do is to have the lexical variables (those
:declared with "my") from the calling routine available in forming the
:format.  The problem is that the format is actually formed by "eval"ing a
:string (similar to the way described in the perlform manpage) in one of the
:module routines.  Is there any way to gain access to the lexical variables
:from the routine that directly called the module routine during the eval?

No, that's not possible.  We are not Tcl. :-)

Tell us why you're eval()ing?  Aren't you using formline?

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

pos += screamnext[pos]  /* does this goof up anywhere? */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: 12 Mar 1997 13:58:32 GMT
From: Graham Barr <gbarr@ti.com>
Subject: ANNOUNCE: libnet-1.05
Message-Id: <5g6cq8$6cc$1@nadine.teleport.com>

I have just uploaded to CPAN a new release of the libnet distribution.

This release contains a lot of changes from the previous release, probably
too many, I would strongly suggest testing any scripts with this release
before you install it.

libnet is a collection of perl modules which encapsulate the usage
of various protocols used in the internet community. These include

  Net::FTP     (RFC959)
  Net::SMTP    (RFC821)
  Net::Netrc
  Net::Cmd
  Net::Domain
  Net::Telnet  (RFC854)
  Net::Time    (RFC867 & RFC868)
  Net::NNTP    (RFC977)
  Net::POP3    (RFC1939)
  Net::SNPP    (RFC1861)
  Net::PH
  Net::Config

To install libnet you ***MUST*** have the following modules installed

  Data::Dumper
  IO::Socket

This release contains the following changes to the previous release

	o Net::NNTP, Net::SMTP, Net::PH, Net::POP3, Net::SNPP
	  - Fixed a bug in new so that the for loop uses a different
	    variable for $host, otherwise $host is undef after the loop
	o Net::PH
	  - Fixed a bug in add and delete for when a string is passed
	    instead of an anonymous hash.
	o Net::Time
	  - Added timeout argument
	o Configure, Net::Time
	  - Added time_hosts and daytime_hosts to NetConfig
	o Net::Domain
	   - Added POSIX uname to methods for obtaining the hostname
	   - Increased the priority of /etc/resolv.conf when looking for
	     domain name
	   - Added the use of syscall for domainname
	o Net::FTP
	  - fixed problem with data channel being left open if there
	    was an error from the command in _data_cmd

	  - Change made to _datacon fir the case where PASV is being
	    used and the command returns an error immediately.

	  - Modified _store_cmd to call abort if it fails to send a packet
	    of data.
	o Added nntp.mirror demo by "Paul E. Hoffman" <phoffman@imc.org>
	o Applied Net::FTP::_extract_path patch from
		Roderick Schertler <roderick@gate.net>, Thanks!
	o Applied Net::SMTP documentation patch from
		Gisle Aas <gisle@aas.no>, Thanks!
	o Applied Net::FTP documentation patch from
		Roderick Schertler <roderick@gate.net>, Thanks!
	o Fixed Net::NNTP to return undef if initial response from
	  the server is
	    502 You have no permission to talk.  Goodbye.
	o Fixed Net::FTP to work with brain-dead MS FTP servers
	o Added site wide passive stuff to Configure and Net::FTP
	o Net::Config is now self-modifying
	o Fixed a bug in Net::Cmd::datasend for quotting lines that start
	  with .
	o Modified Configure script
	o added skeleton tests ftp.t, smtp.t, nntp.t, ph.t
	o minor bug fixes to NNTP and FTP


It should be avaliable on mirror sites soon from

	http://www.perl.com/CPAN/authors/Graham_Barr/

Comments are always very welcome.

Copyright 1996 Graham Barr. All rights reserved.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

Share and Enjoy!
Graham <gbarr@ti.com>
-- 
Graham Barr                                               <gbarr@ti.com>
Q: How do you pronounce Linux?
A: Here in Fort Collins, it's LIN-uhks. As one poster said before, rhymes
   with "win sucks".  For that reason alone, I find it the most appealing.
	--Michael Merideth <mike@cumulus.org> in comp.os.linux.misc





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

Date: 11 Mar 1997 15:50:01 -0600
From: kperrier@Starbase.NeoSoft.COM (Kent Perrier)
Subject: Re: Does Llama book really cover perl 5? Yes!
Message-Id: <cspvx6qet2.fsf@Starbase.NeoSoft.COM>

In article <ELIOT.97Mar10140517@kern1.dg.com> 
eliot@kern1.dg.com (Topher Eliot) writes:
>
>I have the new one. ISBN 1-56592-149-6.  $40 or so.
>I also have the old one, so I'm sure the new one is new.  It even says
>"Covers Perl 5" on the front cover, and "second edition" inside.
>
>Having spent a bunch of time using just the Llama book(s), I am now reading
>the camel book, and so far have found it worthwhile.  I would recommend it
>as a starting point.

This is the camel book, not the llama. 
Camel == Programming Perl, Llama == Learning Perl

Kent
-- 
Kent Perrier           If Bill Clinton is the answer, then it must
kperrier@neosoft.com    have been a really stupid question.
Corporations don't have opinions, people do.  These are mine.
PGP 2.6 Public Key available by request and on key servers
PGP encrypted mail preferred!



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

Date: 12 Mar 1997 07:23:48 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: yili@cse.bridgeport.edu, yli@eccubed.com
Subject: Re: flock() problem
Message-Id: <8c7mjdi3yj.fsf@gadget.cscaper.com>

>>>>> "yili" == yili  <yili@cse.bridgeport.edu> writes:

yili> flock(FH, $LOCK_UN);

This is bad.  Never ever ever ever use flock(BLAH, 8).  Unless you
really know what you are doing.  And even then, it'll be rare.
Just close the filehandle.  It'll then flush the output buffer, close
the fd, and release the lock implictly.

Just consider flock(BLAH, 8) to NOT EXIST.

(For those that want to know, the problem with releasing the lock
first is that someone else can get the flock *before* your buffer
flushes.  Ouch.)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 538 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 9 Mar 1997 18:45:14 GMT
From: ashby@iac.org.nz (Dean Ashby)
Subject: GD.pm newFromGif problem
Message-Id: <5fv0fq$76j@venus.plain.co.nz>



I'm encountering some problems with GD 1.14 from www.genome.wi.mit.edu.
Most things seems to work OK except when I try to create a new GD
image from and exsting file, this is true for GIF, XBM, or GD formats.

$! comes back with "Bad file number at ..."

The demo script 'brushes.pl' produces:

        brush is not of type GD::Image at brushes.pl line 28.

But this is because a few lines prior $tile = newFromGif GD::Image(TILE);
died because of "Bad file number at ..."

I currently suspect fh2file as being the root of the problem, especially
as our perl environment was compiled with perlio and sfio support on.
Details are below.

If anyone can shed some more light on the problem I would be grateful.

Cheers,

Dean


crozier % make
cp GD.pm ./blib/lib/GD.pm
AutoSplitting GD (./blib/lib/auto/GD)
cp qd.pl ./blib/lib/qd.pl
DEFINE=''; export DEFINE INC; \
cd libgd && make -e
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  gdfontg.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  gdfontmb.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  gdfontt.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  mtables.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  gdfontl.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  gdfonts.c
cc -c  -I/opt/include -O     -DVERSION=\"0.10\"  -DXS_VERSION=\"0.10\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  libgd.c
ar cr libgd.a gdfontg.o  gdfontmb.o  gdfontt.o  mtables.o  gdfontl.o  gdfonts.o  libgd.o
: libgd.a
/opt/bin/perl -I/opt/lib/perl5/sun4-solaris/5.00327 -I/opt/lib/perl5 /opt/lib/perl5/ExtUtils/xsubpp  -typemap /opt/lib/perl5/ExtUtils/typemap -typemap typemap GD.xs >GD.tc && mv GD.tc GD.c
cc -c  -I/opt/include -O     -DVERSION=\"1.14\"  -DXS_VERSION=\"1.14\" -fpic -I/opt/lib/perl5/sun4-solaris/5.00327/CORE  GD.c
Running Mkbootstrap for GD ()
chmod 644 GD.bs
LD_RUN_PATH="" cc -o blib/arch/auto/GD/GD.so  -G GD.o  libgd/libgd.a   
chmod 755 blib/arch/auto/GD/GD.so
cp GD.bs ./blib/arch/auto/GD/GD.bs
chmod 644 blib/arch/auto/GD/GD.bs
Manifying ./blib/man3/GD.3
crozier % make test
PERL_DL_NONLAZY=1 /opt/bin/perl -I./blib/arch -I./blib/lib -I/opt/lib/perl5/sun4-solaris/5.00327 -I/opt/lib/perl5 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/GD................
Use of uninitialized value at t/GD.t line 48.
brush is not of type GD::Image at t/GD.t line 48.
dubious
        Test returned status 9 (wstat 2304)
Failed Test  Status Wstat Total Fail  Failed  List of failed
------------------------------------------------------------------------------
t/GD.t            9  2304     5   ??       %  ??
Failed 1/1 test scripts, 0.00% okay. 5/5 subtests failed, 0.00% okay.
*** Error code 2
make: Fatal error: Command failed for target `test_dynamic'






crozier % perl -V
Summary of my perl5 (5.0 patchlevel 3 subversion 27) configuration:
  Platform:
    osname=solaris, osvers=2.4, archname=sun4-solaris
    uname='sunos crozier 5.4 generic_101945-41 sun4m sparc '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=n useperlio=define d_sfio=define
  Compiler:
    cc='cc', optimize='-O', gccversion=2.7.2.1
    cppflags='-I/opt/include'
    ccflags ='-I/opt/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/opt/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsfio -lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G'
 
 
Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Feb 20 1997 13:45:26
  @INC:
    /opt/lib/perl5/sun4-solaris/5.00327
    /opt/lib/perl5
    /opt/lib/perl5/site_perl/sun4-solaris
    /opt/lib/perl5/site_perl
    .



--
+-------------------------------------------------------------------------+ 
| Dean Ashby, ashby@icair.iac.org.nz, ph 64-3-358-4450, fax 64-3-358-4480 |  
| International Centre for Antarctic Information and Research (ICAIR)     | 
| PO Box 14-199, Christchurch, New Zealand.  http://www.icair.iac.org.nz/ |
+-------------------------------------------------------------------------+


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

Date: Wed, 12 Mar 1997 07:59:22 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Grep function question
Message-Id: <qrc6g5.vp.ln@localhost>

Triantafyllos Marakis (ceetm@cee.hw.ac.uk) wrote:
: I am trying to construct a function that will count the 
: number of occurances of a string to a file.

: So far I've written the following code:

: open(IN_FILE, $in_file) or
:   die "Program Fault; File cannot be found:$in_file\n";


Good checking of return values!

The answer to your question is below.


But, before I get to that:

Your program will say:

"Program Fault; File cannot be found:..."

even if the file _could_ be found, but open() failed for some other
reason (Permission Denied, maybe).


Let perl and the OS say what kind of error:

die "$0: File '$in_file': $!\n";


Now, if the open() fails you will know:

   1) the name of the script that generated the error message ($0)

   2) the name of the file it was trying to open(). I always enclose
      filenames in delimiters so when the inevitable "newline on end
      of filename" occurs, it will be easy to see.

   3) Some error message text ($!) from the OS.

That will go a long way toward being able to track down the problem.



: while ($line = <IN_FILE>)
: {                          
:   $line = lc($line);
:   
:   @list = split(/ /, $line);
:   $strings_per_line = grep(/$string/, @list); #count the occurance
: 				              #of the string
:   $counter += $strings_per_line;
: }
: close(IN_FILE);

: But if a string is contained more than once in a word      
: (e.g. ......hello......hello... it increases the counter 
: by one)


Because that's what you asked it to do...

Grep returns a list of array elements that match the pattern.
The array elements you are feeding to it are lines.

So, it should return a list of lines that match the pattern.

You want to be counting a list of _words_ not lines.


: How is it possible to change the code above to achieve the goal?


while ($line = <IN_FILE>)
{
   $line = lc($line);
   while ($line =~ /$string/g) {$counter++}
}


If you don't want "embedded" words 
('embedded' counted when looking for 'bed'), then use:

/\b$string\b/g
 ^^       ^^


If $string will never change, then optimize:

/\b$string\b/go
              ^


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


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

Date: Sun, 9 Mar 1997 14:31:34 GMT
From: ceetm@cee.hw.ac.uk (Triantafyllos Marakis)
Subject: grep question
Message-Id: <E6s5oM.Eyr@cee.hw.ac.uk>

 I have written the following code

     $line = lc($line);
     @list = split(/ /, $line);   #split the line to words
     $strings_per_line = grep /$string/, @list;
     $counter += $strings_per_line;

 How is it possible to return the number of occurances of a string
 if $strings_per_line 
 has the required string occuring more than once to its body?

 Example.
   If $string = "hello" and $line = "..hello....hello...."
   to return 2

 Thanks

--
TRIANTAFYLLOS MARAKIS     |Email:ceetm@cee.hw.ac.uk
BSc in Computer Science IV|Web  :http://www.cee.hw.ac.uk/~ceetm
HERIOT-WATT University    |George Burnett Hall(2.54), Heriot-Watt Univ.,
Edinburgh, Scotland       |Edinburgh,EH14 4AS, Scotland UK




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

Date: Wed, 12 Mar 1997 14:07:20 GMT
From: netkid@netcom.com
Subject: Re: help with printing to a socket
Message-Id: <netkidE6xoK8.Asy@netcom.com>

In <5g3u5r$rkl@fridge-nf0.shore.net>, nvp@shore.net (Nathan V. Patwardhan) writes:
>Nathan V. Patwardhan (nvp@shore.net) wrote:
>: Rachel Polanskis (rachel@virago.org.au) wrote:
>
>: : When I run my script below, on port 7 (echo) I expected it
>: : to return whatever I print out.
>
>: Are you root?  
>
>OOPS.  Sorry to follow-up on my own posting, but the reason I asked if
>you were root is because I wondered info you had also written a server
>that was attempting to run on port 7, and thus would be a problem.  
>
>Sorry for the lunacy.  I'm going to get my first cup of coffee - now :-)
>
>--
>Nathan V. Patwardhan
>nvp@shore.net

Wouldn't be a problem if you were running a Perl server on a desktop OS.
I've already had my first cup of tea ;-).

---
Jim
Cybernet Connections


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

Date: 11 Mar 1997 23:23:26 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: Interactive drawing alternatives in perl?
Message-Id: <slrn5ibqbe.t7m.bill@granite.sover.net>

In article <Pine.SOL.3.91.970306095845.25345A-100000@Helios.goldworks.com>, Serge Kolgan wrote:
>
>was looking for some light-weight (not perl/Tk) package in perl(5) which 
>allows to draw graphics primitives on the screen interactively, nothing 
>is available on CPAN AFAIK...
>any idea if there's such a beast?
>
>Greets,
>Serge.

   Depending on your current platform, misc. security concerns, and 
intentions in general, you may find have some luck with Svgalib under 
Linux.  I've spent some time creating a very bare-bones module to let me 
do the basics--set video modes, draw lines, set colors, etc, but it does 
what I need.  Svgalib is an existing C library of routines that is 
commonly used for non-X graphics under Linux and perhaps a several other 
platforms.  Let me know if you are interested...
   Incidentally, has anyone really done any graphics programming in 
Perl?  I'm in the process of porting a raytracer I wrote to Perl, mostly 
to learn more about Perl, but also to see how the thing runs.  Do people 
generally use Perl only for other things?
						Bill

-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.



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

Date: Wed, 12 Mar 1997 09:01:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Is possible in perl run a string like a piece of program?
Message-Id: <comdog-1203970901240001@nntp.netcruiser>

In article <5g5v72$r5n@server-b.cs.interbusiness.it>, Maurizio Belluati
<Maurizio.Belluati@cselt.stet.it> wrote:

> We've a perl application that need to read math functions stored (like
> strings) in a file. After read the function we need to process it. So a
> possible solution is to write a subroutine that read the function parse
> its string rappresentation end return the result. It could be better if
> in perl there is a function that receives as input a piece of perl code
> (so we write the function in perl syntax) and run it. 
> Does perl have it?

does eval do what you want?  see the Blue Camel [1] or the perlfunc
manpage for details :)

#!/usr/bin/perl

$y = q| $x * $x |;

foreach $x (0..10)
   {
   print eval $y, "\n"
   }

__END__

[1]
Programming Perl, Larry Wall, Tom Christensen, & Randal L. Schwartz, ISBN
1-56592-149-6.

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


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

Date: Wed, 12 Mar 1997 13:57:45 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Is possible in perl run a string like a piece of program?
Message-Id: <adelton.858175065@aisa.fi.muni.cz>

Maurizio Belluati <Maurizio.Belluati@cselt.stet.it> writes:

> Hello,
> 
> We've a perl application that need to read math functions stored (like
> strings) in a file. After read the function we need to process it. So a
> possible solution is to write a subroutine that read the function parse
> its string rappresentation end return the result. It could be better if
> in perl there is a function that receives as input a piece of perl code
> (so we write the function in perl syntax) and run it. 
> Does perl have it?

Sure. eval.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Wed, 12 Mar 1997 13:32:14 +0100
From: David Syer <syer@mpa-garching.mpg.de>
To: mriggsby@sybex.com
Subject: Re: ISBN/Checkdigit calculator
Message-Id: <3326A24E.2781@mpa-garching.mpg.de>

brian d foy wrote:
>    #return what the check digit should be
>    return 11 - ($sum % 11);

fails if checksum is 0 (it reurns 11).  You could use:

    return (11 - ($sum % 11))%11;

Incidentally, all the ISBN numbers on my bookshelf are 10-digits (not 11
as specified in the original posting).  The example program posted by
brian foy however corrected that error.

Dave.


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

Date: Wed, 12 Mar 1997 12:20:37 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Learning Perl's object-oriented features
Message-Id: <E6xJME.KKM@world.std.com>

gihan@pobox.com (Gihan Perera) writes:

>I wonder if anybody can point me in the direction of a good
>introduction to the object-oriented features of Perl (Preferably
>on-line).

Check <http://www.perl.com/CPAN/doc/FMTEYEWTK/perltoot.html>
-- 
Andrew Langmead


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

Date: 12 Mar 1997 13:09:18 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Learning Perl's object-oriented features
Message-Id: <5g69tu$crj$1@gaia.ns.utk.edu>

Andrew M. Langmead (aml@world.std.com) wrote:
: gihan@pobox.com (Gihan Perera) writes:
: 
: >I wonder if anybody can point me in the direction of a good
: >introduction to the object-oriented features of Perl (Preferably
: >on-line).
: 
: Check <http://www.perl.com/CPAN/doc/FMTEYEWTK/perltoot.html>

or check out the man pages at your site or go to:

http://www.perl.com/CPAN/doc/manual/html/frames.html

especially look at:
perlmod
perlref
perlobj
perltie
perlbot

you might want to refresh your mind with perl data structures:
perldata
perldsc
perllol

Jay
-- 
**********************************************
Jay Flaherty          fty@hickory.engr.utk.edu

    ------visualize whirled peas------
**********************************************


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

Date: Wed, 12 Mar 1997 15:02:27 +0100
From: Juergen Seeger <js@ix.heise.de>
Subject: MacPerl5
Message-Id: <3326B773.4066@ix.heise.de>

Is anyone here who is using MacPerl?
JS

-- 
 =
|Juergen Seeger |   Fax: +49 511 5352-361 |    EMail:  js@ix.heise.de   
|
|iX - Magazin fuer professionelle Informationstechnik
|D-30625 Hannover, Helstorfer Str. 7      |    Tel.:  +49 511 5352-387  
|



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

Date: 11 Mar 1997 22:56:47 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: Making sure 'perl -v' works
Message-Id: <slrn5ibopf.ro3.bill@granite.sover.net>

In article <5fkiqc$rnq$3@marina.cinenet.net>, Craig Berry wrote:
>Just out of curiosity, what benefit would an ISP gain through doing 
>this?  In other words, why encourage use of a 'backlevel', unsupported 
>version of Perl?  Presumably they have some good reason.

   To be honest, I have no idea. :)  Here's a somewhat mysterious quote 
from http://www.va.pubnix.com/www/www-cgi.html,(WWW hosting service):


--
If you want to use Perl 5, be aware that it is not as stable as Perl 4, 
and it may use more files external to its binary than Perl 4
does. You can find a copy of Perl 5 in /usr/local/bin/perl5. The Perl 4 
auxiliary files are in /usr/contrib/lib/perl.
--

   Not sure why they think this...
						Bill

-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.



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

Date: 11 Mar 1997 20:46:22 -0500
From: Roderick Schertler <roderick@argon.org>
To: gtk@walsh.med.harvard.edu
Subject: Re: On implementing tie
Message-Id: <pziv2xubqn.fsf@eeyore.ibcinc.com>

On 10 Mar 1997 23:20:33 GMT, gtk@walsh.med.harvard.edu (Gregory Tucker-Kellogg) said:
> 
> I'm trying to tie a hash.  I won't bore you with the whole
> implementation, but the parts I'm having trouble with look like this:

Please, do your best to post self-contained code fragments.  Posting
self contained code is more important than posting a small amount of
code (though doing both is best).

At the least post code which you've actually tried to run.  There are
basic errors in the code you posted, you must not have run it.  I could
fix the errors and then move on to trying to figure out what you're
doing wrong, but from this end it's not an inviting task.

Eg, you're missing a semicolon here

>   package GTK::PeakFile
>   use Tie::Hash;

and here

>     # Lots of code deleted, hauling data into a %list
>     print $list{HEADER}[0];
>     return bless $list,$self;

you're trying to bless $list, but $list isn't a reference so this fails
(even without using -w).

-- 
Roderick Schertler
roderick@argon.org


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

Date: 11 Mar 1997 20:51:12 -0500
From: Roderick Schertler <roderick@argon.org>
To: Raymond Yu <rayyu@cup.hp.com>
Subject: Re: Q:How to turn off taint checking locally in a function?
Message-Id: <pzg1y1ubis.fsf@eeyore.ibcinc.com>

On Mon, 10 Mar 1997 17:34:18 -0800, Raymond Yu <rayyu@cup.hp.com> said:
> 
> Can any one tell me how to turn off taint checking locally in a
> function?

You can't.

> I would like to turn off taint checking because I need to do something
> like:
> 
> 	unlink <*.dat>;

Don't do that, then.  Use opendir()/grep readdir()/closedir().  Or
sanitize your @ENV{qw(PATH IFS)}.

In general you'll have to untaint the data you want to trust.  See
perlsec(1).

-- 
Roderick Schertler
roderick@argon.org


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

Date: Wed, 12 Mar 1997 12:57:01 GMT
From: alan@bc.edu (Bradley Alan)
Subject: Re: What's a good Perl book?
Message-Id: <3326a7b6.1281212@delphi.bc.edu>

On 11 Mar 1997 21:14:20 GMT, dtong@lynx.dac.neu.edu (David Tong)
wrote:

>Hi,
>
>I know C and KSH very well but I am new to Perl. I need to implement on NT,
>UNIX and QNX with Perl. What would be a good Perl reference book I can get
>in the book store?
>
>	Thank You
>	David Tong

The camel book of course!  It's Programming Perl by Larry Wall,
Randall Schwartz, and Tom Christiansen.  It's published by
O'Reilley and Associates, and can be found in any good book
store.

/ Brad


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

Date: Wed, 12 Mar 1997 09:16:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: WWW, and grabbing input from a command
Message-Id: <comdog-1203970916200001@nntp.netcruiser>

In article <332422D7.A6D@scs.leeds.ac.uk>, paulf@scs.leeds.ac.uk (Paul
Forsyth) wrote:

> I have some files to unzip using the unix zcat command, and I want to
> grab its output and put into a list. However, I am calling this via a
> WWW form.

> open(LOG, "zcat <$accessL|");
 
> This seems to work fine using the command line but if I call it using my
> form it fails to.

does whichever user runs the script through the web interface know where
zcat is?.  i hope that you are using taint checking [1] :)


[1]
<URL:http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html>.  see
in particular Q37, Q43, Q44.

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


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

Date: 12 Mar 1997 13:29:43 GMT
From: dxe@cassidy.sbi.com (Dan Ellsweig (Enterprise Management))
Subject: Re: year 2000 question
Message-Id: <5g6b47$g94@tensapp.sbi.com>

In article <5g6ar2$g7s@tensapp.sbi.com>, dxe@cassidy.sbi.com (Dan Ellsweig (Enterprise Management)) writes:
|> 
|> Greetings
|> 
|> I am in the process of insuring year 2000 compliance for all of
|> my PERL code. I have a question regarding the 'localtime()' library
|> function.
|> 
|> Does anyone know of a version of PERL which will support
|> 4 character year as returned by localtime()?? Currently
|> the localtime function calculates the correct year then it
|> subtracts 100 from the year before returning the year value
|> in the localtime array. The result is a 2 character year (99 for 1999 or
|> 00 for 2000). 
|> 
|> Dan
|> 
|


My mistake - localtime subtracts 1900 from the year.

Dan


> 
|> -- 
|> ******************************************************************************
|> Dan Ellsweig    **   Salomon Inc.               **  dellsweig@sbi.com
|>                 **   Route 3   Rutherford, N.J. **  (201) 896-6162
|>                 **   Enterprise Management      **  (800) 800-7759 PIN 221370
|> ******************************************************************************

-- 
******************************************************************************
Dan Ellsweig    **   Salomon Inc.               **  dellsweig@sbi.com
                **   Route 3   Rutherford, N.J. **  (201) 896-6162
                **   Enterprise Management      **  (800) 800-7759 PIN 221370
******************************************************************************


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

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

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