[11264] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4864 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 10 15:07:20 1999

Date: Wed, 10 Feb 99 12:00:23 -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, 10 Feb 1999     Volume: 8 Number: 4864

Today's topics:
    Re: Big pbm with perl5.00502 solaris "package" (Greg Ward)
    Re: Calculate yesterdays date (John Stanley)
    Re: Calculate yesterdays date (M.J.T. Guy)
    Re: Calculate yesterdays date nguyen.van@imvi.bls.com
    Re: Calculate yesterdays date <mhofer@jpmorgan.com>
    Re: Can't get hash to return properly. (Greg Ward)
    Re: change column of nmbers to 2 dim array (brian d foy)
    Re: change column of nmbers to 2 dim array <jeffp@crusoe.net>
    Re: Converting CSV to LDIF (Craig Berry)
        Echoing a Perl Script <JEDI@xxx.com>
    Re: Echoing a Perl Script (brian d foy)
        Echoing Lines in PERL <JEDI@xxx.com>
    Re: Echoing Lines in PERL <ludlow@us.ibm.com>
    Re: Echoing Lines in PERL <alex@kawo2.rwth-aachen.de>
    Re: Frustrating problem with Exporter (Greg Ward)
    Re: fun with strings... ()
    Re: list comparison code? <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Monospace font (Michel Bujardet)
    Re: Need Perl Tcl/Tk for Linux (Greg Ward)
        OS-supported open-time mandatory file locks from Perl? <chess@watson.ibm.com>
    Re: Perl 'zine <jjarrett@ecpi.com>
    Re: perl -T results in @INC not getting $PERL5LIB (M.J.T. Guy)
    Re: perl floating points [benchmarking] (Sitaram Chamarty)
        PERL for Personal Web Server <sangapum@hotmail.com>
        Problem with exporter (repost) <tomw@action.cnchost.com>
    Re: Python vs. Perl vs. tcl ? <aqumsieh@matrox.com>
    Re: Python vs. Perl vs. tcl ? <che@debian.org>
    Re: Python vs. Perl vs. tcl ? <larsga@ifi.uio.no>
        system() blocks SIG{INT}/HUP; workaround? <ljnelson@unix.amherst.edu>
        Win32 perl how to do system(set var= $var) sirron@mail.mcoe.k12.ca.us
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 10 Feb 1999 19:14:28 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Big pbm with perl5.00502 solaris "package"
Message-Id: <79slqk$4hu$3@news0-alterdial.uu.net>

David Combs <dkcombs@netcom.com> wrote:
> Although have been happily writing useful programs with perl5.004,
> am having problems with perl5.00502, as just downloaded as a solaris 2.5.1 
>   already-compiled "package" from www.sunfreeware.com, via the file 
>   "perl-5.005_02-sol25-sparc-local.gz", which I gunzipped and then
>   (solaris) "pkgadd'ed".
[...]
> use strict;
> use diagnostics;
> print "hello\n";
[...]
> /david3/packages/LWperl/bin/perl5.00502 -I/david3/packages/LWperl/lib/perl5/5.00502/ -w ~/hello.pl
> couldn't find diagnostic data in
> /usr/local/lib/perl5/5.00502/pod/perldiag.pod
> /david3/packages/LWperl/lib/perl5/5.00502//sun4-solaris
> /david3/packages/LWperl/lib/perl5/5.00502/
> /usr/local/lib/perl5/5.00502/sun4-solaris /usr/local/lib/perl5/5.00502
> /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
> /usr/local/lib/perl5/site_perl/5.005 . /home/dkc/hello.pl at
> /david3/packages/LWperl/lib/perl5/5.00502//diagnostics.pm line 229,
> <POD_DIAG> chunk 533.
> 
> BEGIN failed--compilation aborted at /home/dkc/hello.pl line 2, <POD_DIAG> chunk 533.

Gee, I hope that quoting and eliding isn't too confusing.  I think I've
reduced your problem to its bare essentials.

In a nutshell, your Perl is mis-installed.  The fact that you're giving
an explicit path to the Perl binary, *and* an explicit -I so Perl can
find its library (I assume -- what happens if you leave off the -I?),
looks very strange.

Where does the Solaris Perl 5.00502 package get installed?  My guess,
from the error message you got when using 'use diagnostics', is that
it's in /usr/local, the default for most Unix systems.  But it appears
that it's library is *not* in /usr/local/lib/perl5, which is the cause
of your problems: your Perl binary has /usr/local/lib/perl5 hardcoded
in, but it can't find its library there.  You *must* put the Perl
library where the binary expects to find it, or you will lose bigtime!

