[11288] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4888 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 13 15:07:18 1999

Date: Sat, 13 Feb 99 12:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 13 Feb 1999     Volume: 8 Number: 4888

Today's topics:
    Re: "Learning Perl" (rogerDH)
    Re: "Learning Perl" <jeffp@crusoe.net>
    Re: Converting CSV to LDIF <gellyfish@btinternet.com>
    Re: cron <gellyfish@btinternet.com>
        Database integration in E-Commerce application? <sorcerer@NetVision.net.il>
    Re: extracting data from returned script <gellyfish@btinternet.com>
    Re: General  sort question (Abigail)
        Help a new Perl student Please <ceo@mptenterprises.com>
    Re: how do I call a perl script from bourne shell <gellyfish@btinternet.com>
    Re: How to dereference properly (Tad McClellan)
    Re: How to dereference properly (Marc-A. Woog)
    Re: newbie perl and cgi question..... <gellyfish@btinternet.com>
    Re: No. of lines in a file <rick.delaney@home.com>
        oops...sorry for that double post <ceo@mptenterprises.com>
    Re: parseInt <gellyfish@btinternet.com>
    Re: passing multiple arrays to a subroutine (Tad McClellan)
    Re: Perl and Solaris 7 for Intel problem <gellyfish@btinternet.com>
    Re: perl not always in /usr/bin/perl <gellyfish@btinternet.com>
    Re: perl password example <gellyfish@btinternet.com>
    Re: Perl programmers wanted (Tad McClellan)
    Re: PFR: mkpath (Was: Re: How to create a directory usi <dgris@moiraine.dimensional.com>
    Re: PFR: mkpath (Was: Re: How to create a directory usi <rra@stanford.edu>
        Please Help a New Perl Student <ceo@mptenterprises.com>
    Re: Python vs. Perl vs. tcl ? <gellyfish@btinternet.com>
        Q: How to peek 2 chars from STDIN? coppit@cs.virginia.edu
    Re: Running script locally in browser <gellyfish@btinternet.com>
    Re: sending mail from nt with perl 4.x...?? <gellyfish@btinternet.com>
    Re: Solaris: panic: corrupt saved stack index, <try> ch <gellyfish@btinternet.com>
    Re: Trying to get IP of a client machine <gellyfish@btinternet.com>
    Re: Using PERL system call with MS IIS 4.0 <gellyfish@btinternet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 13 Feb 1999 17:06:37 GMT
From: rogdh@iname.com (rogerDH)
Subject: Re: "Learning Perl"
Message-Id: <36c7b0df.98347376@news.earthlink.net>


>> chomp ($name);

Yes, as the other response saidj... "define doesn't work".
Perhaps the above line is incorrect.
Try  "chop" instead of "chomp"

rogerDH



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

Date: Sat, 13 Feb 1999 12:58:43 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: "Learning Perl"
Message-Id: <Pine.GSO.3.96.990213125509.19433K-100000@crusoe.crusoe.net>

>> chomp ($name);

> Try  "chop" instead of "chomp"

If you're getting an error about chomp(), and the code works fine when you
replace it with chop(), you're using an older Perl (< Perl5).  And if you
need the behavior of chomp() and not chop(), and chomp() doesn't exist, I
suggest you try:

	$string =~ s!$/*$!!;

chomp() depends on the $/ variable.  Learn about it in perlvar.

-- 
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: 13 Feb 1999 16:27:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Converting CSV to LDIF
Message-Id: <7a495r$40g$1@gellyfish.btinternet.com>

On Wed, 10 Feb 1999 10:45:24 +0100 Martin Lvnnar wrote:
> LDIF = LDAP Data Interchange Format.
> 

Right now we've got that sorted out we can get down to it ;-}

You can use the module Text::CSV (or some code derived from the example in
perlfaq5) to split your input file's fields into the appropriate variables
and then for each record print these records in the appropriate manner
for LDIF.  Because I neither know the format of your input file nor
remember the format of LDIF (beyond that is contains multiline records) I
wont attempt an example. 

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 15:18:17 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: cron
Message-Id: <7a453p$3ut$1@gellyfish.btinternet.com>

On Thu, 11 Feb 1999 22:12:57 GMT JJ wrote:
> Does anyone know of a way to do a type of cron with cgi? I cant get my isp
> to set up anything for me in cron..
> what I want to do is update a page automatically every 3 days
> 

Not really - I doubt that if your ISP wont allow you to have cronjobs
they will like you to have a long running Perl program either.  

You couldnt do something like this through CGI anyhow - generally CGI
implies a finite runtime (ever seen those Time out messages ?).

I would look at another way of automating this (perhaps with your own Linux
box that runs some job in cron that will do the update onto your ISP server
every once in a while )

Anyhow this is getting too far away from Perl.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 19:33:40 +0200
From: Adi Gabbai <sorcerer@NetVision.net.il>
Subject: Database integration in E-Commerce application?
Message-Id: <36C5B774.657FF9CB@NetVision.net.il>

Hi,
I am looking for a convenient and easy way to 'pull' database
information from my HTML.
The thing is, I wanna design an E-Commerce site. The main page
for example, will include, several products. Now instead of manuall,
playing around the page, and MANUALLY putting properties of products,
their names, their, IMG SRC pic, I wanna, just refer them from my
HTML page with something like:(I wish it could be that easy):
<H3><PRODCUTS SN:1002.LABEL></H3> <- That whould take the label field
                                     from my database for the 1002.

<IMG SRC=PRODUCTS SN:1002.PIC>    <- That would take the picture
                                     of the product.
The price is: <PRODUCTS SN:1002.PRICE  <-That would show the price

-----------------------------------------------------------
Well, you get the picture.
I just finished reading a 600pages book on Web development,
and i want to create an e-commerce site by my self.
(Not a program that will do it for me!)
I am unsure, if the way to do it, is using perl cgi-scripts
or .ASP scrips.

If someone, could help me, I would very much appreciate it.(-:


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

Date: 13 Feb 1999 19:03:04 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: extracting data from returned script
Message-Id: <7a4i98$47j$1@gellyfish.btinternet.com>

On 09 Feb 1999 22:02:09 +0100 Tony Curtis wrote:
> Re: extracting data from returned script, Thijs
> <T.Elenbaas@stud.tue.nl> said:
> 
> Thijs> Hello, I have a problem. I want to submit a
> Thijs> form to a site and grab the returned page, so
> Thijs> that I can extract the info I want. Is this
> Thijs> possible, and if so, can someone please help
> Thijs> me,
> 
> You don't mention perl anywhere but I assume you
> want to do this in perl.
> 
> Most of what you'll need to know is in:
> 
>     perldoc LWP
>     perldoc LWP::UserAgent
>     perldoc HTTP::Request

And not foregetting of course:

    HTML::Parser

Depending on what you want to do with the page.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 18:32:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: General  sort question
Message-Id: <7a4ggq$eam$1@client2.news.psi.net>

AWKYOU (corlando@NOTpop.phnx.uswest.net) wrote on MCMXCII September
MCMXCIII in <URL:news:36c515dc.0@news2.uswest.net>:
## Given the following as input from a text file:
## 
## 20555    red    green      1000  250
## 4678      blue   yellow      500    10004
## 20555    red    green       850    200
## etc         etc      etc           etc       etc
## 
## How do I  sum the last 2 fields  by the first 3?
## 
## in other words I want the  end report to display
## 
## 20555  red   green      1850    450
## 


while (<>) {
    chomp;
    my ($nums, $colour1, $colour2, @fields) = split;
    $sums -> {$colour1} -> {$colour2} ||= [0, 0, $nums];
    foreach my $i (0, 1) {
        $sums -> {$colour1} -> {$colour2} -> [$i] += $field [$i];
    }
}

foreach my $colour1 (keys %$sums) {
    foreach my $colour2 (keys %{$sums -> {$colour1}}) {
        print $sums -> {$colour1} -> {$colour2} -> [2],
              '   ', $colour1, '   ', $colour2,
              $sums -> {$colour1} -> {$colour2} -> [0], '   '
              $sums -> {$colour1} -> {$colour2} -> [1], "\n";
        }
    }
}



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


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

Date: Sat, 13 Feb 1999 14:35:47 -0500
From: "William M. Toohey" <ceo@mptenterprises.com>
Subject: Help a new Perl student Please
Message-Id: <36c5d4ad.0@208.148.50.4>

I am teaching myself to write CGI's in Perl from an otherwise great book.  I
know this is an elementary question, but without this piece of information,
I can do nothing.

Simply, I know Perl is a free language, but where do I type in the perl code
and how do I save it?

I code HTML in MS Word and save as text only with a .htm extension.
I code C++ in a compiler and compile and link the code.
What is the equivelant in Perl?

I tried writing the Perl Code in Word (named "first"), saving as text only
with a .cgi extention.
When I uploaded this to my server, it ended up being labeled "first.cgi.txt"
If I can only get over this bump, the rest of the book seems well written,
and the language itself seems rather easy for me to learn.  It just seems
that everyone forgot to include this basic instruction.

Thanking you all ahead of time for responses.

I am at ceo@mptenterprises.com

William M. Toohey




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

Date: 13 Feb 1999 18:50:38 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: how do I call a perl script from bourne shell
Message-Id: <7a4hhu$47b$1@gellyfish.btinternet.com>

On Tue, 09 Feb 1999 15:53:38 GMT mduwjd@maersk.com wrote:
> how do I call a perl script from bourne shell:
> 
> What would be the proper syntax to call perl from bourne and have the perl
> program run concurrently.  The perl script does decoding of web form data and
> prints it to a log file.  It is not necessary that the perl script return
> anything to bourne.
> 

I'm not entire sure of what you are trying to achieve here - Is there some
reason that you cant just run the Perl program directly ?

> I am trying the following code but the perl script does not pick up some of
> the data from the form. /usr/lpp/perl/track& <STDIN
> 

I think you meant something else - the redirection on the outside of the
ampersand will throw an error on most systems. Also I get :

bash: STDIN: No such file or directory

on my system with such a locution.


> This code decodes everything and prints it to the log but does not return to
> perl.
> /usr/lpp/perl/track


I think you should post us a bit more of your code in order to comment 
further.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 09:31:42 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to dereference properly
Message-Id: <us54a7.fl1.ln@magna.metronet.com>

Marc-A. Woog (mwoog@pobox.ch) wrote:

: I am doing my first steps with references and I am getting kinda
: crazy. I have stored references to hashes in the hash %levels. 


   You should have provided some code that shows that.

   1) the problem might be in the construction of the HoH, but
      we will not be able to help if that is where the problem is.

   2) We would know that you do in fact have a HoH. Which is not
      clear in what you _did_ give us, since you are dereferencing
      an _array_ in that code.

   3) It would have been Really Easy for you to provide it (see
      how I did it below) and would increase the liklihood of
      getting an accurate answer, as well as increase the
      number of Answerers who might take a stab at helping you
      with it (some might go to the next post rather than do
      the added work of making the construction).


: This
: seems to be working. 


   "seems" has a significant different semantic from "is"   :-)

   We would like to have been able to tell that from some code
   ourselves. Since you are having problems with HoHs to begin,
   it makes me uneasy to take your word for it.

   Providing code would have eased my uneasiness  :-)


: Now I would like to dereference the stored hashes
: and sort them by keys. But the sorting doesn't work, so I assume I am
: not dereferencing right (believe me: I've read perlref back and forth
: without even getting close).

: (-w and 'use strict' is on)


   Mucho Bueno!

   Kudos!


: foreach $key (sort keys %levels) {
:  print "$key\n";
:  foreach $level (@{$levels{"$key"}}) {
                   ^
                   ^

   At sign is for arrays.

   What array are you trying to get to?

   You said you had references to _hashes_ ...


: Could anynone help me out? Thanks for any answers!


   Sure.


-----------------------
#!/usr/bin/perl -w
use strict;

# construct a hash-of-hashes
my %levels = (
                lc => { one => 1, two => 2, three => 3},
                uc => { ONE => 1, TWO => 2, THREE => 3},
             );

foreach my $key (sort keys %levels) {
   print "$key\n";               # the "name" (key) of the subhashes (lc, uc)
   my %hash = %{$levels{$key}};  # dereference the _value_ of that key
   foreach my $bookmark (sort keys %hash) {
      print "$bookmark -> $hash{$bookmark}\n";
   }
}
-----------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 13 Feb 1999 16:44:49 GMT
From: mwoog@pobox.ch (Marc-A. Woog)
Subject: Re: How to dereference properly
Message-Id: <36c5aa8b.24230614@news.datacomm.ch>

On Sat, 13 Feb 1999 09:31:42 -0600, tadmc@metronet.com (Tad McClellan)
wrote in <us54a7.fl1.ln@magna.metronet.com>:

Hi Tad McClellan,

>Marc-A. Woog (mwoog@pobox.ch) wrote:
>
>: I am doing my first steps with references and I am getting kinda
>: crazy. I have stored references to hashes in the hash %levels. 
>
>
>   You should have provided some code that shows that.
>
>   1) the problem might be in the construction of the HoH, but
>      we will not be able to help if that is where the problem is.

[snipped]

As you may see in my follow-ups you are absolutely right: the problem
was constructing the "HoH". Sorry for that! Should have provided more
code but I tried to keep it short but this time I overdid it ;)

[snipped]

Thanks for your sample code and your help!

Regards,

Marc


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

Date: 13 Feb 1999 19:37:01 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: newbie perl and cgi question.....
Message-Id: <7a4k8t$47q$1@gellyfish.btinternet.com>

[removed the ridiculous alt.perl from newsgroups]

In comp.lang.perl.misc John Barrett <argus@sover.net> wrote:
> Here is a code snippet that I use a lot and works like a charm.
> 
> sub ReadParse {


OK thats fine and it seems to be better than most attempts but I still
dont think that it is any better than recommending to use CGI.pm which
is well documented, well debugged and isolates us Perl folk from the
exigencies of various OS/HTTP server combinations.

Using a module like this when dealing with some external interface allows
people to concentrate on the real application design issues rather than
messing about recreating something that has been done both well and
badly many times before.

People may retort that the monolithic CGI.pm is overkill for many
applications but if they find that to be the case there also its offspring
the CGI::* modules which place much of the functionality into several
module files.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 16:31:10 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: No. of lines in a file
Message-Id: <36C5AAA4.85183911@home.com>

[posted & mailed]

Greg Ward wrote:
> 
>    {} continue {
>        print or die "-p destination: $!\n";
>    }
> 
> Remember, any block can have a continue block -- it doesn't have to be 
> a loop (see perlsyn).

It does have to be a loop.  You can't use continue on an if-block for
instance.  This works because the bare block *is* a loop.  From perlsyn:

    A BLOCK by itself (labeled or not) is semantically equivalent to a 
    loop that executes once. Thus you can use any of the loop control
    statements in it to leave or restart the block. (Note that this is 
    NOT true in eval{}, sub{}, or contrary to popular belief do{} 
    blocks, which do NOT count as loops.) The continue block is 
    optional. 

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 13 Feb 1999 14:43:43 -0500
From: "William M. Toohey" <ceo@mptenterprises.com>
Subject: oops...sorry for that double post
Message-Id: <36c5d68a.0@208.148.50.4>

Sorry...some sort of glitch in my brain or something
serious lack of sleep here





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

Date: 13 Feb 1999 15:38:06 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: parseInt
Message-Id: <7a468u$3vb$1@gellyfish.btinternet.com>

On Thu, 11 Feb 1999 18:42:55 GMT bababozorg@aol.com wrote:
> hi
> there is a function in javascript:
> parseInt(number ,10)
> which give me a number less than "10" or any number i want!
> i am looking for the similar function in perl
> can you help me please

I think your understanding of how parseInt() works is incorrect:

>From the JavaScript documentation:

<QUOTE>

parseInt 

Function. Parses a string argument and returns an integer of the 
specified radix or base.

Syntax 

parseInt(string [,radix])

Parameters 

string is a string that represents the value you want to parse.

radix is an integer that represents the radix of the return value.

</QUOTE>

This would simply be done in Perl (ignoring the radix bit ) like:

$string = "string 999 with integer in it";

$number = parse_int($string);

sub parse_int
{
   my $string = shift;

   if ($string =~ /(\d+)/ )
     {
       return $1;
     }
   else
     {
       return undef;
     }
}


read the perlsyn and perlre manpages.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 08:54:12 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: passing multiple arrays to a subroutine
Message-Id: <km34a7.fl1.ln@magna.metronet.com>

Cybernetic Bear (cybear_x[nospam]@geocities.com) wrote:

: I am trying to pass two arrays to a subroutine, but its not working.
                                      ^^^^^^^^^^
                                      ^^^^^^^^^^

   So then, being a good 'net citizen, and cleverly wanting to
   get past this problem in the least possible amount of time,
   you decided you better have a look at what the documentation 
   that came with your perl has to say about subroutines.

   So you opened up 'perlsub.pod' (titled "Perl subroutines"),
   and right there on the very first page you saw that it said:

   (emphasis added)

----------------------
The Perl model for function call and return values is simple: all
functions are passed as parameters one single flat list of scalars, and
all functions likewise return to their caller one single flat list of
scalars.  Any arrays or hashes in these call and return lists will
collapse, losing their identities--but you may always use
          ^^^^^^^^^^^^^^^^^^^^^^^
pass-by-reference instead to avoid this.  Both call and return lists may
----------------------


   But there was some part of that that you did not understand.

   So then you posted with a Subject like "What is pass-by-reference?"
   or "What does 'losing their identities' mean?" or something,
   and this particular post does not exist.

   So how come I can see it then?

   :-)


   Use the docs Luke.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Feb 1999 14:54:09 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl and Solaris 7 for Intel problem
Message-Id: <7a43mh$3ui$1@gellyfish.btinternet.com>

On Fri, 12 Feb 1999 23:59:45 -0600 Barry Scott Densch wrote:
> 
> make: ar: Command not found
> 
> make: *** [libperl.a] Error 127
> 
> ******************************************************
> 
> I've tried everything this newbie can think of. Please help.  I am using
> GNUgcc 2.8.1 and GNUmake 3.77.  Both were compiled for i86 pc.
> 

The command 'ar' is part of the GNU binutils package I believe - if you
have not got this then you will need to download and install it.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 14:28:37 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl not always in /usr/bin/perl
Message-Id: <7a426l$3ue$1@gellyfish.btinternet.com>

On Thu, 11 Feb 1999 21:56:04 GMT David Combs wrote:
> In article <36BB51F8.42B749F4@giss.nasa.gov>,
> Jay Glascoe  <jglascoe@giss.nasa.gov> wrote:
>>Alan Diercks wrote:
>>> 
>>> Is there a clever way to avoid having to edit all of my scripts to fix
>>> the
>>>   #!/usr/bin/perl
>>> line at the top for each new installation?
>>
>>try
>>
>>#! /usr/bin/env perl
>>
>>as long as perl is somewhere in the luser's path,
>>this will find it.
> 
> Is the above a mistake?  What is that space before
> the "perl" in the #! line?
> 
No it isnt a mistake -


ENV(1)                                                     ENV(1)


NAME
       env - run a program in a modified environment

SYNOPSIS
       env    [-]    [-i]    [-u   name]   [--ignore-environment]
       [--unset=name] [--help] [--version] [name=value]...  [com-
       mand [args...]]


Of course I have no way of knowing whether this is portable to all Unices
but it certainly works for Linux.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 16:16:42 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl password example
Message-Id: <7a48ha$40a$1@gellyfish.btinternet.com>

On 11 Feb 1999 21:17:36 -0800 Randal L. Schwartz wrote:
> 
> print "Just another Unix security guy and Perl hacker,"
> 

JAUSGAPH ! Nasty ;-}

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 08:37:29 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl programmers wanted
Message-Id: <9n24a7.fl1.ln@magna.metronet.com>

KC (dont@send.me.nothing) wrote:

: I still new to Perl and can't tell if you're joking or not. What's the
: differance between PERL, Perl, and perl???


   Perl FAQ, part 1:

      "What's the difference between "perl" and "Perl"?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Feb 1999 11:14:58 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: PFR: mkpath (Was: Re: How to create a directory using perl on linux?)
Message-Id: <m3btiy9nml.fsf@moiraine.dimensional.com>

Russ Allbery <rra@stanford.edu> writes:

> Randal L Schwartz <merlyn@stonehenge.com> writes:

> > But but but why not just use the one that comes with Perl!
> 
> >     use File::Path;
> >     mkpath ("/some/place/I/want/to/have");
> 
> > No need to put anything in the repository... and this one's already
> > extremely portable!
> 
> And unlike a lot of other modules, actually just does this and one closely
> related thing (removing a path of directories).  Yeah, on this one, I'm
> with Randal.

This raises a good question (ok, it's actually several questions) that
I would like some help with.  

How general should the repository's contents be?  Should we avoid
anything that already has a better implementation elsewhere, or should
we celebrate TMTOWTDI?  In cases (like mkpath) where a good other
solution exists should I just put a pointer to the appropriate modules
into the repository?

My initial feeling is that we should err on the side of including too
much and possibly duplicating effort.  My reasoning is that it is far
easier to solve the indexing and searching problem that comes along
with too much data than it is to solve the content problem that comes
from having too little data.  But I can see Russ' and Randal's point.

Opinions?

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 13 Feb 1999 10:45:59 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: PFR: mkpath (Was: Re: How to create a directory using perl on linux?)
Message-Id: <yl1zjub0rc.fsf@windlord.stanford.edu>

Daniel Grisinger <dgris@moiraine.dimensional.com> writes:

> How general should the repository's contents be?  Should we avoid
> anything that already has a better implementation elsewhere, or should
> we celebrate TMTOWTDI?  In cases (like mkpath) where a good other
> solution exists should I just put a pointer to the appropriate modules
> into the repository?

> My initial feeling is that we should err on the side of including too
> much and possibly duplicating effort.  My reasoning is that it is far
> easier to solve the indexing and searching problem that comes along with
> too much data than it is to solve the content problem that comes from
> having too little data.  But I can see Russ' and Randal's point.

My gut reaction is to say include anything that has an obvious advantage
over what's available elsewhere.  In the case of mkpath, File::Path is
more portable and doesn't seem to be significantly slower, so I don't
really see the advantage, but it's a judgement call.

Adding a note to the documentation that File::Path is also available may
be sufficient and requires less editorial work.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sat, 13 Feb 1999 14:33:00 -0500
From: "William M. Toohey" <ceo@mptenterprises.com>
Subject: Please Help a New Perl Student
Message-Id: <36c5d406.0@208.148.50.4>

I am teaching myself to write CGI's in Perl from an otherwise great book.  I
know this is an elementary question, but without this piece of information,
I can do nothing.

Simply, I know Perl is a free language, but where do I type in the perl code
and how do I save it?

I code HTML in MS Word and save as text only with a .htm extension.
I code C++ in a compiler and compile and link the code.
What is the equivelant in Perl?

I tried writing the Perl Code in Word (named "first"), saving as text only
with a .cgi extention.
When I uploaded this to my server, it ended up being labeled "first.cgi.txt"
If I can only get over this bump, the rest of the book seems well written,
and the language itself seems rather easy for me to learn.  It just seems
that everyone forgot to include this basic instruction.

Thanking you all ahead of time for responses.

I am at ceo@mptenterprises.com

William M. Toohey




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

Date: 13 Feb 1999 17:17:53 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <7a4c42$470$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Jonathan Feinberg <jdf@pobox.com> wrote:
> There must be something wrong with my version of gnus.  I seem to have
> this bug wherein a discussion of the relative merits of various
> programming languages results in thoughtful and rational commentary by
> informed people.  Has this been addressed in 5.6?

Worry not I am working on a version of FlameReader (tm) that will act as a
filter to your newsfeed and will ensure that the appropriate flameage
is inserted as necessary.  It can be configured so that both inward and
outward feeds can be filtered as required - just think the luxury of a
flamewar without any typing on your (or anyones) part.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 13 Feb 1999 19:12:04 GMT
From: coppit@cs.virginia.edu
Subject: Q: How to peek 2 chars from STDIN?
Message-Id: <7a4iq0$pc6$1@nnrp1.dejanews.com>

I'd really appreciate some help with this...

My script is reading compressed data from STDIN, and depending on the type
of compressed data, invoking a different decompressor. Below is an example
of how I was hoping to do it (and what works for a normal file). Since the
data on STDIN is sensitive and sizable, I'd rather not write it to a
separate file.

Apparently the seek is failing for STDIN. Is there some way (perhaps using
tied filehandles) of reading the first two characters on STDIN without
modifying STDIN's buffer?

if ((-B STDIN) && (-s STDIN))
{
    binmode STDIN;

    my $testChars;
    read STDIN,$testChars,2;
    seek(STDIN,0,0);

    # between gzip'd and bzip2'd and tzip'd files is.
    if ($testChars eq "TZ")
    {
      $fileHandle->open("tzip -cd -|") or die;
    }
    elsif ($testChars eq "BZ")
    {
      $fileHandle->open("bzip2 -dc -|") or die;
    }
    else
    {
      $fileHandle->open("gunzip -c -|") or die;
    }

    Process($fileHandle);
    $fileHandle->close();
}

TIA,
David

_________________________________________________________________________
David Coppit - Graduate Student        coppit@cs.virginia.edu
The University of Virginia             http://www.cs.virginia.edu/~dwc3q
                "For I am a Bear of Very Little Brain,
             and long words Bother me" - Winnie the Pooh

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Feb 1999 15:47:29 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Running script locally in browser
Message-Id: <7a46qh$404$1@gellyfish.btinternet.com>

On 11 Feb 1999 07:55:07 GMT Brian Dean Swan wrote:

Please sort out your newsreader so it doesnt put your entire post in one
big line - I have reformatted.

>  I have successfully written some Perl scripts and tested them on a
> remote server and from the command line.  I am unable to view them in
> my browser.  All I get is the script in text form as if I asked to see
> the source.  I seen another entry which suggested mime type problem.

It is not a mime type problem - it is a server configuration problem.

> I don't see where this would cause a problem.  I am using Linux kernel
> 2.0.36 and I am somewhat new to it.  

Your Linux distribution should have come with an HTTP server that will
enable you to run CGI programs locally.  How you might achieve this
however is not a Perl question - If you are running Apache then simply
pointing your browser at http://localhost/manual/ should give you access
to the Documentation if it is a new and unblemished installation.

If you have further problems with your server software I might suggest
asking in comp.infosystems.www.servers.unix .

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 16:20:04 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: sending mail from nt with perl 4.x...??
Message-Id: <7a48nk$40d$1@gellyfish.btinternet.com>

On Tue, 09 Feb 1999 15:36:17 GMT dragnovich@my-dejanews.com wrote:

Subject: sending mail from nt with perl 4.x...??
                                        ^^^^^^^^
> 
> use Net::SMTP;
> 

<snip code>

> dont know if this can helps! you!
> 

Not on Perl 4 it wont.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 15:21:21 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Solaris: panic: corrupt saved stack index, <try> chunk 1.
Message-Id: <7a459h$3v0$1@gellyfish.btinternet.com>

On Thu, 11 Feb 1999 21:30:07 GMT Joe Loiacono wrote:
> Recent 'make test' of Perl 5.004_04 on Solaris 2.5 fails:
> 
> /perl5.004_04/t: ./perl base/term.t
> 1..7
> ok 1
> ok 2
> #3      :1: == :1:
> ok 3
> ok 4
> ok 5
> ok 6
> ok 7
> panic: corrupt saved stack index, <try> chunk 1.
> panic: corrupt saved stack index, <try> chunk 1.

I have seen this too with 5.004.04 I am not sure whether it is a bug in
Perl that only afflicts Solaris or a problem with Solaris itself (well
either way its a problem with Solaris really).

Whatever the cause of the problem it goes away with 5.005.02.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 15:03:45 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Trying to get IP of a client machine
Message-Id: <7a448h$3up$1@gellyfish.btinternet.com>

On Sat, 13 Feb 1999 13:54:52 +1030 Henry Penninkilampi wrote:
> fl_aggie@thepentagon.com:
>>rjsing@hotmail.com:
>>
>>+ I am currently facing a problem in obtaining IP address of a client
>>+ machine that is sending a request to my server. I am using
>>+ $ENV{REMOTE_ADDR} to obtain the IP address of the client. But what I am
>>+ getting is the IP address of the proxy server to which the client is
>>+ connected.
>>
>>1. This isn't a perl question
>>2. I don't think you can
> 
> Use JavaScript to obtain the IP address of the client's machine and submit
> this information along with the rest of the form as an invisible field.
> 

No.  Even if Javascript has a method of determining a clients IP number
this will of course not work if the client has turned off Javascript
or if the client does not support Jvavscript at all (I for one will use
Lynx to access sites where the graphical content is unimportant).

Secondly even given that your method *does* work the information will
be useless to you because the IP number of a client behind a proxy can
be completely bogus - at best they could be non-routeable at worst they
could be duplicates of legal network addresses.

Thirdly, neither the original question not your answer have anything to
do with Perl.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Feb 1999 18:59:04 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Using PERL system call with MS IIS 4.0
Message-Id: <7a4i1o$47e$1@gellyfish.btinternet.com>

On 9 Feb 1999 10:55:31 -0600 Rolland Suh wrote:
> 
> parent.pl
> 
> 	$|=5;					# Flush everything.
> 
> 	print "Content-type: text/html\n\n";
> 
> 	print "Trying to call child process.\n";
> 
> 	system "perl.exe child.pl"		|| die "Could not fork.";
> 
> 	print "Finished calling child process.\n";
> 
> 
> child.pl
> 
> $|=5;			# Flush everything.
> 
> 
> 	print "Hello World from the Child Process.\n";
> 
> 

An alternative is to use the backticks to retrieve the output of your
command into a variable and then print the contents of that variable in
your parent program - I would suggest that this possibly a better 
approach under a variety of platforms and not just the broken IIS - it
is necessary (In my understanding) with Apache/mod_perl because of the
way in which 'print' is overloaded in that module.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

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

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