[6817] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 442 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 6 21:17:18 1997

Date: Tue, 6 May 97 18:00:22 -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           Tue, 6 May 1997     Volume: 8 Number: 442

Today's topics:
     Re: bad name for good idea: comp.lang.perl.moderated (w (Geoff Simmons)
     Re: closed filehandle error <sib@worldnet.att.net>
     Re: closed filehandle error <mcampbel@tvmaster.turner.com>
     Re: closed filehandle error (David Alan Black)
     Re: Compiling curseperl and oraperl questions!! (John D Groenveld)
     Re: DANGER !! Search patters <usenet-tag@qz.little-neck.ny.us>
     Re: DANGER !! Search patters (Michael Fuhr)
     Re: DANGER !! Search patters <ajohnson@gpu.srv.ualberta.ca>
     Re: How to fit a Perl5 program to Perl4? (brian d foy)
     Re: How to fit a Perl5 program to Perl4? <anirvan@crl.com>
     Re: MacPerl5 on PB100 (Paul J. Schinder)
     Re: Modules/Packages in Perl (Randy J. Ray)
     Moving a file (Jonas J. Schlein)
     New Module List Posted (Andreas Koenig)
     Re: Notice to antispammers - is there a list of spammer (Dave Regan)
     Re: Perl Books : cross-platform perl && perl-how-to ?> <johnsone@camax.com>
     Perl Tutorials - Boulder, CO (John Donnelly)
     Re: program for perl? (Tad McClellan)
     Re: scalar holds compiled code <sfink@cs.berkeley.edu>
     Re: Singles and doubles <mrchristopher@inorbit.com>
     Re: slow script (David Alan Black)
     Re: slow script (Andrew M. Langmead)
     Re: slow script <ajohnson@gpu.srv.ualberta.ca>
     using modules in a different branch of the sub (Neil Quiogue)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 06 May 1997 23:13:02 +0100
From: g.simmons@elmshorn.netsurf.de (Geoff Simmons)
Subject: Re: bad name for good idea: comp.lang.perl.moderated (was Re: Loosing clpm regulars (was Re: Perl auto-replier))
Message-Id: <g.simmons-ya023580000605972313020001@news.shlink.de>

In article <slrn5mguco.mfu.I-hate-cyber-promo@nessie.mcc.ac.uk>,
I-hate-cyber-promo@man.ac.uk wrote:

> >> I would like to know what regular readers of clpm think about adding a
> >> comp.lang.perl.moderated to the pre-RFD.

> Geoff> I vote yes. Many solutions to the low signal-to-noise ratio on
Usenet have
> Geoff> been proposed and attempted, but I don't think anything really works
> Geoff> besides moderation.

In article <8civ0wo8nt.fsf_-_@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:

> The moderation idea is just fine, but putting "moderated" in a title
> always seems to rub me the wrong way. [...]
> I like comp.lang.perl.questions (moderated) myself.

Hm. I have no problem with taking "moderated" out of the name, but are you
sure that you want "questions" to go in its place? The *idea* of c.l.p.misc
is not just Q&A, but also more general discussion of whatever there is to
discuss about Perl (even though it may be little more than Q&A now). Wouldn't
you want the moderated group to have a similarly broad agenda?


Best,
Geoff


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

Date: Tue, 06 May 1997 17:25:41 -0400
From: Scott Blanksteen <sib@worldnet.att.net>
Subject: Re: closed filehandle error
Message-Id: <336FA1D5.E5CC742A@worldnet.att.net>

Undergraduate labs wrote:
> open(FILE, "</fozz/home1/ug/cmp/u9437517/www/cgi-bin/test.pab");
              ^
              |
              this should be a '>' - you have tried to open
              the file for _reading_, not _writing_

(and, you should check the return value of the 'open' call to 
ensure that it succeeded.)
 
> print FILE "Hello\n";
> close(FILE);

You probably also want to check the return value of 'close'.

Scott


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

Date: 06 May 1997 17:08:07 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: closed filehandle error
Message-Id: <r5rafk9umg.fsf@tvmaster.turner.com>

Undergraduate labs <nobody@sys.uea.ac.uk> writes:

> What could possibly be wrong with this program? I get the error 
 ...
> open(FILE, "</fozz/home1/ug/cmp/u9437517/www/cgi-bin/test.pab");

Other than the fact you open the file for read, then try to write to
it?



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

Date: 6 May 1997 13:23:22 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: closed filehandle error
Message-Id: <5knbca$k54@pirate.shu.edu>

Hello -

Undergraduate labs <nobody@sys.uea.ac.uk> writes:

>What could possibly be wrong with this program? I get the error 
>print on closed file handle main::FILE

1. You don't use the -w switch.  Except I think you do, on the
     command line, since you got a -w-ish error message :-)
