[7340] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 965 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 3 00:07:23 1997

Date: Tue, 2 Sep 97 21:00:24 -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, 2 Sep 1997     Volume: 8 Number: 965

Today's topics:
     [Q] Stupid question about "use strict" (Nicholas J. Leon)
     Re: character substitutions in msqlperl ..again <ptrainor@aura.title14.com>
     Re: character substitutions in msqlperl ..again <rootbeer@teleport.com>
     Re: Check if a URL exists <bgingeryNoSpAm@pLeAsEgtcs.com>
     Re: complex pattern?!? it shouldn't be, i think :) <v3100411@student.anu.edu.au>
     Re: complex pattern?!? it shouldn't be, i think :) <daftary@cisco.com>
     Re: complex pattern?!? it shouldn't be, i think :) <chris@wzone.com>
     Re: errorlevel  of a perl system call ? <chris@wzone.com>
     Re: getting time accuracy in miliseconds <mf@fishbone.ruhr.de>
     Re: Getting WWW URL info on multi domain server <rootbeer@teleport.com>
     Re: Getting WWW URL info on multi domain server <chris@wzone.com>
     HELP My flock does not work?!? <bosch@goweb.lu>
     Re: HELP My flock does not work?!? <doug@ono.tc.net>
     Re: Is this a permissions problem Opening and reading a <rootbeer@teleport.com>
     Re: Limits in Perl 5 on array sizes ??? <rootbeer@teleport.com>
     mktime bug on Perl5.004 Solaris 2.5 scott@excite.com
     NET::NNTP Woes <bruceh@interaccess.com>
     next if (1 .. /^$/); <daftary@cisco.com>
     Re: Pattern matching problem with \n (Ha_Ha_X)
     Re: Q: assoc. arrays as subroutine argument (Jordyn A. Buchanan)
     Re: Randal and Intel, Was: Scrambling using tr (remove *Y* to reply)
     Re: Reserved words <bgingeryNoSpAm@pLeAsEgtcs.com>
     Re: Server Error Help <fishrman@shell.wco.com>
     Re: Simple Perl for  Win 32 Question (not in FAQ) (Eric Bohlman)
     Re: Simple Perl for  Win 32 Question (not in FAQ) <rootbeer@teleport.com>
     Slogans (Was Re: perl and XEmacs) (Michael W Peterson)
     Re: What's wrong with my 'if' statement? <cnew@eos.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Sep 1997 23:31:07 GMT
From: nicholas@neko.binary9.net (Nicholas J. Leon)
Subject: [Q] Stupid question about "use strict"
Message-Id: <slrn60p8dj.qf4.nicholas@neko.binary9.net>


Ok, this is a terribly basic and simple question, yet I can't seem to
divine it myself.

I just (finally) started using "use strict" in my apps. Ok, not a
problem. But what I can't seem to do is illustrated with the following
snippets:


> cat test.ph
$FOO=1;

1;

> cat test.p
#!/usr/bin/perl

use strict;
require "test.ph";

print $FOO;

> perl test.p
Global symbol "FOO" requires explicit package name at test.p line 6.
Execution of test.p aborted due to compilation errors.

------

I've tried more variation of "$FOO=1" than I can recount. I tried
 eval "$FOO=1";
 my $FOO=1;
 local $FOO=1;
 $main::FOO=1;
 ::FOO=1;
 
Apart from making test.ph a true package* and doing it that way, I'm
stumped. All I'm trying to do is keep some globals in a seperate file
so that I don't have to change them in multiple locations.



Help?

* I could also do a "sub FOO {1;}" like the system .ph headers do, but
I don't want to :)


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

Date: Tue, 2 Sep 1997 18:37:38 -0400
From: Pat Trainor <ptrainor@aura.title14.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: character substitutions in msqlperl ..again
Message-Id: <Pine.LNX.3.95.970902183619.7310A-100000@aura>

On Tue, 2 Sep 1997, Tom Phoenix wrote:

>     # protect special chars (backslash and tick) 
>     $qual_duties =~ s#([\\'])#\\$1#g;
>     # Now interpolate
>     $sql_statement = "UPDATE DIGEST SET qual_duties =  '$qual_duties'
> 	WHERE index_number = '$index_number' ";
>     $sth = $dbh->query($sql_statement) or die $Msql::db_errstr;

	That was the magic! But I see no use of the # chars in any of my