BTW, the reason that 'use diagnostics' is failing is because it pokes
around the library directory looking for a file called perldiag.pod.  If
it can't find it ... boom!

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 10 Feb 1999 18:27:36 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Calculate yesterdays date
Message-Id: <79sj2o$766$1@news.NERO.NET>

In article <oee7ltqh5th.fsf@alpha.hut.fi>,
Jarkko Hietaniemi  <jhi@alpha.hut.fi> wrote:
>
>Peter Webb <Peter.Webb@cern.ch> writes:
>
>> Is there a quick way of calculating yesterdays date?
>
>localtime(time()-86400)

Be careful. Depending on where you live and what time you run this code,
you may get the day before yesterday.



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

Date: 10 Feb 1999 18:51:44 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Calculate yesterdays date
Message-Id: <79skg0$pdv$1@pegasus.csx.cam.ac.uk>

Jarkko Hietaniemi  <jhi@alpha.hut.fi> wrote:
>
>Peter Webb <Peter.Webb@cern.ch> writes:
>
>> Is there a quick way of calculating yesterdays date?
>
>localtime(time()-86400)

As I keep repeating, that will give wrong answers for two hours each year
(in most places).


Mike Guy


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

Date: Wed, 10 Feb 1999 18:58:40 GMT
From: nguyen.van@imvi.bls.com
Subject: Re: Calculate yesterdays date
Message-Id: <79sksq$qu$1@nnrp1.dejanews.com>

Hi,

yes, I think that manip perl module is the best tool to calculate any date you
want. I used it a lot, and it works very nicely.
the follwoing is the sample code

_____________________________________________________________________________

 use Date::Manip qw(ParseDate UnixDate);

($string_date = "yesterday")
$date = ParseDate($string_date);
          if (!$date)
          {
             warn "Bad date string: $_\n";
             next;
          }
          else
          {
              ($year, $month, $day) = UnixDate($date, "%Y", "%m", "%d");
              print "Date was $month/$day/$year\n";
              print "month was $month\n";
              print "date was $day\n";
              print "year was $year\n";
          }
#}

exit;

____________________________________________________________________________
In article <36C158F1.463073ED@cern.ch>,
  Peter Webb <Peter.Webb@cern.ch> wrote:
>
> Is there a quick way of calculating yesterdays date?
>
> Peter.
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 10 Feb 1999 14:03:42 -0500
From: "Michael D. Hofer" <mhofer@jpmorgan.com>
Subject: Re: Calculate yesterdays date
Message-Id: <36C1D80E.4893@jpmorgan.com>

M.J.T. Guy wrote:
> 
> Jarkko Hietaniemi  <jhi@alpha.hut.fi> wrote:
> >
> >Peter Webb <Peter.Webb@cern.ch> writes:
> >
> >> Is there a quick way of calculating yesterdays date?
> >
> >localtime(time()-86400)
> 
> As I keep repeating, that will give wrong answers for two hours each year
> (in most places).
> 
> Mike Guy

Luckily, neither of those hours span a month boundary (at least in the
USA), so by comparing the day-of-the-month of both dates you can
determine if you are playing with a ST/DT cusp.
-- 
Michael D. Hofer
Internet Services
212 235 4415


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

Date: 10 Feb 1999 19:20:41 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Can't get hash to return properly.
Message-Id: <79sm69$4hu$4@news0-alterdial.uu.net>

Ken Wilson <ken.wilson@home.com> wrote:
> Here is the code that's driving me up a wall.  Any assistance would be
> appreciated.
> 
> #Purpose: Changes "surname, given" to "given surname" in hash values
> #Given: \%hash where values are of format "surname, given names"
> #Returns: Reference to hash where values are now "given names surname"
> #Example: $r_users = reverseNames(\%users);
> sub reverseNames {
>     my ($ref_hash) = @_;
>     foreach my $key (keys %$ref_hash) {
>         my ($surname, $givenName) = split /, /, $$ref_hash{$key};
>         $$ref_hash{$key} = "$givenName $surname";
>     }
>     return $ref_hash;
> }

This code looks fine to me, although I haven't tried it (since another
poster said it worked for him).  Note that since you're modifying
$ref_hash in place, you really don't have to return it: any sub calling
reverseNames will find that the hash it passed in a reference to has
been changed as a side-effect.  The return is pointless.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Wed, 10 Feb 1999 14:07:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <comdog-ya02408000R1002991407260001@news.panix.com>

In article <36C1C043.15F2A09D@larc.nasa.gov>, Dale Bess <t.d.bess@larc.nasa.gov> posted:

> How can I use perl to transform a column of numbers (2592) to a 2
> dimensional
> array  (36 x 72) using say an embedded loop and print out results?

the perldsc (dsc => data structure cookbook) has a lot of good
examples of creating, accessing, and printing complex data structures.

