[12859] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 269 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 27 09:07:19 1999

Date: Tue, 27 Jul 1999 06:05:12 -0700 (PDT)
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, 27 Jul 1999     Volume: 9 Number: 269

Today's topics:
    Re: Another host_addr question <gellyfish@gellyfish.com>
    Re: Beginner-friendly group as cultural adaptation? (Bart Lateur)
    Re: Beginner-friendly group as cultural adaptation? <gellyfish@gellyfish.com>
    Re: Beginner-friendly group as cultural adaptation? (Malcolm Ray)
        beginner-redirect and download <ph@alternativerealities.co.uk>
    Re: beginner-redirect and download (Sam Holden)
    Re: changing file owner (S Berch)
        cross platform perl, how is done bodhyfryd@my-deja.com
    Re: cross platform perl, how is done (elephant)
    Re: cross platform perl, how is done (Andreas Fehr)
    Re: Don't want to make file that owner is "NOBODY" (S Berch)
        How do I redirect STDERR to STDOUT in a system() on Win <Armin.Faltl@siemens.at>
    Re: HTML::Parser sample <kin@0011.com>
    Re: Listing Files (with extension) <Adrian.Duncan@trinite.co.uk>
    Re: Newbie needs help:  Environment variables (Gary O'Keefe)
    Re: Newbie needs help:  Environment variables (Gary O'Keefe)
        paragraph breaks in text? <breville@mpce.mq.edu.au>
    Re: paragraph breaks in text? (Andreas Fehr)
    Re: Pass by value or pass by reference? <ELB@iname.com>
    Re: Perl and Personal Web Server (Win98) <jimrie@guideguide.com>
        platform independent perl advice bodhyfryd@my-deja.com
        Pretty prompt creation from info in a file... <richj@home.com>
    Re: Problem making libraries <james.williamson@bbc.co.uk>
    Re: Problem with sockets (Anno Siegel)
    Re: reg expression <llornkcor@earthlink.net>
    Re: remove records from database (Anno Siegel)
    Re: special problem <tchrist@mox.perl.com>
    Re: stopping email overflow on failure <gellyfish@gellyfish.com>
    Re: stopping email overflow on failure <gellyfish@gellyfish.com>
        Unix 'comm' command - in Perl? <cingram@pjocs.demon.co.uk>
    Re: Unix 'comm' command - in Perl? <tchrist@mox.perl.com>
    Re: Which group is appropriate? <bradw@newbridge.com>
    Re: Which group is appropriate? <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 27 Jul 1999 13:01:55 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Another host_addr question
Message-Id: <379d9fb3@newsread3.dircon.co.uk>

Vicki Surratt <vicki@vickishome.com> wrote:
> 
>                  Is there another way to have the information displayed?
> Is there any way to use the IP address to automatically lookup the host
> address in a perl script?
> 

See for instance : 

<http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=489776960&fmt=text>

/J\
-- 
"You look lovely this evening. Have you decreased in mass?" - Alien,
The Simpsons


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

Date: Tue, 27 Jul 1999 09:39:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <379e7d5b.8101821@news.skynet.be>

Martien Verbruggen wrote:

>Nobody has troubles with newbies per se. As long as they show they've
>done their best to find answers themselves,

Hah!

How about "off topic" questions, then? This newsgroup is very intolerant
with regards to what it considers off-topic. It's not just CGI, although
that is quite a typical example. "How do I run a Perl script on a
regular basis", or "Why can I not create a file in this directory?", are
other examples.

Apperently, this newsgroup is reserved for algorythms, syntax and
meta-discussions. Although I fail  to see the Perl content in
"algorythms": you can do that in any language. Algorythms are
language-independent.

When the only answer to "How do I write a simple HTML parser using the
HTML::Parser module?" is: "You need to subclass the parser class, go
read the docs.", well, then there's something *seriously* wrong with the
group, because it's usefulness is pretty damn near zero. IMO. (Not so
humble, but feel free to ignore me. I don't mind.)

	Bart.


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

Date: 27 Jul 1999 12:18:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <379d95a1@newsread3.dircon.co.uk>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> John Callender <jbc@shell2.la.best.com> wrote:
> 
>> This may well be doomed from the outset. If you really hate the idea
>> and would vote against it under any circumstances, please consider
>> letting me know either publicly or privately.
> 
> If I vote for it, and the group is created, then fails to live up to its
> mission, will people stop bringing up the idea of creating such a
> nesgroup?
> 
> Probably not.
> 
> But when people do bring it up, at least we can tell them it has been
> tried, and it didn't work, and hopefully that will shut them up.
> 

This point does have some merit but it strikes me that perhaps we can
say that now with respect to alt.perl - although I can find no reference
to any discussion in alt.config before it was created (or anywhere else
for that matter) so I can only speculate as to why that group was created -
it seems to serve no purpose and the only light that is shed in there is
when there is a crosspost here which is followed up in both groups.

/J\
-- 
"Tony Blair is reported to be detained indefinitely under plans unveiled
by the Home Secretary" - Corrupt Teletext Page


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

Date: 27 Jul 1999 12:49:31 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <slrn7pramr.3hn.M.Ray@carlova.ulcc.ac.uk>

On 27 Jul 1999 07:02:25 GMT, John Callender <jbc@shell2.la.best.com> wrote:
>I'm curious why people think no one who knows anything will answer
>newbie questions in a newbie group. People answer newbies now. There
>are tons of great followups to newbie questions. I would assume those
>same people would be equally motivated to followup to newbie questions
>in a separate group. But it would shock me if the people who make fun
>of the newbie posts would bother to follow them there.

It's often said that the level of hostility shown to FAQs and off-topic
questions in clpmisc is due to their high volume.  Speaking as someone
who has lurked here for a fair while, it often seems to me that the
*majority* of the traffic shouldn't be here - and I already kill more
articles here than in any other group I read.  If I were a regular
contributor, I'd probably get demoralised by this pretty quickly,
and that might show in my responses, particularly since I'm not known
for my patience with dumb questions.

If the proposed .newbie group succeeded in taking most or all
(fat chance!) of this traffic away from clpmisc, then it would in
turn be a high-traffic group with an even higher proportion than
clpmisc of FAQs and off-topic questions.  So, what's to stop those
questions getting a similarly hostile response in the new group?
If you succeed in leaving the jaded curmudgeons behind in clpmisc,
then the new group might have a successful honeymoon period.  Until it
bred its own collection of irritable FAQ-answerers...

I think it would be better for those who believe that clpmisc isn't
working to improve the *existing* group, rather than fragmenting
the Perl community further.  The culture of a group *does* change
over time, and the best way to effect change is to lead by example.
If you recruit enough useful contributors to your kinder, gentler
viewpoint, then eventually the curmudgeons will be seen as irrelevant
and will either leave, change their ways, or could be safely killfiled.

Your mission, should you choose to accept it, is to find a way to
motivate your friendly troops while preventing burn-out.
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: Tue, 27 Jul 1999 10:15:47 +0100
From: "Paul Huckstepp" <ph@alternativerealities.co.uk>
Subject: beginner-redirect and download
Message-Id: <379d7892@news.intensive.net>

Hi,

Is it possible to tell a browser to download a file and redirect the browser
to another URL, or in failing that, open a new window that prompts the
download and send the original window to a new URL?

If so how?

Thanks for your help

Paul Huckstepp
p.huckstepp@ballard.co.uk




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

Date: 27 Jul 1999 09:18:56 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: beginner-redirect and download
Message-Id: <slrn7pqucc.1j9.sholden@pgrad.cs.usyd.edu.au>

On Tue, 27 Jul 1999 10:15:47 +0100,
     Paul Huckstepp <ph@alternativerealities.co.uk> wrote:
>Hi,
>
>Is it possible to tell a browser to download a file and redirect the browser
>to another URL, or in failing that, open a new window that prompts the
>download and send the original window to a new URL?
>
>If so how?

Why don't you try asking in alt.tv.x-files I suspect it has more to do with
the domain of your question then this _perl_ group.

-- 
Sam

Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
	--Ken Thompson


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

Date: Tue, 27 Jul 1999 11:53:35 GMT
From: sberch_no-spam_@world.std.com (S Berch)
Subject: Re: changing file owner
Message-Id: <379d9c54.160925759@news.std.com>

On Mon, 26 Jul 1999 14:29:43 GMT, cpierce1@ford.com (Clinton Pierce)
wrote:


>Make the file readable by you, copy its contents into a new file, delete
>the original (assuming the directory is writable by you and it's not "s").

Thanks for helping.

When I copy the contents of "old" file in to the "new" file, I can not
change the properties of "new" file. The "chmod" running in the script
gets an error message that is not the owner. After the script finishes
"nobody" is the owner and I can not use "chmod" from the command line.


I seem to get locked out of changing properties and ownership from
both places. The only solution I can come up with is running the
script on my user id, which I've been told is a big security risk.

-sb


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

Date: Tue, 27 Jul 1999 09:14:48 GMT
From: bodhyfryd@my-deja.com
Subject: cross platform perl, how is done
Message-Id: <7njta4$rp1$1@nnrp1.deja.com>

I am currently developing perl cgi scripts on Linux, as this is the
platform my web sites will be hosted on (quite common). However,
everything else i do is on WIN95 (to become NT shortly).

MY QUESTION is: what advice can you lot give on how and what is needed
to develop platform independent perl cgi? and are all the CPAN modules
etc available for this.


 I find it a real pain in ar** rebooting and going from one OS to
another and dos2unix everything.


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


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

Date: Tue, 27 Jul 1999 19:36:20 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: cross platform perl, how is done
Message-Id: <MPG.120828a3b05e04db989b8b@news-server>

bodhyfryd@my-deja.com writes ..
>MY QUESTION is: what advice can you lot give on how and what is needed
>to develop platform independent perl cgi? and are all the CPAN modules
>etc available for this.

1) use ActiveState's port of perl
2) learn everything you can about line endings - they'll bite you if 
you're not savvy with them
3) read the ActiveState Win32 documents which detail the Win32 
limitations - then don't use those in your perl code (not too difficult 
with the simple tasks that web script programming usually present)

