[12067] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5667 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 15 00:07:37 1999

Date: Fri, 14 May 99 21:00:21 -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           Fri, 14 May 1999     Volume: 8 Number: 5667

Today's topics:
    Re: /usr/bin/perl vs /usr/local/bin/perl <cassell@mail.cor.epa.gov>
    Re: /usr/bin/perl vs /usr/local/bin/perl (Matthew Bafford)
    Re: C call perl - perl call c question <rick.delaney@home.com>
    Re: Can't Write to Files? <rick.delaney@home.com>
    Re: Can't Write to Files? <rick.delaney@home.com>
    Re: Character codes in Perl (Henry Gondorff)
    Re: Email Attachments w/o MAIL, MIME, or NET modules <swarren@www.wwwdotorg.org>
    Re: Getting a DNS record (Charles DeRykus)
        how to fix file permission mistakes (BLUESRIFT)
    Re: How to share vars across files? (Larry Rosler)
        htaccess <atto@slip.net>
    Re: japh tags (Kevin Reid)
    Re: man pages and FAQs: why posted? (Lee)
    Re: man pages and FAQs: why posted? (Lee)
    Re: man pages and FAQs: why posted? <cassell@mail.cor.epa.gov>
    Re: man pages and FAQs: why posted? <tchrist@mox.perl.com>
    Re: man pages and FAQs: why posted? (Lee)
    Re: man pages and FAQs: why posted? <mpersico@erols.com>
    Re: Need Help with putting Hashes in a two-dimensional  <rick.delaney@home.com>
        newbie problems with Perl CGI and Netscape <drifter888@hotmail.com>
        newbie problems with Perl CGI and Netscape <drifter888@hotmail.com>
    Re: Ok, here I go... Help! (Bob Trieger)
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" <tchrist@mox.perl.com>
    Re: Perl "constructors" (Ilya Zakharevich)
        Reading a file in variable <lasteyrie@iname.com>
    Re: Reading a file in variable <swarren@www.wwwdotorg.org>
        Telnet cmd, Net::Telnet gillian8086@my-dejanews.com
    Re: Which book do you recommend? (Larry Rosler)
    Re: Which book do you recommend? (Lee)
    Re: Which book do you recommend? <ffchopin@worldnet.att.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 14 May 1999 17:24:10 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <373CBEAA.C185235D@mail.cor.epa.gov>

Mike Flaherty wrote:
> 
> Hi,
> 
> I installed perl into /usr/local/bin/perl.  This has been fine excpet now I
> am working with a package that has about 40 .pl files that all reference
> /usr/bin/perl.
> 
> Should I...
> 
> 1) place a link from /usr/bin/perl to /usr/local/bin/perl?
> 
> [snip]

Yes.  #1 is the winner.  You'll be glad, when you install your
next Perl upgrade.  Your users can continue to use 'Perl'
without having to make big mods in their programs.  And all
you have to do is change the link [once you've satisfied your
boss/users that the new version won't break everything].

HTH,
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sat, 15 May 1999 01:36:44 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <slrn7jpilt.u4.dragons@dragons.duesouth.net>

On Fri, 14 May 1999 18:28:02 -0400, Mike Flaherty <mflaherty2@earthlink.net>
held some poor sysadmin at gun point while typing in the following:
: 3) Replace all of the headers with /usr/local/bin/perl.

Not the best option, but:

: If anyone knows a good sed command for three it would be cool.

sed!?!  You don't need no stinkin' sed!

perl -i -pe 's{^#!/usr/bin/perl}{#!/usr/local/bin/perl}' *.plx

Just the backslashing that you'd have to do in sed is enough to use Perl
instead. :-)

: Thanks,

HTH,

: Mike Flaherty

--Matthew


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

Date: Sat, 15 May 1999 03:01:30 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: C call perl - perl call c question
Message-Id: <373CE32A.E7771D4B@home.com>

[posted & mailed]

Tim Armbruster wrote:
> 
> Luca Legittimo wrote in message <7hf1o4$bso$1@fe2.cs.interbusiness.it>...
> >When i create a perl interpreter from a C program, can I call a C 
> >function from perl interpreter?

Yes.

> >
> 
>  Huh?

Is that "huh?" as in "What are you talking about?" or as in "Why would
you want to do this?"  In either case, you might want to check out this
section of perlembed:
    
