[6814] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 439 Volume: 8

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

Date: Tue, 6 May 97 06:01:05 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 6 May 1997     Volume: 8 Number: 439

Today's topics:
     Re: @r=($a=~/./g) Sets @r to the list of matching eleme <jhi@alpha.hut.fi>
     Re: Comparing multi-line variables <a.aitken@unl.ac.uk>
     Re: composing a key out of 2 fields <a.aitken@unl.ac.uk>
     Re: Definition of $<digit> in perlvar.pod (David Alan Black)
     Re: dos2unix <jhi@alpha.hut.fi>
     Re: How to safely and properly update an ASCII text dat <a.aitken@unl.ac.uk>
     Re: Inserting list item into HTML bullet list.... <a.aitken@unl.ac.uk>
     Re: Loosing clpm regulars (was Re: Perl auto-replier) (Geoff Simmons)
     MacPerl5 on PB100 (Warren Pollans)
     Re: Need file info for perl script <jhi@alpha.hut.fi>
     Re: Need file info for perl script <jhi@alpha.hut.fi>
     Not word wraping. <pratt@sigma.net>
     Re: Not word wraping. <seay@absyss.fr>
     Re: Notice to antispammers - is there a list of spammer (Sitaram Chamarty)
     Re: Perl auto-replier <jhi@alpha.hut.fi>
     Perl to C <NYXEL@ny.ubs.com>
     Re: PerlScript (activeserverpages) and setting a cookie <good.luck@getting.spam.to.zenin.at.best.com>
     Re: program for perl? <carrigad+usenet@iplenergy.com>
     REQ: Script to send mail to LIST of persons <ogluck@g26.ethz.ch>
     Re: RISC vs CISC  or SunOS <karlt@ilinks.net.njem>
     Re: scalar holds compiled code <a.aitken@unl.ac.uk>
     Re: scientific notation compare bug <jhi@alpha.hut.fi>
     Re: Script runs fine from shell, but browser doesn't re (Abigail)
     Re: select() wierdness <seay@absyss.fr>
     Trash can or wastebasket for Unix (Tom Bates)
     Re: Trash can or wastebasket for Unix <stephen+usenet@farrell.org>
     Re: What is the best way of learning Perl? (John Nolan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 03 May 1997 20:53:38 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: @r=($a=~/./g) Sets @r to the list of matching elements
Message-Id: <oeed8r8phlp.fsf@alpha.hut.fi>


etienne@isr.isr.ist.utl.pt (Etienne Grossmann) writes:
> 	Is the fact that 
> 		@r=($a=~/./g) Sets @r to the list of matching elements
>   a normal perl feature? (I did not see it in the man pages)
> 	Etienne

Look harder. perlop:
          If used in a context that requires a list value, a pattern match
          returns a list consisting of the subexpressions matched by the
          parentheses in the pattern, i.e. ($1, $2, $3...).
-- 
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.


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

Date: Tue, 06 May 1997 11:27:36 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Comparing multi-line variables
Message-Id: <336F0798.1633@unl.ac.uk>


Zachary Brown wrote:
> 
> Given two variables $a and $b containing multiple lines of ascii text, how
> could perl locate all the start and end indices of the words or groups of
> words that are different in one from the other and vice versa?

Slowly with patterns I should think.  I presume you want to use word
boundaries as the limits of a match and not simply groups of characters
which may or may not include whitespace.  Do the ends of lines matter to
the match rules? If not I might start by stripping the ends of lines and
creating two arrays with the words in them.  split() uses whitespace by
default:

$olda = $a;
$oldb = $b;	# store the original strings

$a =~ s/\n//g;
$b =~ s/\n//g;
@awords = split($a);
@bwords = split($b);	# make two arrays out of the words only

The problem is that for example:

$a = '
this is a test string
containing a variety of
words and phrases';
$b = '
The quick brown fox
jumps over the lazy dog';

Now - the number of different strings in here is enormous.  Is that what
you want and can you be a bit more specific?

In the arrays above every word is different and so each group of words
is different too.  Identifying similarities is much easier than
differences in the example case.

Alastair.


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

Date: Tue, 06 May 1997 11:30:56 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: composing a key out of 2 fields
Message-Id: <336F0860.53A3@unl.ac.uk>

Shawn wrote:
> 
> I plan to have a comma delimeted file for recording hours worked week
> by week with the following format
> 
> project number, start date, end date, Sun hrs, Mon hrs, .. sat hrs,
> total hrs
> 
> Each contractor has their own file. Since someone may be working on
> several projects at once, I need both the project number and the start
> date to identify unique records.
> 
> I would like to set the file up as a hash of arrays with the key being
> a composite of the project number and the start date.
> 
> Is there any way to do a sort on composite keys, say if the keys were
> something like  541_5/5/1997
> 
> What's the best format for the date?

Just a comment but this doesn't sound very normalised.  Each Contractor
should have a contractor record and each project should have a unique
record, keyed on project number with a field item for the contractor
record key to link to the contractor record.

What about converting the date to a number of days after a given start
date - say 01.01.1900?  Then all sorting is numeric.

Alastair.


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

Date: 6 May 1997 11:09:51 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Definition of $<digit> in perlvar.pod
Message-Id: <5kn3hv$bgm@pirate.shu.edu>

Hello -

[ The following is subject to regex master correction and intervention. ]


allen@gateway.grumman.com (John L. Allen) writes:

>I've been trying to understand something that a fine perl-porter has
>been trying to learn me, and so far I just can't get it.  What should
>the outputs of
>
>        1. perl -e '$_="abcd"; /(?:(b)|(c))*/; print "$1:$2:$3:$4\n"'
>        2. perl -e '$_="abcd"; /((b)|(c))*/; print "$1:$2:$3:$4\n"'
>
>be, and how does their behaviour relate to this paragraph in perlvar.pod

The output should be ':::', in both cases.

In both cases (though in somewhat different ways with respect to $1-4),
the search is for zero-or-more of (either 'b' or 'c').  In both cases,
the match succeeds at the beginning of the string (the zero case), and
never reaches the 'b' or the 'c'.  Therefore, the match succeeds, but
the $1-4 variables are empty.  Hence :::.

(And note that the parens around c *and* the inner parens set variables,
in the second example.)

>        =item $<digit>
>
>        Contains the subpattern from the corresponding set of parentheses in
>        the last pattern matched, not counting patterns matched in nested
>        blocks that have been exited already.  (Mnemonic: like \digit.)
>        These variables are all read-only.
>

Your abcd example isn't a great one, since it doesn't return any () matches.
Look for some examples that do....  The bit about nested blocks means, by
the way, means this:

$str = "abcd";
$str =~ /(a)/;
print $1;          # prints a
for (1) {
	$str =~ /(b)/;
	print $1;      # prints b
}
print $1;          # prints a again - we've exited nested (for) block


>With perl5.003_99, they both print ':::', clearly a bug.  If the 'a' is
>removed from $_, #1 gives ':c::' and #2 gives 'c::c:'.  I frankly don't
>know _what_ the above paragraph is trying to say, but was told the
>answer lies there.

I don't mean to jump down your throat, John, but why is it that *so many*
regex questions make claims of having found a bug?  This is, for very many
people, the most intricate and difficult part of Perl to master, and yet,
strangely, the area where the most supposed bugs are announced....  The
regex part of the language is also depended upon heavily by a huge
number of programs.  This doesn't mean it can't have bugs, but - playing
the percentages - it's pretty unlikely that something like the $<digit>
mechanism doesn't work.

As for removing 'a':

1. perl -e '$_="bcd"; /(?:(b)|(c))*/; print "$1:$2:$3:$4\n"'
2. perl -e '$_="bcd"; /((b)|(c))*/; print "$1:$2:$3:$4\n"'

Here, the pattern succeeds at the beginning of the string, and keeps
succeeding through the first two characters.  Therefore, the pattern
matches the substring 'bc'.  The $<digit> variables also come into play.

If you want to see how the whole pattern matches, put parens around the
whole expression:

perl -e '$_="bcd"; /(((b)|(c))*)/; print "$1:$2:$3:$4\n"'
bc:c::c

Note that $1 is the whole match (the outermost parentheses).  

If you want to get at the heart of this, you could trim your
examples to:

perl -e '$_="ab"; /(b)*/; print "$1\n"'
perl -e '$_="b"; /(b)*/; print "$1\n"'

and explore how those work.

David Black
dblack@icarus.shu.edu



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

Date: 02 May 1997 21:30:50 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: dos2unix
Message-Id: <oeewwphvi91.fsf@alpha.hut.fi>


Something like this:

#	
# IBM PC to ISO Latin 1
#
# NOTE: destructive and non-reversible mapping because of the IBM PC box
# drawing graphics: there are no such in ISO Latin 1.  They are approximated
# with the "ASCII graphics".
#
# The encoding function thanks to the GNU project 'recode' -program.
#
tr(\024\025\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\240\241\242\243\244\245\246\247\250\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\344\345\346\347\350\351\352\353\354\355\356\357\361\362\363\364\366\367\370\371\372\373\374\375\377)(\266\247\307\374\351\342\344\340\345\347\352\353\350\357\356\354\304\305\311\346\306\364\366\362\373\371\377\326\334\242\243\245\341\355\363\372\361\321\252\272\277\254\275\274\241\253\273\043\043\043\174\053\174\053\056\056\174\174\056\047\047\047\056\140\053\053\053\055\053\174\053\140\056\075\075\174\075\075\075\053\075\053\140\140\056\056\053\075\047\056\043\043\043\043\043\205\337\203\204\206\265\207\212\202\210\211\215\255\214\213\261\225\233\223\367\224\260\227\267\226\201\262\240!
 );
s(\015\012)(\012)g;

and

#
# ISO Latin 1 to IBM PC
#
# The encoding function thanks to the GNU project 'recode' -program.
#
tr(\024\025\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\240\241\242\243\244\245\246\247\250\252\253\254\255\256\257\260\261\262\265\266\267\272\273\274\275\277\304\305\306\307\311\321\326\334\337\340\341\342\344\345\346\347\350\351\352\353\354\355\356\357\361\362\363\364\366\367\370\371\372\373\374\375\377)(\266\272\307\374\351\342\344\340\345\347\352\353\350\357\356\354\304\305\311\265\306\364\367\362\373\371\337\326\334\363\267\321\377\255\233\234\261\235\274\025\277\246\256\252\355\275\273\370\361\375\346\024\372\247\257\254\253\250\216\217\222\200\220\245\231\232\341\205\240\203\204\206\221\207\212\202\210\211\215\241\214\213\244\225\242\223\224\366\260\227\243\226\201\262\230);
s(\012)(\015\012)g;


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

Date: Tue, 06 May 1997 11:50:26 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: How to safely and properly update an ASCII text database?
Message-Id: <336F0CF2.7FFD@unl.ac.uk>


Martin, Mathis wrote:
> 
> Hi all,
> 
> I'm learning PERL with a bunch of books at my hands. However, I can't
> seem to find an answer to the following task:
> 
> I have an ASCII text database with e.g. addresses for an example, one
> record per line. Each record contains an "active" flag ("Y" or "N").
> Based on some criteria I want to change some flags from Y to N.
> 
> In a single user environment I would read the file, determine the new
> flags and output to a temporary file, when done rename to database
> again.
> 
> However, I'm in a multi-user environment (Web site) and want to make
> sure there is a flock or similar on the database while the flag update
> is running. Since read/write-to-temp and rename are two steps, I'd
> lose the flock when closing the first step (assuming I can't safely
> rename before the filehandles are closed).
> 
> Is my only option to manually write out a lock file for the update
> duration and hope that no one cancels the script before the lock file
> can be removed again?
> 
> Or should I determine the flag on the fly from my criteria each time
> rather than bother to write a status flag?

I have been through this and considered a variety of things including
locking on read with a timeout if the (expected) write was not returned
within five minutes.  Unfortunately in a web environment there is always
a danger that the script will cancel for one reason or another before
the lock is removed.  Is the flock you seek a read or a write flock?  If
only write then the method as for single user is relatively safe as
there will only be a very brief moment (when the database is renamed
back to the original) when conflicts could occur.  Flocking just before
this and unflocking immediately after would cut the window of
opportunity for a premature script exit.  If the flock is a read flock
then the window will be much longer and then applying a time out might
also be in order in case the script crashes before unflocking.

In my case, I considered how many people might use the update facility
(on ndbm database) - only about 4 and then about twenty to forty updates
per day and decided to take the risk that their might be a concurrent
write that would crash the database.  I also installed an on disk backup
routine that saved the files each day of the week so that, if a crash
occured I could retrieve a recent version of the file in a matter of
moments.

No crashes yet over a year later.

Anyway - if the flag is determinable then it shouldn't be stored.  It
isn't "normal".

Alastair.


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

Date: Tue, 06 May 1997 13:48:12 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Inserting list item into HTML bullet list....
Message-Id: <336F288C.30A3@unl.ac.uk>

Jeff Keller wrote:
> 
> Ok, I'm trying to both learn Perl and save myself time in the same weekend and I've run across some difficulties ;-)
> 
> What I'm trying to do is write a Perl script to automatically add and delete people from the high school alumni list I've kept for the past several years..
> 
> I can get it to delete people just fine.. but when I want to add someone's entry, I want it to go in the > right spot alphabetically.. but I can't even think of a logical way to do it, let alone use Perl to do it > <grin>