in this case, you'd like to use a list of lists (aka LoL).

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 10 Feb 1999 14:01:28 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <Pine.GSO.3.96.990210135517.20443E-100000@crusoe.crusoe.net>

> How can I use perl to transform a column of numbers (2592) to a 2
> dimensional
> array  (36 x 72) using say an embedded loop and print out results?

It depends how you want it oriented:

Numbers
-------
A
B
C
D
E
F
G
H
I
J
K
L

If you want a 3x4 array, do you want it to look like this?
[A,B,C],
[D,E,F],
[G,H,I],
[J,K,L]


If so, the following loop should do the trick.  If you don't totally
understand references, I suggest you try:
	% man perlre
or
	% perldoc perlre


my ($x,$y);
for (@numbers){
	$array[$x][$y++] = $_;
	($x++ and $y = 0) if $y == 2;
}


A quick explanation may be in order.  $x and $y are 0 to begin with.  For
each element in @numbers, $array[$x][$y++] is assigned that element.  $y
is incremented after that is done.  Then, if $y == 2 (or possibly 36 in
your case), $x is incremented, and $y is set back to 0.

Hope this is useful.

--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp
evilJaph on #perl

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Wed, 10 Feb 1999 19:14:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Converting CSV to LDIF
Message-Id: <qUkw2.30$x72.675@newsfeed.slurp.net>

Bart Lateur (bart.lateur@skynet.be) wrote:
: Craig Berry wrote:
: >"Comma separated values".  Typically, in addition to commas separating
: >values, values may be double-quoted strings to protect internal commas,
: >and double quotes inside such strings may be backslashed to protect them.
: 
: Ouch. I don't think quotes are backslashed. Otherwise, you'd have to
: backslash backslashes too. Quotes are generally *doubled*.

I've run into both variants, actually.  Thanks for pointing out the other
one.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "The hills were burning, and the wind was raging; and the
       clock struck midnight in the Garden of Allah."


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

Date: Wed, 10 Feb 1999 18:10:36 GMT
From: "JEDI" <JEDI@xxx.com>
Subject: Echoing a Perl Script
Message-Id: <wYjw2.62$DG2.21647@PM01NEWS>

Is it possible to echo line of a PERL script while it is executing? If so,
how?

Thanks in advance...




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

Date: Wed, 10 Feb 1999 14:05:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Echoing a Perl Script
Message-Id: <comdog-ya02408000R1002991405370001@news.panix.com>

In article <wYjw2.62$DG2.21647@PM01NEWS>, "JEDI" <JEDI@xxx.com> posted:

> Is it possible to echo line of a PERL script while it is executing? If so,
> how?

you could write a pared-down debugger to do this for you, but i'm 
guessing that the scroll rate would be pretty fast.  did you want a 
breakpoint after every line?

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 10 Feb 1999 18:55:19 GMT
From: "JEDI" <JEDI@xxx.com>
Subject: Echoing Lines in PERL
Message-Id: <rCkw2.63$DG2.22053@PM01NEWS>

Being new to PERL, is it possilble to echo back lines of a PERL
script as it is executing? If so, how?

Thanks....




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

Date: Wed, 10 Feb 1999 13:10:18 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Echoing Lines in PERL
Message-Id: <36C1D99A.C812F9ED@us.ibm.com>

JEDI wrote:
 
> Being new to PERL, is it possilble to echo back lines of a PERL
> script as it is executing? If so, how?

I'm guessing that you want to do this for some kind of debugging.  If
so, try the -d switch.

perldoc perldebug

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Wed, 10 Feb 1999 20:26:27 -0500
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: JEDI <JEDI@xxx.com>
Subject: Re: Echoing Lines in PERL
Message-Id: <36C231C3.10A66C24@kawo2.rwth-aachen.de>

JEDI wrote:
> 
> Being new to PERL, is it possilble to echo back lines of a PERL
> script as it is executing? If so, how?

Hi,

add -d switch to your perl interpreter in the script:

#!/usr/bin/perl -d

and it will run perl debugger. Use then "n" and "s"
commands. There's an introducing article at
http://www.ssc.com/lj/issue49/2484.html

Greetings
Alex

--
http://www.simplex.ru/pref.html


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

Date: 10 Feb 1999 19:31:07 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Frustrating problem with Exporter
Message-Id: <79smpr$4hu$5@news0-alterdial.uu.net>

Tom Williamson <tomw@action.cnchost.com> wrote:
> The export script looks like:

The standard terminology would be to call this an "exporting module",
but that's picking nits.