=head2 Using Perl modules, which themselves use C libraries, from your C
program

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 15 May 1999 03:05:01 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can't Write to Files?
Message-Id: <373CE406.E58B0384@home.com>

Jerry Raynor
> 
>   open(DAT, ">>$file");                #open the file for appending

[snip]

>   open(OUTF,">$file");                 #open the file for output

[snip]
 
> It never creates the file [snip]

Always, always, always check the success of open.  And always ask why it
failed if it fails. 

    open(OUTF,">$file") || die "Can't open '$file': $!\n";

This will tell you what your problem is better than anyone here can
guess.  And it works for many other functions too.

perldoc -f open

Also check perlfaq3, "How do I debug my Perl programs? ".

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 15 May 1999 03:07:08 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can't Write to Files?
Message-Id: <373CE486.C46952C4@home.com>

[posted & mailed]

Kent Perrier wrote:
> 
> First, your problem is a cgi one, not a perl one so this should be asked
> in the cgi newsgroup comp.infosystems.www.authoring.cgi

I don't see how this is a CGI problem.  It is a debugging problem.
 
> Second, I would check the permissions of the file against the permissions that
> the webserver is running under.  Your problem may lie there.

It may, but it is usually a good idea to start with common debugging
techniques to reduce the number of wild guesses that need to be made. 

My other post in this thread shows one such common technique and no wild
guesses.  :-)

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 15 May 1999 03:20:25 GMT
From: gondorff@shaws.com (Henry Gondorff)
Subject: Re: Character codes in Perl
Message-Id: <373cb507.35186721@news.intac.com>

Java also uses virtual key codes, but I haven't seen a Perl equivalent
yet... that is basically what I wanted to know, if anyone knows of a
module that processes extra keys or that uses Unicode encodings...

Thanks anyway,
HG

On Fri, 14 May 1999 06:47:49 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:
>No, it's a Windows problem. When programming in VB, you have the same
>problem.
>
>And maybe you can tackle it the same way as in VB. There, you should not
>use the KeyPress event, which passes the Ascii code, and doesn't fire
>when pressing the arrow keys; but the keyDown (or keyUp) event, which
>passes a "virtual key" code. Try and see if you can use something like
>that in Win32 Perl.
>
>	Bart.



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

Date: Sat, 15 May 1999 00:06:16 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Email Attachments w/o MAIL, MIME, or NET modules
Message-Id: <YT2%2.1210$6x6.1753@news.rdc1.sfba.home.com>

<rmason@hal-pc.org> wrote in message
news:373c999e.2502647@news.hal-pc.org...
> How do I tell the sendmail program that I want to include an Excel
> file attachment with the email that goes out?   I can send email OK,
> but my ISP has not installed MAIL::Sendmail, MIME::Lite, or NET::SMTP.

You might find you can install them yourself in a sub-directory of your
home directory, then adjust @INC before you use or require the module. If
you can already send mail, then you probably only need MIME::Lite.

Of course, perhaps your ISP would be receptive to installing those
modules?

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Sat, 15 May 1999 02:01:22 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Getting a DNS record
Message-Id: <FBr4AA.8y5@news.boeing.com>

In article <7hdjp0$gfk$1@nnrp1.deja.com>,  <voxelman@my-dejanews.com> wrote:
>I have an application that needs to obtain the mx handle (mail
>exchanger, mail server) for a domain to be passed to the application. Is
>there a way to do this in Perl? If not or if there is an easier way to
>do this some other way please let me know, this has been puzzling me for
>a while now and I haven't found a good solution just some work arounds
>I've used for other applications I've done..like parsing the output of
>host -t mx domain but I really now need to be doing it in native perl or
>some otherway. If someone has some ideas or could provide even a small
>bit of assistance i would greatly appreciate it. Thanks in advance.
>

Look for Michael Fuhr's  Net::DNS module on CPAN.


Here's something from the docs:

       use Net::DNS;
       $name = "foo.com";
       $res = new Net::DNS::Resolver;
       @mx = mx($res, $name);
       if (@mx) {
           foreach $rr (@mx) {
               print $rr->preference, " ", $rr->exchange, "\n";
           }
       }
       else {
           print "can't find MX records for $name: ", $res->errorstring, "\n";
       }


hth,
--
Chales DeRykus


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

Date: 15 May 1999 03:43:36 GMT
From: bluesrift@aol.com (BLUESRIFT)
Subject: how to fix file permission mistakes
Message-Id: <19990514234336.22842.00000872@ng-fv1.aol.com>