Well, do you want it to go *in* to the right spot or come *out* in the
right order?  I'd say the second from a glance at your page. 
(http://lostworld.pair.com/smhs/years/1994.html)

> Say I want to have the script put in  "Bob Jones '96 (and all that follows)" -- it needs to go in the right place!

> if you post publicly here be sure to copy me in on the message too..

What?  You can write but can't read?

It sounds like making some sort of interim storage for the this would
ease your task greatly - rather than adding to the html file.  You could
do ths a variety of ways but a ':' separated ascii file seems pretty
easy and efficient.  The format could be:

year:lname:fname:college:email1 email2 email3 ...	# note that the emails
are space separated in there!

Once this file is up and running the following script would read and
parse it similarly to 1994.html:

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

require 5.003;
use strict;

my (@fields,@unsorted,@sorted,@emails);

print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
print "<html><title>SMHS Class of
19$ENV{'QUERY_STRING'}</title></head><body>\n";
print "<center><h2>San Mateo High School</h2>\n";
print "<h3>Class of 19$ENV{'QYUERY_STRING'}</h3></center>\n";
print "<ul>\n";

open(IN,"path/to/asciifile");
@unsorted = <IN>;
@sorted = sort(@unsorted);
foreach (@sorted) {
    if (substr($_,0,2) eq $ENV{'QUERY_STRING'}) {
        @fields = split(/:/,$_);
        print "<li>$fields[2] $fields[1] - <b>$fields[3]</b>\n";
        print "<ul>\n";
        @emails = split($fields[4]);	# split splits on whitespace by
default
        foreach (@emails) {
            print "<li><a href=\"mailto:$_\">$_</a>\n";
        }
    print "</ul>\n";
    }
print "</ul>\n";
}

close (IN);
print "</body></html>\n";

exit 0;
	
This script should be called by a URL of the form:

http://server.domain/cgi-bin/scriptname.pl?<year_in_two_digit_form>

This is neither tested nor perfect - the colons in the sort routine
might cause some unexpected behaviour but it is free.  Um ... TMTOWTDI -
this is just one of many.

Alastair.


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

Date: Mon, 05 May 1997 21:29:41 +0100
From: g.simmons@elmshorn.netsurf.de (Geoff Simmons)
Subject: Re: Loosing clpm regulars (was Re: Perl auto-replier)
Message-Id: <g.simmons-ya023580000505972129410001@news.shlink.de>

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

> As some of you know, I recently published a pre-RFD for some additional
> (moderated) clp.* newsgroups.
> 
> I would like to know what regular readers of clpm think about adding a
> comp.lang.perl.moderated to the pre-RFD.

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


Best,
Geoff


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

Date: Mon, 5 May 1997 21:56:56 GMT
From: wpollans@scrap.encore.com (Warren Pollans)
Subject: MacPerl5 on PB100
Message-Id: <E9qAAx.AvC@encore.com>

Hello,

		Anyone using MacPerl5 on their pb100?  I've downloaded
		Mac_Perl_513r2 and get something like: application "unknown" 
		has unexpectedly quit, because an error of type 2 occurred.  What 
		does that mean - other than I can't run MacPerl5?  I've been 
		using MacPerl4 with no problems.

Thanks,

Warren



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

Date: 04 May 1997 15:56:49 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Need file info for perl script
Message-Id: <oeeu3kjbdke.fsf@alpha.hut.fi>


: Does anyone know of any other file information I can get using Perl
: besides "ls -l" and the stat() command?

The stat()/fstat() is the only portable one.  Everything else is
operating environment dependent (read: non-portable), accessible in
UNIXy systems in Perl with syscall()/pack()/unpack() or by writing a
XS, see perlxs.

: I'm trying to write a "super ls" program, but I need more info than
: stat gives.

"More info", like...?

-- 
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.



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

Date: 04 May 1997 17:24:04 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Need file info for perl script
Message-Id: <oeelo5vxqm3.fsf@alpha.hut.fi>


: > I'm trying to write a "super ls" program, but I need more info than
: > stat gives.
: 
: There are -X types of checks (-B -k -S ...). What exactly do you need?

Most of which are nothing but stat() derivatives, the -t isatty.
Only the -T and -B are not and at best they are heuristics.

-- 
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.



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

Date: Mon, 05 May 1997 17:56:14 -0700
From: David Pratt <pratt@sigma.net>
Subject: Not word wraping.
Message-Id: <336E81AE.3DDC@sigma.net>

I have an email generating script that is running fine, with one
problem, I'm getting no wordwrap, reguardless of a "physical" setting.

Is there anyone out there with a script modification that will wrap a
string and rename it?

Or is there a simpler answer?

ANY help is appreciated.

EVERYTHING else works perfectly, I'm running PERL5, on a unix box.


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

Date: Tue, 06 May 1997 12:58:18 +0100
From: Douglas Seay <seay@absyss.fr>
To: dpratt@logistix.com
Subject: Re: Not word wraping.
Message-Id: <336F1CDA.28E3A02E@absyss.fr>

[posted and mailed]

David Pratt wrote:
> 
> I have an email generating script that is running fine, with one
> problem, I'm getting no wordwrap, reguardless of a "physical" setting.
> 
> Is there anyone out there with a script modification that will wrap a
> string and rename it?
> 
> Or is there a simpler answer?
> 
> ANY help is appreciated.
> 
> EVERYTHING else works perfectly, I'm running PERL5, on a unix box.

look in CPAN, there is a module that does this.

- doug


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

Date: Tue, 06 May 1997 12:03:51 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Notice to antispammers - is there a list of spammers to pluginto procmail?
Message-Id: <336f1c67.116909796@news.diac.com>

My news server missed Tom's original post, so I read it on dejanews.

My question, for Nathan or Tom or anyone else who knows, is: is there
a frequently updated list of spammers that I can periodically plug
into my procmail recipe as an include file?  (I do use procmail, but I
got tired of constantly adding addresses to it, hence this question).

If there was, I'd delete the no-spam junk in my email address.  I
don't mind having to download something once a week (using LWP) (and
that takes care of making this post on-topic for c.l.p.m :-).