> use Exporter;
> @ISA = qw(Exporter);  ##This is never explained, but it's in all the
> examples
> $MYSYM1 = "BLA BLA BLA";
> $MYSYM2 = "I HATE PERL";
> @EXPORT = qw( MYSYM1 MYSYM2 );

If the symbols you're trying to export are scalar variables, then you
need the dollar sign:

   @EXPORT = qw($MYSYM1 $MYSYM2);

I don't recall ever seeing this mentioned in the Exporter documentation
-- I guess you're just supposed to figure it out on your own.  ;-)

BTW #1: that documentation you quoted in your second post is not
ActiveState's, it's Perl's.  Nice of them to repackage it for the
Windows folks, but that's the standard Perl documentation!

BTW #2: if you don't like Perl, try Python.  Among other nice features,
it has a very clear and simple import mechanism.  (Err, most of the
time... various people are trying to complicate it, but for now it's
still quite clear and simple.)  See http://www.python.org/.

BTW #3: there is no such newsgroup as comp.lang.perl.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Wed, 10 Feb 1999 18:11:32 GMT
From: alves@sparky.webmetro.com ()
Subject: Re: fun with strings...
Message-Id: <oZjw2.15$st6.3886356@IConNet>

Allan M. Due (Allan@due.net) wrote:
: Ronald J Kimball wrote in message
: <1dmzir6.14u24bmk0l37kN@bay2-161.quincy.ziplink.net>...
: :Marcos <alves@webmetro.com> wrote:
: :> I need to be expand the \n and \t sequences to actual newlines and tabs.
: :s/(\\[nt])/"\"$1\""/gee;


: Can't resist:  gee that's cool.

: AmD

Thanks for all the replies!  And yes, gee that is cool.

marcos





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

Date: 10 Feb 1999 19:17:33 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: list comparison code?
Message-Id: <837ltqjf7m.fsf@vcpc.univie.ac.at>

Re: list comparison code?, Monty
<Monty.Scroggins@mci.com> said:

Monty> Does anyone have a snippet of code that would
Monty> perform the equivilent of the unix "comm"
Monty> command?  I would like to compare two lists
Monty> (A and B) and generate three output lists

Monty> a list of lines in A and not B, a list of
Monty> lines in B and not in A, a list of lines in
Monty> both A and B.

http://www.cpan.org/ would be the best bet.  And...

Set::Scalar is probably what you're after.

    use Set::Scalar;
    
    @A = qw(1 2 3 4 5 6);
    @B = qw(3 4 5 6 7 8);
    
    $sa = Set::Scalar->new(@A);
    $sb = Set::Scalar->new(@B);

    $AnotB = $sa - $sb;
    $BnotA = $sb - $sa;
    $AandB = $sa + $sb;
    
    print "in A and not in B: $AnotB\n";
    print "in B and not in A: $BnotA\n";
    print "in A and in B:     ", $AandB->as_string, "\n";

    ==>
        in A and not in B: (1 2)
        in B and not in A: (7 8)
        in A and in B:     (1 2 3 4 5 6 7 8)

(perldoc Set::Scalar for the full scoop)

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Wed, 10 Feb 1999 11:50:38 -0800
From: mb@nospamplease.matchfonts.com (Michel Bujardet)
Subject: Re: Monospace font
Message-Id: <mb-1002991150380001@news.compuserve.com>

In article <36BEBFE7.B4795452@intnet.mu>, Eddy Young <young@intnet.mu> wrote:

> I'm looking for a good monospaced font with decent line spacing (not too
> close) for program editing. I'd prefer free fonts.

See the site below, Text section for pure monospace. The Dactylographe
font has a free evaluation sample.

For programming, though, there is Oloron Program, in the Special section,
which is a monospaced font created especially for programming, with bolder
punctuation, slashed zero, and more.

Michel Bujardet

-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Fonts for Windows, Macintosh, OS/2, Linux - Free samples !

Check out : http://www.matchfonts.com

Michel Bujardet

-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Fonts for Windows, Macintosh, OS/2, Linux - Free samples !

Check out : http://www.matchfonts.com




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

Date: 10 Feb 1999 19:04:56 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Need Perl Tcl/Tk for Linux
Message-Id: <79sl8o$4hu$2@news0-alterdial.uu.net>

KC <dont@send.me.nothing> wrote:
> Where can I download the Perl Tcl/Tk module for linux. I found it once
> but can't anymore.

I'm not sure what you're talking about; do you mean Perl/Tk?  (Ie. the
module that includes Tk with all the Tcl ripped out and bound to Perl.)
If so, you can find it on CPAN: try going to http://cpan.perl.com/ and
searching for "Tk".

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Wed, 10 Feb 1999 19:17:35 GMT
From: David M. Chess <chess@watson.ibm.com>
Subject: OS-supported open-time mandatory file locks from Perl?
Message-Id: <79sm03$1uk$1@nnrp1.dejanews.com>