2. You don't check the return value of the system calls.
3. You open a non-existent or unreadable file for input, and then
     try to write to it.

>#! /usr/local/bin/perl

>open(FILE, "</fozz/home1/ug/cmp/u9437517/www/cgi-bin/test.pab");
>print FILE "Hello\n";
>close(FILE);

Had the file been readable, you would have gotten:
Filehandle main::FILE opened only for input.  And if the file
is not readable (which I believe to be the case), then checking
the return value of open() would have tipped you off.

s/</>/;

David Black
dblack@icarus.shu.edu


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

Date: 6 May 1997 20:14:34 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Compiling curseperl and oraperl questions!!
Message-Id: <5kohha$rqd$1@tholian.cse.psu.edu>

In article <336d8a5a.12759196@king.mcs.drexel.edu>,
Keleen Kuo <uckuo@king.mcs.drexel.edu> wrote:
>If you have compile curseperl or oraperl in a HP-UX machine or know
>the following problems, please give me some advices for the following
>problems.

Are you sure you want to run perl4 extensions? You'll have better luck
getting support if you upgrade to perl5 and the Curses, DBI/DBD-Oracle
modules.

See http://www.perl.com/perl/ for details.

John
groenvel@cse.psu.edu


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

Date: 6 May 1997 21:18:34 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: DANGER !! Search patters
Message-Id: <5ko77a$uo2$1@news.netusa.net>

Shlomo Anglister  <shlomoa@iil.intel.com> wrote:
>Avoid search patters with $'rs and and + signes they tend to confuse
>perl.

They do not. You confuse perl by using them wrong.

>for example try to extract a file name containing +#$@% from a full
>path.

Huh? What is the question? You want the equivilent of a basename
command?

$program =~ s:.*/([^/]+)$:$1:;

>/usr/include/#TEST#++/foo++##@@$$/test%%$##$@!^.#$%
>
>This is a good excercise, I think

Okay, exercise with it. Fixing a path with "/../" or "/./" in
it is more interesting I think. (Bonus points if you do file
stats to make sure you don't break the path when elements are
symbolic links.) Then there's everyone's favorite, matching a
C quoted string getting cases like "", "\"", and "\\" right.

Elijah
------
_MRE_ has been useful for optimizing regexps, not learning them (for me)


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

Date: 6 May 1997 18:19:24 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: DANGER !! Search patters
Message-Id: <5kohqc$b1k@nova.dimensional.com>

Shlomo Anglister <shlomoa@iil.intel.com> writes:

> Avoid search patters with $'rs and and + signes they tend to confuse
> perl.

man perlre - it's not Perl that they confuse :-)

> for example try to extract a file name containing +#$@% from a full
> path.
>
> /usr/include/#TEST#++/foo++##@@$$/test%%$##$@!^.#$%
>
> This is a good excercise, I think

That's what backwhacks are for.  Add a little dose of quotemeta
if it gets too hairy.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Tue, 06 May 1997 17:20:12 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: DANGER !! Search patters
Message-Id: <336FAE9C.24D72D96@gpu.srv.ualberta.ca>

Shlomo Anglister wrote:
> 
> Avoid search patters with $'rs and and + signes they tend to confuse
> perl.
> for example try to extract a file name containing +#$@% from a full
> path.
> 
> /usr/include/#TEST#++/foo++##@@$$/test%%$##$@!^.#$%
> 
> This is a good excercise, I think

$full_path='usr/include/#TEST#++/foo++##@@$$/test%%$##$@!^.#$%';
$full_path=~m{/(test.*)};
print "filename = $1";

but I wouldn't want to use that filename for anything.

regards
andrew


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

Date: Tue, 06 May 1997 16:50:45 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to fit a Perl5 program to Perl4?
Message-Id: <comdog-0605971650450001@nntp.netcruiser>