(This particular post has my correct email address!)

Thanks,

Sitaram.
-------------------------------------
Sitaram Chamarty
delete the word "delete" from the domain name - as I'm sure you've
guessed - to get my email address


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

Date: 04 May 1997 15:32:43 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl auto-replier
Message-Id: <oeewwpfbeok.fsf@alpha.hut.fi>


fl_aggie@hotmail.com (I R A Aggie) writes:
> I think the most up-to-date version of the perl FAQ and metaFAQ should
> be included in the perl documentation.
> 
> James - yes, I know, they won't use it, but we can pointedly point them
>         to them...

As of Perl 5.004 the FAQ will be.

-- 
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.


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

Date: Tue, 29 Apr 1997 14:12:04 -0400
From: "Simon E." <NYXEL@ny.ubs.com>
Subject: Perl to C
Message-Id: <336639F4.7A4D@ny.ubs.com>

Hi there,
Does anyone know if there is a Perl to C translator program out there?
We want to convert a couple of perl scripts into C functions, but trying 
to avoid re-writing.

Please e-mail to nyxel@ny.ubs.com, -- I don't really check this 
newsgroup.
thanks a lot,
-Simon


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

Date: 6 May 1997 05:15:28 GMT
From: Zenin <good.luck@getting.spam.to.zenin.at.best.com>
Subject: Re: PerlScript (activeserverpages) and setting a cookie ?
Message-Id: <5kmepg$f5f$1@nntp2.ba.best.com>