-- 
 jason - remove all hyphens for email reply -


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

Date: Tue, 27 Jul 1999 10:07:03 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: cross platform perl, how is done
Message-Id: <379d8391.2126187@news.uniplus.ch>

On Tue, 27 Jul 1999 09:14:48 GMT, bodhyfryd@my-deja.com wrote:

>MY QUESTION is: what advice can you lot give on how and what is needed
>to develop platform independent perl cgi? and are all the CPAN modules
>etc available for this.

Try ActivePerl from www.activestate.com and read the Win32 FAQs.


> I find it a real pain in ar** rebooting and going from one OS to
>another and dos2unix everything.

Check www.vmware.com. They have a solution for the rebooting pain.

Andreas


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

Date: Tue, 27 Jul 1999 11:58:11 GMT
From: sberch_no-spam_@world.std.com (S Berch)
Subject: Re: Don't want to make file that owner is "NOBODY"
Message-Id: <379e9e4a.161427762@news.std.com>

I've asked the same question in another message thread. The only
solution so far, is to run the script under your user id. This poses a
big risk. Someone could use that to delete all your files if the
entered the right commands at the right place.

-sb

On Tue, 27 Jul 1999 09:41:31 +0900, "channeli" <cybok@nobreak.com>
wrote:

>My perl script make several data files.
>But the problems of my server is that never allow the file that owned by
>"NOBODY".
>
>I'm using
>
>umask(077);
>
>now.
>
>At the result, some files owned by the owner of script, some are "nobody".
>Any other solution is there?
>
>I'm really urgent...
>
>
>
>
>



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