I hope I don't get too jumped-all-over for suggesting that certain
Closed Proprietary Operating Systems might have useful features
that Certain Popular Open Systems don't, but...

In Windows95 and WindowsNT (and heck in DOS 3.3 for that matter),
there's a set of flags you can pass in at open time that has semantics
like "and don't let anyone else open this file until I've closed it",
or "and don't let anyone open this file for write until I've closed it",
and so on.  I'm writing a simple logfile-writing class that might be
used by two different processes at once, to try to write to the same
log file.  If this were C, I'd just pass in "SH_DENYWR" on the _sopen()
call, put the obvious retry-for-a-bit loop around it, and there I'd
be (roughly).  But this is Perl!

I've been unable to find a way to do this from Perl; is it possible?
I suppose it'd be sort of a faux pas for a real Perl Guru to write
a module that only worked under DOS and Windows.   *8)  But I thought
I'd ask anyway.

I've searched the groups and read about various means of file
locking: flock() works under WinNT but not Win95, and is sometimes
only an advisory lock anyway; creating little hokey .lock files
using sysopen and O_EXCL doesn't always work under NFS (and is hokey);
and in general all the solutions I've seen involve opening the
file first, and locking it later.  That's the Unix tradition, I
know, and it's certainly fine in many circumstances, but it isn't
what I need in this case.

Is there any module in Perl that's implemented for Win32, and that
will let me do the equivalent of an _sopen with SH_DENYWR?  (Ideally
it'd even be implemented under other systems, as long as the fileserver
being used was running an operating system that supported that
semantics, and the network file system in use had a way to communicate
it; but that'd be asking too much!)

- -- -
David M. Chess                | "Some look at the world as it is, and ask
IBM Watson Research           |  'why?'. I look at the world as it is,
                              |  and say 'Hey, neat hack!'."  - J. R. H.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 10 Feb 1999 13:29:57 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: Perl 'zine
Message-Id: <36C1D025.8453E09D@ecpi.com>

Jon Orwant wrote:

> [snip]

> If it's not frequent enough (I'm working on that; it'll
> go bimonthly in 2000, and all-glossy with the next issue), then
> that's one thing that argues for electronic distribution -- but
> now you're talking about print as well?
>
> [snip]

> If anyone wants to help put out an electronic (and more frequent)
> version of TPJ, I'll be happy to pay you too.

[snip]

If you already plan to go monthly as soon as possible, then maybe we could just help you
out to meet our needs. Lord knows you already have publishers and paper suppliers and
advertisers and all that lined up and that alone would probably take me a full quarter to
line up assuming I did actually pull off the financial backing.

<em> I </em> wasn't wanting to go into competition with TPJ - more like supplement it
with a monthly.

And as I've been trying to field some of the basic CGI and SSI questions, what IS
actually needed and would probably sell better on news stands is a perl-based mag <em>
for webmasters </em> (be they guys like you with your own servers or guys like me using a
dial-up / commercial website or some virtual host like hypermart) which was about making
things work on the web, specifically. That is what most of our dumb questions are about
and what this newsgroup just is not for.

Thanks and sorry for stepping on any toes,

John T. Jarrett



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

Date: 10 Feb 1999 18:33:34 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl -T results in @INC not getting $PERL5LIB
Message-Id: <79sjdu$ofk$1@pegasus.csx.cam.ac.uk>

John Bossert  <jbossert@dazel.com> wrote:
>
>I note that when I execute perl (5.004 on a HP/UX system) with -T, the
>value of $PERL5LIB doesn't get into the @INC list.  Thus, things like
>"use strict;" fail. :-(

Eh?    strict.pm should be in one of the directories in the default @INC;
you shouldn't need PERL5LIB.    If not, your Perl installation is broken.

>What's the best way of addressing this?  I can think of a few:
>
>1) #!/usr/bin/perl -wTI/location/of/my/PERL5LIB as the first line of my
>script
>
>2) adding 'unshift(@INC, $ENV{'PERL5LIB'});' to the top of my script.

Don't do any of those things.    You're creating security holes.
The taint restriction is there for a reason.   Instead do

    use lib '/explicit/path/to/lib';

at the top of your script.


Mike Guy


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

Date: Wed, 10 Feb 1999 18:26:52 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: perl floating points [benchmarking]
Message-Id: <slrn7c3ch0.g4p.sitaram@diac.com>

