[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

macperl-anyperl-digest V1 #8




macperl-anyperl-digest      Sunday, April 4 1999      Volume 01 : Number 008



[MacPerl-AnyPerl] Syntax Question
Re: [MacPerl-AnyPerl] Syntax Question
Re: [MacPerl-AnyPerl] Syntax Question
Re: [MacPerl-AnyPerl] Syntax Question
Re: [MacPerl-AnyPerl] Syntax Question

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

Date: Fri,  2 Apr 1999 08:35:45 -0500
From: Richard Gordon <maccgi@bellsouth.net>
Subject: [MacPerl-AnyPerl] Syntax Question

I am working with an example script from a book on cgi scripting and have run
across some unfamiliar syntax that is not explained and Perl doesn't seem to
like. I think that all of the relevant stuff is included in:

my $dir = $_[0];
    my $st = $_[1];
    my (@dirs, @files, @results, $filename, $newdir, $list);
    opendir(DIR, $dir);
    @dirs = grep {!(/^\./) && -d "$dir/$_"} readdir(DIR);
    rewinddir(DIR);
    @files = grep {!(/^\./) && /html$/ && -T "$dir/$_"} readdir(DIR);
    closedir(DIR);
    
    for ($list(0..$#dirs)   {
        if (!($dirs[$list] = [td]/temp/ || $dirs[$list] = [td]/images/))    {
            $newdir = $dir."/".$dirs[$list];
            &scan_files($newdir, $st);
            
What we are supposed to be doing is making a directory list to be followed by a
file scan. There may still be some other problems with the above, but the part I
do not understand at all is the [td] as used in the if() statement. Perl
complains that this is a bareword that may conflict with future reserved words,
but I am more concerned that I just don't grasp what this is in any case.

I do know that there were some problems relating to a lack of quoting and other
stuff in some of the other program listings, but I assumed those were proofing
errors while this looks like High Martian to me. Any thoughts?

Thanks.

Richard Gordon
Gordon Consulting & Design
maccgi@bellsouth.net



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org

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

Date: Fri, 2 Apr 1999 10:38:37 -0500 (EST)
From: rjk@linguist.dartmouth.edu (Ronald J. Kimball)
Subject: Re: [MacPerl-AnyPerl] Syntax Question

Richard Gordon wrote:
> 

>         if (!($dirs[$list] = [td]/temp/ || $dirs[$list] = [td]/images/))    {


> There may still be some other problems with the above, but the part I
> do not understand at all is the [td] as used in the if() statement. Perl
> complains that this is a bareword that may conflict with future reserved words,
> but I am more concerned that I just don't grasp what this is in any case.
> 
> I do know that there were some problems relating to a lack of quoting and other
> stuff in some of the other program listings, but I assumed those were proofing
> errors while this looks like High Martian to me. Any thoughts?

Get a better book.

That [td] is some sort of typesetting code for 'tilde', aka '~'.
Apparently the typesetting codes were not properly translated
when the book was printed.


if (!($dirs[$list] =~ /temp/ || $dirs[$list] =~ /images/))    {


Ronald

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org

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

Date: Fri, 2 Apr 1999 11:06:20 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl-AnyPerl] Syntax Question

At 10.38 -0500 1999.04.02, Ronald J. Kimball wrote:
>That [td] is some sort of typesetting code for 'tilde', aka '~'.
>Apparently the typesetting codes were not properly translated
>when the book was printed.

Ack!  That's very funny (and tragic) ... what book is that, Richard?

- --
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org

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

Date: Fri, 2 Apr 1999 11:11:27 -0500
From: Richard Gordon <maccgi@bellsouth.net>
Subject: Re: [MacPerl-AnyPerl] Syntax Question

At 10:38 -0500 4/2/1999, Ronald J. Kimball wrote:
>Get a better book.
>
>That [td] is some sort of typesetting code for 'tilde', aka '~'.
>Apparently the typesetting codes were not properly translated
>when the book was printed.
>
>
>if (!($dirs[$list] =~ /temp/ || $dirs[$list] =~ /images/))    {

I figured there was something horribly out of whack, although there 
are other portions of the same listing in which the tildes show up 
okay. I'd never thought about it before, but I suppose that editing a 
Perl book would tend to be a nightmare once the publisher's markup 
software had mangled it. Anyway, thanks for your help and I think 
that this also explains some other stuff that I've come across that 
looks very odd and appears to be broken.


Richard Gordon
- --------------------
Gordon Consulting & Design
Database Design/Scripting Languages
mailto://maccgi@bellsouth.net
770.565.8267

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org

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

Date: Fri, 2 Apr 1999 12:11:33 -0500
From: Richard Gordon <maccgi@bellsouth.net>
Subject: Re: [MacPerl-AnyPerl] Syntax Question

At 11:06 -0500 4/2/1999, Chris Nandor wrote:
>At 10.38 -0500 1999.04.02, Ronald J. Kimball wrote:
> >That [td] is some sort of typesetting code for 'tilde', aka '~'.
> >Apparently the typesetting codes were not properly translated
> >when the book was printed.
>
>Ack!  That's very funny (and tragic) ... what book is that, Richard?
>
>--

"MacPerl Power and Ease" by Vicki Brown and Chris Nandor. :-]



Actually, it's "Using Perl 5 for Web Programming" by David Harlan and 
others (Que, 1996). The worst part is that it is actually a pretty 
good book in terms of clarity and scope, but it is abundantly clear 
that nobody bothered to test the program listings after the galleys 
were flowed. I'm really surprised because I've got a couple of other 
Que books on various topics that were nicely done.

I noticed that the acquisitions editor says "we'd like to hear from 
you," so I may pick a bone with him about this when I get a chance. A 
few typos are one thing, but given how fussy Perl is anyway, I would 
have thought that they would have spent more time making sure that 
nothing had gotten hosed up than they did writing it to begin with.


Richard Gordon
- --------------------
Gordon Consulting & Design
Database Design/Scripting Languages
mailto://maccgi@bellsouth.net
770.565.8267

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org

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

End of macperl-anyperl-digest V1 #8
***********************************


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to
==== macperl-anyperl-digest-request@macperl.org