[16429] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3841 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 29 03:10:28 2000

Date: Sat, 29 Jul 2000 00:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964854618-v9-i3841@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 29 Jul 2000     Volume: 9 Number: 3841

Today's topics:
    Re: return value of `eval "use lib"' <bart.lateur@skynet.be>
    Re: Script for copy all the site (Neil Kandalgaonkar)
    Re: Should truncate length be 0? (Larry R) (BUCK NAKED1)
    Re: Should truncate length be 0? (Larry R) (BUCK NAKED1)
    Re: Should truncate length be 0? (Larry R) (Keith Calvert Ivey)
    Re: Store Order Form (Mark W. Schumann)
    Re: Strange behaviour with localtime() <debjit@oyeindia.com>
        strip from character to end of string <poohba@io.com>
    Re: strip from character to end of string (Mark W. Schumann)
    Re: Suggestion for syntax change (Andrew Johnson)
    Re: taking subroutine name as a parameter (Abigail)
    Re: WWWBoard.PL (Neil Kandalgaonkar)
    Re: WWWBoard.PL (Frans la Cour)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 29 Jul 2000 07:01:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: return value of `eval "use lib"'
Message-Id: <k305osch3ck1799k0v13gu76fvltqtbo37@4ax.com>

Jakob Schmidt wrote:

>but now I just can't make use lib LIST die. I thought it used to die when
>you asked to include a directory which doesn't exist. But it doesn't.
>I'm a little confused.

Use the source, Luke. "use lib" will die if you pass it an empty string,
or a file name instead of a directory.

But that happens inside "import", so require+import should die as well.

-- 
	Bart.


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

Date: Sat, 29 Jul 2000 03:55:55 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Script for copy all the site
Message-Id: <8ltk72$60v$1@localhost.localdomain>

In article <397F3DC0.72007999@reuna.cl>,
Pablo Lambert  <plambert@computer.org> wrote:
>Hello:
>        I am searching for a tool that allows me copy some remote site
>via http, to my local filesystem. 

WWW::Robot.

-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: Fri, 28 Jul 2000 20:08:09 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Should truncate length be 0? (Larry R)
Message-Id: <665-39822E79-113@storefull-246.iap.bryant.webtv.net>

Yes, I looked carefully at what I posted. Before I sent it, those A=0's
weren't there. I apologize for that. My newsreader does that sometimes,
and I don't know how to fix it. Are you reading this on Winblow? ...
probably doesn't make any difference.

I know what it means though because I've come across that before in
other people's posts. The A=0 means nothing or same as a blank space.  I
think it has something to do with a certain group of Latin-1 characters
that I read about that MS doesn't always translate into proper uuencode. 

Anyway, the A=0 was not plugged into my coding. I put the coding in just
as you suggested, and now it won't compile. If you're saying it is
correct, I'll just go thru the entire code file to see if something else
broke. 

Thanks again for letting me know,
Dennis



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

Date: Fri, 28 Jul 2000 20:38:32 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Should truncate length be 0? (Larry R)
Message-Id: <668-39823598-15@storefull-246.iap.bryant.webtv.net>

I got it fixed. I left it opened up as you had it for better
readability. When I closed it all up, it worked. Strange. Maybe my
server broke the code. I dunno. Before I ran the codes together, I went
over every character in those 3 lines of coding several times very
carefully, and it looked the same. Sorry to have bothered you on this
one. Problem solved, though.

--Dennis



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

Date: Sat, 29 Jul 2000 04:24:18 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Should truncate length be 0? (Larry R)
Message-Id: <39845a74.4517975@news.newsguy.com>

dennis100@webtv.net (BUCK NAKED1) wrote:

>I know what it means though because I've come across that before in
>other people's posts. The A=0 means nothing or same as a blank space.

The =A0 (not A=0) represents a nonbreaking space (equivalent to
the HTML entity &nbsp;) in quoted-printable encoding.  It's a
single byte, chr(160) or "\xA0" or however you prefer to write
it, and it's not the same as a blank space, so Perl won't accept
it as whitespace in a program.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: 29 Jul 2000 01:38:43 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Store Order Form
Message-Id: <8ltql3$of4@junior.apk.net>

In article <398108c2@news.in-tch.com>, Streamline <look@in.message.com> wrote:
>I have a script that's essentially a store.  If after filling in the
>required information the user submits the info, then it emails a
>confirmation to the user and submits me another email with info.  For
>security reasons I would like to strip out the credit card number from the
>email sent to the user.  Without rewriting this whole script how can I
>access the hash from the form and strip that one field out?  Any help
>greatly appreciated.