On 10 Feb 1999 07:40:04 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Abukar Mohamed
><abukar@insidewire.com>],
>who wrote in article <36c0a703.0@diana.idirect.com>:
>> Hi
>
>About your subject: Perl has only one floating point, and it is
>allowed to float upwards only.  This point, though a scarce resource,
>is very useful to implement the bubble sort algorithm, one which is
>used when you do sort(@array) in Perl.
>
>In fact it is quite interesting to listen to these tiny bubbles
>created when this point floats upward (you need to have a pretty big
>@array for the sound to be above the ear threshold).  What I always
>was interesting in is how the speed of sort algorithm depends on
>having a desktop case vs. a tower case (with the same processor).  I
>would think that bubbles may accelerate to much higher speed given a
>tower case.
>
>Anybody ready for a benchmark?

Who would have thunk it?  Ilya *has* a sense of humour!  (Please
Ilya - no offense intended!  I have seen a few posts where you
responded very seriously to an obvious joke...)

Anyway, what you say brings the following to mind:

A long time ago there was an old Burroughs B1700, which was used
to process some usual business type stuff.  When the job got to
the "sort" phase, the rapid movement of the disk arm made the
entire disk array shake and rattle violently - you could tell from
way outside the computer room that the job had entered the sort
phase.

A co-worker of mine had a good explanation for this.  According to
him, this is how sorting technology used to work in the old days:

    Shake the disk and all the heavy records fall to the bottom!


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

Date: Wed, 10 Feb 1999 13:19:18 -0800
From: Mangesh Sangapu <sangapum@hotmail.com>
Subject: PERL for Personal Web Server
Message-Id: <36C1F7D6.28AD@hotmail.com>

okay.. i'm trying to figure out how to use PERL on the Microsoft
Personal Web Server which came with my Win98 CD.

i've downloaded ActiveState's Perl for Win95/NT.. and i've downloaded
perl5_00402-bindist04-bc.zip...  all i want to know is how do i actually
use it.. setups/configurations.. etc..

all the faq's i read seem to have a lot about PERL itself, but i haven't
seen much about actually running it on win95/98

i know you type in perl whatever.pl to test a script, but how would i
run it on my Personal Web Server... and what are all the security
hassles i may encounter...

basically, does anyone know a good page for PERL-newbies that will
explain to me in SIMPLE ENGLISH what i described above.

thanks a bunch.
mangesh


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

Date: Wed, 10 Feb 1999 11:02:53 -0700
From: Tom Williamson <tomw@action.cnchost.com>
Subject: Problem with exporter (repost)
Message-Id: <36C1C9CC.D899E75A@action.cnchost.com>

My question, in case it was unclear, was:

What is the easiest way to export global values to a number of different

Perl scripts/modules?

>From the Perl documentation ( 4.91 MB, which I HAVE been wading
through)
it appears that the Exporter class is the "preferred" method of
exporting
global values.   Yet, the entire documentation for this class (at least
in
the ActiveState implementation of Perl) consists of a single example:




SYNOPSIS
In module ModuleName.pm:

  package ModuleName;
  require Exporter;
  @ISA = qw(Exporter);
  @EXPORT = qw(...);            # symbols to export by default
  @EXPORT_OK = qw(...);         # symbols to export on request
  %EXPORT_TAGS = tag => [...];  # define names for sets of symbols

In other files which wish to use ModuleName:
  use ModuleName;               # import default symbols into my package

  use ModuleName qw(...);       # import listed symbols into my package
  use ModuleName ();            # do not import any symbols



which follows what I have laid out below.  The export/import mechanism
is
touched on obliquely if at all, and (of course) troubleshooting
information is nowhere to be found.  It is, as the saying goes, "left as

an exercise for the reader".

I simply would like to know if (1) The Export module works for this
purpose and (2) if there is an easier/better way to do this?

Tom

Jonathan Feinberg wrote:

> "Tom Williamson" <tomw@action.cnchost.com> writes:
>
> > use Exporter;
> > @ISA = qw(Exporter);  ##This is never explained, but it's in all the

> > examples
>
> When you say "this is never explained", what on earth do you mean?  Do

> you mean that the @ISA variable isn't documented?  Sure it is.  See
> perlmod, perlobj, and perltoot for starters.
>
> > $MYSYM1 = "BLA BLA BLA";
> > $MYSYM2 = "I HATE PERL";
>
> Perhaps you'll have better luck with Python.
>
> > @EXPORT = qw( MYSYM1 MYSYM2 );
>
> You haven't exported $MYSYM1 or $MYSYM2 there.
>
> You have exported some undefined entities called MYSYM1 and MYSYM2.
> Maybe they're subroutines; maybe they're filehandles.  I don't know.
>
> Followups set to delete dead group.
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
> http://pobox.com/~jdf





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