I wasn't paying attention and the following script segment created a
subdirectory and if I understand it correctly also chmod'd it to 700.  This is
on a unix server.

$root = "$ENV{'DOCUMENT_ROOT'}";

$datadir = "$root/fanciful/cgi-bin/data";

if (!opendir (DIR, "$datadir")) {
	mkdir ("$datadir", 0700);
}

Then the script also created files in that directory, one of which is named
1.txt.

My understanding is that the "data" directory and the files therein are owned
by the server acting as user "nobody".  Based on that knowledge I have
attempted to write another script to delete the files (one at a time):

#!/usr/local/bin/perl

$root = "$ENV{'DOCUMENT_ROOT'}";

$datadir = "$root/fanciful/cgi-bin/data";

print "Content-type: text/html\n\n";

if (unlink("$datadir/1.txt")) {print "deleted\n";}
else {print "not deleted\n";}

And the script returned "not deleted" and indeed the file was not deleted.  Was
my logic correct (even though it didn't work)?  Is there another way using Perl
on Unix to alter a chmod 700 file or directory? or am I forced to go crawling
on my knees to my hosting service for help?

Thanks!
Rob Bell


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

Date: Fri, 14 May 1999 18:02:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to share vars across files?
Message-Id: <MPG.11a66763cf0f2d85989a6a@nntp.hpl.hp.com>

In article <373CB238.FA0D4144@mail.cor.epa.gov> on Fri, 14 May 1999 
16:31:04 -0700, David L. Cassell <cassell@mail.cor.epa.gov> says...
> Jalil Feghhi wrote:
> > I have a couple of perl files and need to share some vars across my files
> > (export them in one file and import it in another). I am using 'use strict'
> > in all my files.
> > 
> > Is there a way to do this?
> 
> Yep.  There's several ways.  But you probably want to look into 'do'.
> As in:
> 
> do 'exported_vars.pl';

I think the issue is sharing the vars with 'use strict;' in effect.  In 
order to be able to syntax check each file separately, the variables to 
be shared should be decalred in each file with:

  use vars qw($scalar @array %hash);

as appropriate.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 14 May 1999 18:41:07 -0700
From: "Eric Umehara" <atto@slip.net>
Subject: htaccess
Message-Id: <7hijit$lvo$1@owl.slip.net>

Hi,

I've been working on a series of Perl scripts for a simple registration
program for web browsers. I want to create a restricted area through which
you get to through the pop-up password dialoge box used through htaccess.
The problem I have is that I can't figure out how to find out which user is
requesting a page. I have thought about this problem and have come up with
couple soulutions that I'm a bit uneasy to implement. The first is to assign
each person a unique number or key. Have this be passed in the
$ENV{'QUERY_STRING'} variable and match it up with a name. Another solution
is to use cookies which I want to steer away from because the user needs to
be able to safely log into the registration program from any computer.
    This program is intended for a small audience, perhaps fifty people and
at most four hundred, so I don't need anything seriously complex.


-E r i c U m e h a r a
atto@slip.net




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

Date: Fri, 14 May 1999 23:14:10 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: japh tags
Message-Id: <1drqxzo.1gotnhm17lj54wN@[192.168.0.1]>

<todd_b_smith@my-dejanews.com> wrote:

> Let's get a thread going with people's tag lines that print "Just
> Another Perl Hacker." I've seen lots, but now I want to see them all!

Well, here's my best try:

  AUTOLOAD{scalar reverse join' ',@_,$AUTOLOAD=~/\w+$/g}
  print tsuJ(qq)\n.).hacker(rehtona(lrePcaM)))

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.
    


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

Date: Fri, 14 May 1999 19:13:58 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: man pages and FAQs: why posted?
Message-Id: <B362267696684E0077@204.112.166.88>

In article <373c9171$0$211@nntp1.ba.best.com>,
John Callender <jbc@shell2.la.best.com> wrote:

>Lee <rlb@intrinsix.ca> wrote:
>
>> I have been reading this ng for quite a while, and also surmised those same
>> reasons. But I don't think it will be effective, and I think it is an
>> enormous waste of bandwidth.
>
>I think this "enormous waste of bandwidth" charge is suspect. 

Fair enough. And your suspicions may well be correct.

>What do you really mean by it? 