Why "access the hash from the form"?  Why not just leave out the line
that puts the credit card number into the message to begin with?

If that is really what you want to do, let me suggest something like:

    delete $big_hash_of_entered_data{'credit_card_number'};

This stuff would be way easier if people posted just enough example
code to explain their questions.



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

Date: Sat, 29 Jul 2000 10:44:27 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Strange behaviour with localtime()
Message-Id: <8luu1t$l5g$1@news.vsnl.net.in>

For me it didn't happen.
----
C:\httpd\cgi-bin>perl -e "print scalar localtime()"
Sat Jul 29 10:42:41 2000
C:\httpd\cgi-bin>time
Current time is 10:42:46.59a
-------------------------------------------------
t0873 wrote in message <8lsi3u$rql$1@nnrp1.deja.com>...
>
>
>Hi all,
>
>I am trying to use localtime on Win32 machine. if I use DOS time
>command it shows the correct EST time. if I try to print with localtime
>(), it shows an hour less. Is this the way localtime() should work??
>
>Or am I doing something wrong?
>
>Please advise. Thanks in advance.
>
>T.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




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

Date: Fri, 28 Jul 2000 22:38:44 -0500
From: Robert Campbell <poohba@io.com>
Subject: strip from character to end of string
Message-Id: <Pine.LNX.4.10.10007282231210.28023-100000@fnord.io.com>

how do i strip a variable from a character to the end of that string.

$image =~ s/"from the '-' to the end of the file name"//g;

All of the files used look like this. THISFILE-athome1.jpg.  I want $image
to only be THISFILE.  How do i accomplish this?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Its not like me to have my back turned to open spaces.  So I can see it
when its coming so I can open faces.
							DMX
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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

Date: 29 Jul 2000 01:23:21 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: strip from character to end of string
Message-Id: <8ltpo9$lin@junior.apk.net>

In article <Pine.LNX.4.10.10007282231210.28023-100000@fnord.io.com>,
Robert Campbell  <poohba@io.com> wrote:
>how do i strip a variable from a character to the end of that string.
>
>$image =~ s/"from the '-' to the end of the file name"//g;
>
>All of the files used look like this. THISFILE-athome1.jpg.  I want $image
>to only be THISFILE.  How do i accomplish this?

$image =~ s/-.*$//g;

This will convert THISFILE-athome1.jpg to THISFILE

It will, however, also convert CATFOOD-FOO-BAR-BAZ-athome1.jpg to CATFOOD
not to CATFOOD-FOO-BAR-BAZ

To get the regex to grab only the _last_ hyphen on out, use

$image =~ s/-[^-]*$//;

Make sure you read "man perlre" too.  It explains this and a lot of
other things you really need to know to understand Perl.



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

Date: Sat, 29 Jul 2000 07:02:27 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Suggestion for syntax change
Message-Id: <7kvg5.16479$k5.170156@news1.rdc1.mb.home.com>

In article <3981F30A.4F430E8B@mindspring.com>,
 Keith G. Murphy <keithmur@mindspring.com> wrote:
> jason wrote:
> > 
> > Keith ..
> > 
> > Ilmari actually brings up a reasonable point that the new behaviour
> > could break existing scripts that rely on (LIST)[0..-2] to return an
> > empty list
> 
> I can see that.  It does bother me.  Ilmari's latest objection bothers
> me even more.

How's this for an alternative:

This is similar to a thread some time ago ('if slices are so great')
where I jokingly suggested a complemented subscript list using the ^
character rather like negated character classes in a regex.

(Uri said I was warped, and implicated Manning authors ... he's
probably half right :-)

But, now that I see this thread -- and I have had a few beers this
evening (enough to cloud my judgement anyway), I am only half-joking
this time around.

Consider:

    (list)[0,1]  -> return elements 0 and 1 from list

    (list)[^0,1] -> return all *but* elements 0 and 1 from list

How does this help? Well, if people wanted to do this:

    (list)[2 .. -2]

    and have it really mean: element 2 up to the 2nd last element,
    or, for a list of length 10 (0,1,2,3,4,5,6,7,8,9):

    (list)[2,3,4,5,6,7,8]

Then they could just do:

    (list)[^-1 .. 1];

which would mean everything exept elements -1,0,1 (which is the same
thing). The advantage is that [^...] is a syntax error now (outside
of regexes) so no old code would be broken.