Per Soderlind <soderlind@gazette.no> wrote:
: Hi,
: I'm trying to set a cookie using PerlScript;
: In VBscript the syntax is;
: Response.Cookies("CookieName") = "CookieValue"

: Since I don't like VB (please don't start a VB vs Perl war), I'm using
: PerlScript on the IIS 3.0 platform. PerlScript is real nice, but there
: is a small problem - the lack of documentation. Looking at the VBscript
: doc, I thought the Perl equivalent had to be;
: $Respose->cookies("CookieName") = "CookieValue";

: But it's not.

: Does anyone know the correct syntax ?

	Well, for starters you can't assign to a method.  At least not
	in perl any.  Maybe it's:
		$Response->Cookies ("CookieName", "CookieValue");

	or:
		$Response->{CookieName} = "CookieValue";

	or something like:
		$Response->SetCookie ("CookieName", "CookieValue");

	BTW, could you point me to the URL for PerlScript?  As I have the
	disfortune to have to work with the new MS-IIS I'd like to check
	it out.  Thanks. :)

-Zenin
 Zenin @ Best . com


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

Date: 05 May 1997 10:12:50 -0600
From: Dave Carrigan <carrigad+usenet@iplenergy.com>
Subject: Re: program for perl?
Message-Id: <86207l6got.fsf@iplenergy.com>