documentation for the y, tr, or s functions.. what gives?! 

(happy guy=me) :)

pat 	
:)
  	

ptrainor@aura.title14.com
http://www.title14.com/resume
#$reality=$bandwidth!=spam;
"While it's true winning isn't everything-LOSING IS NOTHING!" -Ed Bighead



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

Date: Tue, 2 Sep 1997 15:39:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Pat Trainor <ptrainor@aura.title14.com>
Subject: Re: character substitutions in msqlperl ..again
Message-Id: <Pine.GSO.3.96.970902153643.12071L-100000@julie.teleport.com>

On Tue, 2 Sep 1997, Pat Trainor wrote:

> 	That was the magic! But I see no use of the # chars in any of my
> documentation for the y, tr, or s functions.. what gives?! 

With those (or other forms of quoting in Perl) you can use any punctuation
character as a quote.

    q/This is a 'single quoted' string/;

    qq[ And they can even be [nested], if they match up. ];

    qx# echo I am a shell command #;

Have fun with Perl!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 3 Sep 1997 01:47:52 GMT
From: Bruce Gingery <bgingeryNoSpAm@pLeAsEgtcs.com>
Subject: Re: Check if a URL exists
Message-Id: <5uifk8$s9h@horn.wyoming.com>


On Tue, 2 Sep 1997 10:07:07 -0700, in 
  <Pine.GSO.3.96.970902100646.6498J-100000@julie.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
-} On 1 Sep 1997 lvirden@cas.org wrote:
-}> You could use webget to do the URL verification - here's a little perl
-}> script that reads a file full of URLs, fetches their title tag and uses
-}> it. 
-} How about LWP?

And, what about temporarily unreachable destinations?  Although it SEEMS
that the net has improved in its throughput over the past few months
there are still occasional breakdowns, where a major node gets overloaded.

If you're validating links (e.g. extracted with the indexer in htmlchek)
then you may want several failures before you invalidate the link, if
it's a foreign link.  If it's a local link, however, to the script
checking the links, odds are that you want to invalidate a link
immediately if it's unreachable - depending on your server load.

     Bruce Gingery


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

Date: Wed, 03 Sep 1997 10:22:47 +1000
From: "MJ.VAN OOSTERHOUT" <v3100411@student.anu.edu.au>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <340CADD7.E7C@student.anu.edu.au>


jonathan.hulatt@unilever.com wrote:
> 
> hi.
> 
> I have an scalar srting with lines of an html file in. I would really
> like to chop the tags out. I've had success using split etc. but isn't
> there a pattern that would do it? I tried several ideas, but just end
> up pulling out everything from first < to the last >.
> 
> ie
> 
> <body>
> <h1>this is some text</h1>
> </body>

This script will remove all HTML tags from a file:

undef $/;
$_ = <>;
s/<.*?>//g;
print $_;

The question mark stops the * being 'greedy'. See perlre

Martijn
Australia


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

Date: Tue, 02 Sep 1997 18:07:30 -0700
From: Kuntal Daftary <daftary@cisco.com>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <340CB852.3780@cisco.com>

MJ.VAN OOSTERHOUT wrote:

> s/<.*?>//g;
 
> The question mark stops the * being 'greedy'. See perlre

cant u just write the same thing as thus:

s/<[^>]*>//g;

-- 
Kuntal M. Daftary   Cisco Systems Inc 
Ph: 408 527 9789    170 W. Tasman Dr 
daftary@cisco.com   San Jose CA 95134


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

Date: 3 Sep 1997 02:14:49 GMT
From: "Chris Waddell" <chris@wzone.com>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <01bcb80e$cba0d7a0$79d2adce@aptiva>

> > hi.
> > 
> > I have an scalar srting with lines of an html file in. I would really
> > like to chop the tags out. I've had success using split etc. but isn't
> > there a pattern that would do it? I tried several ideas, but just end
> > up pulling out everything from first < to the last >.
> > 
> > ie
> > 
> > <body>
> > <h1>this is some text</h1>
> > </body>
> 
> This script will remove all HTML tags from a file:
> 
> undef $/;
> $_ = <>;
> s/<.*?>//g;
> print $_;
> 
> The question mark stops the * being 'greedy'. See perlre