In article <336F7085.65224B72@scudc.scu.edu>, "Ben Lai (A linuxer)"
<ylai@scudc.scu.edu> wrote:

> Sorry about this silly question.  I'm very new to Perl and this problem
> is very urgent, so I come here looking for help.

everyone's problem is urgent to them :)

> I am going to establish a simple mailing server and using "Minordomo"
> for it.

> Since minordomo needs Perl 5 but my school just provide perl 4, I can
> execute the program in my school system.  I got the following error
> message,

bring your school up to date by making them get a modern version
of Perl :)  with that said:

> syntax error in file minordomo at line 75, next 2 tokens "use Getopt"

find the Perl4 equivalent of this (newgetopts.pl?) and "require" it.

> syntax error in file minordomo at line 86, next 2 tokens ") or"
> syntax error in file minordomo at line 93, next 2 tokens ") or"
> syntax error in file minordomo at line 113, next 2 tokens ") or"
> syntax error in file minordomo at line 120, next 2 tokens ") or"

use  || and ensure that the change doesn't affect associativity
(|| binds more tightly than "or")

> syntax error in file minordomo at line 160, next 2 tokens "chomp
> @subscribers"

you'll need to use chop() - but be careful!  chop() might chomp
more than you want.

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


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

Date: 6 May 1997 19:54:39 GMT
From: Anirvan Chatterjee <anirvan@crl.com>
Subject: Re: How to fit a Perl5 program to Perl4?
Message-Id: <5ko29v$7p4$1@nnrp1.crl.com>

-----BEGIN PGP SIGNED MESSAGE-----

[Followups redirected to c.l.p.m]

In comp.lang.perl.misc Ben Lai (A linuxer) <ylai@scudc.scu.edu> wrote:
: Since minordomo needs Perl 5 but my school just provide perl 4, I can
: execute the program in my school system.  I got the following error
: message,

I'll try to comment on some fixes you can make.

: syntax error in file minordomo at line 75, next 2 tokens "use Getopt"

Perl 4 isn't module-savvy. Roll your own getopts-type function or use
getopts.pl.

: syntax error in file minordomo at line 86, next 2 tokens ") or"

Change "or" to "||"

: syntax error in file minordomo at line 160, next 2 tokens "chomp
: @subscribers"

chomp individually chops every element of the list (@subscribers), and
returns the total. Turning this into a function call should be easy.

_______________________________________________________________
Anirvan Chatterjee . anirvan@crl.com . <URL:http://www.mx.org/>
PGP 0x93C5C165 . finger for PGP/geek . encrypted mail preferred
http://www.mx.org/bookfinder/ : online book comparison shopping 

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBM2+MGWTQ0LuTxcFlAQFuiQQAi6hJNmVq552q06nYH4rysUySolLTmKoG
pCnB3mAPHfSVYo+xrAKo5QAHOVllWGcshxbhRMvSFdRON98wSolD/DBDc+6ZtFNs
XmRH6rScnVh1tlXdhei1L1lVfvP0C0gMNeus+brwmv+JGt6lVYf8BFgE0o4+r6Zh
jovudeqlM/E=
=4zUT
-----END PGP SIGNATURE-----


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

Date: Tue, 06 May 1997 19:22:04 -0400
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MacPerl5 on PB100
Message-Id: <schinder-0605971922050001@schinder.clark.net>

In article <pudge-ya02408000R0605970843410001@news.idt.net>,
pudge@pobox.com (Chris Nandor) wrote:

}  In article <E9qAAx.AvC@encore.com>, wpollans@scrap.encore.com (Warren
}  Pollans) wrote:
}  
}  #                Anyone using MacPerl5 on their pb100?  I've downloaded
}  #                Mac_Perl_513r2 and get something like: application
"unknown" 
}  #                has unexpectedly quit, because an error of type 2
occurred.  
}  #                What 
}  #                does that mean - other than I can't run MacPerl5? 
I've been 
}  #                using MacPerl4 with no problems.
}  
}  You need Mac_Perl_513r2_appl_big IN ADDITION TO Mac_Perl_513r2_appl.