I suppose that I mean simply that I view them as "flooding" the group with
pointless posts. I started out simply asking why it was being done. I got a
couple of reasonable answers, and it seems that it will continue, so I'll
set some filters and live happily ever after.

>Perhaps you're using "bandwidth" in the more slippery sense: the
>bandwidth between your eyeballs and your frontal lobes

Yer a funny guy, Johnny.

Lee





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

Date: Fri, 14 May 1999 19:13:59 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: man pages and FAQs: why posted?
Message-Id: <B362267796684E00A1@204.112.166.88>

In article <7hhd8g$ouu$2@info2.uah.edu>,
gbacon@itsc.uah.edu (Greg Bacon) wrote:

>My, you're optimistic.  The docs come with every Perl installation!
>They're right there on the user's machine!  If they won't read those,
>what makes you think reading pointers here is going to?

If they won't read them there, what makes you think they'll read them here?
My point was that maybe they just don't know how to access them.

I was introduced to perl with a crappy book and a telnet link to a remote
unix machine. No previous unix background. It took me a while to find man,
and a while longer to find perldoc. I suspect the same is true for many a
newbie.

>We're teaching angling instead of giving away scaly seafood.

Seems to me that quite the opposite is being done. Posting many stinky fish
per day instead of one little Fishing For Newbies lesson.

Lee




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

Date: Fri, 14 May 1999 17:20:52 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <373CBDE4.6A89FADB@mail.cor.epa.gov>

Lee wrote:
> 
> In article <7hhd8g$ouu$2@info2.uah.edu>,
> gbacon@itsc.uah.edu (Greg Bacon) wrote:
> 
> >My, you're optimistic.  The docs come with every Perl installation!
> >They're right there on the user's machine!  If they won't read those,
> >what makes you think reading pointers here is going to?
> 
> If they won't read them there, what makes you think they'll read them here?
> My point was that maybe they just don't know how to access them.

That's a very *good* point, which has been made in this ng about 2**$n 
times, for some values of $n .

> I was introduced to perl with a crappy book and a telnet link to a remote
> unix machine. No previous unix background. It took me a while to find man,
> and a while longer to find perldoc. I suspect the same is true for many a
> newbie.

Or even worse, since some newbies seem to want to use Perl on their
ISP's machine but may not have Perl installed on their own PC.. so
they don't have *any* access to the docs until someone carefully 
explains to them how to fetch a copy from CPAN.
 
> >We're teaching angling instead of giving away scaly seafood.
> 
> Seems to me that quite the opposite is being done. Posting many stinky fish
> per day instead of one little Fishing For Newbies lesson. 

That's why, now that Perlmonth is on the web, I have started 
pointing sufficiently clue-challenged people to Dave Cross's
article there on using perldoc etc. to read the docs in the
first place.

What more than that would you suggest?
 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 14 May 1999 18:28:46 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <373cbfbe@cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "David L. Cassell" <cassell@mail.cor.epa.gov> writes:
:That's why, now that Perlmonth is on the web, I have started 
:pointing sufficiently clue-challenged people to Dave Cross's
:article there on using perldoc etc. to read the docs in the
:first place.

That's a shame.  As soon as I put out enough fires and slay enough
alligators, I fully intend, in a rather dispassionate sort of way,
to put a bullet through perldoc's head.

Notice has been given.

--tom
-- 
In general, if you think something isn't in Perl, try it out, because it
usually is.  :-)
        --Larry Wall in <1991Jul31.174523.9447@netlabs.com>


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

Date: Fri, 14 May 1999 20:23:13 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: man pages and FAQs: why posted?
Message-Id: <B36236B1966851D0AB@204.112.166.88>

In article <373CBDE4.6A89FADB@mail.cor.epa.gov>,
"David L. Cassell" <cassell@mail.cor.epa.gov> wrote:

>> Seems to me that quite the opposite is being done. Posting many stinky fish
>> per day instead of one little Fishing For Newbies lesson. 
>
>That's why, now that Perlmonth is on the web, I have started 
>pointing sufficiently clue-challenged people to Dave Cross's
>article there on using perldoc etc. to read the docs in the
>first place.
>
>What more than that would you suggest?

Actually, I was proposing less. :)

Lee




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

Date: Fri, 14 May 1999 22:32:27 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <373CDCBB.491E81F4@erols.com>



Tom Christiansen wrote:

> That's a shame.  As soon as I put out enough fires and slay enough
> alligators, I fully intend, in a rather dispassionate sort of way,
> to put a bullet through perldoc's head.
> 

And what did poor little old perldoc do to deserve such shabby
treatment? It is so much easier to tell someone to perldoc something
than to try and get their MANPATH variable to point to all the right
place.

And what, pray tell, if anything, are you intending to replace it with?

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


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

Date: Sat, 15 May 1999 03:02:50 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Need Help with putting Hashes in a two-dimensional array
Message-Id: <373CE384.19EC4B9C@home.com>

[posted & mailed]

Martin Baur wrote:
> 
> I'd llike to split that into a twodimensional array. Each cell should be
> 
> a hash. I tried the following (which is not even part of the solution)
> 
> ---
> @basket_rows = split (/&BASKETZEILE/, $v1);

    @basket_rows = split /&BASKETZEILE\d+=/, $v1;

Since your data is actually started by '&BASKETZEILE1=',
'&BASKETZEILE2=', etc. I have modified the regex to include the numbers
and '='.

Also, because the data is *started* by these, the first element of
@basket_rows will be useless.

    shift @basket_rows;

> 
> for ($i=0; $i <= $#basket_rows; $i++) {
>    ($basket_rows[$i]) = split (/&&/, $basket_rows[$i]);
> }

No need for a C-style for loop here.  See below.

> ---
> 
> This does not work. I want to access the data with two methods somehow
> like this:
> 
> ---
> $v1 = $basket_rows[1]{'BZ_STATUS'};   # only the value of this key
> $v2  = $basket_rows[1][2];   # the entire key=value pair
> ---

You will not be able to access your data in both of these ways from the
same variable.  The first implies a hash reference stored in
$basket_rows[1], the second an array ref stored in $basket_rows[1].  You
can only store one reference in there.  If you want to store both a
hashref and an arrayref in $basket_rows[1] then you will have to store
them in an intermediate aggregate and store a reference to that in
$basket_rows[1].

I am using an anonymous hash as the intermediate aggregate here:

    for my $row (@basket_rows) {
        my @pair = split /&&/, $row;
        $row = {
            Hash  => { map { split /=/ } @pair },
            Array => \@pair,
        };
    }


> Please, can anybody MAILl me the correct splitting code and the correct
> referencing for accessing or printing the values of the name=value
> paris?

They're accessed as above, but with the extra level in between.  And
there's no need to shout.  A lot of courtesy copies are sent from clpm
to those with valid email addresses.

    $v1 = $basket_rows[1]{Hash}{'BZ_STATUS'};   
          # only the value of this key

    $v2 = $basket_rows[1]{Array}[2];   
          # the entire key=value pair

The whole thing can be printed quite easily with the right module.

    use Data::Dumper;
    print Dumper (\@basket_rows);

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Fri, 14 May 1999 22:08:05 -0400
From: "Drifter" <drifter888@hotmail.com>
Subject: newbie problems with Perl CGI and Netscape
Message-Id: <6F4%2.175$cg6.1922@newsfeed.slurp.net>

When I print out html code in my cgi script it works great in IE but in
Netscape,
all i get is a listing of the code and not the web page.

i have tried using  print "Content-type: text/html";

tried cgi-lib.pm

&PrintHeader;

&HtmlTop;
 .
 .
html code
 .
 .

&HtmlBot;

everything works great in IE, but nothing works in Netscape!

Can neone help me?

--
Drifter
~

The softest stuff in the world
Penetrates quickly the hardest;
Insubstantial, it enters
Where no room is.

TAO TE CHING





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

Date: Fri, 14 May 1999 22:08:05 -0400
From: "Drifter" <drifter888@hotmail.com>
Subject: newbie problems with Perl CGI and Netscape
Message-Id: <9H4%2.178$cg6.139@newsfeed.slurp.net>

When I print out html code in my cgi script it works great in IE but in
Netscape,
all i get is a listing of the code and not the web page.

i have tried using  print "Content-type: text/html";

tried cgi-lib.pm

&PrintHeader;

&HtmlTop;
 .
 .
html code
 .
 .

&HtmlBot;

everything works great in IE, but nothing works in Netscape!

Can neone help me?

--
Drifter
~

The softest stuff in the world
Penetrates quickly the hardest;
Insubstantial, it enters
Where no room is.