>>>>> "Randal" == Randal Schwartz <merlyn@stonehenge.com> writes:


 Randal> $ cat >myscript
 Randal> #!/usr/bin/perl
 Randal> ... [rest of script]
 Randal> ...
 Randal> ^D
 Randal> $ chmod +x myscript
 Randal> $ ./myscript
 Randal> [runs perfectly]
 Randal> $

So, which program, `cat' or `chmod' does the auto perl debugging part?
I really, really need to get me one of those.

-- 
Dave Carrigan                            | Yow! I'll show you MY telex number
Unix Specialist, Technology Services     | if you show me YOURS...
Interprovincial Pipe Line Inc.           | 
Edmonton, Alberta, Canada                | 


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

Date: Tue, 06 May 1997 10:57:12 +0200
From: Ortwin Glueck v/o Odi <ogluck@g26.ethz.ch>
Subject: REQ: Script to send mail to LIST of persons
Message-Id: <336EF268.55FA@g26.ethz.ch>

Looking for a script that sends a text-file to the e-mail adresses
listed in another file.

Anyone got one or wants to write one?

mailto:ogluck@g26.ethz.ch


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

Date: 6 May 1997 12:08:58 GMT
From: "Karl Thomas" <karlt@ilinks.net.njem>
Subject: Re: RISC vs CISC  or SunOS
Message-Id: <01bc5a16$14fc7140$72c289ce@hitachi>