No, MacPerl itself is fat, and runs on both 68020 (I think) and above
(definitely on a 68030) and PPC machines  You need big MacPerl only if you
want some additional libraries that are included in the MacPerl
distribution as PPC dynamic libraries.  I asked Matthias on the mailing
list what's in big MacPerl that isn't in MacPerl, and if I remember right
at this point it's only GD.

}  
}  The version you have -- if you check it with a utility like PowerPCheck --
}  only has PPC code in it; the PB100 is a 68K machine.  The "big" MacPerl has
}  the 68K binary.

The PB 100 is a *68000* machine.  I don't believe MacPerl 5.13r2 runs on
anything less than a 68020.  AFAIK, the only MacPerl available that will
run on a 68000 is 4.18, and I might be mistaken about even that.

}  
}  --
}  Chris Nandor                 pudge@pobox.com                
http://pudge.net/
}  %PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80
B6 B6'])
} 
#=============================================================================
}  I was going 70 miles an hour and got stopped by a cop who said, "Do you know
}  the speed limit is 55 miles per hour?"  "Yes, officer, but I wasn't going to
}  be out that long..."
}                  --Steven Wright
} 
#=============================================================================

-- 
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@leprss.gsfc.nasa.gov


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

Date: 06 May 1997 11:58:32 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: Modules/Packages in Perl
Message-Id: <uowohao4h4n.fsf@tremere.ecte.uswc.uswest.com>

stephen farrell <stephen+usenet@farrell.org> writes:
> I think what Neil wants to do (if I now understand him correctly) is
> affect the load path with some variables, such as $HOME which he is
> getting from a config file.  It would seem likely that this effect
> could be afforded by "use lib './foo'" type construct (if he really
> meant $ENV{HOME}, then the relative link might be just the right
> thing).  One place to look might be at DynaLoader for this.

If he needs to simply add a new directory to the search path, then the lib
pragma is what he needs. I'm not sure what DynaLoader would be able to offer
him, but the man page for lib.pm should answer most of the questions. If what
he is trying to do is load subroutines on demand, then he may want to look at
AutoLoader.pm (or wait for TPJ #6, which will have an article on making use of
AutoLoader and AutoSplit).

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
                Denver, CO                                     rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin


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

Date: 6 May 1997 20:24:00 -0400
From: schlein@umbc.edu (Jonas J. Schlein)
Subject: Moving a file
Message-Id: <5koi30$dkk@umbc9.umbc.edu>

PERL doesn't seem to have a "move" or "copy" operator for files.  The
"Learning Perl" book does suggest that you may 'move' a file by using
the rename command, however this does not appear to work across file
systems.  I guess I'd have to blame this on the way UNIX implements the
underlying "rename" function.

Anyway what is the best work around for this? Calling 'mv' would certainly,
work, but it's not 100% portable to non-UNIX systems. I'd really rather
not write my own copy function although this seems like the best way
off the top of my head followed by an unlink call.

Thanks in advance!
-- 
"If it wasn't for C, we would be using BASI, PASAL, and OBOL."

Jonas J. Schlein  (schlein@gl.umbc.edu)


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

Date: 6 May 1997 21:07:14 GMT
From: andreas.koenig@franz.ww.tu-berlin.de (Andreas Koenig)
Subject: New Module List Posted
Message-Id: <5ko6i2$o4v$1@brachio.zrz.TU-Berlin.DE>
Keywords: FAQ, Perl, Module, Software, Reuse, Development, Free


The Perl 5 Module List, v2.41...
================================

A new revision is on it's way around USENET and CPAN. It has been
posted to

    news:comp.lang.perl.modules

and uploaded to

    http://www.perl.com/CPAN/modules/00modlist.long.html

The recent changes are appended below. As usual, comments, corrections
and suggestions are more than welcome. Please don't hesitate, mail
them to modules@perl.org

I believe that I have taken into account all mails we have received
since the last posting. If this is not the case, please let us know.

A big thank you to all contributors helping to keep the document up to
date. I hope, you enjoy it!

andreas


Recent Changes in the modules database
--------------------------------------

4) Operating System Interfaces
 ------------------------------
Errno          cdpf  Constants from errno.h EACCES, ENOENT etc    GBARR !

Mac::Apps::
::Anarchie     RdpO  Interface to Anarchie with AppleEvents       CNANDOR +

