[6588] in Perl-Users-Digest
Perl-Users Digest, Issue: 213 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 1 08:07:08 1997
Date: Tue, 1 Apr 97 05:00:38 -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 Tue, 1 Apr 1997 Volume: 8 Number: 213
Today's topics:
Re: ? about require and memory consumption (M.J.T. Guy)
Re: Can you figure this out? Split, Array, Literal, wi (Simon Hyde (aka Jeckyll))
Common Blocks in text files ()
Dates before epoch (Scott M. Crevier)
Re: Dates before epoch (David Alan Black)
Deleting a line from a file <n1835173@sparrow.qut.edu.au>
Re: Does perl have constants? <Patrick.Hayes.CAP_SESA@renault.fr>
dont know to fix <engel@carmel.cc.huji.ac.il>
Re: FAQ? Where do I install modules? <vladimir@cs.ualberta.ca>
Re: File Locking <tchrist@mox.perl.com>
Re: Functions and operators (Mark)
Re: Has anyone heard the rumour that Microsoft have bou <jont@uunet.pipex.com>
Re: How Do I Use Perl To... (Simon Hyde (aka Jeckyll))
Re: how to check Backslash? <e8726057@student.tuwien.ac.at>
Re: Microsoft Running Naked Through the Streets? <jont@uunet.pipex.com>
my STDOUT is dying (SMS/Christian Fowler)
NT 4.0, IIS 3.0, Perl, Server setup netlink@netlinkcorp.com
Re: Question: Using perl to execute shell commands (Tad McClellan)
Re: Robert Braver Kills 39 People (Robert Braver)
Re: running .pl with perl.exe ERROR help! (M.J.T. Guy)
Re: Sorting a List on multiple fields <neiled@enteract.com>
Re: Sorting a List on multiple fields (Simon Hyde (aka Jeckyll))
Re: Sorting a List on multiple fields (Tad McClellan)
Re: sourcing (bash) config files within perl (Gerben Vos)
Usyng the 'system' function from perl. (Afgin Shlomit)
Re: Usyng the 'system' function from perl. (Scott M. Crevier)
Re: Usyng the 'system' function from perl. (Simon Hyde (aka Jeckyll))
Where do I get 'h2n' perl script for unix <mike_hayden@inetuk.wang.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Apr 1997 11:24:41 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: ? about require and memory consumption
Message-Id: <5hqr9p$2ep@lyra.csx.cam.ac.uk>
Keywords: Perl require use memory
David Alan Pisoni <david@cnation.com> wrote:
>
>I have a nagging question that has been on my mind for quite some time,
>but that the man pages and FAQ do not seem to address. The answer seems
>implicit in the man pages, but is never explicitly stated (and so I may
>have inferred it incorrectly.)
>
>My question is, when one uses 'require' (or 'use') in one package (i.e.,
>main), and also in another (i.e., another module 'require'd by main), does
>perl load that code module into memory a second time?
The manual is actually very explicit, down to showing equivalent code.
Extracted from the 'require' entry in perlfunc:
Otherwise, demands that a library file be included
if it hasn't already been included. The file is
included via the do-FILE mechanism, which is
essentially just a variety of eval(). Has semantics
similar to the following subroutine:
[snipped]
Note that the file will not be included twice under
the same specified name.
Mike Guy
------------------------------
Date: Tue, 01 Apr 1997 11:27:03 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Can you figure this out? Split, Array, Literal, within string
Message-Id: <3345ec0a.4886652@news.uni-stuttgart.de>
On 1 Apr 1997 03:51:56 GMT, pa19@tiac.net (Paul Antinori) wrote:
>Hi:
>
>I was wondering if anyone can help me figure out how to not recognize the
>"@" symbol as an indicator for an array in the following?
>
>Thanks much.
>
>Paul
>pa19@tiac.net
>
>
>$string = "John|Smith|John@world.net||||"
Simple, either escape the @ with a \, ie:
$string = "John|Smith|John\@world.net||||";
or use the other quotes which prevent interpretation
$string = 'John|Smith|John@world.net||||';
------------------------------
Date: 31 Mar 1997 22:24:55 GMT
From: lmsilva@cygnus.lnec.pt ()
Subject: Common Blocks in text files
Message-Id: <5hpdjn$k29$1@cygnus.lnec.pt>
Hello,
I would like to compare two files and find common
blocks of text between them. When I say common I
mean at least 5 lines of text that are the same (
ignoring case and spaces/tabs). I don't have a clue
about which blocks are similar.
I've been trying to use "diff", but it is too much
info for such a small thing (I've got many files to
compare).
Could anyone give me some hints on the problem (maybe
someone that already had to face a similar problem)?
Thanks in advance,
Luis Silva
------------------------------
Date: Tue, 01 Apr 1997 08:45:41 GMT
From: smc@smcnet.com (Scott M. Crevier)
Subject: Dates before epoch
Message-Id: <3340c7e1.55646096@netnews.worldnet.att.net>
I'm looking for suggestions on how to deal with dates before
01-Jan-1970. I've boiled down my needs into two practical examples:
1. If I was born on Nov 7, 1962, how can I calculate my age?
2. How can I find out what day of the week I was born on?
Now, I can do both of the above with dates after the Nixon era, but
I'm working with the Kennedy years. Here's a sample of code (perl 5)
that I'd like to make work:
----
#!/usr/local/bin/perl -w
use Time::Local;
$mm = '11';
$dd = '07';
$yyyy = '1962';
$i = timelocal(0, 0, 0, $dd, $mm - 1, $yyyy - 1900, 0, 0, 0);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($i);
print $mon + 1, "/", $mday, "/", $year + 1900, "\n";
----
When this runs, I would expect to have it print the same date I
started with (but it always prints "12/31/69"). I understand (or
perhaps I don't) the situation with Jan 1 1970, but I've got to think
that there is some way to work with prior dates successfully.
_______________________
Scott M. Crevier
smc@smcnet.com
http://smcnet.com
------------------------------
Date: 1 Apr 1997 11:46:25 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Dates before epoch
Message-Id: <5hqsih$2m4@pirate.shu.edu>
smc@smcnet.com (Scott M. Crevier) writes:
>I'm looking for suggestions on how to deal with dates before
>01-Jan-1970. I've boiled down my needs into two practical examples:
Also check out the Date::Manip module.
David Black
dblack@icarus.shu.edu
------------------------------
Date: Tue, 1 Apr 1997 15:53:38 +1000
From: THIAM YEO <n1835173@sparrow.qut.edu.au>
Subject: Deleting a line from a file
Message-Id: <Pine.OSF.3.93.970401155105.9762A-100000@sparrow.qut.edu.au>
Hi there!
Can anybody tell me how do I seach for a particular word in a text files
and delete that whole line?
Thanks in advance.
==================================================================
Ervin Yeo Thiam Soon
Internet : ervinyeo@elf.brisnet.org.au
------------------------------
Date: 01 Apr 1997 09:52:25 +0200
From: Patrick Hayes <Patrick.Hayes.CAP_SESA@renault.fr>
Subject: Re: Does perl have constants?
Message-Id: <vxj3etb89ja.fsf@goblin.pdj.renault.fr>
shields@crosslink.net (Michael Shields) writes:
> Tom Christiansen <tchrist@mox.perl.com> wrote:
> > *PI = \3.14159.
>
> What are the pros and cons of this vs. `sub PI { 3.14159 }'?
One con is that the sub form is exportable (in @EXPORT & @EXPORT_OK), while
the glob form isn't (unfortunateley).
Pat
--
--------------------------------------------------------
Patrick.Hayes.CAP_SESA@renault.fr (33) 01.41.04.64.20
--------------------------------------------------------
------------------------------
Date: Tue, 1 Apr 1997 14:57:11 +0300
From: Michael Engel <engel@carmel.cc.huji.ac.il>
Subject: dont know to fix
Message-Id: <Pine.SGI.3.96-heb-2.07.970401145047.21987A-100000@carmel.cc.huji.ac.il>
I was trying to fix a problem: The output is only of a single line instead
of a few ones in:
print FNOTIFY "\nRelevant Plenary Session(s):\n";
foreach $j (0..$npl) {
print FNOTIFY "\n",$fldpl[$j]," x ",$plen{$fldpl[$j]};}
i.e. only $j=0 is printed, but not the other $j.
(everything is defined, also $npl)
Could you help?
Thanks,
Michael (e-address: micky@cc.huji.ac.il)
The perl source is:
#!/usr/local/bin/perl -w
%para = ("pa01","1. Hadron Spectroscopy",
"pa02","2. Soft Interactions",
"pa03","3. Structure functions and low x physics",
"pa04","4. Hard processes and perturbative QCD",
"pa05","5. Production and decays of heavy flavours",
"pa06","6. High energy nuclear interactions and heavy ion collisions",
"pa07","7. Precision tests of the Standard Model",
"pa08","8. W-boson physics production and decay",
"pa09","9. Quark masses and mixing, CP violation and rare phenomena",
"pa10","10. Neutrino physics",
"pa11","11. Physics beyond the Standard Model phenomenology",
"pa12","12. Phenomenology of GUTS, Supergravity and Superstring
developments",
"pa13","13. Search for new particles at present colliders",
"pa14","14. Astroparticle physics and cosmology",
"pa15","15. Lattice calculations and non-perturbative methods
phenomenology",
"pa16","16. New developments in field theory and string theories",
"pa17","17. New detectors and experimental techniques",
"pa18","18. Physics at future machines",);
%plen = ("pn1","1. Astroparticle physics",
"pn2","2. Searches for new particles",
"pn3","3. QCD at hadron colliders",
"pn4","4. Supersymmetric extensions of the Standard Model",
"pn5","5. Status of the LHC",
"pn6","6. Soft interactions and diffraction phenomena",
"pn7","7. New Directions in quantum field theory",
"pn8","8. Heavy quark effective theory and weak matrix elements",
"pn9","9. Structure functions",
"pn10","10. Neutrino masses and oscillations",
"pn11","11. Lattice gauge calculations",
"pn12","12. QCD, theoretical issues",
"pn13","13. High energy nuclear collisions",
"pn14","14. Physics at future colliders",
"pn15","15. CP violation in K- and B-systems and the CKM matrix",
"pn16","16. Recent Development in detectors",
"pn17","17. New results on Cosmology",
"pn18","18. Charm and tau physics",
"pn19","19. New electron collider outlook",
"pn20","20. New Directions in particle theory",
"pn21","21. B Physics: lifetimes, decays, spectroscopy, Z->bb",
"pn22","22. Test of the Standard Model, W mass and WWZ coupling",
"pn23","23. Summary of experimental results",
"pn24","24. Top physics",);
require "../cgi-lib.pl";
$webmaster = "engel\@cc\.huji\.ac\.il";
$ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin';
MAIN:
{
my (%input); # The CGI data
$tmpfile1="/tmp/engel/tmp2";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$rmon=$mon+1;
# Read in all the variables set by the form
&ReadParse(\%input);
$npa = (@fldpa=split(':',$input{'parallel'}));
$npl = (@fldpl=split(':',$input{'plenary'}));
if($input{'fname1'} eq "" && $input{'fname2'} eq ""){
print &PrintHeader;
print &HtmlTop("Error - empty name! <P>Click 'Back' and refill
it");
print &HtmlBot;
}
else{ if($input{'phone'} eq "" && $input{'fax_no'} eq "" &&
$input{'email_addr'} eq ""){
print &PrintHeader;
print &HtmlTop("Error: No telephone or fax oe e-mail
address!");
print &HtmlBot;
}
else{
# Print the header
print &PrintHeader;
print &HtmlTop ("");
print <<ENDOFTEXT;
<BGCOLOR="#f2f358">
<p> <font size="5"> </font>
<p>
<p> <font size="5"> Thanks for filling this abstract submission form.
<p> <font size="5"> A confirmation message acknoledging receipt of your
form,
<p> will be sent to your e-mail address:
<p> <center>$input{'mail'} </center>
<p>
<p> <font size="5"> Thanks,
<p> <font size="5"> HEP97 Scientific Secretariat
<p> $mday.$rmon.$year
ENDOFTEXT
# Close the document cleanly.
print &HtmlBot;
open(FNOTIFY,">$tmpfile1");
print FNOTIFY "-----------------------------------\n\n";
print FNOTIFY "This abstract is submitted by: ",$input{'kind1'},
"\nName: ",$input{'title'}," ",$input{'fname1'};
print FNOTIFY "\n ",$input{'fname2'};
print FNOTIFY "\nContact Address(es): ", $input{'address1'},"\n",
" ",$input{'address2'},
"\n ",$input{'address3'};
print FNOTIFY "\nTelephone: ",$input{'phone'},
"\n Fax: ",$input{'fax_no'},
"\n e-mail: ",$input{'email_addr'} , "\n";
print FNOTIFY "\nRelevant Parallel Session(s):\n";
print FNOTIFY "\nRelevant Parallel Session(s):\n";
# while (($xpa,$pa) = each %para) {
# print FNOTIFY "\n",$fldpa,$pa;}
foreach $i (0..$npa) { $pa=$para{$fldpa[$i]};
print FNOTIFY "\n",$fldpa[$i],$pa;}
print FNOTIFY "\nRelevant Plenary Session(s):\n";
foreach $j (0..$npl) {
print FNOTIFY "\n",$fldpl[$j]," x ",$plen{$fldpl[$j]};}
print FNOTIFY "\n\nABSTRACT TITLE:\n",$input{'abstitle'};
print FNOTIFY "\n\nAUTHOR(S):\n",$input{'auttitle'};
print FNOTIFY "\n\nProposed Speaker(s) (for collaboration):\n",
$input{'speaker'};
print FNOTIFY "\n\nNotes: ",$input{'notes'},"\n\n",
"Date: ",$mday,".",$mon+1, ".",$year,"\n";
close(FNOTIFY);
system "/usr/ucb/Mail -s 'Abstract Submission' engel\@cc.huji.ac.il <
$tmpfile1" ;
# system "/usr/ucb/Mail -s 'Abstract Submission' hep97\@www.hep97.ac.il <
$tmpfile1" ;
unlink($tmpfile1);
}
}
}
------------------------------
Date: 01 Apr 1997 00:34:35 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: ceolas@celtic.stanford.edu (Ceolas)
Subject: Re: FAQ? Where do I install modules?
Message-Id: <omybb3tcvp.fsf@tees.cs.ualberta.ca>
In article <ceolas-2803972340070001@b461-powmac7500.stanford.edu> ceolas@celtic.stanford.edu (Ceolas) writes:
> I'm sure this is a Really Dumb Question
> How do I find modules and where do I put them?
These are really two questions :-)
Short answers:
- find: read the module list, then access them at
CPAN/modules/by-module/Foo/Foo-1.23.tar.Z or whatever.
- install: (and I assume you can't write to the main perl dir at your site)
cd ~/perl/src
zcat Foo-1.23.tar.Z | tar xvf -
rm Foo-1.23.tar.Z; cd Foo-1.23
perl Makefile.PL PREFIX=~/perl
make
make test
make install
Exception: if the module is listed as "Standard" (first letter of status = S)
it should already be there!
Better yet, first install the module CPAN then use that to automate
installation and update.
> I was confused by the :: nomenclature, and whether to go looking for A::B or
> A/B.pm in each case
A/B.pm and often A.pm. However, these will only exist after installation. On
CPAN they are in tar distribution files....
> (though Net had disappeared and was now appartently part of libnet, which
> I'm not sure if it's a library or a module or what...
....which often don't have much in common with the module names. Look in
CPAN/modules/02packages.details.txt for some canonical locations of the tars.
Eg it lists Net::Domain in GBARR/Net-Domain-1.06.tar.gz but Net::FTP in
GBARR/Net-FTP-1.18_1.tar.gz (GBARR is a subdir of CPAN/authors/id/).
> I see that IO should be part of the standard distribution;
Wrong. The first letter of its status is 'c' (under construction), not 'S'
(standard).
> For IO, it tells me that /perl5/ExtUtils/MM_Unix.pm can't find IO/Handle.pm
Hmm.. This might be a "bug" in MM_Unix: it shouldn't use IO::Handle.
You may try to resolve it by copyng manually IO/Handle.pm to
perl5/lib/IO/Handle.pm
> and when I try to install Net, it tells me that it can't locate IO/File.pm.
You should first install IO.
HTH, Vlad
------------------------------
Date: 1 Apr 1997 12:02:46 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: File Locking
Message-Id: <5hqth6$as$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
rmfowler@raptor.mtc.ti.com (Rex Fowler) writes:
:In article <Pine.GSO.3.96.970327191350.15008O-100000@kelly.teleport.com>,
:Tom Phoenix <rootbeer@teleport.com> wrote:
:>On 27 Mar 1997, Rich Schramm wrote:
:>
:>
:>> I am concerned about blocked processes attempting to write to my file
:>> after I unlock it but before I close it.
:>
:>
:>I think you might want to see the methods in Randal's fourth Web
:>Techniques column, which explains all you need about how to use flock().
:>
:> http://www.stonehenge.com/merlyn/WebTechniques/
:
:Been there and also examined the FAQ. Didn't quite get all I need to know.
:How do I flock() a file I don't have a handle for?
You can't. See the example in DB_File for getting the fd
and locking it.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
*** The previous line contains the naughty word "$&".\n
if /(ibm|apple|awk)/; # :-)
--Larry Wall in the perl man page
------------------------------
Date: Tue, 01 Apr 1997 06:07:33 GMT
From: (Mark)
Subject: Re: Functions and operators
Message-Id: <3341a426.7060625@news.ntr.net>
On Mon, 31 Mar 1997 22:41:14 GMT, abigail@ny.fnx.com (Abigail) wrote:
>On Mon, 31 Mar 1997 06:11:16 GMT, Mark wrote in comp.lang.perl.misc:
>++
>++ The comma is a syntactic element, the same way a paren or a dollar
>++ sign is syntactic in certain contexts. Comma is part of the syntax of
>++ a function/sub/etc
>Did you report it as an entry for the Camel errata list? The Camel
>thinks it's an operator. It even has a section about it.
Oh, Yeah...
On a darker note, I screwed myself *TWICE* with commas at work
hehe :> I really should have known better than to even comment on
that post.
Using comma rather than a period when cat'ing strings is bad.
Also leaving the parentheses out of this was bad...
print join "\n", @list, "\n";
One of my coworkers (who was whining cause the last return wasn't in
there was *REALLY* ungrateful when I gave him TWO at the end.
Maybe I should read c.l.p.m first rather than last from now on...
(p.s. Thanks for the comeuppance BTW :> *sigh*)
--
Mark <mark@ntr.net>
Please don't sue my boss because you don't
understand the concept of free speech.
*Pain is something funny that happens to YOU*
------------------------------
Date: 1 Apr 1997 09:22:32 GMT
From: "Jonathan Tracey" <jont@uunet.pipex.com>
Subject: Re: Has anyone heard the rumour that Microsoft have bought Perl?
Message-Id: <01bc3e7e$5ba4f530$0600000a@salmon>
The good authority is a Manager at Microsoft in the US, maybe more to this
than meets the eye.
Jon..............
Jonathan Tracey <jont@uunet.pipex.com> wrote in article
<01bc3a03$d955c100$0600000a@salmon>...
> 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..................
>
------------------------------
Date: Tue, 01 Apr 1997 11:27:11 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: How Do I Use Perl To...
Message-Id: <3346eccf.5083330@news.uni-stuttgart.de>
On Mon, 31 Mar 1997 19:35:53 -0500, Jerome Bradenbaugh Bradenbaugh
<bradenb@ibm.net> wrote:
>If I want to change the location of the document in my browser, I write
>something to the following effect:
>
>Print "Location: newpage.html\n";
>
try comp.infosystems.www.authoring.cgi, this doesn't sound like a perl
question at all...and definitely doesn't belong in perl.tk
------------------------------
Date: Tue, 01 Apr 1997 13:24:22 +0100
From: Klaus Johannes Rusch <e8726057@student.tuwien.ac.at>
Subject: Re: how to check Backslash?
Message-Id: <3340FE76.33A9@student.tuwien.ac.at>
Connie Mueller-Goedecke wrote:
> if ($lastletter eq a) <- that's not a problem.
> But: how to write: if ($lastletter eq /)?
$lastletter eq "/"
$lastletter eq "\\"
If you only want to split individual directories as in your example,
you can of course also tr all "\\" to "/" (to allow both backward and
forward slashes), then split at "/".
Klaus Johannes Rusch
--
e8726057@student.tuwien.ac.at, KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/
------------------------------
Date: 1 Apr 1997 09:28:07 GMT
From: "Jonathan Tracey" <jont@uunet.pipex.com>
Subject: Re: Microsoft Running Naked Through the Streets?
Message-Id: <01bc3e7f$230bdd00$0600000a@salmon>
I think you will find the Island is owned by Microsoft.
Lee <DeathToSpam@dev.null.com> wrote in article
<333ee79f.59377475@news.earthlink.net>...
> I think its time to retire to some remote island....before this
> nightmare really begins<s>
>
> nvp@bill-graham.nfic.com (Nate Patwardhan) wrote:
>
> @>-->---I R A Aggie (fl_aggie@hotmail.com) wrote:
> @>-->---James> In article <5hc0e7$ger$1@bob-marley.nfic.com>,
> nvp@bill-graham.nfic.com
> @>-->---James> (Nate Patwardhan) wrote:
> @>-->---
> @>-->---+ I've heard rumours that Microsoft is running naked through
> the
> @>-->---+ streets. Well I suppose it's their perogative, as they own
> the
> @>-->---+ streets they're running naked through.
> @>-->---
> @>-->---James> Hey, as long as no one forces me to watch Bill G. run
> nekkid thru
> @>-->---James> the streets...
> @>-->---
> @>-->---It's rumoured that running through the streets will become the
> @>-->---industry standard. :-)
> @>-->---
> @>-->---Nate Patwardhan
> @>-->---nvp@nfic.com
> @>-->---nvp@shore.net
> @>-->---
>
> --Lee
>
> Internet/Intranet Counsulting and Design:
> http://www.designwest.com
> Nurses' Call:
> http://www.nurse.org/Nurses_Call/
>
------------------------------
Date: 1 Apr 1997 04:52:48 GMT
From: sms@magenta.com (SMS/Christian Fowler)
Subject: my STDOUT is dying
Message-Id: <5hq4b0$sn7$1@solaris.cc.vt.edu>
I am trying to do a simple task - print some text to STDOUT, open another
file for OUTPUT, write to it, close it, then print some more text to
STDOUT. My second STDOUT will never work.
I keep wondering if I am changing my default output filehandle, but that
shouldn't matter since I am specifying filehandle in each case.
Regardless, I have tried saving, reopening, and everything else I can
think of.
System is ULTRIX running PERL 4.0.1.8. Here is chunk of code:
{
prints great -> print "begin\n";
$fileName = "$gDirectory$gTopicDir/".&GetNewFileName;
open (OUTFILE, ">$fileName") || die "Can't open $fileName : $!\n";
print OUTFILE $outputData;
close OUTFILE;
# set permission for our newly created file so the world can see it.
chmod 0755, $fileName;
&UpdateTopicIndex;
never prints -> print STDOUT "Entry Submitted.\n";
}
(apologies if this is a simple problem. Been hacking on it for several days,
and have run out of other things to code instead..)
--
=-=
=-=+=-= Sound Machine Sound | The Music Makers Net Directory
=-=%=-= Christian Fowler | sms@magenta.com
=-=+=-= Shape Factor Moment | http://magenta.com/~sms/
=-=
------------------------------
Date: Tue, 01 Apr 1997 03:45:51 +0100
From: netlink@netlinkcorp.com
Subject: NT 4.0, IIS 3.0, Perl, Server setup
Message-Id: <334076DF.56D9@netlinkcorp.com>
Hello,
A question from a newbie to Perl and NT 4.0.
I need to setup an NT 4.0 Server to be able to use perl scripts.
I am currently using IIS 3.0 and Perl 5 (build 304)
I have Registry Setting as .pl:REG_SZ:C:\Perl5\bin\Perl.exe
The scripts seem to run error free from the command line but not
the browser.
I get the NT password authorization window when submit is
clicked.
IIS has a Virtual Directory called Scripts with read and execute
Is there a specific location needed for this directory (scripts)?
I believe the problem exists between User Manager and permissions set
via NT explorer on the scripts directory. I can't get the proper ones
set.
Is there a specific account that needs to be identified with the
scripts directory? If so, which account and what are the associated
permissions?
I have read the FAQ's and most all pertain to Unix permissions.
I would appreciate any assistance with this from a more knowlegeable
source.
TIA
Rick Hall
netlink@netlinkcorp.com
------------------------------
Date: Tue, 1 Apr 1997 05:59:06 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Question: Using perl to execute shell commands
Message-Id: <aatqh5.hj.ln@localhost>
Jason J. Levit (jlevit@ou.edu) wrote:
: Hi everyone,
: I'm trying to use perl to execute some simple shell commands, but
: since they're built into the shell (i.e., sh, csh, tcsh, etc.), perl
: can't
: seem to handle them. For example, if I the perl command:
: system 'source $name';
: or
: system 'setenv $name';
Try 'source filename' or 'setenv filename' directly in /bin/sh.
What happened?
: ...both of these come up with the shell error 'source: command
: not found'. Obviously, /bin/sh/source doesn't exist, since it's
: built into the shell.
^^^^^^^^^^^^^^^^^^^^
built into the csh.
source is not built-in to sh.
(sh uses 'dot' eg: '. filename')
: However, I do have the need of sourcing
: some files and setting some environment variables to run another
: program, which actually uses these environment variables to run.
If the 'other program' is launched from within your perl script
(ie. is a child of the perl process), then you can set the envars
within perl before calling it:
$ENV{other_prog_var} = 'other_prog_value';
system("other_prog");
There is another thread currently in this newsgroup about how to
parse the file from within your script to set all the envars. Search
for it in Dejanews.
: The perl script handles passing various values to be input into
: the program...does anyone know how I can get around this?
The primary problem that you are facing is that child processes
cannot affect the environment of the parent process, and system()
is a child process of your perl process.
(see "I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?" in the new Perl FAQ part 8)
: Thanks for any help!
1) do the 'source' in the csh before launching the perl script
or
2) parse the file from within perl and set the envars
or
3) do the 'source', along with showing the environment, all within
the same process, then parse the shown environment and set the envars.
Hope this helps!
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 1 Apr 1997 06:30:38 GMT
From: rbraver@ohww.norman.ok.us (Robert Braver)
Subject: Re: Robert Braver Kills 39 People
Message-Id: <5hqa2e$k59@wilbur.ohww.norman.ok.us>
On 29 Mar 1997 15:51:07 GMT, kibo@dhp.com (the one and only real true kibo)
said...
>
>There's no question that Robert Braver and his sister/wife Lizzie
>are guilty of many federal crimes, including trafficking in child
>pornography and Usenet forgery. Where is the FBI when we need it?
>
>"ohww" stands for "Oakbrook Home for Wayward Wonks", an obviously phoney
>domain. Robert Braver is really rbraver@firmware.com, the proprietor of
>Micro Firmware, Inc., 330 W. Gray St., Ste 120, Norman, OK 73069-7111,
>(405) 573-5501. He is also responsible for the several waves of forged
>cancels coming from Cottagesoft and Internet Oklahoma last year.
>
>Timothy McVeigh had breakfast with the Braver's before blowing
>up the Federal office building later that day.
>
>Josh McCormick sued the Bravers for $2000 in small claims court; he
>won, but he's still waiting to collect.
Well, Grubor managed to get himself kicked off of yet another ISP in his
latest outburst of paranoid delusions. And he got kicked off of not just any
ISP, but dhp.com, which has a reputation for taking freedom of speech to an
obsessive, unhealthy level. I believe the only way to get kicked off is to
commit a criminal act via their service.
The sad thing about it is that is likely all true in the world in which he
alone lives. He probably actually believes every word. Possibly true also
for the two or three itinerant cronies that follow along. They may either buy
into it, or enjoy being in on what they think is an ongoing sick and twisted
joke.
For some reason he is fixated on pedophilia, rape and homosexuality, as these
are his standard interchangeable accusations that he levels at his perceived
enemies.
Even though it's patently ridiculous, it is still hurtful to my wife (who was
at the Murrah building with the Red Cross within a few hours after the
bombing) to be accused of having Timothy McVeigh over for breakfast.
It's too bad he's mentally ill, but it's worse that innocent people who leave
him alone are subjected to such unrelenting abuse.
I'm only one of numerous other victims, which is some comfort. However, I
draw the line when employers' names are dragged in. Another fellow apparently
did, too.
--
Robert Braver
rbraver@ohww.norman.ok.us
http://spam.ohww.norman.ok.us
------------------------------
Date: 1 Apr 1997 11:17:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: running .pl with perl.exe ERROR help!
Message-Id: <5hqqrk$27m@lyra.csx.cam.ac.uk>
Lou Lanaro <llanaro@calumet.yorku.ca> wrote:
>
>is any one familiar with
>
>500 Server Error
Well, I'm not, but the FAQ seems to be:
=head2 Where can I learn about CGI or Web programming in Perl?
For modules, get the CGI or LWP modules from CPAN. For textbooks,
see the two especially dedicated to web stuff in the question on
books. For problems and questions related to the web, like "Why
do I get 500 Errors" or "Why doesn't it run from the browser right <<<<<<<<<<<
when it runs fine on the command line", see these sources:
The Idiot's Guide to Solving Perl/CGI Problems, by Tom Christiansen
http://www.perl.com/perl/faq/idiots-guide.html
Frequently Asked Questions about CGI Programming, by Nick Kew
ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
http://www.perl.com/perl/faq/perl-cgi-faq.html
The WWW Security FAQ, by Lincoln Stein
http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
World Wide Web FAQ, by Thomas Boutell
http://www.boutell.com/faq/
Mike Guy
------------------------------
Date: 1 Apr 1997 08:01:18 GMT
From: "Neil Edmondson" <neiled@enteract.com>
Subject: Re: Sorting a List on multiple fields
Message-Id: <01bc3e73$1e3237e0$2d9a70cf@nedmondson.iclretail.com>
This is how I solved my own problem. I'd appreciate any comments and any
pointers on how to optimize this little gizmo... there's got to be a better
way?
#!/bin/perl
We're going to time the thing
$start = time();
# Read the input and use each line as an
# index (albeit rather large) into a hash
open (FILEIN, "<" . "ad.dat.txt");
while (<FILEIN>) {
$adhash{"$_"}=1;
}
close (FILEIN);
# Filter the sort through the subroutine
foreach $key (sort AdSort keys %adhash) {
print "$key\n";
}
# Just for information - prepare summary
$keycount=keys(%adhash);
$end = time();
$lapse = $end-$start;
print "$end $start $lapse $keycount", "\n";
exit (0);
sub AdSort {
# the input lines have fields that are "|" separated
my
($Aad_id,$Astatus,$Acategory,$Atype,$Adescription,$Aask_price,$Asell_price,
$Alive_on,$Aclosed_on,$Aad_first,$Aad_last,$Aad_email1,$Aad_email2,
$Aad_tel,$Apub_tel,$Apub_email) = split /\|/, $a;
my
($Bad_id,$Bstatus,$Bcategory,$Btype,$Bdescription,$Bask_price,$Bsell_price,
$Blive_on,$Bclosed_on,$Bad_first,$Bad_last,$Bad_email1,$Bad_email2,
$Bad_tel,$Bpub_tel,$Bpub_email) = split /\|/, $b;
# sort by category
$category = $Acategory cmp $Bcategory;
return $category if $category;
# then by description
$description = $Adescription cmp $Bdescription;
return $description if $description;
# then by status
$status = $Astatus cmp $Bstatus;
return $status if $status;
}
------------------------------------------------------
> I've spent the day reading FAQs and experimenting to sort a file the way
I
> want it.
>
> My input list has a list of items, with sub-fields seperated by "|" ,
> something like:
>
> field1|field2|field3|field4|.....|fieldn
>
> No problem doing a basic sort with:
>
> @list = sort ($a cmp $b) @list;
>
> What I want to do is sort the list by field3 within field2 within field4,
> for example, in one clean move.
>
> Any pointers?
>
> While I wait guess I'll read the Camel Chapter 4 tutorial again...
>
------------------------------
Date: Tue, 01 Apr 1997 11:26:54 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Sorting a List on multiple fields
Message-Id: <3343e9d4.4320322@news.uni-stuttgart.de>
On 1 Apr 1997 05:19:30 GMT, "Neil Edmondson" <neiled@enteract.com>
wrote:
>I've spent the day reading FAQs and experimenting to sort a file the way I
>want it.
>
>My input list has a list of items, with sub-fields seperated by "|" ,
>something like:
>
> field1|field2|field3|field4|.....|fieldn
>
>No problem doing a basic sort with:
>
> @list = sort ($a cmp $b) @list;
>
>What I want to do is sort the list by field3 within field2 within field4,
>for example, in one clean move.
>
>Any pointers?
>
You could of course just look at the old post and you will find the
following message posted by me around a week ago. I've added a small
amount of code to demonstrate sorting by multiple columns at the same
time:
>in perl i need to sort a list with x number of columns by different keys
>(either key#1, key#2, key#3, etc)
>
>i would like to store the list as a tab-delimited text file.
>
>i was told perl 5 has provisions for multidimensional arrays, which i
>would use to handle the list.
>
>how do you implement multidim arrays and sort them by diff keys?
>
>* please try to keep any sample code to simple elemental commands
>and not the complicated does 1000 things in 1 line kind of stuff,
>it's much easier for me to understand perl scripts written in the
>style of c or pascal
Well, i'll try to explain how this works, if you don't follow try
taking a look at the sort section of man perlfunc. In perl a 2D array
is in fact an array of references (pointers in C terms) to arrays,
although most of the time it behaves like a 2D array would normally,
this program takes advantage of this, when creating and sorting it.
while (<DATA>){
next if /^\s*$/;
chomp $_;
#Add the array of split data as one element of @data_2d
push(@data_2d, [split(/\t/,$_)]);
}
#Sort will go through the array of references @data_2d, and compare
#each element to the other by passing them to the function which was
#it's first argument as $a and $b, we then take the arrays to which $a
#and $b point to fish out their first element and compare it to the
#other
# Therefore to sort alphabetically by the first column:
@sorted = sort {$a->[0] cmp $b->[0]} @data_2d;
# Print it out:
print "Sorted by name:\n---------------\n";
#Go throught the array of references returned by sort
foreach $line (@sorted){
#and then go through the array to which these point
#(see below for a quicker way)
foreach $column (@$line){
print "$column\t";
}
print "\n";
}
# To sort numerically by the second column:
@sorted = sort {$a->[1] <=> $b->[1]} @data_2d;
print "\nSorted by score:\n----------------\n";
foreach $line (@sorted){
#print a joined version of the array which is pointed to
print join("\t", @$line), "\n";
}
# However this will place huddersfield before bristol, so to sort
#by the second column numerically and then first alphabetically:
@sorted = sort {($a->[1] <=> $b->[1]) or ($a->[0] cmp $b->[0])}
@data_2d;
print "\nSorted by score, and then
town:\n-------------------------------\n";
foreach $line (@sorted){
#print a joined version of the array which is pointed to
print join("\t", @$line), "\n";
}
__END__
London 999
Leeds 34
Manchester 7
Mirfield 55
Dewsbury 9
Huddersfield 10
Birmingham 15
Bristol 10
Cardiff 4
------------------------------
Date: Tue, 1 Apr 1997 06:15:51 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Sorting a List on multiple fields
Message-Id: <n9uqh5.3l.ln@localhost>
Neil Edmondson (neiled@enteract.com) wrote:
: I've spent the day reading FAQs and experimenting to sort a file the way I
: want it.
: My input list has a list of items, with sub-fields seperated by "|" ,
: something like:
: field1|field2|field3|field4|.....|fieldn
: No problem doing a basic sort with:
: @list = sort ($a cmp $b) @list;
: What I want to do is sort the list by field3 within field2 within field4,
: for example, in one clean move.
I think what you want is:
sort on field4
if field4 is equal, then also sort on field2
if field2 is equal, then also sort on field3
(field4 is primary key, field2 secondary, field3 tertiary)
Is that it?
: Any pointers?
something like this should do it:
---------------------------------------------
#! /usr/bin/perl -w
@list = (
'f1e|f2e|f3e|f4e', # f4e ones sorted on f2
'f1d|f2d|f3d|f4e',
'f1c|f2c|f3c|f4c', # f4c ones sorted on f3 ('cause f2's are equal)
'f1b|f2c|f3b|f4b',
'f1a|f2c|f3a|f4c',
);
foreach (sort custom @list) {
print "$_\n";
}
### simple minded sort routine
sub custom { # this will be dreadfully slow for large lists...
@a = split /\|/, $a;
@b = split /\|/, $b;
$a[3] cmp $b[3] || $a[1] cmp $b[1] || $a[2] cmp $b[2];
}
---------------------------------------------
: While I wait guess I'll read the Camel Chapter 4 tutorial again...
Hope this helps!
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 1 Apr 1997 09:23:05 GMT
From: gerben@localhost.cs.vu.nl (Gerben Vos)
Subject: Re: sourcing (bash) config files within perl
Message-Id: <5hqk5p$61s@star.cs.vu.nl>
You could also let bash parse the configuration file and dump its environment,
and parse the result. Untested code follows:
foreach (`. $configfile; set`)
{
chomp;
($a, $b) = /^(.*?)=(.*)$/;
$ENV{$a} = $b;
}
. . . . . . . . . . . . . . . . . . . . . . . . . . . G e r b e n V o s <><
mailto:gerben@cs.vu.nl http://www.cs.vu.nl/%7Egerben/
Misery is much more serious than pleasure, but it is not more important.
-- Herman Finkers
------------------------------
Date: Tue, 1 Apr 1997 08:07:46 GMT
From: vshlomit@wishful.weizmann.ac.il (Afgin Shlomit)
Subject: Usyng the 'system' function from perl.
Message-Id: <1997Apr1.080746.198@wisipc.weizmann.ac.il>
Hi
I tried to use the system function in a perl script with no success.
my system line look like:
system("sort -r group1.sum > group1tmp.sum");
but the file group1tmp.sum is empty, not contain the sort output.
ofcourse the file group1.sum contain lines.
Please reply to vshlomit@wishful.weizmann.ac.il.
Thanks,
--
Shlomit.
------------------------------
Date: Tue, 01 Apr 1997 08:51:44 GMT
From: smc@smcnet.com (Scott M. Crevier)
Subject: Re: Usyng the 'system' function from perl.
Message-Id: <3340cc3b.56760043@netnews.worldnet.att.net>
On Tue, 1 Apr 1997 08:07:46 GMT, vshlomit@wishful.weizmann.ac.il
(Afgin Shlomit) wrote:
>
>
>Hi
>
>I tried to use the system function in a perl script with no success.
>my system line look like:
>system("sort -r group1.sum > group1tmp.sum");
>but the file group1tmp.sum is empty, not contain the sort output.
>ofcourse the file group1.sum contain lines.
>
>
>Please reply to vshlomit@wishful.weizmann.ac.il.
>Thanks,
>--
>
> Shlomit.
I just tried that and it worked fine for me.
_______________________
Scott M. Crevier
smc@smcnet.com
http://smcnet.com
------------------------------
Date: Tue, 01 Apr 1997 11:25:23 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Usyng the 'system' function from perl.
Message-Id: <3341e911.4125197@news.uni-stuttgart.de>
On Tue, 1 Apr 1997 08:07:46 GMT, vshlomit@wishful.weizmann.ac.il
(Afgin Shlomit) wrote:
>
>
>Hi
>
>I tried to use the system function in a perl script with no success.
>my system line look like:
>system("sort -r group1.sum > group1tmp.sum");
>but the file group1tmp.sum is empty, not contain the sort output.
>ofcourse the file group1.sum contain lines.
This sounds like you are trying to read the output of the sort, in
which case you would be better off using open(SORT, 'sort -r
group1.sum |'); and then reading from the sort by using the filehandle
SORT.
------------------------------
Date: 1 Apr 1997 09:52:19 GMT
From: "michael" <mike_hayden@inetuk.wang.com>
Subject: Where do I get 'h2n' perl script for unix
Message-Id: <01bc3e84$52b48a20$330873c1@mikeh_lt.inetuk.wang.com>
Dear All,
I'm trying to locate the 'h2n' hosts-to-name perl tool for use in
publishing DNS files on a Unix system.
I've got Perl5 but this doesn't include the above script. I've looked on
various sites, namely www.perl.hip.com and www.ora.com but without luck. I
realise I could make use of the NT version of perl+scripts as this already
has the 'h2n' script, but this requires me running NT Workstation and then
transmitting the files generated onto the unix end system.
It would be neater and more compact to keep averyting together under one
OS.
Anyone know any good perl-script library sites for unix??
thankyou very much for your help.
Michael Hayden
------------------------------
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 213
*************************************