Stephan Schaem <t21@ix.netcom.com> wrote in article
<5klcml$gce@sjx-ixn5.ix.netcom.com>...
>  Risc make great cheap lowend chip...  The best chance RISC had to
>  porve itself was with the macs. Because of apple it was a total failure.
>  PPC macs had nothing more to offer over 680x0 mac aside bigger
>  price tag. (maybe tho cheaper to produce for apple)

When were you ever able to get a Mac at the (relative) performance level of
PPC603e-180Mhz based Mac at $1150?  What else were the PPC Macs suppose to
do besides increase the speed?  



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

Date: Tue, 06 May 1997 12:37:00 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: scalar holds compiled code
Message-Id: <336F17DC.7CDD@unl.ac.uk>


Tom Vaughan wrote:
> 
> Abigail (abigail@fnx.com) wrote:
> : Look up in the manual or the Camel:
> :    system, qx, backticks and exec.
> 
> Unfortunately no. The functions you've mentioned involve file access.
> In my case, $STUFF already holds the contents of what could be considered a
> file. What I need is a way to execute not a file but a location in memory.

eval ("$STUFF");

Alastair.


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

Date: 04 May 1997 15:26:32 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: scientific notation compare bug
Message-Id: <oeeyb9vbeyv.fsf@alpha.hut.fi>