Mac::Comm::
::OT_PPP       RdpO  Interface to Open Transport/PPP              CNANDOR +


5) Networking, Device Control (modems) and InterProcess Communication
---------------------------------------------------------------------
Net::
::ACAP         adpO  Interface to ACAP Protocol (Internet-Draft)  KJOHNSON +
::Bind         adpO  Interface to bind daemon files               KJOHNSON +
::ICAP         adpO  Interface to ICAP Protocol (Internet-Draft)  KJOHNSON +
::IMAP         adpO  Interface to IMAP Protocol (RFC2060)         KJOHNSON +
::Ping         SupO  TCP and ICMP ping (will come with perl5.004) RMOSE !
::Ping         Supf  TCP ping (comes with with perl5.003)         PMQS !
::xAP          adpO  Interface to IMAP,ACAP,ICAP substrate        KJOHNSON +

RPC::
::ONC          adcO  ONC RPC interface (works with perlrpcgen)    JAKE !


6) Data Types and Data Type Utilities (see also Database Interfaces)
--------------------------------------------------------------------
Bit::
::Vector       RdcO  Efficient bit vector base class              STBEY !

Set::
::IntRange     RdcO  Set of integers (arbitrary intervals, fast)  STBEY +
::Window       bdpO  Manages an interval on the integer line      SWMCD +


7) Database Interfaces (see also Data Types)
--------------------------------------------
DBD::
::Solid        amcO  Solid Driver for DBI                         TWENRICH +


8) User Interfaces (Character and Graphical)
--------------------------------------------
Term::
::Size         adcf  Simple way to get terminal size              TIMPX +


11) Text Processing, Parsing and Searching
------------------------------------------
SGMLS          RdpO  A Post-Processor for SGMLS and NSGMLS        INGOMACH !

Text::
::Bib          RdpO  Module moved to Text::Refer                  ERYQ !
::Refer        RdpO  Parse refer(1)-style bibliography files      ERYQ +


13) Internationalization and Locale
-----------------------------------
Locale::
::Country      cdpf  ISO 3166 two letter country codes            NEILB +
::Language     cdpf  ISO 639 two letter language codes            NEILB +


15) World Wide Web, HTML, HTTP, CGI, MIME etc (see Text Processing)
-------------------------------------------------------------------
MIME::
::Lite         bdpO  Single module for composing simple MIME msgs ERYQ !


16) Server and Daemon Utilities
-------------------------------
MailBot        cdpO  Archive server, listserv, auto-responder     RHNELSON +


18) Images, Pixmap and Bitmap Manipulation, Drawing and Graphing
----------------------------------------------------------------
OpenGL         adcf  Interface to OpenGL drawing/imaging library  ADESC !
ThreeD         i     Namespace root for all kinds of 3D modules   ADESC +


Recent Changes in the users database
------------------------------------
+  ABW      Andy Wardley <abw@peritas.com>
!  ADESC    Alligator Descartes <descarte@hermetica.com>
+  AGENTML  Mailing List For Perl5 Agents
+           Send email to perl5-agentr@epitome.hawk.igs.net with the
+           body "subscribe <emailaddr>"
+  ARSML    The ARSperl Mailing List
+           See http://arsinfo.cit.buffalo.edu/ for mor info.
+  CARL     Carl Declerck <carl@miskatonic.inbe.net>
+  DCEPML   The DCE-Perl mailing list
+           Mail to majordomo@lists.csupomona.edu with body "subscribe
+           dce-perl <your-address>"
+  ESR      Eric S. Raymond <esr@snark.thyrsus.com>
+  FRAMM    Frederik Ramm <ramm@rz.uni-karlsruhe.de>
+  HVDS     Hugo van der Sanden <hv@crypt.compulink.co.uk>
+  IFLAN    Ian Flanigan <flan@cs.wustl.edu>
+  INGOMACH Ingo Macherius <Ingo.Macherius@tu-clausthal.de>
+  OCROW    Owen Crow <ocrow@crl.com>
+  RCAPUTO  Rocco Caputo <troc@shadow.net>
!  SBECK    Sullivan Beck <sbeck@cise.ufl.edu>
+  SKANE    Steve Kane <skane@cse.psu.edu>
!  SWMCD    Steven McDougall <swmcd@world.std.com>
+  TEKE     Torsten Ekedahl <teke@matematik.su.se>
+  TWENRICH Thomas Wenrich <wenrich@ping.at>


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