TAO TE CHING





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

Date: Fri, 14 May 1999 23:27:26 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Ok, here I go... Help!
Message-Id: <7hiaa2$ef1$1@birch.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
"Bruce" <bruce@pond.net> wrote:

[ snip ]
>I know that perl is working on my server, because I can run a "hello world"
[snip

Check back when perl isn't working and let us see a snippet of the code 
that isn't doing what you expect it to do. Along with the results and 
the expected results.

If you have a mail problem, try a mail newsgroup:
comp.mail.*

If you have a webserver problem, post to a webserver group.
news:comp.infosystems.www.servers.*

If you have a cgi problem, try the cgi newsgroup:
news:comp.infosystems.www.authoring.cgi

If you just want something for nothing, vote democrat.


HTH



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

Date: Sat, 15 May 1999 03:20:48 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hip6f$86p$1@nnrp1.deja.com>

In article <slrn7jo2id.hn5.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Fri, 14 May 1999 11:08:25 GMT, armchair@my-dejanews.com wrote:
> >I think it is a questionable "feature" of Perl that the user can
define
> >any name for an object constructor.
>
> I'm sure you do, but perl is in good company in this respect...
> After all Eiffel does a similar thing...

To quote mothers everywhere - "Two wrongs, do not make a right".

>
> >I think this should be changed.
>
> Perl tends to let the programmer so all the enforcing of rules like
> that. new() seems to be what most people to use anyway...

That is fine, until more than one programmer has to look at the
same code, then it becomes a problem. Some fellow has later bragged that
he doesn't always use new().

>
> >And an object should be able to consist of more than just a
reference.
>
> why???? It doesn't gain you anything.

It doesn't??? It's easier to stuff varibles inside of an array and
remember which is which and access them via subscripts rather than name
them and access them by name discretely?? Or stuff them in a hash and
have to use that bulky syntax to get them out?? You're pulling my leg,
but you almost had me. But there is the lack of a record construct in
Perl. Surely we see eye to eye about that oversight. And I am certain we
can both lift our glasses in concert and agree that one variable should
never be able to hold both a number or a string or a reference. Both you
and I and the rest of the world want to catch our errors at compile time
and not runtime. And God bless us all, everyone.
>
> I can't believe I'm replying to this... oh well, you're free to modify
> the perl you use to make these things come true...

If I modified it to make these things come true (assuming I could) I
wouldn't call it Perl anymore. I would rename it Earl.

>
> You just won't be liked much...

What if I handout free pizza at the Earl Developers Conference?

>
> --
> Sam
>
> Another result of the tyranny of Pascal is that beginners don't use
> function pointers.
> 	--Rob Pike
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Sat, 15 May 1999 03:31:11 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hippv$8j0$1@nnrp1.deja.com>

In article <7hh9rs$58m$1@nnrp1.deja.com>,
  John Porter <jdporter@min.net> wrote:
> In article <7hh079$ueo$1@nnrp1.deja.com>,
>   armchair@my-dejanews.com wrote:
> > I think it is a questionable "feature" of Perl that the user can
> define
> > any name for an object constructor. I think this should be changed.
>
> That's a common first reaction from people who are coming to Perl
> from C++ and its derivatives.  But Perl is not C++, and can never be.
>
> For a complete explanation of why you are misguided, please read
> the perlobj document, very closely.  Also read the perltoot again.

Why don't you just make your case in this forum. I have read those
documents and did not reach the same conclusion you have. Perl would not
have to be C++ to have a fixed name for constructors. And since C++ is
used for major projects, whereas Perl is used on more "quick and dirty"
small projects, I am very surprised that you would feel that the Perl
way is the right way.

>
> > And an object should be able to consist of more than just a
reference.
>
> What would that gain you that you don't already have with references?
> Even if there was more than a reference, how would you get at it?
> All data structures in Perl -- other than the basic scalar, array,
> and hash -- are build using references.  Overlaying the class
> mechanism on this was a natural thing to do and leads to great
> convenience in programming.  Have you run into some kind of brick
> wall as a result of objects only being references?

It is much easier to work with discrete variables rather than
subscripted array variables. I can remember that total_attendees is the
number of peope who attended the meeting a lot easier than I can
$rSelf->[10] is. I have not run into any brick wall, but having worked
with C++, I can assure you that having only one reference in an object
point to it's data (none of which is a struct or true multi-dimensional
array) does not lead to a great convenience in programming.