> In the bug demonstrated below, $r is simultaneously greater than
> 1000 and less than 1000.  But, only in perl5.003.  Would 
> someone please help me report this bug to the perl gurus?

This bug does not seem to be there any more, not even for 5.003_02.
Now at 3_99 it has not come back.

-- 
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.



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

Date: Mon, 5 May 1997 22:47:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Script runs fine from shell, but browser doesn't receive variables
Message-Id: <E9qCMw.H4C@nonexistent.com>

On Mon, 05 May 1997 18:48:37 GMT, Jeffrey Morgan wrote in
comp.lang.perl.misc URL: news:336e2965.22056503@news.atl.mindspring.com:
++ I have a script that simply reads a directory, stores the file names
++ in an array, uses those filenames to open a string of text files and
++ print the output to the browser that calls the script.
++ 
++ From the shell it works great, but from the browser I get not out put.
++ To test it, I disabled the part where it reads the files themselves
++ and tried to get it to just print the file names. This too works from
++ shell but not from the browser.
++ 
++ I even put in a test print statement that prints to the browser fine
++ just before the expected list of file names, but no go.
++ 
++ Here is my script:

Did you check what the error file says? I catch 99.5% of the bugs that way.

++ #!/usr/bin/perl

You don't have -w. You don't have -T.

++ require "cgi-lib.pl";

You don't have use CGI; You don't have use strict.

++ &ReadParse (*input);
++ $pathtogroup="/path to a group/";
++ $fullpathtogroup="fullpath to a group/";
++ 
++ 
++ ($sec,$min,$hour)=localtime(time);
++ $ip = $ENV{'REMOTE_ADDR'};
++ 
++ 
++ print "Content-type: text/html", "\n\n";
++ print "<HTML>", "\n";
++ print "<HEAD><TITLE>Test.pl</TITLE></HEAD>", "\n";
++ print "<BODY>", "\n";
++ 
++ &getdir;
++ 
++ print "All files \n"; # this is my test line. It prints fine.
++ print @allfiles; # this will not appear in my browser, not in shell
++ print "</BODY></HTML>", "\n";
++ 
++ sub getdir{
++ 
++ opendir (jeff, "$fullpathtogroup$group\/");

You don't check the return value.

++ @allfiles=readdir (jeff);
++ closedir jeff;

You don't check the return value.

++ print "@allfiles","\n"; # this wont work either

Not at all? Not even the newline?

++ $i=2; # this routine opens the files and prints the whole contents
++ # to the shell, but wont print in browser
++ 
++ while (@allfiles[$i]) {
++ 
++ open (blah, "$fullpathtogroup$group\/@allfiles[$i]");

You don't check the return value.

++ @lines=<blah>;
++ close (blah);

You don't check the return value.

++ 
++ print "$fullpathtogroup$group\/@allfiles[$i]\n" ;
++ #print "##\n@lines";   
++ 
++ # print "@allfiles[$i]\n";
++ $i++;
++ }
++ return
++ 
++ }
++ 
++ 
++ I think it must be the way that @allfiles is being sent. Still, the
++ browser should pick it up.
++ 
++ Any ideas?

Many. See above.



Abigail


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

Date: Tue, 06 May 1997 10:46:43 +0100
From: Douglas Seay <seay@absyss.fr>
To: Ken Stevens <kstevens@globeandmail.ca>
Subject: Re: select() wierdness
Message-Id: <336EFE03.26E7A89C@absyss.fr>

[posted and mailed]

Ken Stevens wrote:
> 
> Hi all!
> 
> select() is wierd.  I've read most of the docs, and I'm still mystified
> as to how on earth select() is able to change the value of $rout.  At
> first I thought that maybe function($out=$in) is some strange syntax for
> passing by reference I'd never heard of, but then I tried to use it and
> couldn't figure out how to code the called subroutine so that it gets
> the reference.  Now, I'm inclined to believe that select() is totally
> out-of-band and is a wierd syntactical exception in perl.  It almost
> looks like it's implemented as a macro, where the macro is expanded in
> place, thus gaining access to the arguments locally.  Is this wierdness
> explained somewhere in my favourite book "Programming Perl"?

