[6579] in Perl-Users-Digest
Perl-Users Digest, Issue: 204 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 30 14:07:16 1997
Date: Sun, 30 Mar 97 11:00:37 -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 Sun, 30 Mar 1997 Volume: 8 Number: 204
Today's topics:
ANNOUNCE: Bit::ShiftReg 2.0 (Steffen Beyer)
Re: BETA version and "DB 1.86"(???, where?) (David Combs)
Re: Capture Output (Tad McClellan)
Re: CORRECT Re: perl5 string splitting question <merlyn@stonehenge.com>
Re: Functions and operators <merlyn@stonehenge.com>
Re: Has anyone heard the rumour that Microsoft have bou <annalisa@mkt2mkt.com>
Re: HELP: how to run perl under dos ? shyde@POBoxes.com
How to convert .dbm to (.pag .dir) <concord@cam.org>
Re: Need Help Troubleshooting Script (I R A Aggie)
Re: Objective C is cool. (Re: Who makes more $$..) <wjhunt@ccnet.com>
Re: Ok, what do I need and where can i get it ?? shyde@POBoxes.com
Re: Perl lib or module for MS-Word docs and/or RTF need shyde@POBoxes.com
Re: Q: sorting by date <merlyn@stonehenge.com>
Quick Help <mianzo+@cs.cmu.edu>
Re: Quick Help (Nathan V. Patwardhan)
Re: Quick Help (Tad McClellan)
Re: String substitution question <rsr@india.ti.com>
Re: two perl4->perl5 gotchas not in perltrap manpage? (M.J.T. Guy)
Unix and ease of use (WAS: Who makes more ...) (Michael Craft)
Re: use and if test (M.J.T. Guy)
visit my first CGI/PERL project <ster@stargazer.net>
Re: Webfax scripts or mods in Perl? shyde@POBoxes.com
Why doesn't pod2html send its default output to STDOUT? (Eric D. Friedman)
Why is no subscripting allowed in custom sort routines? (Eric D. Friedman)
Re: Why is no subscripting allowed in custom sort routi (David Alan Black)
WinPerl by Maxwell Nairn Andrews Beta 95 (ELARISHY)
Re: work on command line and not via browser? (Tad McClellan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Mar 1997 17:23:31 GMT
From: sb@sdm.de (Steffen Beyer)
Subject: ANNOUNCE: Bit::ShiftReg 2.0
Message-Id: <5hm7ij$1me@sunti1.sdm.de>
I am glad to announce
======================================
Module "Bit::ShiftReg" Version 2.0
======================================
to the Perl community.
Contents of this message:
-------------------------
- Legal stuff
- Prerequisites
- What does it do
- Where to find
- Final note
Legal stuff:
------------
Copyright (c) 1997 by Steffen Beyer. All rights reserved.
This package is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
Prerequisites:
--------------
Perl version 5.000 or higher, a C compiler capable of the ANSI C standard (!)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What does it do:
----------------
This module implements rotate left, rotate right, shift left and shift
right operations with carry flag for all C integer types.
The results depend on the number of bits that the integer types unsigned
char, unsigned short, unsigned int and unsigned long have on your machine.
The module automatically determines the number of bits of each integer type
and adjusts its internal constants accordingly.
It also provides subroutines to determine the number of bits of these types
in your Perl programs.
For shift registers of arbitrary size, you can either chain several bytes
together using the functions of this module, or use the new module
"Bit::Vector" (coming soon!).
This latter module is actually the new version of the "Set::IntegerFast"
module, which will be split into a base class, "Bit::Vector", and appli-
cation classes, like "Set::IntegerFast", "Set::IntegerRange" and
"Math::MatrixBool".
Where to find:
--------------
At the usual ftp sites for Perl (CPAN = "Comprehensive Perl Archive Network"):
The file
Bit-ShiftReg-2.0.tar.gz
can be found in directory
.../CPAN/authors/id/STBEY/
or
.../CPAN/modules/by-category/06_Data_Type_Utilities/Bit/
or
.../CPAN/modules/by-module/Bit/
See "The Perl 5 Module List" by Tim Bunce and Andreas Koenig in news:
comp.lang.perl.modules for a list of CPAN ftp servers, or direct your
WWW browser to
http://www.perl.com/CPAN/modules/by-module/Bit-ShiftReg-2.0.tar.gz
and you will be redirected automatically to a CPAN ftp server near you.
You can also download this module from the author's web site at
http://www.engelschall.com/u/sb/download/
where you will also find my other modules and a couple of logos
describing what the modules do.
Final note:
-----------
If you need any assistance or have any comments, problems, suggestions,
findings, complaints, questions, insights, compliments or donations to give ;-)
then please don't hesitate to send me some e-mail:
sb@sdm.de (Steffen Beyer)
Yours sincerely,
--
|s |d &|m | Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
| | | | software design & management GmbH & Co. KG
| | | | Thomas-Dehler-Str. 27, 81737 Munich, Germany.
"There is enough for the need of everyone in this world,
but not for the greed of everyone." - Mahatma Gandhi
------------------------------
Date: Sun, 30 Mar 1997 13:33:13 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: BETA version and "DB 1.86"(???, where?)
Message-Id: <dkcombsE7uyzD.EKo@netcom.com>
Sorry -- I found the link to it. (I think the link
was the ONLY mention of 86 in the entire file).
Next question: WHICH ONE to use, 85 or 86? The text
sort of implies one should use 85...
Am just learning Perl, and have downloaded new beta
version of it, and INSTALL file says I have to
have the dbm ALREADY installed BEFORE building Perl...
(Too bad you can't tell it about dbm at run time,
but I guess it needs the .h files at build time.)
I guess every time you grab another data-base pkg, or
even another version of existing one, you have totally
rebuild perl?
------------------------------
Date: Sun, 30 Mar 1997 08:35:16 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Capture Output
Message-Id: <4ntlh5.ip.ln@localhost>
SG (mcj@execulink.com) wrote:
: Whenever I run the UNIX commans grep from my perl script, the output
: goes directly to the screen. I cannot read the output. Can anyone help
: me?
As I am sure you are a good net citizen and have therefore spent at
least 30 seconds doing word searches in the free documentation that
is included with the perl distribution, I guess you must have missed
the below in the perlfunc man page (I added the underlining):
[ searching for 'capture', taken from _your_ Subject: leads to: ]
---------------------------
=item system LIST
Does exactly the same thing as "exec LIST" except that a fork is done
first, and the parent process waits for the child process to complete.
Note that argument processing varies depending on the number of
arguments. The return value is the exit status of the program as
returned by the wait() call. To get the actual exit value divide by
256. See also L</exec>. This is I<NOT> what you want to use to capture
^^^^^^^
the output from a command, for that you should merely use backticks, as
^^^^^^^^^^ ^^^^^^^^^^^^^
described in L<perlop/"`STRING`">.
---------------------------
: Thank you sooooo much!
Uh huh. We are not here to search the docs for you ya know...
If you are sincere about those thanks, then please spend a few minutes
searching for keywords from your question before posting a question
to tens of thousands of computers around the entire World...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 30 Mar 1997 11:36:35 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: CORRECT Re: perl5 string splitting question
Message-Id: <8c9135xm4s.fsf@gadget.cscaper.com>
>>>>> "David" == David Alan Black <dblack@icarus.shu.edu> writes:
David> Or even:
David> #!/usr/local/bin/perl -w
David> $string = '123456789_123456789';
David> $chunksize = 4;
David> print join "\n", grep /./, split /(.{$chunksize})/, $string;
David> (Go ahead, Randal. Make my day. :-)
At your bequest:
$ perl
$string = "123456789_123456789";
@chunks = $string =~ /(.{1,4})/sg;
print map("[$_]", @chunks), "\n";
^D
[1234][5678][9_12][3456][789]
$
Notice the last short chunk. Ahh, the magic of greedy regex!
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 519 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: 30 Mar 1997 11:43:55 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: tchrist@mox.perl.com (Tom Christiansen), perl5-porters@perl.org
Subject: Re: Functions and operators
Message-Id: <8c3etdxlsk.fsf@gadget.cscaper.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> @a = ('a'..'z');
Tom> $a = time @a; print "$a\n"; # takes no args, hence compiler error
Tom> $a = int @a; print "$a\n"; # takes one scalar arg
Tom> $a = unlink @a; print "$a\n"; # takes a list of args
Or this:
%3 = ( fred => 5, barney => 2);
$a = time %3; # no args, so time mod 3
$a = int %3; # one arg, so scalar (hash bucket stats)
$a = unlink %3; # list arg, so unlink qw(fred 5 barney 2)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 519 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: Sun, 30 Mar 1997 00:53:21 -0800
From: annalisa <annalisa@mkt2mkt.com>
Subject: Re: Has anyone heard the rumour that Microsoft have bought Perl?
Message-Id: <333E29D8.1A2B@mkt2mkt.com>
Jonathan Tracey wrote:
>
> I have it on good authority that Microsoft have aquired the rights to
> future versions of Perl. If so how long before we get Visual Perl?
> Any thoughts.
>
> Jon..................
Gawd!!! I'm having a heart attack just thinking about it for one
second!
Talk about Darth Vadar and a Dark Star!
Bill Gates and the Black Perl....
Larry Wallwalker and Princess Arraya...
chop(bacca) and rand($olo)
------------------------------
Date: Sun, 30 Mar 1997 05:51:10 -0600
From: shyde@POBoxes.com
Subject: Re: HELP: how to run perl under dos ?
Message-Id: <859722010.20814@dejanews.com>
In article <333C46CA.18F@dimensional.com>,
josin@dimensional.com wrote:
>hi, i have a wintel box, with perl4 loaded in.
>
>i want to be able to call my scripts from any directory, while
>in a dos window.
>
>currently, i have to execute the script from the same directory
>where perl.exe resides. else, i get the msg:
>
>"Can't locate getopts.pl in @INC at...(script name)"
>
>i have the directory where perl.exe resides in my path. thus, i have
>no trouble invoking perl itself from anywhere.
>
>but i have trouble executing scripts from other directories...
>
>i tried using "perlgate". thanks to it, i can just
>type the name of the script, if i am in any directory. but
>with the same results... (same msg as above)
>
>thanks for any pointers. - josin
You need to set the PERLLIB environment variable, add a line similare to
this to your autoexec.bat:
set PERLLIB=c:\path\to\perllib
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 30 Mar 1997 07:35:40 -0500
From: Alex Chkliar <concord@cam.org>
Subject: How to convert .dbm to (.pag .dir)
Message-Id: <333E5E1C.3578@cam.org>
Hello!
My ISP recently switched to NDBM library that allows users to open
several databases
at the same time. However, my older database is a single file .dbm
format.
NDBM library now supports dbm files that come as a pair of files (.pag
.dir)
and my scripts return an empty file after a query.
Is there a way to convert .dbm to (.pag .dir)? Thank for help.
Alex.
Montreal
------------------------------
Date: Fri, 28 Mar 1997 15:49:33 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Need Help Troubleshooting Script
Message-Id: <fl_aggie-ya02408000R2803971549330001@news.fsu.edu>
In article <5hh6f1$5ih$1@newsin-1.starnet.net>, ficken@mobot.org (Keven D.
Ficken) wrote:
[posted && cc'd]
+ I need help with the following script. I can not figure out what is
+ wrong with it. It seems to work fine from the command line, but when
+ I try to submit the form to which it is tied using a web browser, I
+ get a "Document contains no Data" error. Can someone please help me?
Yeah, see my sig.
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Fri, 28 Mar 1997 14:38:25 -0800
From: William Hunt <wjhunt@ccnet.com>
Subject: Re: Objective C is cool. (Re: Who makes more $$..)
Message-Id: <333C4861.2965@ccnet.com>
Da Borg wrote:
> ...
> Objective-C was indeed developed by Next people but since it was
based on GNU code, it was released after a FSF letter to NextStep
lawyers.
Objective C was developed a long time ago by a small company called
Stepstome. Brad Cox, the guy behind it wrote lots of articles and at
least one book about software ICs.
Next adopted it as a better choice than C++ but they didn't develop it.
(I think they eventually bought Stepstone since they were by then the
principal remaining user of Objective C.
Bill Hunt
------------------------------
Date: Sun, 30 Mar 1997 06:01:38 -0600
From: shyde@POBoxes.com
Subject: Re: Ok, what do I need and where can i get it ??
Message-Id: <859723013.21144@dejanews.com>
In article <333D18EA.6369@mailbox.swipnet.se>,
lo.tech@mailbox.swipnet.se wrote:
>Hey you!...
>
>Ok, I feel like I wanna get started to learn how to program
>CGI-Scripts..
>Or Pearl ?!.. Ehh..
>Any diference??..
Well...yeah...that's a bit like saying i want to learn to program for a
PC or learn C, any difference? You can write CGI programs in languages
other than perl and u can use perl for stuff other than CGI, just like
you can write programs for a PC in a language other than C, and you can
use C to write programs for machines other than PCs.
>
>Anyone know any good page to learn from the begining how
>to get started...
>I know some C++.. And I have Visual C++...
>
>What else do I need to get started and where can I get it..
>(I prefer to get it for free!.. *grin*)..
Take a look at the FAQs and manpages in the documentation section on
www.perl.com/perl
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 30 Mar 1997 05:51:10 -0600
From: shyde@POBoxes.com
Subject: Re: Perl lib or module for MS-Word docs and/or RTF needed!
Message-Id: <859721779.20768@dejanews.com>
In article <333C752D.25E9@mail.nevalink.ru>,
blazer@mail.nevalink.ru wrote:
>If you know some perl program that can create/convert Word 6.0-7.0 and
>Reach Text Format, or even the description of data format, please, send
>me. I'd like both UNIX and Win32 versions.
>Thanks.
Why not just use the converter built into word?
> ***************************
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 30 Mar 1997 11:52:14 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eric Poindexter <eric@nettown.com>
Subject: Re: Q: sorting by date
Message-Id: <8czpvlw6u9.fsf@gadget.cscaper.com>
>>>>> "Eric" == Eric Poindexter <eric@nettown.com> writes:
Eric> sub dateSort {
Eric> my ($aMM, $aDD, $aYY) = split m!/!, $a;
Eric> my ($bMM, $bDD, $bYY) = split m!/!, $b;
Eric> $y = $aYY <=> $bYY;
Eric> return $y if $y;
Eric> $m = $aMM <=> $bMM;
Eric> return $m if $m;
Eric> return $aDD <=> $bDD;
Eric> }
This is pretty expensive on a large hash. You should be using
something like the Schwartzian Transform, described in some detail in
my "sorting" Unix Review columns at
http://www.stonehenge.com/merlyn/UnixReview/. Here's how it
would look for this one:
@dates{qw(
01/23/45 5/02/46 4/14/43 11/21/12 1/23/45
1/2/45 1/11/45 01/23/99
)} = ();
@sorted_keys =
map { $_->[0] }
sort {
$a->[3] <=> $b->[3] or # year
$a->[1] <=> $b->[1] or # month
$a->[2] <=> $b->[2] # day
} map {
[$_, split /\//] # (orig, mm, dd, yy)
} keys %dates;
print map "$_\n", @sorted_keys;
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 519 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: Sun, 30 Mar 1997 04:01:03 -0500
From: Mark C Seigle <mianzo+@cs.cmu.edu>
Subject: Quick Help
Message-Id: <333E2BCF.2781E494@cs.cmu.edu>
Hey all!
Look, I am new to perl, and I need a quick command that will take a
scalar or an array and convert it to lowercase. Subtracting 48 from the
value, (for all of us old C programmers!), doesn't seem to work. Any
help will be grealy appreciated...
Thanx,
--
Mark C. Seigle
School of Computer Science Operations
Carnegie Mellon University
------------------------------
Date: 30 Mar 1997 14:54:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Quick Help
Message-Id: <5hluqu$asa@fridge-nf0.shore.net>
Mark C Seigle (mianzo+@cs.cmu.edu) wrote:
: Look, I am new to perl, and I need a quick command that will take a
: scalar or an array and convert it to lowercase. Subtracting 48 from the
: value, (for all of us old C programmers!), doesn't seem to work.
Goodness! I think you're supposed to run around the block a few times after
subtracting 48 from the value, and THEN it will work. :-)
I just answered this question several minutes ago, and I really shouldn't
have, because it's asked about four times a day, and no one seems to read
the follow-ups to the other postings asking about lc(), much less the
copious and satisfying amounts of Perl documentation included with your
Perl distribution!
Grepping ain't no crime.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Sun, 30 Mar 1997 08:43:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Quick Help
Message-Id: <d7ulh5.eq.ln@localhost>
Mark C Seigle (mianzo+@cs.cmu.edu) wrote:
: Look, I am new to perl,
That matters not at all.
You are _still_ expected to make some small attempt to answer your
question yourself before posting to tens of thousands of computers
around the entire Earth.
: and I need a quick command that will take a
: scalar or an array and convert it to lowercase. Subtracting 48 from the
^^^^^^^^^
^^^^^^^^^
: value, (for all of us old C programmers!), doesn't seem to work.
For *really* "Quick Help" (and to follow the polite Usenet custom
of spending a few seconds looking for the answer before posting)
search the free documentation for 'lower case'.
You would have gotten the answer in 20 *seconds* if you had...
Think someone will answer your question from c.l.p.m in less time
than that?
grep 'lower case' *.pod Finds two lines. One of them contains an answer.
grep lowercase *.pod Finds 15 lines. One of them says:
"Returns an lowercased version of EXPR."
Golly, I bet that does what you have asked for...
: Any
: help will be grealy appreciated...
Any effort on your part to answer your question yourself before posting
will be greatly appreciated...
: Thanx,
Uh huh.
We are not here to read the docs for you ya know.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 30 Mar 1997 14:12:27 +0530
From: Regeti Srinivasa Rao NIVA <rsr@india.ti.com>
Subject: Re: String substitution question
Message-Id: <t0xg1xdydn0.fsf@india.ti.com>
burt@ici.net (Burt Lewis) writes:
> $value =~ s///_/g;
s/\//_/g # please note that I had to use a '\'
> $value =~ s/[/]/_/g;
> $value =~ s/([/]/_/g;
>
> Appreciate any help on this.
>
> Thanks,
>
> Burt Lewis
> burt@ici.net
>
--
-srinu-
------------------------------
Date: 30 Mar 1997 13:44:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: two perl4->perl5 gotchas not in perltrap manpage?
Message-Id: <5hlqok$dht@lyra.csx.cam.ac.uk>
Dave Steiner <steiner@klinzhai.rutgers.edu> wrote:
>I have something like:
>
> print "$user@$host\n";
>
>and -w never complained but it certainly didn't print what I expected
>since @$host was undefined. \@ fixed the problem. I suspect this
>can't be found via -w although maybe it could warn you during
>run-time.
You should get an error if you "use strict 'refs'".
>The second one is a different behavior in accessing non-defined hash
>elements. Perl4 would return '' but perl5 returns undef. I think the
>perl5 behavior makes more sense but I didn't find any reference to
>this change in behavior in the book or manpages.
It's not to do with undefined hash elements. It's because you tested
the value for equality to ''. In Perl4, if you used an undefined
variable in a string context, the variable got set to ''; if you used
such a variable in a numeric context, it got set to 0.
This undocumented behaviour does not occur in Perl5.
Mike Guy
------------------------------
Date: 30 Mar 1997 01:11:03 -0800
From: jsi@idiom.com (Michael Craft)
Subject: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5hlan7$2uu@idiom.com>
> > > > You want a more productive capitalism? Scrap the copyright and
> > > > patent laws and let the little guy, who has invented *everything*,
> > > > unleash his creativity and capitalism will have a fighting chance;
> > > > otherwise, socialism is better in all ways than capitalism, which
> > > > inevitably leads to monopolization if it weren't for interference
> > > > by the state.
> > >
> > > Uh -- patents were invented to *protect* the little guy. Otherwise,
> > > everytime the "little guy" invented something, the "big guy" would
> > > simply use the idea, and blow out the little guy because of much
> > > greater resources.
> >
> > Then what value is the "little guy" if he is unable to compete?
> >
> > If the patent and copyright laws were revoked the assets of the
> > "big guy" would be substantially depleted as it is economic protection
> > by the state that gives the "big guys" their awesome power.
>
> Actually, exactly the opposite would be true. Socialism has one major
> flaw, a flaw that will forever make it never more than marginally
> successful (unlike capitalism, which, over time is always very
> successful). Socialism fails to take into account the simple fact that
> any human will work harder and smarter when he/she directly enjoys the
> fruits of his/her labor. Why should any person work harder than needed
> to provide for him/herself when everything beyond their needs goes to
> someone else. Socialism assumes that all people are willing to work for
> the social good.
Socialism has it that those who work well for the common good are
more valuable than those who do the same work for profits.
------------------------------
Date: 30 Mar 1997 11:25:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: use and if test
Message-Id: <5hliir$9cc@lyra.csx.cam.ac.uk>
Tom Phoenix <rootbeer@teleport.com> wrote:
>So, maybe you could do something like this.
>
> BEGIN {
> if ($PERL_VERSION >= 5.003) {
> require 'strict.pm';
> import strict;
> }
> }
>
>What happened to the scoping problem? I wish I could tell you! :-) Every
>time I try to write what I _think_ is happening, I realize that I know
>less than I thought I did. (Somebody who understands this will now, I
>hope, enlighten us all as to just what's happening here.)
Yes, that should work OK (tho' I haven't tested it).
If you look at strict.pm, it's not too difficult to understand why.
strict::import simply sets (or resets) flags which the compiler acts on.
To achieve block scoping, the compiler simply preserves the flags at
the start of a block, and restores them at the end of the block. At
the start of a file, the flags are preserved and reset; at EOF they are
restored. The above code will set the flags _at compile time_; they
will remain in force until the restore at the end of the block or file
containing the BEGIN block.
You need to think carefully about the BEGIN block. The flags are
restored at the end of _compilation_ of the BEGIN block, as with any other
block. The block is _subsequently_ executed, setting or resetting the
flags as required.
Exercise for the reader: what happens with the following code?
BEGIN {
if ($PERL_VERSION >= 5.003) {
no strict;
require 'strict.pm';
import strict;
}
}
Mike Guy
------------------------------
Date: 30 Mar 1997 09:16:49 GMT
From: "Ster" <ster@stargazer.net>
Subject: visit my first CGI/PERL project
Message-Id: <01bc3ce9$e28d2a40$0a7b65cf@cornholio>
I welcome everyone to visit my first CGI/Perl project. I am welcoming the
readers of com.lang.perl & comp.lang.perl.misc because you have helped me
so much.
here it is: http://stargazer.net/ster_scripts/help.desk.pl?
THANKS!
Ster
___________________________________________
Ster Computer Services http://stargazer.net/~ster
Ster's Idiot Extravaganza: http://server.nich.edu/~njd
StarGazer ISP http://www.stargazer.net
WHO's WHO? http://stargazer.net/~ster/who.html
------------------------------
Date: Sun, 30 Mar 1997 05:51:11 -0600
From: shyde@POBoxes.com
Subject: Re: Webfax scripts or mods in Perl?
Message-Id: <859721281.20642@dejanews.com>
In article <333CAAE2.6C0@mkt2mkt.com>,
annalisa <annalisa@mkt2mkt.com> wrote:
>Does anyone know of any webfax scripts laying around?
>
>I'm investigating writing a program for an order form to be sent to a
>fax rather than an email box.
>
>Then I thought..Gee maybe it's been done already.
>
>Care to share?
You could just send an email to tpc.int (free email->fax gateway) take a
look at www.tpc.int for more info
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 30 Mar 1997 14:20:08 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Why doesn't pod2html send its default output to STDOUT?
Message-Id: <5hlsqo$t26@news.service.uci.edu>
[author of script in question cc'd as requested in source]
[perl5.002; SunOS medusa.acs.uci.edu 5.4 Generic_101945-13 sun4m sparc]
All of the other pod2* scripts in the standard perl distribution
that I've tried (pod2man, pod2text) print to STDOUT. pod2html,
however, insists on writing a file in the directory it's reading
from, which is often a nuisance when I've gsu'd to an account which
doesn't have write privileges iin that directory!
If for some reason this can't be changed (and I can't see why it
couldn't), could there at least be an option to set the filename
with a switch? And how about a usage message, or if not that,
reading from STDIN in the absence of an input file?
Running it with no args produces:
medusa% pod2html
Creating POSIX.html from POSIX.pod
can't create POSIX.html: Read-only file system at /dcs/packages/perl5.002/bin/po
d2html line 86.
POSIX? Who said anything about POSIX? :-)
Dreaming of a day when I just do
pod2html myfile.pm > /my/own/damn/path/and/filename.html !
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: 30 Mar 1997 14:05:09 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Why is no subscripting allowed in custom sort routines?
Message-Id: <5hlrul$sns@news.service.uci.edu>
[perl 5.002; SunOS medusa.acs.uci.edu 5.4 Generic_101945-13 sun4m sparc]
With reference to the syntax for custom sort routines, the manpage on
sort says
"SUBNAME may be a scalar variable name, in which case the value provides
the name of the subroutine to use. In place of a SUBNAME, you can
provide a BLOCK as an anonymous, in-line sort subroutine."
Consequently the following does not work:
use strict;
my @foo = qw( cat mouse dog fish bird squirrel zebra );
my $routine = sub { $a cmp $b };
my @sorted_foo = sort &$routine @foo;
My question: how can I write an anonymous sort subroutine that is NOT
an in-line BLOCK? I want to be able to create a reference to a default
sort routine which I could then change if one condition or another is
met.
As in the following pseudocode:
if ( defined($opt_s) ) {
$sort = eval "sub { $opt_s };";
} else {
$sort = sub {$a cmp $b};
}
foreach (sort &$sort @dirs) {
...
}
At present it seems that only named subroutines or IN-LINE BLOCKS will
work, and that neither of these is suited for the task spelled out
above.
I suppose I could eval the whole foreach loop using the BLOCK syntax,
but that seems like a major kludge.
if ( defined($opt_s) ) {
eval "foreach (sort { $opt_s } \@dirs) { do stuff }";
} else {
eval "foreach (sort {\$a cmp \$b} \@dirs) { do stuff }";
}
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: 30 Mar 1997 18:43:06 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Why is no subscripting allowed in custom sort routines?
Message-Id: <5hmc7q$agp@pirate.shu.edu>
Hello -
friedman@medusa.acs.uci.edu (Eric D. Friedman) writes:
>[perl 5.002; SunOS medusa.acs.uci.edu 5.4 Generic_101945-13 sun4m sparc]
>My question: how can I write an anonymous sort subroutine that is NOT
>an in-line BLOCK? I want to be able to create a reference to a default
>sort routine which I could then change if one condition or another is
>met.
>As in the following pseudocode:
>if ( defined($opt_s) ) {
> $sort = eval "sub { $opt_s };";
>} else {
> $sort = sub {$a cmp $b};
>}
>foreach (sort &$sort @dirs) {
> ...
>}
>I suppose I could eval the whole foreach loop using the BLOCK syntax,
>but that seems like a major kludge.
>if ( defined($opt_s) ) {
> eval "foreach (sort { $opt_s } \@dirs) { do stuff }";
>} else {
> eval "foreach (sort {\$a cmp \$b} \@dirs) { do stuff }";
>}
Possible something like this would work as middle ground:
my $routine = "sort { \$a cmp \$b }";
foreach (eval "$routine \@foo;") {
...
}
David Black
dblack@icarus.shu.edu
------------------------------
Date: 30 Mar 1997 13:05:38 GMT
From: elarishy@aol.com (ELARISHY)
Subject: WinPerl by Maxwell Nairn Andrews Beta 95
Message-Id: <19970330130500.IAA16492@ladder01.news.aol.com>
I looked very hard for a GUI type perl until l I founded ( see above )
Does anyone know , how I can get a better release ( If any )
Appreciate anyhelp, to locate a similer product ( even commercial one )
PS There is no way to get hold of M.N. Andrews he does not respond to
email
------------------------------
Date: Sun, 30 Mar 1997 08:23:52 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: work on command line and not via browser?
Message-Id: <o1tlh5.sm.ln@localhost>
diep.truong@mci.com wrote:
: The following routine, which reads a web page and writes the data to
: a file, works everytime in a command line environment but works
^^^^^ ^^^^^^^^^^^^^^^^^
: intermitently when the program is called from a web browser.
^^^^^^^^^^^^^^^^^^^^^^^^^
: Any ideas why? and what can I change to make it work every time?
This is a Frequently Asked Question.
Even though it is a _CGI_ question, _not_ a perl question, the Perl FAQ
addresses it.
from the perl Frequently Asked Question (FAQ) part 9:
---------------------------------------------
=head2 My CGI script runs from the command line but not the browser. Can you help me fix it?
Sure, but you probably can't afford our contracting rates :-)
Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols). Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.
The useful FAQs are:
http://www.perl.com/perl/faq/idiots-guide.html
http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
http://www.perl.com/perl/faq/perl-cgi-faq.html
http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
http://www.boutell.com/faq/
---------------------------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.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 204
*************************************