Date: Tue, 27 Jul 1999 14:45:04 +0200
From: Armin Faltl <Armin.Faltl@siemens.at>
Subject: How do I redirect STDERR to STDOUT in a system() on WinNT?
Message-Id: <379DA9D0.A1F75214@siemens.at>

Hi!

My problem is to find an equivalent to

@out = qx(some_prog 2>&1);

or

system(some_prog >>$::Log 2>&1);

on Windows NT 4.0 and I use command.com as command interpreter.

I use ActivPerl build 509, and tried to read the FAQ
on the subject of redirecting STDERR to STDOUT (and both to a file),
but I found only UNIX answers.

If this question has been answered before, pleas hint
me to a search engine of the newsgroup (do it anyway!).

Regards, Armin

-- 
* D.I. Armin Faltl                                 ---------   *
*           email: Armin.Faltl@siemens.at            |  |      *
*      work phone: +43-1-1707-46429                  |--|-     *
* from 1. Nov. 1999 on:                           |__|  |_     *
*      work phone: +43-51707-46429                             *


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

Date: Tue, 27 Jul 1999 02:29:44 -0700
From: Kin Lum <kin@0011.com>
Subject: Re: HTML::Parser sample
Message-Id: <379D7C08.39F14AB@0011.com>

Thank you Anthony, this seems a very nice solution.
i think in some cases like <img src=foo.gif alt="<Home>"> 
that is, with "<" or ">" inside of the tag, then it
would choke.  But for  <b> <i> <font  > and <a  >
your solution would work fine.  