this "anti-greediness question mark" works only in perl 5.  if you are
forced to use perl 4, try the following:

undef $/;
$_ = <FILE>;
s/\<[^\>]*\>//g;
print WHEREVER $_;

----

Chris Waddell
chris@wzone.com


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

Date: 3 Sep 1997 02:09:38 GMT
From: "Chris Waddell" <chris@wzone.com>
Subject: Re: errorlevel  of a perl system call ?
Message-Id: <01bcb80e$124cb080$79d2adce@aptiva>

> is there a way to import back into perl dos errorlevel 
> after execution of some system command (other than creating a process
> and using GetExitCode method)

I don't know if I understand your context fully, but here's a shot in the
dark.  (I am assuming you are running a PERL program freshly after
executing some other program)

Use a batch file to run both and throw the errorlevel at the command line
of the PERL program.

Long live the Batch Files!!

-----

Chris Waddell
chris@wzone.com


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

Date: 2 Sep 1997 22:25:42 +0200
From: Martin Fischer <mf@fishbone.ruhr.de>
Subject: Re: getting time accuracy in miliseconds
Message-Id: <5uhso6$kqg$1@fishbone.ruhr.de>


Michael Q. Le <lem@ece.ucdavis.edu> wrote:
>Hello,

>Is there a way to measure elapsed time in miliseconds? I am
>trying to measure the time between sending and receiving
>a packet from a server and want the delay.  It's basically
>a "ping" function. Is there a way to do this?  The functions
>in perl seem to only have resolution in seconds.
It's a faq. Read perlfaq8:
    How_can_I_measure_time_under_a_s.html

ciao
Martin
-- 
Martin Fischer <mf@fishbone.ruhr.de>                    -------------------
               <Martin.Fischer@fh-bochum.de>           | Comp Sci Student
PGP key available at: http://localhost.ruhr.de/~martin | FH-Bochum, Germany
Unsolicited commercial e-mail will be proof-read for $199/hr.


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

Date: Tue, 2 Sep 1997 15:29:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Shawn Neumann <shawn@epicbc.com_._._>
Subject: Re: Getting WWW URL info on multi domain server
Message-Id: <Pine.GSO.3.96.970902152839.12071I-100000@julie.teleport.com>

On Tue, 2 Sep 1997, Shawn Neumann wrote:

> Is there any similar way to find this out in Perl? 

If it's in the CGI spec, then you can find out in Perl or in any other
language the CGI script is written in. Is that what you needed to know?
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 3 Sep 1997 02:00:13 GMT
From: "Chris Waddell" <chris@wzone.com>
Subject: Re: Getting WWW URL info on multi domain server
Message-Id: <01bcb80c$c13ab620$79d2adce@aptiva>

http://www.wzone.com/cgi-local/tattle.cgi

the above url contains a simple little script which throws %ENV into HTML
and out through HTTP.  I think you'll find what you're looking for under
SERVER_NAME or HTTP_HOST, but you need to test this on your own server to
allow for discrepancies.

the program is (shortened to) this:

------------------cut here----------------

#!/usr/local/bin/perl
## or whatever your perl path is
print "Content-type: text/html\n\n";
print "<html><head><title>HTTP Environment Dump</title></head><body>\n";
print "<h1>HTTP Environment Settings</h1>\n";
print "<p><hr><h3>System environment variables available to $0</h3>\n";

## the line below is the one which is important to you
foreach $key (keys %ENV) { print "$key=$ENV{$key}<br>\n"; }

print "<center><font size=-1><no br><i>&copy; Copyright, 1995-1996
&quot;the wZone&quot;. All Rights Reserved.</i></no br></font></center>\n";
print "</body></html>\n";

------------------cut here----------------



Chris Waddell
chris@wzone.com


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

Date: Wed, 03 Sep 1997 03:06:08 +0200
From: Bosch Patrick <bosch@goweb.lu>
Subject: HELP My flock does not work?!?
Message-Id: <340CB7FE.813A5188@goweb.lu>

Hello!