Date: 6 May 1997 23:04:16 GMT
From: regan@ao.com (Dave Regan)
Subject: Re: Notice to antispammers - is there a list of spammers to pluginto procmail?
Message-Id: <5koddh$a36$1@bashir.peak.org>

In article <336f1c67.116909796@news.diac.com>,
	sitaram@diac.com (Sitaram Chamarty) writes:

>My question, for Nathan or Tom or anyone else who knows, is: is there
>a frequently updated list of spammers that I can periodically plug
>into my procmail recipe as an include file?  (I do use procmail, but I
>got tired of constantly adding addresses to it, hence this question).
>
>If there was, I'd delete the no-spam junk in my email address.  I
>don't mind having to download something once a week (using LWP) (and
>that takes care of making this post on-topic for c.l.p.m :-).

There is a list that AOL maintains.  It isn't necessarily in a format
for directly plugging into procmail.  See:
	http://www.idot.aol.com/preferredmail/

With a short Perl program I'm sure you can remove the HTML wrapping
and get straight to the addresses.  From there it should be easy
to add the wrapping to make it fit into procmail.  Then you can fire
the whole mess off with cron and not have to worry about it anymore
(except for when AOL changes the format of the file. :))

Once done, you can advertise your hack in all of the appropriate places.

The version I am looking at was updated on 5 May 1997, so it
appears that they keep it up to date.  AOL is also the target of
lots of spammers so they probably get notified promptly when there
is abuse.

			Dave Regan
			regan@ao.com




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

Date: Tue, 06 May 1997 16:39:54 -0500
From: Eric Foster-Johnson <johnsone@camax.com>
To: The Sixth Beatle <Clint.Eastwood@spaghetti.westerns>
Subject: Re: Perl Books : cross-platform perl && perl-how-to ?>
Message-Id: <336FA52A.55E8@camax.com>

The Sixth Beatle wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> 
> Hello,
> 
> I was recently checking out the foll books in the local
> tech-book store :
> (1) Cross Platform Perl
> (2) Perl 5 How-To
> 
> Any comments of which is better ?
> I have read the review on Cross-Platform Perl at
> www.perl.com;

I'm the author of Cross-Platform Perl. I'd be happy
to answer any questions. My web pages also have
the table of contents and other info on the book.

Hope this helps,
-Eric

-- 
Eric Foster-Johnson http://www.pconline.com/~erc
CAMAX, SDRC's CAM Business
7851 Metro Parkway         phone: +1 612 854 5300 fax: +1 612 854 6644
Minneapolis, MN 55425 USA  johnsone@camax.com


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

Date: 6 May 1997 09:34:51 -0600
From: johnd@xor.com (John Donnelly)
Subject: Perl Tutorials - Boulder, CO
Message-Id: <5knj2r$6jg@xor.com>

	**Upcoming Perl (May-June '97) Tutorials**
All sessions are held at our training facility in Boulder, CO.
Contact me for further information, registration forms.
--John Donnelly, Training Coordinator
  XOR Network Engineering, Inc.
  http://www.xor.com/  johnd@xor.com  303-448-4816
				*****
                     Beginning Perl Programming
                  (Three Day Hands-on Lecture/Lab)
                    Tom Christiansen, Consultant
              Monday - Wednesday, May 19-21, 1997
				*****
                   CGI and WWW Programming in Perl
                   (Two Day Hands-on Lecture/Lab)
                    Tom Christiansen, Consultant
			 June 17-18, 1997
				*****
                     Advanced Perl Programming
                  (Three Day Hands-on Lecture/Lab)
                    Tom Christiansen, Consultant
		Monday - Wednesday, June 23-25, 1997
				*****


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

Date: Tue, 6 May 1997 15:08:55 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: program for perl?
Message-Id: <n43ok5.gu2.ln@localhost>

Kyzer (junkmail@sysa.abdn.ac.uk) wrote:
: Michael J Gebis, while smelling of fish, wrote:
: : junkmail@sysa.abdn.ac.uk (Kyzer) writes:

: : }: Suzanne L. wrote:
: : }: > 
: : }: > Is there a program that is needed to write in perl or can they be
: : }: > written in any text editor?