Date: Wed, 10 Feb 1999 18:32:35 GMT
From: @l@ <aqumsieh@matrox.com>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <79sjc3$vg6$1@nnrp1.dejanews.com>

In article <wkr9s0hfff.fsf@ifi.uio.no>,
  Lars Marius Garshol <larsga@ifi.uio.no> wrote:

> I think these two arguments of yours are common fallacies, but will
> not try to argue here. People in these two newsgroups are mostly fed
> up with language wars and so I think it's better if we just agree to
> differ on this.

I agree too. Appreciation of a language basically stems out from experience
and personal taste. Nothing wrong with having your own opinions :)

> | 4) He says "There are many Perl features built right into the
> | language." I just can't see why this is a Bad Thing (tm).
>
> Maybe it isn't for you, but it really freaks me out.

Again .. everyone is entitled to his own opinions.

> | 5) [...] If the author was unable to do something as easy as
> | dereferencing an array of references, then I would not count on his
> | experience to make any conclusions.
>
> That's entirely up to you, of course. The section was written that way
> to illustrate how non-intuitive this is for something that's supposed
> to be a scripting language. Even C is more straightforward.

Perl does have some awkward syntax. I don't consider references to be one of
them, but there are others. Yet, from my Python readings so far, I found a
lot of similarities between it and Perl. It (Python) also seems to have some
awkward non-intuitive syntax. For example, to avoid a newline after the
output of a print statement, you add a trailing comma. Now, that is not what
I would call intuitive (does it remind of me of Basic??) .. another example,
to construct a tuple of one item, add a comma .. again .. not very intuitive.

But I like it so far.

> | 7) He says that Python documentation is better than Perl's and
> | mentions a "program" that generates the documentation in various
> | formats. I wonder if that author knew about perldoc and the pod2*
> | scripts.
>
> Vaguely. Do they automatically get the signatures of subroutines and
> methods right in the generated documentation?

If you include the proper pod syntax .. yes.

> | 8) He says Python's data structures are easier to use than Perl's. I
> | wouldn't really comment on that since I don't know much of Python.
> | But from my limited knowledge I would tend to agree with him there.
>
> I'm glad to hear it. This was what I tried to illustrate with the
> array stuff.

Ease of use is one issue. A more important issue is efficiency (IMHO). I will
have to wait until I know enough Python to make a comparison there.

> | PS. I intend to read more on Python in the next few days. I will try
> | to draw my own conclusions then and compare them with the others.
>
> Great! If you write something about it please let me know and I'll put
> up a link to it. (I can even include it if you want.)

I will sure do that :)

--Ala
$monger->{montreal}->[0];

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 10 Feb 1999 11:05:59 -0800
From: Ben Gertzfield <che@debian.org>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <ytt1zjyjcyw.fsf@gilgamesh.cse.ucsc.edu>

>>>>> "l" == l  <@l@> writes:

    l> Perl does have some awkward syntax. I don't consider references
    l> to be one of them, but there are others. Yet, from my Python
    l> readings so far, I found a lot of similarities between it and
    l> Perl. It (Python) also seems to have some awkward non-intuitive
    l> syntax. For example, to avoid a newline after the output of a
    l> print statement, you add a trailing comma. Now, that is not
    l> what I would call intuitive (does it remind of me of Basic??) 
    l> .. another example, to construct a tuple of one item, add a
    l> comma .. again .. not very intuitive.

Interestingly enough, these two 'features' (trailing comma to inhibit
newline on print, trailing comma to make a tuple of one item) are the
EXACT features that bother me most about Python.

I adore the fact that Perl has the guts not to play tricks with
newlines like the standard C/C++ libraries and Python and Java. If you
ask for a line of input, Perl gives you a line of input -- including
the newline.

Thus the distinction between binary and text files is rendered null,
making Perl an ideal cross-platform tool for programs that need to
munge binary or text files without a distinction between the two.

Python has a lot of graceful and excellent features, but I personally
prefer how Perl's input and output routines never add or remove
newlines for you -- and never, EVER in Perl do you have to do anything
like adding a trailing comma to inhibit an automatic newline. Yuck.

Ben

-- 
Brought to you by the letters O and P and the number 8.
"I wanna be Twist Barbie!"
Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet/Open Projects IRC as Che_Fox.


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

Date: 10 Feb 1999 20:04:22 +0100
From: Lars Marius Garshol <larsga@ifi.uio.no>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <wkaeym6pxl.fsf@ifi.uio.no>


* Lars Marius Garshol
| 
| People in these two newsgroups are mostly fed up with language wars
| and so I think it's better if we just agree to differ on this.

* aqumsieh@matrox.com
| 
| I agree too. 

Cool! A low-temperature flamewar! :-)