Anthony Sadera wrote:
> 
> Try something like this:
> 
> sub JustWhatIWant {
>         my $incomingtag = shift;
>         if (lc($incomingtag) =~ /^<\/*(b|i|font|a)[^\w>]*[^>]*>$/) {
>                 return $incomingtag;
>         } else {
>                 return "";
>         }
> }
> 
> ...
> 
> $myhtml =~ s/(<[^>]*>)/&JustWhatIWant($1)/eg;
> 
> Kin Lum wrote:
> >
> > to use HTML::Parser, shouldn't the following code work?
> > it seems that the method cannot be overridden...
> >
> > #!/usr/local/bin/perl
> >
> > require HTML::Parser;
> > $p = HTML::Parser->new;
> >
> > $p->parse("<b>hi</b><i><bbb>");
> > $p->eof;
> >
> > sub start {
> >     print join(" ", @_), "\n";
> > }
> >
> > Kin Lum wrote:
> > >
> > > using HTML::Parser is fine.  but for such a simple task,
> > > using it would be an overkill.  can it be done in 2, 3 lines
> > > in Perl?
> > >
> > > Abigail wrote:
> > > >
> > > > Kin Lum (kin@0011.com) wrote on MMCLIV September MCMXCIII in
> > > > <URL:news:379BA0E4.6A7A5127@0011.com>:
> > > > {} can you easily kill all tags except the ones you want to keep:
> > > > {}   <b>  <i>  <font  >  <a   >
> > > >
> > > > If you have simplistic HTML (the kind most browser can understand)
> > > > you can use the horribly misnamed 'HTML::Parser' module.
> > > >
> > > > {} # now kill all tags
> > > > {} s/<.*?>//g;
> > > >
> > > > This is too stupid to take seriously.  Please read the FAQ.
> > > >
> > > > Abigail
> > > > --
> > > > perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
> > > > 0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
> > > > =>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
> > > > !$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
> > > >
> > > >   -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> > > >    http://www.newsfeeds.com       The Largest Usenet Servers in the World!
> > > > ------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----
> 
> --
> -----------------------------------------------
>                                  Anthony Sadera
>                           mailto:afs@sadera.com


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

Date: Tue, 27 Jul 1999 13:41:38 +0100
From: Adrian Duncan <Adrian.Duncan@trinite.co.uk>
Subject: Re: Listing Files (with extension)
Message-Id: <379DA901.58A087B1@trinite.co.uk>

Hello All,
this seems to be *the* most read article ever!
I would like to do something similar, but my
sole desire is to find the directory size including
any subdirectories from a directory.  I would
like to insert them into an array (prob 2 dimsensional).

Sadly, I too am using NT.

Could anyone please help?
Cheers
Adrian





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

Date: Tue, 27 Jul 1999 11:48:23 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Newbie needs help:  Environment variables
Message-Id: <379d9a70.11390972@news.hydro.co.uk>

Masse wrote:

>Doesn't
>
>  $ENV{variable_name} = $value;
>
>work?

It works fine. Just don't go around expecting the child process (perl
executing the script) to go altering the parent process's (the
shell's) environment. Bad security juju. Well, that's the way I
understand it.

If you called exec() or system() after altering @ENV, child processes
would execute in the altered environment. AFAIK. Anyone?

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Tue, 27 Jul 1999 12:06:15 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Newbie needs help:  Environment variables
Message-Id: <379da083.12945752@news.hydro.co.uk>

Gary O'Keefe wrote:

>If you called exec() or system() after altering @ENV, child processes
>would execute in the altered environment. AFAIK. Anyone?

Arrrgh! %ENV! Sorry.

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Tue, 27 Jul 1999 22:37:55 +1000
From: "Brendan Reville" <breville@mpce.mq.edu.au>
Subject: paragraph breaks in text?
Message-Id: <7nk980$3qj$1@sunb.ocs.mq.edu.au>

hi all,

I'm using the POP3 module to pull normal text messages from a POP server,
and am then displaying the messages to display them in HTML.

However, multiline messages often look like this:

this is my multiline message which is wrapping
at a certain point on the screen, but unfortunately
sometimes there are also breaks such as
item 1
item 2
item 3
and then we start the normal writing again.

When displaying this as HTML, I'd like to treat the first 3 lines as one
paragraph with no breaks, but I want to insert <br> or <p>s for each of the
bullet items.

But what, if any, is the trick to knowing when it's normal text wrapping due
to the mail format, and when it's an intentional end of paragraph?

Do I just treat lines smaller than a certain length as being
end-of-paragraphs?

thanks for any suggestions..





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

Date: Tue, 27 Jul 1999 12:49:49 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: paragraph breaks in text?
Message-Id: <379da968.11813627@news.uniplus.ch>

On Tue, 27 Jul 1999 22:37:55 +1000, "Brendan Reville"
<breville@mpce.mq.edu.au> wrote:

>However, multiline messages often look like this:
>
>this is my multiline message which is wrapping
>at a certain point on the screen, but unfortunately
>sometimes there are also breaks such as
>item 1
>item 2
>item 3
>and then we start the normal writing again.
>

Where is the Perl in your question? Anyhow, what about

<PRE>Some multiline 
text</PRE>

So you get the line breaks the sender used. If the sender typed no
breaks at all, you may add them, otherwise you have to scroll the mail
horizontally.

Andreas


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

Date: Tue, 27 Jul 1999 09:35:30 -0300
From: "Eric L. Brine" <ELB@iname.com>
Subject: Re: Pass by value or pass by reference?
Message-Id: <379DA792.B172338C@iname.com>

> is these operation pass the value (copy) or pass the reference (link)?

Both are possible, it's up to the function itself.

=======
e.g. 1:
sub test {
  my ($arg0, $arg1) = @_;          # Pass by value.
  print($arg0, ' - ', $arg1, "\n");
}
$a = 1; $b = 2;
test($a, $b);

Notice the copying from $_[0] to $arg0, and from $_[1] to $arg1.

=======
e.g. 2:
sub test { # $sum = $a + $b;
  #  $sum = $_[0];    # Pass by ref.
  my $a   = $_[1];    # Pass by val.
  my $b   = $_[2];    # Pass by val.
  $_[0] = $a + $b;
}
my ($sum, $a, $b);
$a = 1; $b = 2;
test($sum, $a, $b);  # $sum = 3

@_ is magical. It's elements are really references to the arguments
instead of a copy of them.

=======
e.g. 3:
sub test {
  local *sum = \$_[0];   # Pass by ref.
  my $a      =  $_[1];   # Pass by val.
  my $b      =  $_[2];   # Pass by val.
  $sum = $a + $b;
}
my ($sum, $a, $b);
$a = 1; $b = 2;
test($sum, $a, $b);  # $sum = 3

Neat, but only works with
  no strict qw(vars)
or with
  use vars qw($sum)

=======
e.g. 4:
sub test {
  my ($sum_ref, $a, $b) = @_;  # Pass by val.
  ${$sum_ref} = $a + $b;
}
my ($sum, $a, $b, $sum_ref);
$a = 1; $b = 2;
$sum_ref = \$sum;
test($sum_ref, $a, $b);  # $sum = 3

Note that $sum_ref is passed by val (since it is copied from @_ instead
of using $_[0]), but $sum_ref is a pointer to $sum, so while $sum is not
passed at all, it can still be modified from within the sub by using
$sum_ref.  See example 7 for the object oriented version of this.

=======
e.g. 5:
sub test(\$$$) {  # Prototypes
  my ($sum_ref, $a, $b) = @_;
  ${$sum_ref} = $a + $b;
}
my ($sum, $a, $b);
$a = 1; $b = 2;
test($sum, $a, $b);  # $sum = 3

=======
e.g. 6:
pop(@a, $a);

@a is passed by ref to the internal call pop().

=======
e.g. 7:
package MyObj;
sub do_it {
  my ($self) = @_;     # Passing the hash/obj reference by value.
  $self->{'a'} = 'B';  # That doesn't stop one from modifying the
                       #     refered object.
}
my $obj = bless({a => 'A'}, 'MyObj');
$obj->do_it();
print($obj->{'a'}, "\n");   # prints 'B'



> i.e.: return ($rv);
What does 'return' have to do with passing args?

> db_write ($dbh);
$dbh is mostly a pointer to an object.  It wouldn't make sense to
suddenly start pointing to another object, so $dhb will still point the
the same object (unless the documentation says otherwise).  In effect
and possibly in reality, $dbh is passed by value.  However, since $dbh
is a reference (pointer) in itself, the referenced object may still be
modified and changes will be seen outside of db_write().  See example 7
above.

ELB

--
Eric L. Brine  |  Chicken: The eggs's way of making more eggs.
ELB@iname.com  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.


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

Date: Tue, 27 Jul 1999 13:31:18 +0100
From: John Imrie <jimrie@guideguide.com>
Subject: Re: Perl and Personal Web Server (Win98)
Message-Id: <379DA696.C17F7403@guideguide.com>

>
> "Hi, my name is Alex, and my girlfriend spends too much time writing Perl
> scripts.  She calls them `programs', but I know better-- programs have
> dialog boxes and stuff, and these just read in stuff and print it out
> again.  What should I do?"
>

It appears that your girlfriend has lost the One True Faith  (tm) and is
consorting with the devil in his form of UNIX.

The only recourse is to exorcise her computer and to reinstall the One True
Operating System (tm).

This will give you years of good karma as you  stare at the calming blue
screens that the OS provides for you every so often.

The Pilgrim



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

Date: Tue, 27 Jul 1999 10:40:06 GMT
From: bodhyfryd@my-deja.com
Subject: platform independent perl advice
Message-Id: <7nk2a5$umc$1@nnrp1.deja.com>



I am currently developing perl cgi on Linux as this is the OS on which
my web site will be hosted (very common). However I usually work on
win95, soon to be NT and Im getting pi**d off with dos2unix'ing and
rebooting to go into windows in order to use my much loved software and
get on the internet. (Im sure Linux could be configured to make life
easier but i dont want to spend time doing this if I can avoid it, and
I dont have the space for a separate box .. believe me).


So question:

1) How and what do ya need for crossplatform perl cgi.

2) are the CPAN modules available

I guess after the script seems to be working then I can test it on
Linux before transferring over to my web site.


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


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

Date: Tue, 27 Jul 1999 12:53:18 GMT
From: Joan Richards <richj@home.com>
Subject: Pretty prompt creation from info in a file...
Message-Id: <379DAB83.FF98FE72@home.com>

Hello,

I've got a question that I'm not exactly sure how it can be solved.
Here's the problem...let's say that I have a file filled with data that
might look like this:

property 222 76 89
shoes stink
birkenstocks rule
property 333 23 11
rest soon

Now, if I want to see the entries that have the "property" tag (first
portion of the entry in the file).  I will do something like this:

sub property_info {
        &show("Available property settings are:\n");
        open(FL, "$FILE") && do {
                while(<FL>) {
                        &show($_) if /^property/i;
                }
        };
        close(CNF);
}

I know I know, i didn't check the return from open.  okay, i'm bad.
anyway, this will list all the lines that start with property.  This is
great, however, when I prompt the user to delete a "property" entry, I
just run my little function and then have the user type in that entire
line, and then call a routine that will appropriate remove the line from
the file.  As you can tell, it is a bit of a pain to type in the entire
"property" entry in full.  So, I'd like to have an output that looks
like this:

(1) property 222 76 89
(2) property 333 23 11

and then just hvae the user enter "1" or "2", and then have my routine
that will appropriate remove this line called and do it's necessary
work.  Now, understand that hte # of "property" entries will grow and
shrink, so I need something that is dynamic in figuring out this
information.

Does anyone have some ideas on how to do this, or even better some
sample code/scripts that will help me in doing this?

Thanks again,

-J




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

Date: Tue, 27 Jul 1999 11:23:59 +0100
From: "James Williamson" <james.williamson@bbc.co.uk>
Subject: Re: Problem making libraries
Message-Id: <7nk1ef$m63$1@nntp0.reith.bbc.co.uk>


elephant wrote in message ...
>Pavel Hlavnicka writes ..
>>I'm poor Win NT user having troubles making perl libraries.
>
><deletia>
>
>>$ make -v
>>GNU Make version 3.77, by Richard Stallman and Roland McGrath.)
>>(and more...)
>
>I think you'll find that Makefile.PL creates a Microsoft Visual C(++)
>specific makefile that needs to be run with nmake
>
>now .. I'm no expert either .. but the standard libnet-1.0606 builds for
>me (using MSVC) with
>
>  perl Makefile.PL
>  nmake
>  nmake test
>  nmake install
>
>I can't remember which module I read about this in .. maybe the mod_perl
>one .. or maybe the perl build itself .. but it definitely said somewhere
>that the Makefile.PL worked with nmake from MSVC or with make from
>Borland with some changes
>
>that all having been said .. if you're using ActiveState's port of perl
>then you should have ppm onboard .. in which case you should use that for
>downloading and installing as many of the modules as you can .. certainly
>libnet is in there .. type this at a command prompt (assuming you have
>ActiveState's perl port)
>
>  ppm install libnet
>
>it should download and install the latest libnet that's in ActiveState's
>module repository
>
>>Is there some need for special configuration or existence of some
>>folders, env. vars. ...?
>
>if there is then it'd be in the accompanying readme file
>
>>What should I read. Is there some guide to makefiles. What are the
>>common problems on NT?
>
>now here my knowledge completely dries up
>
>--
> jason - remove all hyphens for email reply -

Call me thick if you like but if I need to use a module (in Winnt), I
download it from cpan, unzip it, place it in the right directory then simply
use whatevermodule
in the script?

James Williamson




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

Date: 27 Jul 1999 09:32:51 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with sockets
Message-Id: <7njuc3$8vb$1@lublin.zrz.tu-berlin.de>

Tommi Niemi <tniemi@paju.oulu.fi> wrote in comp.lang.perl.misc:
>In comp.lang.perl.misc Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Tommi Niemi  <tniemi@mail.student.oulu.fi> wrote in comp.lang.perl.misc:
>> >
>> >I have a forking server (the code is from Panther book) and the problem
>> >is, that sometimes I got this error message:
>> >
>> >	usage $fh->accept([PKG]) at program.pl line 544
>> >
>> >and code is here:
>
>> [snipped, except for (I suppose) line 544]
>
>>      while($new_socket = $main_socket->accept()) {
>
>> Something strange is going on.  In my version of IO::Socket, the
>> generation of this message is like this:
>
>> sub accept {
>>     @_ == 1 || @_ == 2 or croak 'usage $sock->accept([PKG])';
>
>> Assuming your version is similar, your call is fine: The sub will
>> be called with an @_ of length 1.  No way this can sometimes happen
>> and sometimes not.  Look up the definition of accept in your
>> /yourlib/perl5/IO/Socket.pm and see what you find.
>
>> Anno
>
>My vesion is 1.1602 and there the geration of the message is: 
>
>sub accept {
>	@_ == 1 || @_ == 2 or croak 'usage $fh->accept([PKG])';
>
>
>In the latest  version  ( 1.25 ? )  the message is just like you said.

Yes, 1.25 is my version which I fetched from cpan during the last
month or two.  Except for the slight difference in wording, they
are the same at this point.  I still don't see how this error can
happen with a call like yours, far less how it can sometimes happen
and sometimes not.

Anno


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

Date: Tue, 27 Jul 1999 05:58:20 -0600
From: llornkcor <llornkcor@earthlink.net>
Subject: Re: reg expression
Message-Id: <933076700.1270095593@news.earthlink.net>

I=20

>Okay, your question, up to epsilon, is asked a painful number of
>times a week here.  As a result, many responders tend to be
>abrupt enough to dissuade casual readers of the newsgroup from
>asking similar questions without doing their Perl homework
>first.  You have just experienced some of the consequences of
>others' acts.

I still don't see why, if those people that lurk here for years, are tire=
d of
seeing these questions posted, can't just IGNORE them??? Instead of makin=
g rude
comments about learning to read. No One is making them answer.

=20
>But in this group, there is a longstanding 'teach a man to
>fish' campaign.  This also leads to some abruptness over time.
>And if 8,000 people asked you how to turn on their camcorders,
>you too might be gruff with the 8,001st poster.

Well, if you had a kid, that wanted to learn how to ride a bike, would yo=
u tell
him/her to "go read the manual"???? or would you SHOW him/her how to ride=
?
I suppose those people that assulted me, would tell him/her to go read th=
e
manual.


>Okay, that's fair.  Regexen are different if you haven't seen
>them before in another language or tool.  And Perl has regex
>features not to be found elsewhere.  You might find the
>tutorial at
>http://www.netcat.co.uk/rob/perl/win32perltut.html
>has a good intro to regexen.  After that, you ought to be ready
>to tackle the perlre manpage which comes with every install
>of Perl [and hence ought to be on your hard dick for maximal
>utility].  I found "Mastering Regular Expressions" by Jeffrey
>Friedl very informative, even if it is a couple years out-of-
>date on Perl's niftiest regex techniques.

>I've also found that searching the newsgroup archives at=20
>deja.com can provide a wealth of information.  Once you
>find out all the tools provided by Perl and the web and
>Perl programmers, you'll see that asking in this newsgroup
>is really the *last* resort.

I have found that searching the archives tends to bring an OVERWHELMING a=
mount
of irrelevent information, and I am not going to weed through thousands o=
f
messages, that may or may not have anything to do with what I searched fo=
r,
when it is ten times easier and faster to ask a simple, stupid question i=
n a
newsgroup.
   I just dont understand why people choose to be mean, and rude when the=
y ARE
tired of seeing these easy-to-them questions. Just ignore them, thats wha=
t I
do on other newsgroups that I have more knowlege about the subject being
discussed. I saw one question "how do I install linux from windows?" did =
I
choose to lambast the guy? No, I  simply laughed and promptly went on to =
the
next message.



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

Date: 27 Jul 1999 09:10:30 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: remove records from database
Message-Id: <7njt26$8tq$1@lublin.zrz.tu-berlin.de>

 <inlandpac@my-deja.com> wrote in comp.lang.perl.misc:
>I am talking about a flat file (| delimited).
>
>I am new at this and don't appreciate the criticism towards my search
>for understanding and knowledge.
>
>These communities are supposed to be for everyone to use; for the
>inexperienced to learn and for others to share their knowledge.  If you
>are not here to share your knowledge and have desires to criticize then
>what is the point in you being here?

For someone who loves to criticize there's a lot of point in being here.
We get about a hundred articles in need of criticism each day.

>Please do not assume that I am an experienced coder and should already
>know this stuff.  If you have some answers or know where I can read
>about it, let me know - guide me to the right place.
>
>I have five books on perl and cgi and not one of them helps with my
>problem on sorting and removing records from flat file databases.

I need to replace every occurrence of "father" in a file with "mother".
I've looked through the index of five books about Perl as well as
in the faq.  None of them mentions "father".  I don't know much
about Perl, but this should be an simple problem.   How come the
books don't give the solution?

You'll have to combine a few things from the books to get your
specific problem solved.  Just using the perl faq, these should
give you the tools at hand to do what you want to do:

perldoc -q sort
perldoc -q unique
perldoc -q 'delete a line'

>So, if you have some suggestions for me or have a solution, please let
>me know.  If you are going to put me down (or anyone else for that
>matter), then don't bother writing anything at all.

Why?  Criticizing inappropriate posts is good for the poster as well
as for the newsgroup.  Yours was pretty inappropriate, as has been
pointed out in this thread.

Anno


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

Date: 27 Jul 1999 06:26:18 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: special problem
Message-Id: <379da56a@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    frank_hampshire@my-deja.com writes:
:You can do this using 'eval'. Try this small program.

1.  This is the worst approach for most cases.  Vide infra.

2.  Your newsreader is playing Jeopardy, placing the
    answer before the question.  Please fix it.

--tom

=head2 How can I use a variable as a variable name?

Beginners often think they want to have a variable contain the name
of a variable.

    $fred    = 23;
    $varname = "fred";
    ++$$varname;         # $fred now 24

This works I<sometimes>, but it is a very bad idea for two reasons.

The first reason is that they I<only work on global variables>.
That means above that if $fred is a lexical variable created with my(),
that the code won't work at all: you'll accidentally access the global
and skip right over the private lexical altogether.  Global variables
are bad because they can easily collide accidentally and in general make
for non-scalable and confusing code.

Symbolic references are forbidden under the C<use strict> pragma.
They are not true references and consequently are not reference counted
or garbage collected.

The other reason why using a variable to hold the name of another
variable a bad idea is that the question often stems from a lack of
understanding of Perl data structures, particularly hashes.  By using
symbolic references, you are just using the package's symbol-table hash
(like C<%main::>) instead of a user-defined hash.  The solution is to
use your own hash or a real reference instead.

    $fred    = 23;
    $varname = "fred";
    $USER_VARS{$varname}++;  # not $$varname++

There we're using the %USER_VARS hash instead of symbolic references.
Sometimes this comes up in reading strings from the user with variable
references and wanting to expand them to the values of your perl
program's variables.  This is also a bad idea because it conflates the
program-addressable namespace and the user-addressable one.  Instead of
reading a string and expanding it to the actual contents of your program's
own variables:

    $str = 'this has a $fred and $barney in it';
    $str =~ s/(\$\w+)/$1/eeg;		  # need double eval

Instead, it would be better to keep a hash around like %USER_VARS and have
variable references actually refer to entries in that hash:

    $str =~ s/\$(\w+)/$USER_VARS{$1}/g;   # no /e here at all

That's faster, cleaner, and safer than the previous approach.  Of course,
you don't need to use a dollar sign.  You could use your own scheme to
make it less confusing, like bracketed percent symbols, etc.

    $str = 'this has a %fred% and %barney% in it';
    $str =~ s/%(\w+)%/$USER_VARS{$1}/g;   # no /e here at all

Another reason that folks sometimes think they want a variable to contain
the name of a variable is because they don't know how to build proper
data structures using hashes.  For example, let's say they wanted two
hashes in their program: %fred and %barney, and to use another scalar
variable to refer to those by name.

    $name = "fred";
    $$name{WIFE} = "wilma";     # set %fred

    $name = "barney";           
    $$name{WIFE} = "betty";	# set %barney

This is still a symbolic reference, and is still saddled with the
problems enumerated above.  It would be far better to write:

    $folks{"fred"}{WIFE}   = "wilma";
    $folks{"barney"}{WIFE} = "betty";

And just use a multilevel hash to start with.

The only times that you absolutely I<must> use symbolic references are
when you really must refer to the symbol table.  This may be because it's
something that can't take a real reference to, such as a format name.
Doing so may also be important for method calls, since these always go
through the symbol table for resolution.

In those cases, you would turn off C<strict 'refs'> temporarily so you
can play around with the symbol table.  For example:

    @colors = qw(red blue green yellow orange purple violet);
    for my $name (@colors) {
        no strict 'refs';  # renege for the block
        *$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
    } 

All those functions (red(), blue(), green(), etc.) appear to be separate,
but the real code in the closure actually was compiled only once.

So, sometimes you might want to use symbolic references to directly
manipulate the symbol table.  This doesn't matter for formats, handles, and
subroutines, because they are always global -- you can't use my() on them.
But for scalars, arrays, and hashes -- and usually for subroutines --
you probably want to use hard references only.
-- 
 "There are two major products that come out of Berkeley: LSD and Unix. We
  don't believe this to be a coincidence." ||   - Jeremy S. Anderson


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

Date: 27 Jul 1999 12:24:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: stopping email overflow on failure
Message-Id: <379d96d7@newsread3.dircon.co.uk>

toby <toby@venice.cas.utk.edu> wrote:
> 
> 'Let _loose_ the dogs of war' or something to that effect.
> 

Crie 'haddock' and unleash the cod of war ...

/J\
-- 
"Report accuses Royal Opera House of 'arrogance and elitism'. Report
further alleges that Pope is Catholic. Report further claims that bears
may well indeed defecate in the woods" - Private Eye


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

Date: 27 Jul 1999 12:36:50 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: stopping email overflow on failure
Message-Id: <379d99d2@newsread3.dircon.co.uk>

Steve . <syarbrou@enteract.com> wrote:
> On 26 Jul 1999 16:04:34 -0500, abigail@delanet.com (Abigail) wrote:
>>

<snip goldfish parable>

>>This is a general coding problem, not a Perl specific one. I assume you
>>can take the story above, and turn it into a solution more suitable for
>>a computer. If not, go ask in a general programming group.
>>
>>
> Whatever you looser.  And I say looser cause you have no clue what you
> are talking about and just wrote a page of crap.  Get a life.
> 

Look I'm in danger of filling a disk with my killfile the way that every
newbie and his cat gets out of their pram over Abigail's replies ...

/J\
-- 
"Over the years I've always had Max Factor in my box" - Tina Earnshaw,
Chief Make-Up Artist, Titanic


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

Date: Tue, 27 Jul 1999 10:17:39 +0100
From: "Clyde Ingram" <cingram@pjocs.demon.co.uk>
Subject: Unix 'comm' command - in Perl?
Message-Id: <933067301.10083.0.nnrp-08.9e98e5bc@news.demon.co.uk>

I need to compare 2 files with records up to 85,000 characters long (worst
case).
On Solaris 2.6, I hit a brick wall with the 'comm' command.  e.g, to find
records only in the first of 2 files:

        comm -23 oldfile newfile

and to find records only in the second:

        comm -13 oldfile newfile

The problem is that my implementation of 'comm' handles a maximum record
length of about 2,048.

Can some helpful person please point me to a Perl script to mimic 'comm',
without the bottleneck?

Thanks in advance for constructive replies,
Clyde Ingram




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

Date: 27 Jul 1999 06:35:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Unix 'comm' command - in Perl?
Message-Id: <379da789@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, "Clyde Ingram" <cingram@pjocs.demon.co.uk> writes:
:The problem is that my implementation of 'comm' handles a maximum record
:length of about 2,048.
:
:Can some helpful person please point me to a Perl script to mimic 'comm',
:without the bottleneck?

    http://language.perl.com/ppt/src/comm/index.html

It's missing its manpage, but this should help.

--tom
-- 
    "If you only have a nail, you tend to see every hammer as a problem."
    	--Larry Wall


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

Date: 27 Jul 1999 08:24:07 -0400
From: bj <bradw@newbridge.com>
Subject: Re: Which group is appropriate?
Message-Id: <op1r9lu702g.fsf@newbridge.com>

> John Callender wrote:
> > 
> > Abigail <abigail@delanet.com> wrote:
> > > Kevin Kinnell (kejoki@netdoor.com) wrote on MMCLIV September MCMXCIII in
> > > <URL:news:379A7B23.237A5761@netdoor.com>:
> > 
> > > ** Is there a group where Perl novices--who don't have all of
> > > ** the faqs memorized and are just exploring how to get things
> > > ** done--should be posting so that they may figure things out
> > > ** together instead of pestering the experts and exposing them-
> > > ** selves to the inevitable ridicule that attends learning how
> > > ** to fit into a new culture?
> > 
> [cut]
> > 
> > A group specifically for beginners could help ease some of the cultural
> > clashes, I believe. I've heard many of the standard arguments against
> > it, but I really think it would be worth a try.

Whom would babysit said group, answering the same FAQs over and over
again, correcting all the wrong answers, gently redirecting all the
lost, confused and clueless back to the road towards better
understanding? Without this, the group would be a disaster, from the
perspective of getting help.

If newbies would just grasp what an advantage it is to have such easy
access to subject matter experts, and try to play by a civilized set
of rules/conventions/culture c.l.p.m would work much better, and there
would be no need for comp.lang.perl.warm.fuzzy.safe. The support
available here is generally of high quality with beteer response times
than what I get from vendors who are under maintenance/support
contracts, partly due to the fact that with them I have to go through
various level of "frontline support" before I can access their subject
matter experts.

bj

-- 
bradw@newbridge.com            Newbridge Networks Corporation
Brad Warkentin                 600 March Road, Kanata, Ontario K2K 2E6
CAE Architect                  (613) 599-3600 ext. 6117  FAX: 599-3654


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

Date: 27 Jul 1999 13:40:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Which group is appropriate?
Message-Id: <379da8a7@newsread3.dircon.co.uk>

Kevin Kinnell <kejoki@netdoor.com> wrote:
> Jonathan Stowe wrote:
> ...
>> Er, comp.lang.perl doesnt exist - hasnt done for a while ...
> 
> That's what the faq says, but it exists on my ISP's news server,
> and on the local U's news server, and it gets quite a few 
> posts from many other domains than those I just mentioned--probably
> from people who haven't read the faq and don't realize it's just
> a figment.  ;-)
> 

Oh dear - It certainly isnt on the news-servers here and I would 
figure thats probably the case for nearly everyone.  I'd have a word
with your ISP if I were you - if they still have that group then theres
a strong possibility that you are also missing some groups that have
been created since ...


> I dunno the answer, but I think a c.l.p.novice group might cut the
> level of invalid posts to this group.  Non hackers would be more
> apt to stay in a group in which they felt less threatened.
> 

I personally dont think that this will work - there is another thread
in the same subject running at the moment where you will find a variety
of other opinions no doubt.

/J\
-- 
"Mark my words, sex is never enough. Sooner of later she'll want a
dishwasher" - Policeman, City Central


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

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

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


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