: : }Ah, yes, there IS a program needed to write in perl.
: : }It's called "perl" :)

: : Technically, that's the program needed to run perl.  You can write in
: : perl using almost anything, from emacs to antelope blood on a cave wall.

: But the $64000 question is, if you write it in antelope blood on a cave wall,
: can you get perl to execute it afterwards? :)


Since you're using the antelope's blood, I assumed it was already executed...

Or was it just a donor antelope?  ;-)


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


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

Date: Tue, 06 May 1997 15:25:04 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
To: Tom Vaughan <tommy@best.com>
Subject: Re: scalar holds compiled code
Message-Id: <336FAFC0.6CE6@cs.berkeley.edu>

You're probably stuck with saving it to a file and running that file. Or
you could create a perl extension that, given a scalar, did what you
want from C. (But the code would have to be completely relocatable.) Or
you could try to find some way of breaking past perl's type system. As
far as I know, there is no way of doing this in perl, nor should there
be.

Not that it would even be easy in C. Overwriting a function pointer
probably wouldn't work, since it'll be in read-only memory. Hmm.... make
a local variable, take its address, look backwards in the stack from
that address until you find something that looks like the return
address, overwrite that with a pointer to the inserted code?

Needless to say, nothing you could come up with would be the least bit
portable. I guess I'd better not ask why you want to do this.


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

Date: Wed, 07 May 1997 07:22:38 +0900
From: christopher <mrchristopher@inorbit.com>
Subject: Re: Singles and doubles
Message-Id: <336FAF2E.17F1@inorbit.com>

Thank you once again those folk who helped me with the above!

Regards

Christopher
Tokyo,May97

http://www.wonderlandinorbit.com


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

Date: 6 May 1997 21:01:48 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: slow script
Message-Id: <5ko67s$jbg@pirate.shu.edu>

Hello -

"Brandon W. Metcalf" <brandon@physics.utexas.edu> writes:

>Below is a script that could most certainly be improved which generates
>a user specified number of "lottery tickets".  Each lottery ticket is a
>group of six numbers each between 1 and 50 inclusive.  The script does
>checking to ensure that each ticket is unique and that a number isn't
>duplicated within a ticket.  However, if more that 19 tickets are
>specified it gets extremely slow.  So my question is, can this code be
>optimized or is perl just slow at this type of procedure?

Is what WHAT?????? I believe I must have misread your question :-)

This is a tested though possibly not bullet-proof rewrite, which
uses hashes to keep track of which numbers have been found within
a ticket, and which tickets have been assigned.  With a very
crude time test, I had to ask for 450 tickets before it reported
taking more than one second.  

(I'm not quoting the original code for space reasons - those who 
get this first, please be patient.)


#!/usr/local/bin/perl -w

use strict;
srand;
 
my (
    $tickets,               # number of tickets to generate
    @array,                 # array where each row represents a ticket
    $whole,                 # ref to $tickets x 6 array 
    %done                   # flag for already-created tickets
);
 
print "How many tickets: ";
chomp ($tickets = <STDIN>);

my $start = time;

foreach (0..$tickets-1) {
    my $ticket;
    do { @array = mk_ticket(); $ticket = join '', @array }
        while ($done{$ticket});
    $done{$ticket}++;
    $whole->[$_] = [ @array ];
}
 
my $end = time;

foreach (0..($tickets-1))  {
   my $i;
   foreach $i (0..5) { printf "%3d", $whole->[$_]->[$i]; }
   print "\n";
}

print "Very rough time estimate: ", $end - $start, " second(s)\n";

sub mk_ticket {
    my ($num, @array, %used) = ();
    foreach (0..5) {
        do { $num = int(rand(50)) + 1 } while ($used{$num});
        $used{$num}++;
        $array[$_] = $num;
   }
   sort { $a <=> $b } @array;
}



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

Date: Tue, 6 May 1997 22:31:26 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: slow script
Message-Id: <E9s6KE.Gxw@world.std.com>

"Brandon W. Metcalf" <brandon@physics.utexas.edu> writes:

>Below is a script that could most certainly be improved which generates
>a user specified number of "lottery tickets".  Each lottery ticket is a
>group of six numbers each between 1 and 50 inclusive.  The script does
>checking to ensure that each ticket is unique and that a number isn't
>duplicated within a ticket.  However, if more that 19 tickets are
>specified it gets extremely slow.  So my question is, can this code be
>optimized or is perl just slow at this type of procedure?

Look at using hashes to store your lottery numbers instead of an
array. That way, you don't have to loop through the "drawn" lottery
numbers to see that you don't get the same number twice.

for(1 .. 6) {
  until(exists $set{$number = mk_number}}
    $set{$number} = 1;
  }
}
  

Or maybe make an array of 1 to 50 and use "splice" to remove
elements. Once the element is removed, it can't be drawn a second
time.

srand;
# time passes

@balls = 1 .. 50;
for $ball (1 .. 6) {
  push @drawing, splice(@balls, rand(scalar @balls), 1);
}

Once you draw a set of six, can you sort the numbers? Or do you need
to keep track of the order. If you can sort, when you compare sets,
you can stop as soon as you find the first non-matching number.
-- 
Andrew Langmead


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

Date: Tue, 06 May 1997 17:05:31 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: slow script
Message-Id: <336FAB2B.27BD8182@gpu.srv.ualberta.ca>

Brandon W. Metcalf wrote:
> 
> Below is a script that generates a user specified number of "lottery
> tickets."  Each lottery ticket consist of 6 unique numbers between 1 and
> 50 inclusive.  The script does checking to ensure that each ticket is
> unique and that each number within a ticket is also unique.  However, if
> more that say 19 tickets are requested, it's slows to a crawl.  I'm sure
> that the code could be improved, but where?  Can it be optimized or is
> perl just slow at this sort of procedure?
> 

the problem is that you aren't making sure there are no
duplicate tickets...you are making sure that no two
sorted tickets share a number in the same location---
after a few tickets, this becomes increasingly likely, thus
it takes a LOT more calls to mk_ticket() before you get a
new one in which the first number doesn't match the first number
in any other ticket, the second number doesn't match the second
number in any other ticket ...etc...

a *quickie* fix to your foreach loop follows, while maintaining
the style of your orignial.
(your part is commented out, new part is below it
and has # to the right of the added lines)

foreach (1 .. $tickets) {
        mk_ticket();
        print "got ticket $_\n";
        my $j = $_ - 1;
TEST: while ($j >= 0) {
         # my $i = 0;
         # while ($i <= 5) { # make sure set of numbers isn't duplicated
         #         if ($array[$i] == $whole->[$j]->[$i]) {
         #                 mk_ticket();
         #                 $j = $_ - 1;
         #                 redo TEST;
         #         }
         #        $i++;
         my $new_ticket=join("",@array);           #
         my $old_ticket=join("",@{$whole->[$j]});  #
         if ($new_ticket eq $old_ticket) {      #
            mk_ticket();                        #
            $j=$_-1;                            #
            redo TEST;                          #
         }     
         $j--;
   }
   $whole->[$_ - 1] = [ @array ];
}

hope it helps
regards
andrew


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

Date: 7 May 1997 16:09:59 GMT
From: neil@marikit.iphil.net (Neil Quiogue)
Subject: using modules in a different branch of the sub
Message-Id: <slrn5mvidd.v8k.neil@marikit.iphil.net>

Greetings,

Some have criticized me for not reading the documents in my previous post.
I have read them even before I placed my post.  It is just that my question
is a bit vague.  So let me clarify it a bit.

I am currently cleaning up a system using object modules in one monolithic
subdirectory (e.g., /home).  I then placed them according to their object
hierarchy.  Lo and behold, the modules were using "require" and the
subdirectories were hard-coded.

Thus, I wanted to use the "use" construct but I'm having problems with the
object not found in @INC array.  My problem cannot be directly solved with
the "use SubDir::Object" construct since one module is using another module
in another branch of the subdirectory.

e.g.,
/home/branch1/object1.pm
/home/branch2/object2.pm

where object1.pm is using object2.pm

My current workaround is to create a symbolic link and use the "use SubDir::
Object" construct.  Is there any better way to do this?  I would have
liked to use a variable as the "SubDir" but it isn't possible or is it?

-- 
[---]
Neil D. Quiogue
IPhil Communications Network, Inc.
e-mail: neil@iphil.net



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

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

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