Here's a quick hack slice() function just to illustrate what I mean:
you pass it an anon array of the subscript elements, and the list to
slice -- if you want a complement you put a '^' as the first element
of the subscript list:

my @array = (0,1,2,3,4,5,6); 
print slice([-2 .. 0], @array), "\n";      # @array[-2 .. 0] 
print slice(['^',-2 .. 0],@array),"\n";    # @array[^-2 .. 0] 
print slice([0,1,2, 4 ..6], @array),"\n";  # @array[0,1,2,4..6]
print slice(['^',3, 4 ..-1], @array),"\n"; # @array[^3,4 .. -1]

$_ = '0 1 2 3 4 5 6'; 
print slice(['^',-1 .. 1],split),"\n"; # (split)[^ -1 .. 1] 
                              # meaning: (split)[2 .. -2]

sub slice { 
    my($sbscr, @list) = @_; 
    if($sbscr->[0] eq '^'){ 
        shift @$sbscr; 
        for (@$sbscr){ 
            $_ += @list if $_ < 0; 
        } 
        my %these = map{$_=>1}@$sbscr; 
        @$sbscr = grep{not $these{$_}} 0 .. $#list; 
    } 
    return @list[@$sbscr]; 
} 
__END__

OK -- I've certainly had more than my share of beer, so if anyone
wants to stomp all over me now's the time (I won't mind, I'll be
sleeping).

andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      They're not soaking, they're rusting!
          -- my wife on my dishwashing habits


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

Date: 28 Jul 2000 22:45:14 EDT
From: abigail@foad.org (Abigail)
Subject: Re: taking subroutine name as a parameter
Message-Id: <slrn8o4h9g.vcg.abigail@alexandra.foad.org>

Eyal Ben-David (eyalb@aks.com) wrote on MMDXXIII September MCMXCIII in
<URL:news:m24s596cid.fsf@localhost.localdomain>:
,, 
,, Why maintain a dispatch table when Perl already has one?
,, Here is an example:
,, 
,,    use strict;
,,    
,,    sub f1 { print "I am f1: @_\n"; }
,,    sub f2 { print "Ego sum f2: @_\n"; }
,,    
,,    sub call_sub_by_name {
,,        my $name = shift;
,,        no strict 'refs';
,,        &{"$name"}(@_);
,,    }


Too long! And you mess up the call stack.

      use strict;

      sub f1 {print "I am f1: @_\n"}
      sub f2 {print "E(r)go sum f2: @_\n"}

      sub _ {goto &{+shift}}

      _ f1 => (1, 2, 3, 4);
      _ f2 => (5, 6, 7, 8);
      __END__

      I am f1: 1 2 3 4
      E(r)go sum f2: 5 6 7 8


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


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

Date: Sat, 29 Jul 2000 02:32:25 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: WWWBoard.PL
Message-Id: <8ltfad$3cc$1@localhost.localdomain>

In article <stevel-2807001518180001@192.168.100.2>,
Steve Leibel <stevel@bluetuna.com> wrote:

>Regardless of the technical merit of wwwboard.pl, it has helped us build a
>huge online community.  Sometimes we forget what code is for -- to provide
>benefit to people.

Your point is well taken. Thank you for bringing it up, it's too easy to
forget. Matt did provide functional scripts for free, at a critical moment
in web history.

That said: what really annoys me about Matt Wright is that he trades on his 
reputation as some sort of programming wizard (try googling for "Matt's 
Script Archive"). He's even co-written a bestselling 656-page book which
further spread his dubious and harmful practices to new users, except
this time they were backed up with incorrect explanations! :)  

-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: 29 Jul 2000 06:22:42 GMT
From: flc.Delete@metier.dk (Frans la Cour)
Subject: Re: WWWBoard.PL
Message-Id: <8F80560E4flcmetierdk@212.242.40.196>

tfm@sei.cmu.edu (Ted Marz) wrote in <3981727D.840859FE@sei.cmu.edu>:

>Neil (and others),
>with all of your comments undoubtably being true (I have looked at the
>code as well, and don't like it particularly), 
>
>what would be people's recommendations for the best (or at least good),
>Free (or cheap, like, under $100) message board processing script (or
>collection of scripts)?
>
>Ted Marz

I have tried the following:

XMLBoard : An XML-Driven Multi-Forum Message Board v 1.2.0
Copyright (C) 2000 Joel Rosen
WWW: http://xmlboard.webprovider.com
Contact: rosenjoel@yahoo.com

it is avaiable from http://freshmeat.org

Written in perl, has some nice features, and easy to install.



Frans


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3841
**************************************


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