>
> --
> John Porter
> Put it on a plate, son.  You'll enjoy it more.
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 14 May 1999 21:40:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl "constructors"
Message-Id: <373cecaa@cs.colorado.edu>

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

In comp.lang.perl.misc, armchair@my-dejanews.com writes:
:Some fellow has later bragged that
:he doesn't always use new().

Of course not.  It's the wrong thing to do.  You use what makes sense
for the problem domain in general.

:But there is the lack of a record construct in
:Perl. 

You're confused.  The %hash is Perl's record construct.

:And I am certain we
:can both lift our glasses in concert and agree that one variable should
:never be able to hold both a number or a string or a reference. 

You have deeply misunderstood virtually everything about Perl.  Please
go flagellate yourself with something more appropriate, like Pascal.
You're not ready for Perl yet.

--tom
-- 
"A momentary lapse of stupidity" -- Dean Roehrich


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

Date: 15 May 1999 03:52:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl "constructors"
Message-Id: <7hir13$9pu$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Christiansen 
<tchrist@mox.perl.com>],
who wrote in article <373cecaa@cs.colorado.edu>:
>  [courtesy cc of this posting sent to cited author via email]
> :And I am certain we
> :can both lift our glasses in concert and agree that one variable should
> :never be able to hold both a number or a string or a reference. 
> 
> You have deeply misunderstood virtually everything about Perl.  Please
> go flagellate yourself with something more appropriate, like Pascal.
> You're not ready for Perl yet.

If the currect implementation of Perl cannot do it, it does not matter
that the future version will not.  If my proposal about calling some
method (INITIATE?) on

       my Dog $spot;

is supported, then one will be able to

       my number_only $x;

Here I suppose that number_only::INITIATE ties $x, with STORE checking
that the data which goes there is "numerical" (whatever it means).  I
agree that this particular class number_only is silly, but if some
application domain requests something like this, one will be able to
do it.

But even now we may teach Pascalese that

    tie $foo, 'number_only';

is how you write a type declaration in Perl ;-).

Ilya


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

Date: 14 May 1999 08:38:25 GMT
From: Laurent de Lasteyrie <lasteyrie@iname.com>
Subject: Reading a file in variable
Message-Id: <7hgne1$3mo$1@news.x-echo.com>

I need a script doing something like that :
there is a file with formatting line :
File :
Peter                       NY
Anne                       Angers
 ...

And the result should be 
Reading file
$Name = "Peter"
$City = "NY"
{ 
  process
}
Next line
$Name = "Anne"
$City = "Angers"
{ 
  process
}
 ..

Like the line is formatting (28 char and 10 char), how can i 
read the file directly in the variable (i really have 15 fields and not

only 2)

Thank's for your help

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Article poste via Voila News - http://www.news.voila.fr
Le : Fri May 14 10:38:25 1999 depuis l'IP : 193.49.1.61


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

Date: Sat, 15 May 1999 03:30:26 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Reading a file in variable
Message-Id: <mT5%2.1286$6x6.1660@news.rdc1.sfba.home.com>

Laurent de Lasteyrie <lasteyrie@iname.com> wrote in message
news:7hgne1$3mo$1@news.x-echo.com...
> I need a script doing something like that :
> there is a file with formatting line :
> File :
> Peter                       NY
> Anne                       Angers
> ...
>
> And the result should be
> Reading file
> $Name = "Peter"
> $City = "NY"
>

>   process
> }

You should investigate the use of <> for reading the contents of the file.
Read 'perldoc perlop' and read the section on "I/O Operators". This will
tell you how to read the lines one by one.

As far as splitting the lines up into fields, there are three common ways.
It sounds like all your lines are fixed-length, so the quickest thing to
do is use substr (perldoc -f substr) and give it the character offsets for
each field.

Alternatively, if your columns are really variable width, you might use
the /PATTERN/ operator (again in perldoc perlop) This will let you specify
a regular expression to match your lines against.

Alternatively, if you have a delimiter between each field, you can use the
split function (perldoc -f split).

Put all this together into a loop, and you'll have your answer...

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Sat, 15 May 1999 01:35:08 GMT
From: gillian8086@my-dejanews.com
Subject: Telnet cmd, Net::Telnet
Message-Id: <7hij0c$436$1@nnrp1.deja.com>

