[7792] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1417 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 5 16:16:44 1997

Date: Fri, 5 Dec 97 13:00:25 -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           Fri, 5 Dec 1997     Volume: 8 Number: 1417

Today's topics:
     Re: can perl do multi-threaded programming? <ghowland@hotlava.com>
     Re: can perl do multi-threaded programming? <ghowland@hotlava.com>
     Re: can perl do multi-threaded programming? <tchrist@mox.perl.com>
     Re: File Editing (Tad McClellan)
     Re: Forced to use brain-dead perl 4 -- how do I accompl <barnett@houston.Geco-Prakla.slb.com>
     How about a new type of "OR" (lazy evaluation)? (Bart Lateur)
     Re: How about a new type of "OR" (lazy evaluation)? <jklein@alerts.co.il>
     Re: How do I print all but the first variable in an arr <r.goeggel@atos-group.de>
     Re: if ( ($a{$b}{$c} > $d ... Newby Question <tigger@sgi.com>
     Re: Joys of tainting (Greg Bacon)
     Re: Matching lowercase letter in regexp (M.J.T. Guy)
     Re: Matching lowercase letter in regexp <ckc@dmi.dk>
     Re: Matching lowercase letter in regexp (Honza Pazdziora)
     Parameter Checking <hvanlint@lodestar.be>
     Re: Parameter Checking <eike.grote@theo.phy.uni-bayreuth.de>
     Perl syntax error <concord@cam.org>
     Re: Perl syntax error <eike.grote@theo.phy.uni-bayreuth.de>
     Re: Perl syntax error scott@softbase.com
     Re: Perl syntax error scott@softbase.com
     Re: Q: Learning perl with no progr. experience <cmuller@avsgroup.com>
     Q: multiline <pivari@geocities.com>
     Re: Recommended PERL-book? <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Recommended PERL-book? <tchrist@mox.perl.com>
     Setting default printer under Windows NT charlot@cam.org
     Re: WANTED: A PERL script to verify an ASCII list of UR (Greg Bacon)
     Re: Web Discussion Board with RFC1867 file upload <cmuller@avsgroup.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 04 Dec 1997 14:32:58 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: can perl do multi-threaded programming?
Message-Id: <3486B10A.4E9A@hotlava.com>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc,
>     "David M Rosner" <dave@digidem.com> writes:
> :i have a program where i want to kick off several other programs all at
> :once. i could fork each one into its own process and then exec it, but i'd
> :rather have the advanatages of true-multithreading and do each one as a
> :seperate task. i've searched around and i can't seem to find any
> :multi-threading information on Perl. is there such a thing?
> 
> Fork is good for you.  Here's a demo that shows how powerful
> fork is for multithreading:
> 
>     # make socket SOCFH, connect, then dup the PC
>     if (fork)   { while (<SOCFH>) { print STDOUT $_ } }
>     else        { while (<STDIN>) { print SOCFH $_ } }

Tom's at it again, with that little program of his.  This is not
multithreading, it's multiprocessing.  fork() is a pathetic solution.


> All you get from the "threading" is shared data, which is its own
  ^^^!
> problem.

It solves a damn sight more problems than it creates.  Anyway,
multithreading gives you more than shared data - it gives you the
ability to stop what you're doing and resume it at a later time, without
the hassle of having to save and restore the program state.

> We've done multitasking for years you know with fork.

And people write applications in COBOL, but it doesn't mean it's the
best solution.  You don't see programs like netscape using fork, do
you?  Imagine if it kicked off a process for every thread!!!!

> For most people, non-PC-duplicating threading is a lame excuse
> for not understanding the select system call.

The select call does not solve the problem of being able to save and
restore your state, but threads do.  If I use select, then every time I
want to do some I/O, I must save my state, return back to the select
loop,  read the next character (or whatever), and restore myself when
selected again!!!  Select() is a pathetic "solution".  (Unless of course
we have a save-state/restore-state facility (coroutines), in which case
select is a fine solution.

In fact, we can easily implement threads in perl using select, if only
we had a pair of perl instructions ("suspend" and "resume"?), that save
and restore the program state.  This facility would be damned useful for
all sorts of other things too, such as backtracking.  But it's not going
to happen, since it's too useful, too (java/python/lisp)-like, and can
implemented in perl as it currently stands (turing machine equivalency
and all that).  Like threads.


Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: Thu, 04 Dec 1997 14:39:10 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: can perl do multi-threaded programming?
Message-Id: <3486B27E.5EB2@hotlava.com>

Kerry Schwab wrote:
> 
> Having been involved with user-space pthreads before, I would concede
> that user-space threads are (almost) useless.

Of course our experience depends upon many factors (such as the project
being developed, the language being used, etc.), but my personal
experience has been just the opposite - that user-space threads work
exceedingly well, and even have certain advantages over kernel threads. 

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: 4 Dec 1997 16:20:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: can perl do multi-threaded programming?
Message-Id: <666l7h$e06$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Gary Howland <ghowland@hotlava.com> writes:
:Tom Christiansen wrote:
:Tom's at it again, with that little program of his.  This is not
:multithreading, it's multiprocessing.  fork() is a pathetic solution.

You're playing word games.  The code is clearly multitasking: there are
two PCs running concurrently.  And I can't see what you mean by pathetic.
You trying to pick a fight?  That's two messages in a row I've read from
you like this.  I'd really rather not.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Does the same as the system call of that name.
    If you don't know what it does, don't worry about it.
            --Larry Wall in the perl man page regarding chroot(2)


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

Date: Thu, 4 Dec 1997 06:23:05 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File Editing
Message-Id: <9b7666.pi.ln@localhost>

Lops (lops@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN) wrote:
           ^^^^^^^^

[ You_should_also_check_the_FAQ_before_posting ]


: 	I have a problem related to  file  editing . 
: I want to change the data in particular location in the file later .
: How can I change the data stored in the file ?


You mean like is described in the Perl FAQ, part 5?

   "How do I change one line in a file/
    delete a line in a file/
    insert a line in the middle of a file/
    append to the beginning of a file?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 04 Dec 1997 08:22:20 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?
Message-Id: <3486BC99.1DCE45BB@houston.Geco-Prakla.slb.com>

Mike Stok wrote:

> In article <-0312970936200001@aggie.coaps.fsu.edu>,
> I R A Aggie <fl_aggie@thepentagon.com> wrote:
>
> >1. perl4 is CERTifiably insecure
> >2. perl4 is not y2k compliant
>
> Please tell me how perl 4 is not Y2K compliant where perl 5.xxx is Y2K

I can't answer for perl 4.  Perl 5 is year 2000 compliant, if you make it so.
You have to keep in mind that certain functions return a short year (aka 97
instead of 1997).  For example, the year portion of localtime(time) if run today
would return 97.

Of course, you're saying, that's not year 2K compliant!  Wouldn't it return 00 if
run on this day in the year 2000?  No.

The year portion of localtime (and gmtime) returns a value equal to "the current
year - 1900".  In other words, in the year 2000, the "year" portion of localtime
will tell you 100!  If you aren't careful, you might end up with "00" for your
year, but only if you are not careful (and aware of this).

HTH.

> compliant.  I have scanned the perldelta for references to 2000 and Y2K
> and don't see any.  Does this mean that perl 5.xxx is not y2k compliant
> too?
>
> While I have some sympathy for encouraging people to get with the times,
> using FUD as a justification seems dubious at best.
>
> Mike
> --
> mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
> http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
> http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
> stok@colltech.com                  |            Collective Technologies (work)



--
"Security through obscurity is no security at all."
                -comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------





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

Date: Thu, 04 Dec 1997 14:03:09 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: How about a new type of "OR" (lazy evaluation)?
Message-Id: <3486b2c8.8226996@news.tornado.be>

I find myself using the syntax like the next,a lot, as it is a nice
shortcut (it could be "||" instead of "or"):

	$result = &calc(@params) or &default(@params);


However, I only want the first part to fail (and continue with the
second part) if it's undefined, so I always end up asking myself: can
the left part return a 0 or  a ""? Under normal conditions, if this is
the case, I want to accept this as result

An example, a typical case, to replace special characters by their HTML
entities, or, if no entity is defined, their encoded ASCII value.

	s/([$charclass])/$entity{$1} || "&#".ord($1).";"/ge;

Note that this is based upon the fact that "0" is not an entity, or we
would have introduced a bug.

I know that you can also do the following:

	$result = defined($temp=&calc(@params))?$temp:&default(@params)

But it doesn't look as nice, and like most people, I don't use it if
it's not necessary.

So, obviously, there is a culprit, a possible source of all sorts of
bugs, built into Perl.


So I would suggest the introduction of a new type of lazy evaluation
operator, in which case the right side is only executed if the left side
evaluates to undef.

I wouldn't know how to call it (for now, I call it "unlessdefined"), but
I think it would be the preferred way to do things like

	open(IN,$file) unlessdefined die "Can't open file";

So what do you think about this?

	Bart Lateur
	bart.mediamind@tornado.be


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

Date: Thu, 4 Dec 1997 17:40:33 +0200
From: Joe Klein <jklein@alerts.co.il>
To: Bart Lateur <bart.mediamind@tornado.be>
Subject: Re: How about a new type of "OR" (lazy evaluation)?
Message-Id: <Pine.SOL.3.95.971204173121.11394F-100000@cain.alerts.co.il>



On Thu, 4 Dec 1997, Bart Lateur wrote:

> I find myself using the syntax like the next,a lot, as it is a nice
> shortcut (it could be "||" instead of "or"):
> 
> 	$result = &calc(@params) or &default(@params);

Just a quick comment on the above line - it doesn't work :-(.  '=' has a
higher precedence than 'or'. So what you're really end up doing is: 

      ($result = &calc(@params)) or &default(@params);

If &calc() returns false, then &default() will get called but its result
won't be assigned to $result.  You have to either explictly parenthesize
everything after the '=' or use the '||' which binds stronger than '='.

I have been bitten by this more than once and it can be a real PIA to find
the problem. i just want to save other people from making the same
mistake. 

Joe Klein
News Alert Inc.



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

Date: Thu, 4 Dec 1997 13:32:37 +0100
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: How do I print all but the first variable in an array?
Message-Id: <6667ts$4vi$1@news.pop-stuttgart.de>


James Zubin Pope wrote <3487a7be.28527677@news.demon.co.uk>...
>Hi there,
>
>I am fairly new to perl and this is the situation I am in. I need to
>be able to print all but the first variable in a regular array. Do I
>make sense? Basically I have an array of:
>
>@stuff
>
>and I want to print $stuff[1] and $stuff[2] and $stuff[3] etc BUT NOT
>$stuff[0].
>


#If you don't need the array any longer you can delete the first element
shift @stuff;
# and then print all elements
# Method 1:
foreach $temp (@stuff) { print $temp }
# Method 2:
print join('', @stuff);
# Method n: TIMTOWTDI

HTH
Ronald





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

Date: Thu, 04 Dec 1997 07:05:21 -0800
From: Jamie Heller-Evans <tigger@sgi.com>
To: Mike Stok <mike@stok.co.uk>
Subject: Re: if ( ($a{$b}{$c} > $d ... Newby Question
Message-Id: <3486C6B1.57624C18@sgi.com>

> One place to look is the perldsc man page (perl data structures cookbook)
> as it explains how preferences can be used to build complex data
> structures.
> 
> $a{$b}{$c}is shorthand for $a{$b}->{$c} which means that you're looking at
> the hash %a and expecting the value associated with %b to be a reference
> to another hash.  $c is used as a key into this hash.


Ah, now I see.  The shorthand syntax was throwing me, especially not
being on intimate terms with data structures.

[... Good Explanation Deleted here for brevity ...]


> Hope this helps,

Very much.

Thanks to all who emailed their answers to me as well.  Your varying
explanations have gone a good ways into helping my understanding!

jamie


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

Date: 4 Dec 1997 16:05:10 GMT
From: gbacon@adtran.com (Greg Bacon)
To: fil_nospam@login.net (Philip)
Subject: Re: Joys of tainting
Message-Id: <666kbm$fj5$1@info.uah.edu>

[Posted and mailed]

In article <348606d9.30136707@nntphost.login.net>,
	fil_nospam@login.net (Philip) writes:
: OK, anybody see the problem with this code :
:  next unless($t=~/([a-zA-Z0-9&=\+]+)/); # line 0
:  $r=quotemeta($1);                      # line 1
:  $r="$r\\W" if(length($t)<=2);          # line 2
: 
: $t is tainted, lines 0 and 1 untaint it in $r.  Line 2 causes $r to
: become tainted.  If I change line 2 to :
:  $r="$r\\W" if(length($1)<=2);          # $r is no longer tainted
: 
: All I can think of is that $r is dependant on the (tainted) length of
: $t.  But if so, then all I can say is *WOW*, that's quite a powerful
: parse.  Also, how could the length of one string impact de security of
: another?
:
: Can anyone justify this?  Is this documented anywhere?

It's documented in the perlsec manpage:

        sub is_tainted {
            return ! eval {
                join('',@_), kill 0;
                1;
            };
        }

    This function makes use of the fact that the presence of
    tainted data anywhere within an expression renders the
    entire expression tainted.

Reading further, you'll see

    But testing for taintedness gets you only so far.
    Sometimes you have just to clear your data's taintedness.
    The only way to bypass the tainting mechanism is by
    referencing subpatterns from a regular expression match.
    Perl presumes that if you reference a substring using $1,
    $2, etc., that you knew what you were doing when you wrote
    the pattern.  That means using a bit of thought--don't
    just blindly untaint anything, or you defeat the entire
    mechanism.  It's better to verify that the variable has
    only good characters (for certain values of "good") rather
    than checking whether it has any bad characters.  That's
    because it's far too easy to miss bad characters that you
    never thought of.

Untainting data is a bitch by design. :-)

: PPPS : remove the _nospam to respond to me.

To receive email replies, please place a repliable address in the From:
or Reply-To: headers, perhaps both.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 4 Dec 1997 13:11:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Matching lowercase letter in regexp
Message-Id: <666a6n$t0d$1@lyra.csx.cam.ac.uk>

In article <881239862.762535@thrush.omix.com>, Zenin  <zenin@best.com> wrote:
>[ posted & mailed ]
>
>Honza Pazdziora <adelton@fi.muni.cz> wrote:
>: I might be missing something in the FAQs, but: how do I match lowercase
>: letter (locale-smart, of course)?
>
>	s/\l\w/$&:/g;
>
>	\l doesn't match anything.  It's just a modifier for something that
>	_does_ match something. :-)

Unfortunately, that doesn't work  -  \l is effectively a no-op here.
\l merely lowercases the next character in the search string, so for
example  /\lA/  will match "a" but not "A".    It has no effect on
metacharacters such as \w.

:-(


Mike Guy


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

Date: 04 Dec 1997 14:15:37 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Matching lowercase letter in regexp
Message-Id: <wvp1zztp7uu.fsf@hobbes.ejoper.dmi.min.dk>

Zenin <zenin@best.com> writes:

> 	s/\l\w/$&:/g;

Ack! Let me exorcise that foul, evil demon for you:

s/(\l\w)/$1:/g or

Never, ever use $& if you can help it. It will slow down ALL regex
operations in the entire script (as well as included libraries) by
making copies of all strings subjected to matching, whereas $1 and
friends only do this to the match in question.

The hip owls book (Mastering Regular Expressions) has more info on
this problem.

Regards,
Kvan.
-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: Thu, 4 Dec 1997 13:55:26 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Matching lowercase letter in regexp
Message-Id: <adelton.881243726@aisa.fi.muni.cz>

Zenin <zenin@best.com> writes:

[...]

> 	Close...really, really close. :-)
> 
> 	s/\l\w/$&:/g;
> 
> 	\l doesn't match anything.  It's just a modifier for something that
> 	_does_ match something. :-)

When is this supposed to start working?

$ echo 'Jezek' | perl -pe 's/\l\w/$&:/g' 
J:e:z:e:k:

for 5.004_04.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Thu, 4 Dec 1997 15:02:01 +0100
From: "Hans Van Lint" <hvanlint@lodestar.be>
Subject: Parameter Checking
Message-Id: <666cto$t1k$1@news2.xs4all.nl>

Is there a way to check if the data entered by a user in a form is an
integer value??

(if data.value is integer then continue)

eg:

User fills in value -> 25
Data entered is ok

User fills in value -> A5
Gets message --> Please enter an integer value




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

Date: Thu, 04 Dec 1997 15:14:14 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Parameter Checking
Message-Id: <3486BAB6.446B@theo.phy.uni-bayreuth.de>

Hi,

Hans Van Lint wrote:
> 
> Is there a way to check if the data entered by a user in a form is an
> integer value??
> 
> (if data.value is integer then continue)

You should take a look at the Perl FAQ (e.g. at 
http://language.perl.com/faq/index.html):

  How do I determine whether a scalar is a number/whole/integer/float? 


Bye, Eike
-- 
=======================================================================
>>--->>    Eike Grote  <eike.grote@theo.phy.uni-bayreuth.de>    <<---<<
-----------------------------------------------------------------------
 Home Page, Address, PGP,...:  http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
 PGP fingerprint:      1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================


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

Date: Thu, 04 Dec 1997 08:41:30 -0500
From: Alex Chkliar <concord@cam.org>
Subject: Perl syntax error
Message-Id: <3486B30A.2DCA@cam.org>

Dear reader,

I have a book Using Perl 5 for Web Programming (a QUE book)
This code is taken right from the book.

#!/usr/local/perl
for $list(0..$#dirs) {
    if (!($dirs[$list]=[td]/temp/ || $dirs[$list]=[td]/images/ )) {
       $newdir=$dir."/".$dirs[$list];
       &scan_files ($newdir);
    }
}

When I compile this code under Perl 5.003 (Unix) I get

syntax error at test.pl line 3, near "/ ||"
syntax error at test.pl line 7, near "}"
test.pl had compilation errors.

Please help what is going wrong. 

Also would like to understand what [td] does. I know that author doesn't
want
to include temp amd images directories for the processing, but [td]
confuses me and
perhaps causes the systax errors.

Thanks.
Alex.


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

Date: Thu, 04 Dec 1997 15:11:25 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Perl syntax error
Message-Id: <3486BA0D.2781@theo.phy.uni-bayreuth.de>

Hi,

Alex Chkliar wrote:
> 
> I have a book Using Perl 5 for Web Programming (a QUE book)
> This code is taken right from the book.
> 
> #!/usr/local/perl
> for $list(0..$#dirs) {
>     if (!($dirs[$list]=[td]/temp/ || $dirs[$list]=[td]/images/ )) {
>        $newdir=$dir."/".$dirs[$list];
>        &scan_files ($newdir);
>     }
> }
 [...] 
> Also would like to understand what [td] does. I know that author doesn't
> want
> to include temp amd images directories for the processing, but [td]
> confuses me and
> perhaps causes the systax errors.

In fact ... replace '[td]' by '~' and it should work (seems to be
a printing problem of the publisher).


Bye, Eike
-- 
=======================================================================
>>--->>    Eike Grote  <eike.grote@theo.phy.uni-bayreuth.de>    <<---<<
-----------------------------------------------------------------------
 Home Page, Address, PGP,...:  http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
 PGP fingerprint:      1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================


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

Date: 4 Dec 1997 16:10:03 GMT
From: scott@softbase.com
Subject: Re: Perl syntax error
Message-Id: <666kkr$2qi$2@mainsrv.main.nc.us>

My bad -- I screwed up on my followup. It's listing 5.2, not
5.1. The caption of the listing has Part 1, and that
caused me to misread it!

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 4 Dec 1997 16:08:33 GMT
From: scott@softbase.com
Subject: Re: Perl syntax error
Message-Id: <666ki1$2qi$1@mainsrv.main.nc.us>

Alex Chkliar (concord@cam.org) wrote:

> I have a book Using Perl 5 for Web Programming (a QUE book)
> This code is taken right from the book.

I've got a copy of this book myself, as part of the HTML, Java, and CGI
special edition CD-ROM-o-rama.  I can't find this code at all.

Telling us the listing would be very helpful. Listing 5.1 has code
very, very similar to this, but it is a complete subroutine (which is a
fragment of a larger program) and it is syntactically correct (to my -w
eyeball scan, anyway!). 

> #!/usr/local/perl
> for $list(0..$#dirs) {
>     if (!($dirs[$list]=[td]/temp/ || $dirs[$list]=[td]/images/ )) {
>        $newdir=$dir."/".$dirs[$list];
>        &scan_files ($newdir);
>     }
> }

The [td] might be some goofup for ~, but even so this code won't
compile or if it did it won't do anything because @dirs has never been
initialized. This isn't the code from the book.

> syntax error at test.pl line 3, near "/ ||"

I don't know where you are getting this code. It is definitely
NOT form the book. Listing 5.1 is a subroutine which is part of
a much larger system for some kind of CGI searching program.
The code that looks almost identical to your own has the
for loop on line 10. It is not a self-contained
program, though, and could not be run by itself. (Well,
it *COULD*, I guess, but it wouldn't do anything if you
didn't call the subroutine!)

> Also would like to understand what [td] does.

My copy of the book does not have the string [td] in the entirety of
chapter 5. I wonder if this is some kind of bizarre
typesetting/printing error. [td] could be a goofup for tilde, ~, which
is the proper character to appear here. (Like luser(at)dot.com you see
in newspapers a lot because @ is a control character in the news wire.)

What edition of the book are you using?

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Thu, 4 Dec 1997 08:53:07 -0600
From: "Chris Muller" <cmuller@avsgroup.com>
Subject: Re: Q: Learning perl with no progr. experience
Message-Id: <3486c3c4.0@news7.centuryinter.net>


Lance Hampton wrote in message <34842F34.8E7BD8DF@ics.com>...
>Hello,
>
>I just began programming just under a year ago.  First, the books you are
>going to want to learn most of your Perl from will be the llama, and camel
>books.  But, with no programming experience, I found that the curve on
>both books was a little too steep.  I found that the "Learning Perl in 21
>days" book was suffiicient to get me pointed in the right direction.  It
<--snip-->

Along this line, I am very happy with the "Instant Web Scripts with
CGI/PERL" by Selena Sol and Gunther Birznieks.  They have put together a
very good tutorial on how to set up and utilize some of their most popular
scripts which they also supply on an acompanying CD.  Their code is very
well structured and commented so you can pick up a lot of the syntax by just
perusing the source.

Hope this helps,
Chris Muller
cmuller@avsgroup.com




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

Date: Thu, 04 Dec 1997 17:33:47 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: Q: multiline
Message-Id: <3486E97B.41C6@geocities.com>

Hi,

I have some problems to find a good method to match in multiline.
For example I want to find the title of an HTML file.
I use this method
if(/<TITLE>/i .. /<\/TITLE>/i)
   {
   $Title.=$_;
   $Title=~/<TITLE>(.*)<\/TITLE>/i;
   $title=$1;
   }

I think this isn't a good method.
Can you help me?

Thanks in advance

-- 
     _/_/_/_/ _/_/_/     Fabrizio Pivari
    _/       _/    _/   mailto:pivari@hotmail.com
   _/_/_/   _/_/_/     mailto:pivari@yahoo.com
  _/       _/         mailto:pivari@geocities.com
 _/       _/         http://www.geocities.com/CapeCanaveral/Lab/3469/


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

Date: Thu, 4 Dec 1997 06:20:32 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Recommended PERL-book?
Message-Id: <666e5u$oit@mtinsc04.worldnet.att.net>

You can't lose with Programming Perl (the Blue Camel book). Actually I don't
think you can go wrong with any of O'Reilly's Perl books.

I also use "Perl by Example" from Sams. It has good examples of the types of
problems I occasionally need to solve (writing my own modules, using Perl
with various net services, etc.)

I have a couple others on my shelf but those should get you through.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl


Christian Bjelle wrote in message <3486883B.4CDE@sesig.mail.abb.com>...
>Hello.
> I want to find a book that describes the basics of PERL, that also
>doesn't get useless after a few days; i.e. it should be useful as a
>reference when the PERL-basics has stuck in my head :)
>I suppose there is some book out there that is to PERL what 'The C
>programming language' by K&R is to C.
>Many thanks in advance. (By the way, this question is most likely
>answered in an faq somewhere isn't it?)
>
>--
>Christian Bjelle - Programmer
>Disclaimer:
> My views are my own, and usually doesn't coincide with my employer's.
> ----------------------------------------------------------------------




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

Date: 4 Dec 1997 16:12:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Recommended PERL-book?
Message-Id: <666koi$e06$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Gary Howland <ghowland@hotlava.com> writes:
:>         I want to find a book that describes the basics of PERL, 
						    ^^^^^^

:"Advanced Perl Programming" is the best perl book by a long shot.
  ^^^^^^^^

Huh?

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    One difference between a man and a machine is that a machine 
    is quiet when well oiled.


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

Date: 4 Dec 1997 09:51:30 -0500
From: charlot@cam.org
Subject: Setting default printer under Windows NT
Message-Id: <666g1i$rb9@stratus.CAM.ORG>

Hello everyone,

I would like to know if it is possible to set the default printer of a Windows
NT (3.51) server from Perl.  "Now why would you want to do that ?", you aks...
Well, I am currently working on a project in which I need to automate the
printing of reports generated in HTML by an Oracle Web Server.  I can easily
(thanks to LWP !) retrieve each report and print it (with a system call to
"netscape.exe /print(...)").

Now for the difficult part (well, it's difficult to me anyways): some reports
must be printed in "landscape" orientation.  The approach I am trying is to
define two NT printers pointing to the same physical printer, but one in
portrait mode and the other in landscape.  Now all I need is to switch the
default printer when needed.  I tried mucking around in the registry, but 
I didn't find anything that works.  I also looked in the Win32 modules docs,
but to no avail.  Might there be a solution using Win32::OLE ?

Any help will be appreciated,
Richard, knowing this is more-or-less a "pure" Perl question and hoping he
         won't get flamed for it...
-- 
Richard Bellavance -- charlot(at)cam(dot)org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: 4 Dec 1997 16:13:58 GMT
From: gbacon@adtran.com (Greg Bacon)
To: ah262@detroit.freenet.org
Subject: Re: WANTED: A PERL script to verify an ASCII list of URLs for 404 errors
Message-Id: <666ks6$fj5$2@info.uah.edu>

[Posted and mailed]

In article <881177151.14531@dejanews.com>,
	ah262@detroit.freenet.org writes:
: Does anyone have a simple PERL script that has the ability to read in a
: flat file of URLs, one by one, and output a simple status report of what
: the return code (specifically 404 NOT FOUND) was for each URL checked?

I hear Randal Schwartz does. :-)  Check out his fourteenth Web
Techniques column.  You can find Randal's WT columns at

    http://www.stonehenge.com/merlyn/WebTechniques/

Bookmark this page when you visit it; I've found it to be an invaluable
collection of resources when it comes to tinkering with WWW code.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Thu, 4 Dec 1997 09:10:51 -0600
From: "Chris Muller" <cmuller@avsgroup.com>
Subject: Re: Web Discussion Board with RFC1867 file upload
Message-Id: <3486c7f3.0@news7.centuryinter.net>


Brian Sullivan wrote in message <663soj$ebr$1@tor-nn1.netcom.ca>...
>Does anybody have any knowledge of a Web based discussion board system
>written in Perl supporting RFC1867 file uploads.
>
>Specifically I would like to allow posts that have file attachments, store
>the uploads, preserve the attachment with the message and allow downloads.
>Does such a beast exist?
>
Check out Selena Sol's site at http://www.extropia.com/Scripts/ Look under
the Scripts section and check out the Bulletin Board script.  I believe the
latest version supports file uploads,

Hope this helps,
Chris Muller
cmuller@avsgroup.com





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

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

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