I have Perl5.003 on a RS600 with AIX4.1 and I want to user flock in a
few perl scripts, Flock is implemented on RS6000 and when I use it in a
Perl scipt I have no fatal error. It even returns a true value! But when
I try to access a file locked by one scrit with another script, then
everything happens as there is no flock!?!

Here is a part of my script:

open(FILE, "+<" . $filename);
flock(FILE, 2);

 ....
 

flock(FILE, 8);
close(FILE);

Could anyones please help me??

Thanks

Patrick
 



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

Date: 02 Sep 1997 23:15:44 -0400
From: Douglas McNaught <doug@ono.tc.net>
To: bosch@goweb.lu
Subject: Re: HELP My flock does not work?!?
Message-Id: <m2afhvdr4v.fsf@ono.tc.net>

[mailed and posted]

Bosch Patrick <bosch@goweb.lu> writes:

> I have Perl5.003 on a RS600 with AIX4.1 and I want to user flock in a
> few perl scripts, Flock is implemented on RS6000 and when I use it in a
> Perl scipt I have no fatal error. It even returns a true value! But when
> I try to access a file locked by one scrit with another script, then
> everything happens as there is no flock!?!

Are you using flock in both scripts?  Most file locking on Unix
systems is advisory rather than mandatory, which means all programs
using a lockable file need to use the same locking mechanism.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Tue, 2 Sep 1997 15:47:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John Lounsbery <lounsbery@blender.com>
Subject: Re: Is this a permissions problem Opening and reading a URL
Message-Id: <Pine.GSO.3.96.970902154506.12071N-100000@julie.teleport.com>

On Tue, 2 Sep 1997, John Lounsbery wrote:

> if(open(TRACE, "$traceprog $surfer|") || die "bye...$!") {

> the die will only get executed if the open fails, even in an if-else

That's just a funny way to write this.

    open TRACE, "$traceprog $surfer|"
	or die "bye...$!";

I'm not sure what you were trying to do by wrapping it in the if
statement. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 2 Sep 1997 15:33:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "James H. Blackwell" <jim.blackwell@gsfc.nasa.gov>
Subject: Re: Limits in Perl 5 on array sizes ???
Message-Id: <Pine.GSO.3.96.970902153142.12071K-100000@julie.teleport.com>

On Tue, 2 Sep 1997, James H. Blackwell wrote:

> Is there a limit on the size of a Perl array ?  

Yes: When your virtual memory runs out, you can't make it any bigger.
Other than that, I don't think you have anything to worry about. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 02 Sep 1997 22:41:56 -0600
From: scott@excite.com
To: scott@excite.com
Subject: mktime bug on Perl5.004 Solaris 2.5
Message-Id: <873257805.9532@dejanews.com>

I seem to be having problems with times, even after switching to
POSIX::mktime

Any ideas, patches or workarounds? The C version of mktime seems to work
fine.

Scott

 ./timelocal.pl
time = 873248400 -> Sun, Sep 02 1997  9:00PM EST -> mktime = 873252000
time = 873248400 -> Sun, Sep 03 1997  1:00AM GMT -> mktime = 873248400

#!/usr/local/bin/perl5
use POSIX;

$ENV{'TZ'} = "US/Eastern";
&time_to_tm_to_time(873248400);
&gmtime_to_tm_to_gmtime(873248400);

# convert from time to struct tm and back
sub time_to_tm_to_time
{
  my ($time) = @_;
  my ($sec, $min, $hour, $day, $mon, $year) = localtime($time);
  $mktime = &POSIX::mktime(sec, $min, $hour, $day, $mon, $year);
  print "time = $time -> ";
  print strftime '%a, %b %d %Y %l:%M%p %Z',
    ($sec, $min, $hour, $day, $mon, $year);
  print " -> mktime = $mktime\n\n";
}


# convert from gmtime to struct tm and back
sub gmtime_to_tm_to_gmtime
{
  my ($time) = @_;
  my $save_tz = $ENV{'TZ'};
  $ENV{'TZ'} = 'GMT';
  my ($sec, $min, $hour, $day, $mon, $year) = gmtime($time);
  $mktime = &POSIX::mktime(sec, $min, $hour, $day, $mon, $year);
  print "time = $time -> ";
  print strftime '%a, %b %d %Y %l:%M%p %Z',
    ($sec, $min, $hour, $day, $mon, $year);
  print " -> mktime = $mktime\n";
  $ENV{'TZ'} = $save_tz;
}

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 02 Sep 1997 21:52:27 -0500
From: Bruce Hodo <bruceh@interaccess.com>
Subject: NET::NNTP Woes
Message-Id: <340CC2DB.5AFAA41E@interaccess.com>

I've been trying to use NET::NNTP.pm in perl, but I get the following
error:

Can't call method "Net::NNTP::post" without a package or object
reference at /export/home/getaway/site/cgi-bin/postnews.cgi line 97,
<BODY> chunk 15.

Line 97 is:
 $nntp->Net::NNTP::post($posting);

I've tried it with just "post($posting);", but it still doesn't work. In
the beginning of my script, I have the following:

use Net::NNTP; # This is how the server I'm using set it up.
$ENV{'NNTPSERVER'}="news.ilk.com";
$nntp = Net::NNTP->new(Debug);

I figure I'm doing something stupid, but I can't figure out what! The
documentation for NET::NNTP is ... well, "thin".

Any help would be appreciated.

--
            Bruce Hodo - Webmaster, GetAwayNetwork, Inc.
==Providing vacation information services on the World Wide Web==
For Villas, Resorts, Hotels, Air/Hotel Packages, Charter Airfares
=============== Visit us at http://getawaynet.com ===============




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

Date: Tue, 02 Sep 1997 18:10:53 -0700
From: Kuntal Daftary <daftary@cisco.com>
Subject: next if (1 .. /^$/);
Message-Id: <340CB91D.3A8A@cisco.com>

i m trying to remove the headers from a mail message using the
so oftern described method in perl books, but to no avail.
can anyone help?

while (<INPUT>) {
    next if (1 .. /^$/);
    print;
}

-- 
Kuntal M. Daftary   Cisco Systems Inc 
Ph: 408 527 9789    170 W. Tasman Dr 
daftary@cisco.com   San Jose CA 95134


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

Date: Wed, 03 Sep 1997 00:21:16 GMT
From: spam-yourself@127.0.0.1 (Ha_Ha_X)
Subject: Re: Pattern matching problem with \n
Message-Id: <340ca9b0.2468713@netnews.nyu.edu>


Thanks to all for helping a reckless newly-converted Perl hacker. I've
since arrived upon several different ways of getting it to work
(which, I gather, is often the case). The straight solution, btw:

$somestring =~ s/\\n/\n/g ;
$somestring =~ s/\\t/\t/g ;
$somestring =~ s/\\\\/\\/g ;

won't compile on my MS-DOS Perl4 implementation (it doesn't like all
the backslashes in the third line), though it seems to work fine with
my Unix Perl5. My quick & dirty workaround was to put the backslashes
in brackets, though there have been some better solutions posted here.

Apologies if the loopback address in my header has caused trouble.
Unfortunately with the state of spam in the world today I don't like
putting my real e-mail address in any Usenet headers.

~k.lee


h a - h a - x_/ \_/ \_/ \_   Webfoot, New Ink: 
                / \_/ \_/ \_ http://www.nyu.edu/pubs/new.ink
kql6708@is.nyu.edu  \_/ \_/ \_     Visit the Radiohead Mailing List FAQ:
http://members.aol.com/hahax/ \_   http://members.aol.com/hahax/rhfaq/


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

Date: Tue, 02 Sep 1997 19:35:13 -0400
From: jordyn@bestweb.net (Jordyn A. Buchanan)
Subject: Re: Q: assoc. arrays as subroutine argument
Message-Id: <jordyn-ya02408000R0209971935130001@news.bestweb.net>

In article <33F8A011.3F26@icl.fi>, petri.backstrom@icl.fi wrote:

> Sascha Kerschhofer wrote:
> > 
> > i'm a litte confused.
> > how can i handle an assoc. array as argument for a subroutine.
> > eg: all of my cgi values are stored in the assoc. array "%data". i nedd a
> > subroutine, which replaces all the non HTML conform charqacter (like "&,
> > <, >") in their html equivalents:
> > 
> > sub ascii2html {
> > foreach $wert (keys @_[0]) {
> >   $_{$wert} =~ s/&/&amp;/g;  # i'm sure this is wrong!
> >   $_{$wert} =~ s/</&lt;/g;
> >   $_{$wert} =~ s/>/&gt;/g; }
> > }
> > 
> > the routine is invoked by "ascii2html(%data)"
> > 
> > but this doesn't work. what am i doing wrong?
> > any help is appreciated. thank you!
> > 
> > Sascha Kerschhofer, Vienna
> 
> You need to pass a reference( "ascii2html(\%data)" ) and
> then dereference it in the sub. For example:

It's probably a lot more reliable that way, but this works pretty well in a
practical sense:

   sub ascii2html {
   my %myhash = @_;
   foreach $wert (keys %myhash) {
   ...

One time I thought about this really hard and figured out why it worked and
it made sense.

Jordyn

|---------------------------------------------------------------|
|Jordyn A. Buchanan                           jordyn@bestweb.net|
|Bestweb Corporation                      http://www.bestweb.net|
|Senior System Administrator                     +1.914.271.4500|
|---------------------------------------------------------------|


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

Date: 02 Sep 1997 17:55:53 -0700
From: jmastYers@pcocd2.intel.com (remove *Y* to reply)
Subject: Re: Randal and Intel, Was: Scrambling using tr
Message-Id: <cavzppv8bc6.fsf@fri034.fm.intel.com>


Stuart Cooper <stuartc@ind.tansu.com.au> writes:

> 
> Sorry if I allowed myself to be misunderstood in my last posting. If
> suggesting to an Intel employee that he gets his organisation to stop
> persecuting Randal Schwartz counts as intended-to-be-personally-insulting 
> comment and guilt-by-association then I apologise. I stand by the assertion
> that the Perl community would benefit should this persecution cease. Or else
> we can change the Intel logo from "Intel Inside" to "Intel Put Randal Inside".
> I didn't consider my posting to be an attack on Justin or other Intel 
> employees; again I apologise if it has been seen in this light.

Stuart, I accept your apology, and thank you for clarifying the
misunderstanding.


> 
> Much more reasoned advice on this subject came from Jeffrey Kegler; pointing
> people to information on the site at <URL:http://www.rahul.net/jeffrey/ovs/>.
> Here you can read and sign an open letter to Intel signed by luminaries 
> (Larry Wall, Richard Stallman, John Ousterhout etc) and lots of other Internet 

As I mentioned in my earlier post, I did not have sufficient knowledge to
make a statement one way or another.  I have read most of one day's worth
of court records, and from what I can tell (it's not in context, nor does
it explicitly say what exactly he did wrong, and so it comes from the 
questioning and answers) it would be easy for someone's actions to be
trumped up if the intent is there.  Most of the questions I see are 
directed towards understanding if anybody directed Randal to do the
particular actions he is accused of in a direct manner.  Given that I have
not determined his status except as being hired on as a contractor system
admin at the time (I could be wrong), I could see where some of his 
actions would just be done in the course of doing routine system admin
work.  Some of it I wouldn't begin to understand how it is rationalized,
but wonder how it was escalated to the level that it was (court, etc). 

Again, I've only read a small part of the transcript, and don't know if I
could do any justice in reading it all...  I don't have that much time.

Justin (not speaking for intel)

P.S.  Thanks for the solution you posted.  As someone noted later, it 
needs a few small things added to get upper/lower case coverage, but I
thank you for that anyway.  I ended up using a simple rot13 routine.

if (($Debug) && ($DMsg =~ tr/a-mn-zA-MN-Z/n-za-mM-ZA-M/)) {print $DMsg;}




> Cheers,
> Stuart Cooper.
> stuartc@ind.tansu.com.au

-- 
------------------------------------------------------------------------------
   Justin Masters   (Sr. Cad Engineer - Design Automation)  PH: 916-356-6735
   Intel Corp. FM5-94                                      FAX: 916 356-7874
   1900 Prairie City Rd, Folsom, CA 95630          jmastYers@pcocd2.intel.com


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

Date: 3 Sep 1997 00:12:21 GMT
From: Bruce Gingery <bgingeryNoSpAm@pLeAsEgtcs.com>
Subject: Re: Reserved words
Message-Id: <5uia15$s9h@horn.wyoming.com>


On Tue, 02 Sep 1997 05:28:18 GMT, in <340ea19e.39592671@news1.radix.net>, Scott Houck <scott@radix.net> wrote:
> aml@world.std.com (Andrew M. Langmead) wrote:

> >I'm glad someone else pointed out keywords.pl and keywords.h, I didn't
> >know they existed. Perl is a little odd, though, in regard to reserved
> >words. In most languages, knowing the keywords is important because
> >every programmer at every level of expertise needs to learn all of the
> >keywords, so as to avoid using them as variable (and subroutine)
> >names.
> >
> >Since perl prefixes its variables with "$", "@", and "%", variable
> >names never conflict with reserved words. If you want to name
> >variables "$if", "@not", or "%foreach", you are perfectly welcome to.

> I'm glad to learn of this too.  Now it'll be much easier to update my
> CodeWright Perl DLL!

Arnaud,
   There really are not any totally reserved words.  List/Arrays, Hashes
and scalar variables are identified by their preceeding @, %, and $,   
respectively.  Also, subroutines can be qualified by enclosing package.
   
   Nevertheless, it's a lot easier to make mistakes, if the alphabetical
commandlist is ignored.  See "perldoc perlop" (should be installed on
your system when Perl was), for operators, and the bottom of
"perldoc perlfunc" for an alphabetical listing of built-in functions
that it (may be) wise to avoid in assigning your own names.
   
   Yet, the "old hands" don't generally avoid them absolutely.   
For example, in Earl Hood's MHonArc package (and others dependent
on his iso8859.pl), he uses the variable
 
    local(*map) = ("${charset}_To_Ent");

even though map is a predefined ``keyword'' in Perl 5 ...
with function description:

     map BLOCK LIST
     map EXPR,LIST
               Evaluates the BLOCK or EXPR for each element of
               LIST (locally setting $_ to each element) and
               returns the list value composed of the results of
               each such evaluation.  Evaluates BLOCK or EXPR in
               a list context, so each element of LIST may
               produce zero, one, or more elements in the
               returned value.


	Bruce Gingery
	Advanced Integrators, LC <URL: http://gtcs.com/ai/ >


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

Date: 2 Sep 1997 22:41:16 GMT
From: "Michael A. Watson" <fishrman@shell.wco.com>
Subject: Re: Server Error Help
Message-Id: <5ui4mc$9ok$1@news.wco.com>

Chris Waddell <chris@wzone.com> wrote:
In my original posting I mentioned that I am getting the data from an html FORM.
And it works just fine except for the error on the browser side.
I have since tried using the Content-type that I see you also saw was missing, 
and everything is working GREAt.


thanks

> You cannot accept input through <STDIN> from HTTP.  You must use a form or
> command line arguments to submit information to a perl script.
> (You're also missing the integral [print "Content-type: text/html\n\n";])

> You can find a library which will give you easy access to GET, POST, and
> Command Line variables at 
> http://www.bio.cam.ac.uk/cgi-lib/

> If you desperately need the script above working, you could try the
> following:

> #!/usr/local/bin/perl
> print "Content-type: text/html\n\n";
> $buffer = $ARGV[0];
> open(NEWFILE,">TEST.TXT") || die $!;
> print NEWFILE "$buffer\n";
> close(NEWFILE);
> print "File opened successfully and string &quot;$buffer&quot; written.\n";

> You would have to specify your "buffer" variable in the command line (your
> url).  For example, tell your browser to locate the following url in order
> to set "buffer" to "Fish"

> http://"host and full path name"/test.cgi?Fish

> Note that you may not use spaces in an url.  If you wish to get more
> complicated, I strogly suggest you get and use cgi-lib.pl, located at the
> url I mentioned above.




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

Date: Tue, 2 Sep 1997 22:20:07 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Simple Perl for  Win 32 Question (not in FAQ)
Message-Id: <ebohlmanEFwJDK.9AA@netcom.com>

T. Wheeler (twheeler@m-net.arbornet.org) wrote:
: I am learning perl and want to know how you could strip just the path
: from a command line argument.

File::Basename contains all the routines you need.  It's included with 
the standard Perl distribution.



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

Date: Tue, 2 Sep 1997 15:49:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "T. Wheeler" <twheeler@m-net.arbornet.org>
Subject: Re: Simple Perl for  Win 32 Question (not in FAQ)
Message-Id: <Pine.GSO.3.96.970902154751.12071O-100000@julie.teleport.com>

On Tue, 2 Sep 1997, T. Wheeler wrote:

> I am learning perl and want to know how you could strip just the path
> from a command line argument. 

If you're wanting to separate a filename into its components, you should
probably use the File::Basename module, which comes with Perl. It lets
your code work on Unix, Windows, and Macintosh without you having to worry
about which character is used on the current machine.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 3 Sep 1997 02:36:07 GMT
From: michael@flash.net (Michael W Peterson)
Subject: Slogans (Was Re: perl and XEmacs)
Message-Id: <5uiien$cha$1@excalibur.flash.net>

On Tue, 02 Sep 1997 17:17:09 -0400, Chris Nandor <pudge@pobox.com> wrote:

[huge snip of Chris's excellent article]

>I argue that Perl's syntax is the most powerful of all the programming
>languages, and that is in part BECAUSE it mirrors the way we think and
>gives us the power to write crappy code.
>


          +---------------------------------------------+
          |                                             |
          |    Perl: The Power to Write Crappy Code.    |
          |                                             |
          +---------------------------------------------+



Funny, but I don't think it will as succesful as Apple's ads.

;)

-- 
Michael W Peterson			<http://www.flash.net/~michael/>
Senior System Administrator
FlashNet Communications			<http://www.flash.net/>
"Unix: more than enough rope..."


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

Date: Tue, 02 Sep 1997 20:50:03 -0400
From: Cecil New <cnew@eos.net>
Subject: Re: What's wrong with my 'if' statement?
Message-Id: <340CB43B.50C6@eos.net>


Rick Garland wrote:
> 
> Greetings all:
> 
> I am an admitted newbie to perl (programming in general) and I have come
> across an issue I cannot seem to solve. This is on Perl 5.002.
> 
> The script I'm trying to complete is below;
> 
>    print ("Please enter the user login to disable:\n");
>    $disablelogin = <STDIN>
>    $disablelogin =~ s/^\s+|\s+$//g;
> 
>    @login = <PW>:
>    @line = grep(/^disablelogin/, @login);
Should this be-->(/^$disablelogin/, ...?
Ie, trying to count the entries that match?

>    $retval = @line;
Here I think $retval will contain the highest index(subscript) for array
@line.

> 
>    ...
> 
>    open (PW)            || die "Can't open $PW: $!\n";
>    open (NPW, ">NPW")   || die "Can't create $NPW: $!\n";
> 
>    while (<PW>) {
>       if ($retval == /^1/) {
So here, you are seemingly checking to see if the array has two elements
(subscripts zero and one).
If true, then use: if ( $retval == 1 )
If you trying to do a pattern match, then use: if ( $retval =~ /^l/ )
Perhaps you intend: if ( /^$disablelogin/ ) 

>          ($name,$pw,$uid,$gid,$comment,$home,$shell) =
> getpwnam($disablelogin);
>          s/:$pw:/:*:/;
>          print NPW;
>       } else {
>          print ("\n\t$disablelogin NOT FOUND\n");
>       }
>    }
> 
>    system("mv $NPW $PW");
>    ...
> 
>    close PW;
>    close NPW
> 
> The problem is when I add the 'if' statement to a while loop. (It works
> fine, but there is no way to tell the user that a $disablelogin does not
> exist or there is incorrect typing.) If the $disablelogin is correct the
> script will work correctly. If a non-existing $disablelogin is input,
> the PW file becomes larger and incorrect info is added to the PW file.
> Also, the $retval seems incorrect; it produces '0' no matter what value
> @line has.
> 
> (Parts of the script has been omitted for brevity.)
> 
> Any help is greatly appreciated.
> 
> Rick
> raggmopp@ix.netcom.com

-- 

http://www2.eos.net/cnew
cnew@eos.net


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

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

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