The following script does not work. Anyone know why? The server has the
standard % prompt. The script times out at the cmd line. The gunzip
command works if applied to the server manually. Best regards.

#!/usr/bin/perl -w
#
# Make adjustments on the website.
#
use Net::Telnet;

#log on
$t=new Net::Telnet(prompt => '/\%/');
$t->open("****.******.***");

#Wait for login:
$t->waitfor('/login:/');
$t->print("******");

#Wait for password
$t->waitfor('/Password:/');
$t->print("******");

#commands
$ok=$t->cmd("gunzip website/members/general/general.tar.gz");

exit;

#telnet.pl


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Fri, 14 May 1999 18:08:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Which book do you recommend?
Message-Id: <MPG.11a6690156d01856989a6b@nntp.hpl.hp.com>

In article <373CA929.CFC368A0@mail.cor.epa.gov> on Fri, 14 May 1999 
15:52:25 -0700, David L. Cassell <cassell@mail.cor.epa.gov> says...
> Lacrosse_20 wrote:
 ...
> > there's one out there that I didn't list that's better than these...if
> > so, what is it?  Thanks in advance for your input.
> 
> There are none better.  There are one or two that are within
> epsilon of 'as good'.

I'll name one of them, as no one else has so far.

PERL The Programmer's Companion, by Nigel Chapman, ISBN 0 471 97563 X

Yes, that's PERL, dammit, on the covers, but not in the text.

I found this to be an urbane presentation, aimed at capable programmers.  
Lots of fun to read (dry English-donnish humor, you know), and much to 
the point.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 14 May 1999 20:53:07 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Which book do you recommend?
Message-Id: <B3623DB3966853762F@204.112.166.88>

In article <7hhjkn$d1t$1@nnrp1.deja.com>,
Lacrosse_20 <mcti@my-dejanews.com> wrote:

>Hey guys.  I just posted this, but it isn't showing up in my list, so
>I'm reposting.  I am planning on buying a new "advanced" perl book, but
>I don't know which book would give me the best instruction for my $.
>The ones I'm looking at are Perl Cookbook; Tom Christiansen, et
>al, Programming Perl, 2nd Edition (covers Perl 5.0); Larry Wall
>(Editor), et al, Mastering Regular Expressions: Powerful Techniques for
>Perl and Other Tools; Jeffrey E. F. Friedl, and Advanced Perl
>Programming; Sriram Srinivasan.  Which of these is the best?  Maybe
>there's one out there that I didn't list that's better than these...if
>so, what is it?  Thanks in advance for your input.

The Perl Cookbook and Programming Perl are both excellent, but very
different. The latter is pretty much "required reading" and the Cookbook
ranks among the best computer books I've read in 20+ years, although the
proofreader apparently fell asleep on page 3, and never woke up. Except for
that, it's up there with W.R. Stevens' books, and that's as good as it
gets.

I really can't recommend one over the other. They're both essential.

The others I can't comment on, because I don't have the regex book and
don't understand a thing in Advanced Perl Programming. I think the series
is missing a semi-advanced book. :)

Lee




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

Date: Fri, 14 May 1999 23:26:43 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Which book do you recommend?
Message-Id: <7hiqos$9hq$1@bgtnsc02.worldnet.att.net>

> Hey guys.  I just posted this, but it isn't showing up in my list, so
> I'm reposting.  I am planning on buying a new "advanced" perl book, but
> I don't know which book would give me the best instruction for my $.
> The ones I'm looking at are Perl Cookbook; Tom Christiansen, et
> al, Programming Perl, 2nd Edition (covers Perl 5.0); Larry Wall
> (Editor), et al, Mastering Regular Expressions: Powerful Techniques for
> Perl and Other Tools; Jeffrey E. F. Friedl, and Advanced Perl
> Programming; Sriram Srinivasan.  Which of these is the best?  Maybe
> there's one out there that I didn't list that's better than these...if
> so, what is it?  Thanks in advance for your input.

I'm not going to rehash what others said, because they summed it up nicely.
But, there is another that nobody has mentioned yet: Effective Perl
Programming, by Hall with Schwartz.  This is a tremendous book that will
help take your code to the next level.  It deals with everything from style
(your code will be more Perl-ish) to advanced programming topics.  And, the
book has a tremendous discussion on the differences between MY and LOCAL,
which, from the posts around here lately, should be read by anyone who
doesn't get it...

Jason Simms





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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