| Appreciation of a language basically stems out from experience and
| personal taste. Nothing wrong with having your own opinions :)

I agree with that. What bothered me and made me write the article was
mainly that a lot of people seemed to choose Perl without even knowing
Python, tcl, Ruby, REXX or anything else existed at all.

I basically wanted to scream out and see if something happened. And it
did: I got the frustration out of my system. :)
 
| It (Python) also seems to have some awkward non-intuitive syntax.
| For example, to avoid a newline after the output of a print
| statement, you add a trailing comma. Now, that is not what I would
| call intuitive (does it remind of me of Basic??) .. another example,
| to construct a tuple of one item, add a comma .. again .. not very
| intuitive.

I agree that these are weak points in the syntax. However, I can't
really think of any better alternatives myself, and also, they are in
parts of the language I rarely need. So thankfully the damage is
limited. (And, yes, it reminds me too of Basic, although the varieties
I've used used ';' instead of ','.)

The trouble with references in Perl for me is that I generally
organize my programs around my data structure and I think in terms of
the data structure. So languages that make it hard for me to build the
data structure do not get a lot of points. :)
 
* Lars Marius Garshol
|
| Do they automatically get the signatures of subroutines and methods
| right in the generated documentation?
 
* aqumsieh@matrox.com
|
| If you include the proper pod syntax .. yes.

In other words: no. :) 

With javadoc and pythondoc the signature description is generated
automatically for you. With pod it seems you need to write it (and
much worse, keep it in sync with your code) yourself. It's not the end
of the world, but it is a disadvantage.

| A more important issue is efficiency (IMHO). I will have to wait
| until I know enough Python to make a comparison there.

I think you'll find that Python can be both startlingly effective and
also exasperatingly slow. Usually, speeding it up when it is very slow
is relatively easy.

--Lars M.


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

Date: 10 Feb 1999 13:17:12 -0500
From: Laird Nelson <ljnelson@unix.amherst.edu>
Subject: system() blocks SIG{INT}/HUP; workaround?
Message-Id: <36c1cd28.0@amhnt2.amherst.edu>

It says here in my handy perl documentation that system() blocks
$SIG{INT} and $SIG{QUIT}.  I'm running a program in a tight loop whose
main purpose is to call system().  This means that no matter how many
signal handlers I install :-) I can't catch any ^C's from the
keyboard.  As far as I can tell, the window of opportunity where a
SIGINT will be recognized is so small--i.e. between iterations of the
tight loop--that effectively you can't shut this stupid program down
except by slaughtering it.

Is there some special way I can install a $SIG{INT} handler so that I
can shut down my program?

Here's some example code to show what's happening.

My tight loop looks something like this (code has been changed to
protect the innocent :-)):

my $rv;
foreach $build_phase (@build_phases) {
  foreach $makefile (@makefiles) {
    $rv = system("make -f $makefile $build_phase") >> 8;
    # check for $rv errors here
  }
}

Now, in the absence of any SIG handlers, all SIGS that don't occur "in
the cracks"--i.e. between the system() call and the checking of $rv
errors--fall on the floor and are ignored.

If I install a SIG{INT} handler, that fires correctly, but again only
if the signal occurs "in the cracks".

What I need is a way to set up a SIG handler that will fire in the
middle of a system() call.  I don't plan on die()ing inside it--I'm
going to set a global var to check in the tight loop--but I can't even
get this far.

Oh, and I can't use anything that Posix might provide because I have
to support Win95 as well.

Lastly, opening to a pipe doesn't work because the command executed by
system() doesn't produce any output unless something goes wrong.

Thoughts?  More documentation pointers? 

Cheers,
Laird

-- 
laird j. nelson '94 (mailto:ljnelson@unix.amherst.edu)
associate (software engineer), time0 group
perot systems corporation (http://www.perotsystems.com)
101 main street; cambridge, ma 02141; (617) 303-5059


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

Date: Wed, 10 Feb 1999 19:37:21 GMT
From: sirron@mail.mcoe.k12.ca.us
Subject: Win32 perl how to do system(set var= $var)
Message-Id: <79sn5g$329$1@nnrp1.dejanews.com>

Hello group,

I have been writing most of my perl scripts on Linux (much more enjoyable),
but now I need to do some sys-admin stuff on an NT box. I have been trying to
use the system command as follows:

       use strict;

       #  a bunch of code
       my $return_code = 0;
       my $data = "c:\\some_dir\\some_file";
       $return_code =  system("set myvar=$data");
       if (!$return_code){
           die "problem with system command - $! - $return_code";
       }

When I do this, I find that the return code is always 0. When I do a set
command in a dos window after running this script, I find that the variable
is not being set.

Any thoughts would be appreciated.

Thanks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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