what is happeneing with function($out=$in) is that $in is copied to $out
and the parens return $out, just as if it had be written

	$out = $in;
	function($out);

In functions, @_ contains aliases of the parameters, so it is possible
to modify them and select() takes advantage of this functionality. 
Since select() is passed the lvalue $out, it modifies $out and never
touches $in.  When select() is done, $out has the modified value and $in
has the original.  Sorry, but there is no magic with select().

Your problem seems to be that you think perl uses pass-by-value.  Try
this little example

	#!/usr/local/bin/perl -w
	use     strict;
	sub     func    { $_[0] = "myself"; }

	my $var = "me";
	print "var(1) = $var\n";
	&func($var);
	print "var(2) = $var\n";

I don't know what mechanism perl uses (probably pass-by-reference with
pass-by-name for typeglobs, but it could be copy-in-copy-out), but it
definately lets you modify the parameters of a function.  The same with
foreach loops where if you modify the index, you modify the original
value.  Even if they don't use the same code (I've never looked at the
source), they have the same "feel".

- doug


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

Date: Tue, 06 May 1997 12:30:41 GMT
From: tfbiv@erols.com (Tom Bates)
Subject: Trash can or wastebasket for Unix
Message-Id: <33782462.2994456@news.erols.com>


I've been looking for a trashcan or wastebasket type of program for
use on a Sun workstation network.  Being a new fan of perl, I thought
I might write one in perl, but I wanted to see if it had been done
already.  Has it?

Thanks
Tom



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

Date: Tue, 6 May 1997 11:46:55 GMT
From: stephen farrell <stephen+usenet@farrell.org>
To: tfbiv@erols.com (Tom Bates)
Subject: Re: Trash can or wastebasket for Unix
Message-Id: <8767wwvn4g.fsf@phaedrus.uchicago.edu>


tfbiv@erols.com (Tom Bates) writes:

> I've been looking for a trashcan or wastebasket type of program for
> use on a Sun workstation network.  Being a new fan of perl, I thought
> I might write one in perl, but I wanted to see if it had been done
> already.  Has it?
> 
> Thanks
> Tom

When I read the subject, I thought that you were inquiring as to which
as a more fitting end for Unix, a trashcan or wastebasket... =)

Ugh... there are many possible answers to your question -- one off the
top of my head is the TkDesk system, which includes a full desktop
metaphor, including "trash".

--steve farrell



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

Date: Tue, 06 May 1997 13:06:33 GMT
From: sg94bwh5@dunx1.ocs.drexel.edu (John Nolan)
Subject: Re: What is the best way of learning Perl?
Message-Id: <567cd$8621.261@XAVIER>

Philippe Benichou (benichop@reality.cse.fau.edu) wrote:

: What is the best way for learning Perl?  Looking at other people's scripts
: is too confusing, and the O'Rielly book doesn't explain things well.


Um... Which O'Reilly book?  There are three of them. 

Two of them are among the best-written computer language books
I've ever read.  They are:

  Learning Perl, by Randal Schwartz
  Programming Perl, 2nd edition by Schwartz, Christiansen and Wall

You should start with Learning Perl.  It's absolutely
straightforward.  Programming Perl is more advanced, but
they do a good job of explaining some rather advanced topics
in a clear and light-hearted way.  (If only other books could
do that!)

The other one, Programming Perl 1st edition, is indeed quite
difficult to learn from.  I would not recommend it for
a new learner.  The 2nd edition is a complete rewrite 
and it's a much better book.  

If you want to invest money into a book, definitely start 
with one of the two books listed above.  They're excellent. 
--
###  John Nolan  
###  jpn@acm.org                               ~       __0    
###  sg94bwh5@dunx1.ocs.drexel.edu            ~      _`\<,_   
###  Drexel University, Philadelphia         ~      (_)/ (_) 

The trouble isn't that there are too many fools, 
but that the lightning isn't distributed right.

           -- Mark Twain 



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

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

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