[13061] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 471 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 11 22:07:13 1999

Date: Wed, 11 Aug 1999 19:05:11 -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           Wed, 11 Aug 1999     Volume: 9 Number: 471

Today's topics:
    Re: 'use strict' - what will I lose if I forgo the prag <tchrist@mox.perl.com>
    Re: ActivePerl PerlScript -- funny problems (Matt)
    Re: ActivePerl PerlScript -- funny problems (elephant)
    Re: CGI timeout problem <USENET@questionexchange.com>
    Re: embedded SQL (Sam Holden)
    Re: Getting perl to accept a flat table file <JFedor@datacom-css.com>
    Re: How to delete an element from an array <USENET@questionexchange.com>
    Re: Improving speed of a sub (Sam Holden)
    Re: is our reese the author of mysql book? (Abigail)
    Re: is our reese the author of mysql book? <JFedor@datacom-css.com>
    Re: Looking for a good Perl Book (Abigail)
    Re: meaning of $mode (lstat) <USENET@questionexchange.com>
    Re: Multi-Page Forms <USENET@questionexchange.com>
    Re: Multi-Page Forms (Sam Holden)
    Re: New to Perl <USENET@questionexchange.com>
    Re: Newbie: Sockets on Win32 (Chris)
    Re: Newbie: Sockets on Win32 (elephant)
    Re: Parse <USENET@questionexchange.com>
    Re: Parse (Damian Conway)
    Re: Perl Novice needs advice (Steve Linberg)
    Re: perl5.005_60 <USENET@questionexchange.com>
    Re: perl5.005_60 (Sam Holden)
    Re: Problem reading forms with perl <ijg@connect.org.uk>
    Re: Problem reading forms with perl (elephant)
        Question Exchange? (Randal L. Schwartz)
    Re: Question Exchange? (Sam Holden)
    Re: s/// and interpolation (Larry Rosler)
    Re: searching complex data structure <USENET@questionexchange.com>
    Re: Stopping output <richj@home.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 11 Aug 1999 19:06:44 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 'use strict' - what will I lose if I forgo the pragma?
Message-Id: <37b21e24@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Phil Voris <pvoris@earthlink.net> writes:
:I 'use strict;' because I think it makes for better programs.  However, I
:am currently working on a program for which I have the option to use a .rc
:config file containing executable Perl code (actually a large
:configuration hash).  In order to add this functionality, I would have to
:forgo the strict pragma because I cannot my the configuration hash.  

Huh?  What does that have to do with anything?  

    use strict;
    do "fooproggie.rc";

The fooproggie.rc file is not under strict, you know!  It's lexically
scoped, and unlike 

    eval `cat fooproggie.rc`;

the do will not only search @INC, it will more importantly bequeath to
the included code a completely unrelated lexical scope.  Since strictures
are lexically determined, there's no issue here.  Otherwise you'd go
crazy every time from a 'use strict' bit of code you then required or
used a module that wasn't built with use strict.

:What sort of performance hit should I expect if all code -- excepting this
:one configuration hash -- complies to strict, but the strict pragma is not
:used?

Performance is the wrong question; sanity and correctness are what it
will get you. :-)

--tom

-- 
Common sense is the collection of prejudices acquired by age 18.
      --Einstein


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

Date: Thu, 12 Aug 1999 01:19:42 GMT
From: mck@iag.net (Matt)
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <37b52107.24984786@news.iag.net>

On Mon, 9 Aug 1999 20:10:00 -0500, "John M. Dlugosz"
<john@dlugosz.com> wrote:

>Here is an illustration of the problem I mentioned earlier (see test.html
>file below).  If $main::document is assigned to, the Perl engine crashes.
>It doesn't even have to execute that statement -- just having it in the
>script is enough!  When the problem line is commented out, you will see a
>report on all the symbols in the main package.  'document' is not one of
>them.

It may also appear that referencing $document causes the same failure,
not only assinging it.



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

Date: Thu, 12 Aug 1999 11:35:17 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <MPG.121ccfe49fd35bc3989c13@news-server>

[ item posted to comp.lang.perl.misc and CCed to John M. Dlugosz ]

John M. Dlugosz writes ..
>Here is an illustration of the problem I mentioned earlier (see test.html
>file below).  If $main::document is assigned to, the Perl engine crashes.

$main::document (just like $main::window and a whole heap of others) is 
a special identifier within client-side scripting .. so that you can say 
things like

  $document->bgColor = 'FFFFFF';

you can't assign to it - the same way that you can't assign to $window 
 .. and yes - it'll be a compile problem - not a runtime problem .. so 
you don't have to pass over the code to see the error

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 12 Aug 1999 1:14:35 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: CGI timeout problem
Message-Id: <790qx@questionexchange.com>

> info about this.
> I have a CGI script which is used to migrate files from one
> server to
> another. It basically writes out a simple shell script with the
> commands
> needed to get the files where they are going. My problem is
> when I have
> a LARGE number of files, the browser wants to think the
> connection is
> dead and gives up. What I want to do is, while this shell
> process is
> running, print something to the brower every so often to keep
> it
> 'entertained'. What's a good way to accomplish this? Fork off a
> process?
> Mebbe I should read up on forking, but that just sounds a
> little messy.
> If I let the shell script run in the background is there a way
> to tell
> when it's finished, and I can quit feeding the browser 'dummy'
> data to
> keep the connection alive?
> Anyway, while I read a little more, if anybody has a ready
> answer, I
> would appreciate some help.
> TIA,
> Duane

So you want to do something like:
$pid = fork();
if($pid < 0) {
 # fork failed--
 # print error message and give up.
 exit(-1);
}
if($pid == 0) {
 # this is the child
 # just keep printing stuff
 # to the browser
 $| = 1;
 while(1) {
  print "still working...\n";
  sleep(5);
 }
} else {
 # this is the parent.
 # do whatever processing you need to do...
 # then call exit so both the parent and child go away.
 exit(0);
}

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2621&cus_id=USENET&qtn_id=2033


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

Date: 12 Aug 1999 01:32:28 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: embedded SQL
Message-Id: <slrn7r4927.74l.sholden@pgrad.cs.usyd.edu.au>

On Wed, 11 Aug 1999 18:05:24 -0700,
	Jason Simpson <jsimpson@haywire.csuhayward.edu> wrote:
>
>Disclaimer: I am new to perl and know absolutely nothing about SQL.
>
>I realize that, at least to the best of my knowledge, there is no standard
>which covers embedded SQL in perl. Can anyone please tell me if this is
>possible and where to find resources to guide me. Otherwise we're going to
>have to rewrite everything in C ? ? ?

Did you bother to read the FAQ? You know the doucmentation that comes
with perl that your meant to read when you have a question before
asking in the newsgroups.

=head1 Found in /usr/lib/perl5/5.00502/pod/perlfaq8.pod

=head2 How do I use an SQL database?



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

Date: Wed, 11 Aug 1999 22:02:39 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Getting perl to accept a flat table file
Message-Id: <7ot7ud$snl$1@plonk.apk.net>


Paul Foran wrote in message <37B1703D.3483F276@analog.com>...
>Andreas Fehr wrote:
>
>> On Wed, 11 Aug 1999 09:21:20 +0100, Paul Foran <Paul.Foran@analog.com>
>> wrote:
>>
>> >Can somebody tell me how to get perl to accept a comma delimited txt
>> >file and parse it contents.
>>
>> Yes, write some Perl code and run it with the filename as parameter.
>>
>> Andreas
>
>How can I do this exactly???
>paul.


Pay me $60 an hour and I'll write you the code and guarantee it to be Y2K
safe!

You can alway read the documentation that came with Perl or spend a few
hundred
dollars buying Perl books like the rest of us and learn how to do it
yourself!

Jody






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

Date: 12 Aug 1999 1:14:8 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: How to delete an element from an array
Message-Id: <788qx@questionexchange.com>

> Could someone please let me know if it is possible to delete an
> element from an array in perl?
> @array = ("one","two and three",4,"five");
> how do I delete '4' and be left with...
> @array = ("one","two and three","five");
> Thanks in advance,
> Dico

splice(@array, 2, 1);
This removes 1 element at offset 2
(counting from 0).  Check out the
section for splice() in 'man perlfunc'
for more information.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2618&cus_id=USENET&qtn_id=1995


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

Date: 12 Aug 1999 01:06:41 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Improving speed of a sub
Message-Id: <slrn7r47hs.74l.sholden@pgrad.cs.usyd.edu.au>

On Wed, 11 Aug 1999 07:59:34 -0400, Duncan Hill <dhill@sunbeach.net> wrote:
>On 11 Aug 1999, Sam Holden wrote:
>
>> On Tue, 10 Aug 1999 22:33:56 -0400, Duncan Hill <dhill@sunbeach.net> wrote:
>> >if one person hits it, but if several hundred people hit the same part
>> >at once, memory is gonna hurt.
>
>> But surely a copyright notice is reasonably small anyway maybe a few hundred K.
>
>In the case of a single CGI script calling a single file that is a
>couple of K, yes.  The snippet of code came from a CGI that handled 2
>different files.  One was the copyright, the other was the form that
>required the copyright to be read.  Now, lets assume that there are 40
>such scripts running on the server, and some of the forms are (for
>some reason) 40K+.  It adds up after a while.

40K * 40 => 1600K => about 1.5M

Pretty tiny for a machine that is running a web server that is forking
perl to run CGI scripts.

If RAM is a concern really then just use disk space, and store however many
hundred different versions of the document you need. 20M of disk space is
_really_ cheap.

-- 
Sam

i am not grouchy. i have a personality deficiency.
	-- Uri Guttman in <x7k8tshmn9.fsf@home.sysarch.com>


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

Date: 11 Aug 1999 20:32:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: is our reese the author of mysql book?
Message-Id: <slrn7r491p.d88.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCLXXI September MCMXCIII in
<URL:news:x74si69shc.fsf@home.sysarch.com>:
--
-- why initialize aggregates when they don't cause warnings when using them
-- uninitialized?

Have you ever wondered about this? Why is it that scalars being used 
unitialized cause a warning, but aggregates don't?

Haven't you ever wondered whether that might be a bug, and that Perl
actually should issue a warning? This gives a warning:

    my $foo;
    my $bar =  $foo + 1;

but this doesn't:

    my @foo;
    my @bar = (@foo, 1);

But aren't they very similar in nature? Why does "my $foo; my $bar =
$foo + 1" give a warning? Answer, because it's very likely you assume
$foo contains a value, and if it's uninitialized you probably made a
mistake. Very well then. Why doesn't the same argument hold for "my
@foo; my @bar = (@foo, 1)"?  I find that inconsistent. Either make both
a warnable offense, or allow both under -w. But allowing one, and not the
other makes we wonder wether coins were flipped. "Do we make $bar = $foo +
1" a warnable offensive?  *coin toss* "It's head, it's warnable". Ok, flip
the coin for "@bar = (@foo, 1)". *toss*. "It's tails, so it's allowable".
And I didn't even mention "my $foo; $foo = $foo + 1;" vs "my $foo; $foo ++;"
Warn for one, and not for the other, just doesn't make any sense at all.

And people wonder why some people don't like Perl.

-- uninitialized? it is just a waste of text and electrons. you can push
-- onto an array or access a hash element even thought they we just
-- declared with my.

Well, you can add and concatenate to uninitialized scalars as well. Isn't
turning on warnings just a waste of text and electrons?

I think people should use '-w'. I hope that it teaches people to write
better Perl. But if people do things just to avoid warnings, and don't
do other, similar things, just because it doesn't give a warning, then
-w has failed on them.

Getting your code to run such that no warnings are generated isn't the
ultimate goal.



Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


  -----------== 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 ==-----


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

Date: Wed, 11 Aug 1999 22:24:50 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: is our reese the author of mysql book?
Message-Id: <7ot980$eq$1@plonk.apk.net>


Uri Guttman wrote in message ...

>this is another reason why we should build a decent cgi repository. his
>stuff will infect kiddies for years if we don't.


I'd love to put a CGI repository on our website.  If you got the time Uri, I
got the space!

Jody




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

Date: 11 Aug 1999 20:37:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Looking for a good Perl Book
Message-Id: <slrn7r499b.d88.abigail@alexandra.delanet.com>

Elaine -HFB- Ashton (elaine@chaos.wustl.edu) wrote on MMCLXXI September
MCMXCIII in <URL:news:37B1966D.772CD4BB@chaos.wustl.edu>:
;; Abigail wrote:
;; > [] 3) get any unix book from O'Reilly
;; > 
;; > I'd trade all Unix books from O'Reilly for any book written by Kernighan
;; > or Pike.
;; 
;; abigail++ :) Marry me darling. 


Sure. How about Friday, Aug 20, around 3ish?

You'd think Kernighan would like to be the best man?


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== 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 ==-----


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

Date: 12 Aug 1999 1:15:16 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: meaning of $mode (lstat)
Message-Id: <793qx@questionexchange.com>

> --------------CD96ECC13D67E82A805ABEA6
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Can anybody explain me the meaninig of the mode field in the
> lstat
> returnvalue? For example a file with mode
> -rwxr-xr-x  gives the number 33261.
> Thank's for any help
>     Pedro
> --------------CD96ECC13D67E82A805ABEA6
> Content-Type: text/x-vcard; charset=us-ascii;
>  name="huesser.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Peter Huesser
> Content-Disposition: attachment;
>  filename="huesser.vcf"
> begin:vcard
> n:Peter;Huesser
> x-mozilla-html:FALSE
> org:Physikinstitut der Universitaet Zuerich
> version:2.1
> email;internet:huesser@physik.unizh.ch
> x-mozilla-cpt:;0
> fn:Huesser Peter
> end:vcard
> --------------CD96ECC13D67E82A805ABEA6--

Does the same thing as the C<stat()> function .....
perlfunc manpage, stat entry:
  2 mode     file mode  (type and permissions)
 ...
Because the mode contains both the file type and its
permissions, you
should mask off the file type portion and (s)printf using a
C<"%o">
if you want to see the real permissions.
    $mode = (stat($filename))[2];
    printf "Permissions are %04o\n", $mode & 07777;

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2617&cus_id=USENET&qtn_id=2108


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

Date: 12 Aug 1999 1:49:7 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Multi-Page Forms
Message-Id: <802qx@questionexchange.com>

> those multi-form questioners you see around the net. For
> example, when you
> first sign up or place an order at an online store you might be
> asked for
> your name and the username and password you want to use. Once
> you've finally
> found a username that isn't already being used, you're
> redirected to a form
> asking for your address. Then maybe, after filling out your
> address, your
> presented with a credit card form.
> Preferably, I'd like to use this in CGI, but anything will do
> for now. Is
> there a certain resource site that I might find cut-n-paste
> scripts of this
> procedure on? I've checked the usual suspects, such as cgi-
> resources.com
> and scriptsearch.com, but I can't seem to find anything like
> this. Maybe I
> just don't know what I'm looking for.
> I currently have an extremely long form that people fill out,
> and are then
> presented with a printable form with everything they filled out
> under the
> appropriate categories so that they can snail mail this form
> in. I'm using
> CGI to do this. I basically want to divide the long form up
> into 2 or 3
> different forms so there's not so much scrolling, etc.
> I'd appreciate any help on this matter.
> Thanks,
> Wayne

To use CGI you will need a host which allows you to run CGI
scripts.  CGI scripts can be written in many different
languages, however I do recomend using Perl.
The best suggestion I can make to you is to learn to use Perl.
There are a lot of good resources out there that will get you
started.  The best, however, are some books by O'Reilly and
Associates. Perl in a Nutshell and the Perl cookbook.  They've
bailed me out a lot, and I've also learned a lot about perl
from them.
Check out these web sites:
http://www.perl.org
(A list of tutorials)
http://www.perl.com/reference/query.cgi?tutorials

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2628&cus_id=USENET&qtn_id=1911


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

Date: 12 Aug 1999 01:55:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Multi-Page Forms
Message-Id: <slrn7r4ack.74l.sholden@pgrad.cs.usyd.edu.au>

On 12 Aug 1999 1:49:7 GMT, QuestionExchange <USENET@questionexchange.com> wrote:

<snip 30 line quote without attribution>

>To use CGI you will need a host which allows you to run CGI
>scripts.  CGI scripts can be written in many different
>languages, however I do recomend using Perl.
>The best suggestion I can make to you is to learn to use Perl.
>There are a lot of good resources out there that will get you
>started.  The best, however, are some books by O'Reilly and
>Associates. Perl in a Nutshell and the Perl cookbook.  They've
>bailed me out a lot, and I've also learned a lot about perl
>from them.
>Check out these web sites:
>http://www.perl.org
>(A list of tutorials)
>http://www.perl.com/reference/query.cgi?tutorials

Again you quote text without attributing it to anyone. 

Did you bother to read the question before answering?

Here are some snips :

In Original Post : I'm using CGI to do this.
In Answer : To use CGI you will need a host which allows you to run
   CGI scripts . CGI scripts can be written in many different
   languages, however I do recomend using Perl.

I think the original poster knows that much about CGI. I also suspect 
they are already using perl otherwsie they wouldn't have posted here.

Orignal Question : I basically want to divide the long form up into 2 or
    3 different forms so there's not so much scrolling, etc.
Answer : <there wasn't one, no mention of any solution>

This is obviously not a perl question. The answer will be the same
no matter what language is used. 

Do you really think your post was useful? Do you think it was more
useful than yesterdays answer by Randal L. Schwartz? 

-- 
Sam

comments on data are usually much more helpful than on algorithms
	--Rob Pike


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

Date: 12 Aug 1999 1:15:4 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: New to Perl
Message-Id: <792qx@questionexchange.com>

> I'm very new to PERL and have a few questions on how to create
> :
> 1) an edited temprary file  of an original file that is being
> read in
> 2) edit and save the original file in place
> What I'm trying to do is open a file then extract a string.
> After this
> string has been stored to a variable, I want to remove the
> additional
> white space  from the end of each line and use this edited text
> to send
> to a printer a number of times determined by the string value.
> Sounds
> simple enough?  I am able to create the temporary file but I
> get the
> error message:
> Use of uninitialized value at "filename" line nn, <> chunk nn.
> Where "filename" = the perl filename and nn = a number.
> What does this mean?  How do I correct it?  Below is an example
> of what
> I've done so far.  Thanks in advance for your help
> Kevin Newman
> knewman@mcs.com
> #!/usr/bin/perl -w
> use Getopt::Std;
> # Define the command line printer options
> getopts("d:");
> @ARGV == 1 or die "usage: label_printer -d<printer> \n";
> if($opt_d or die){
>    print "Printer Destination: $opt_d \n";
> }
> $command_line = join ($",@ARGV);
> print "Line Print Command $command_line \n";
> $line_print = "lp";
> # Assign the command line printer options list
> $print_options = "-d$opt_d";
> print "Print Options: $print_options \n";
> # Initialize found_copies to 0
> $found_copies = 0;
> #Just a temp file.  I would really like the
> # filename to be the original filename.tmp
> $new = "dummy2";
> # Look for the Keyword ^FX COPIES = nnn ^FS (Case is not
> important)
> # if one occurance of the copies line is found the if statement
> will
> # not be entered again, but the file will continue to be
> cleaned of
> spaces
> open (NEW, "> $new") or die "can't open $new: $!";
> select (NEW);
> while ($line = <> ) {
>      if ($line =~ m/^(\^FX\s*COPIES\s*\=\s*([0-9]+)\s*\^FS)/i
> &&
> $found_copies == 0)
>      {
>  #DEBUG CODE
>         print "inside of the if statement";
>         $nmbr_of_labels = $2;
>         $found_copies++;
>  #DEBUG CODE
>  print "FOUND COPIES = $found_copies \n";
>      }
> $line =~ s/ *$/END/;
> print NEW $_ or die "can't write $new: $!";
> print $line;
> }
> close(NEW)   or die "can't close $new: $!";
> # Now print the labels
> # for ($i = 0; $i < $nmbr_of_labels; $i++) {
> #    @args = ($line_print, $print_options, $command_line);
> #    print "@args \n";
> #    system(@args) == 0 or die "system @args failed: $?"
> #}
> #

do
print NEW $line
and not
print NEW $_
Perl realized that you were using $_ that didn't have value
inside it and printed to you the helpful message - all you need
to do is to look in your program at that line number (nn) and
see what is causing the message.
BTW: you might want to look at the -i parameter, see perlrun
manpage

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2619&cus_id=USENET&qtn_id=2100


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

Date: Thu, 12 Aug 1999 01:24:54 GMT
From: chrisl@tourneyland.com (Chris)
Subject: Re: Newbie: Sockets on Win32
Message-Id: <37b221ba.12107596@news.swbell.net>

>Chris .. lamer .. go see my reply to your post yesterday entitled 
>"Newbie: Looking for help/info on Sockets with Win32"
>
>and try not to post the same question over again .. it makes people who 
>help want to go back and cancel their other articles

Thanks for the really swell advice, elephant. Someone used my computer
the other day and reset the date (they thought mine was wrong), so I
didn't see my posting (or any others). So my posting of the previous
day didn't appear where I expected, and I didn't see it, so I
reposted.

You might want to think about trying some of the Eastern Religions
newsgroups, elephant, for an apparantly greatly needed dose of inner
peace.
>
>-- 
> jason - elephant@squirrelgroup.com -



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

Date: Thu, 12 Aug 1999 11:38:54 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Newbie: Sockets on Win32
Message-Id: <MPG.121cd0b7a0118297989c15@news-server>

Chris writes ..
>You might want to think about trying some of the Eastern Religions
>newsgroups, elephant, for an apparantly greatly needed dose of inner
>peace.

I hope you've already read my response to your previous post .. the 
response that told you where to find sockets examples .. because I'm 
feeling petty - so I've cancelled the article

*plonk*

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 12 Aug 1999 1:14:50 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Parse
Message-Id: <791qx@questionexchange.com>

> himself?)  I'm having trouble with error reporting and
> optional subrules in a production, probably best demonstrated
> with a short example:
> my $txt = "(FILE (VERSION 1) (REV X) (FRUIT banana))";
> my $gmr = q{
>   file   : '(' 'FILE'  headers fruit ')' /\Z/
>   headers: version(?) rev(?)
>   version: '(' 'VERSION' /\d+/ ')' | <error>
>   rev    : '(' 'REV'     /\d+/ ')' | <error>
>   fruit  : '(' 'FRUIT'   /\w+/ ')' | <error>
> };
> Parse::RecDescent->new($gmr)->file($txt);
> This produces:
>   ERROR (line 1): Invalid fruit: Was expecting 'FRUIT'
>     but found "REV X) (FRUIT banana))" instead
> I was expecting it to complain about X, not FRUIT.
> I discovered that if I made the subrule rev
> non-optional ("headers: version(?) rev"), it would work:
>   ERROR (line 1): Invalid rev: Was expecting /\d+/
>     but found "X) (FRUIT banana))" instead
> Alternatively, I found another way to trigger expected
> results was to inline the "headers" rule:
>   file : '(' 'FILE' version(?) rev(?) fruit ')' /\Z/
>   ERROR (line 1): Invalid rev: Was expecting /\d+/
>     but found "X) (FRUIT banana))" instead
>   ERROR (line 1): Invalid fruit: Was expecting 'FRUIT'
>     but found "REV X) (FRUIT banana))" instead
> From looking at $::RD_TRACE, I can tell that
> rule:rev fires and fails each time; it's just a question
> of whether that error gets pruned or not.
> Any ideas on what's going on here, or, at least, how I
> can get the desired behaviour without in-lining?
> This is perl5.00503 under x86 RedHat Linux 6.0,
> Parse::RecDescent version 1.66.
> Thanks,
> Rand.

The thing to do here is to use the <commit> directive after you
have seen the REV token - then RecDescent will know that it
shouldn't backtrack to try other alternatives any more.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2620&cus_id=USENET&qtn_id=2071


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

Date: 12 Aug 1999 01:22:24 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Parse
Message-Id: <7ot7kg$okp$1@towncrier.cc.monash.edu.au>

QuestionExchange <USENET@questionexchange.com> writes:

>The thing to do here is to use the <commit> directive after you
>have seen the REV token - then RecDescent will know that it
>shouldn't backtrack to try other alternatives any more.

Nice thought, but it doesn't work that way.

<commit> is local to the current rule, so if you put the <commit> in
the middle of 'rev', when we get back to the 'header' rule--and
eventually back to the 'file' rule--the commitment is already forgotten
(at the end of 'rev').

Damian


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

Date: Thu, 12 Aug 1999 01:52:09 GMT
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: Perl Novice needs advice
Message-Id: <slinberg-1108992152100001@cc11620-a.lwmrn1.pa.home.com>

In article <37B20C75.32F7A3A9@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:

> Since you're on a PC already, I'll assume you have ActiveState
> Perl.

Arrgh!  Why assume that PC eq "Windows"?

Even if it's likely, let's not assume that.  :)


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

Date: 12 Aug 1999 1:22:27 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: perl5.005_60
Message-Id: <799qx@questionexchange.com>

> 'make' at the point where I get the message "Installing ld2
> into
> /usr/local/bin".  At that point, I get a ton of "=head1: not
> found"
> messages, then things *really* go to hell.  It seems as if the
> 'sh
> Configure' command gets reissued (it starts through the
> Configure
> questions again).  Prior to that, it seems to try to fork
> everything
> in the joint including me, but fails.  Well, except for me.
> I'm 'bout
> done.  The only thing I can do once it starts the Configure
> questions
> again is Ctrl+C, which totally trashes my machine.  By the time
> I get
> back in, there is no ld2 anywhere.
> But up until that point, things seem to be fine except for
> during the
> make dependencies section I get a number of "Permission denied"
> warnings wrt types.h, config.h, stddef.h, stdarg.h, ctype.h,
> stdlib.h
> and so forth.  There may be more; those are just the ones I
> managed to
> jot down during scroll-by.  Since things seem to proceed fine
> afterward (until ld2), I just took these as warnings I could
> ignore.
> No?
> I am aware of the advice in README.cygwin re: 'make' failing at
> ld2,
> but the solutions it suggests don't work for me.  For one
> thing, I can
> never achieve ld2-ness ... so I can't put the thing into any
> path
> anywhere.  As far as I can tell, ld2 never gets made... or, I
> believe
> there is a message that pops up after I do the Ctrl+C about
> 'ld2 being
> deleted'.  But if I don't Ctrl+C it appears I'll be stuck in an
> endless loop.  I did find an ld2.in file (part of the kit,
> apparently)
> which I tried renaming and putting into the path, just out of
> desperation, you understand, but that didn't seem to make any
> difference.
> Is there anybody (anybodies) in here willing to help me get
> past this
> ld2 jam?  I'm willing to post all the detail you might need
> (path,
> mount table, etc.) to help you help me diagnose the problem.  I
> didn't
> want to do it now for fear that I would get yelled at for being
> in the
> wrong group or something.  This is a perl, problem, of course.
> But it
> also is an OS problem, so, I dunno ...
> As a start, I'm using gcc 2.95 from the recommended site.  I'm
> not
> using the egcs version used in README.cygwin because that
> version's
> Readme says it has been 'obsoleted' by 2.95.  Also, I am using
> cygwin-b20.1.
> I'm not very experienced or skilled at this sort of thing.  I'd
> very
> much appreciate any advice that can get me past this ld2
> nightmare.
> --
>  mrw

5.00x_5* and 6* etc. are.
The stable, supported releases are
5.005_0*
so they would be recommended. If you have a reason to use the
development release, you should file a bug report about this
through the appropriate channels (perlbug).

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2623&cus_id=USENET&qtn_id=2081


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

Date: 12 Aug 1999 01:41:07 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: perl5.005_60
Message-Id: <slrn7r49ie.74l.sholden@pgrad.cs.usyd.edu.au>

On 12 Aug 1999 1:22:27 GMT,
	QuestionExchange <USENET@questionexchange.com> wrote:
<snip 67 lines of unattributed quote (with its format messed up I suspect>

<snip 6 lines of reply which would have been 4 lines if
it was formatted in the standard used in English>

Do you really need to quote all that to say just that?

Do you really need to screw with the formatting so badly?

Do you really need to be anonymous?

I hope your not an 'expert' at whatever questionexchange.com is.

-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


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

Date: Thu, 12 Aug 1999 00:16:09 GMT
From: Ian Garlick <ijg@connect.org.uk>
Subject: Re: Problem reading forms with perl
Message-Id: <37B21248.89DD8510@connect.org.uk>

genelong@my-deja.com wrote:

> You misunderstand, Trond - I don't want to manipulate, I want to retain
> it.  Right now all text inside of angle brackets gets dropped.  If I
> enter "Joe <joe@domain.com>" on the form, by the time the text gets to
> the program, all I have is "Joe ".  I lose the rest.  That's the whole
> problem.

Are you sure?How can you tell?
Do you just print it to the browser to check it? I am betting you do.

If so I would hot foot it over to comp.infosystems.www.authoring.cgi quick
and ask them why you can't see the "<joe@domain.com>" part in the HTML
page.

If your really brave though you could fly by the seat of your pants and do
something radical and check the source with your browser to see just what is

being "printed".

I could be way of base here and if so ignore these ramblings, but this
thread is
huge for what just appears to be confusion by someone who doesn't comprehend

the HTML spec.

Ian




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

Date: Thu, 12 Aug 1999 11:28:49 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Problem reading forms with perl
Message-Id: <MPG.121cce594e6a5cdd989c12@news-server>

Ian Garlick writes ..
>genelong@my-deja.com wrote:
>> You misunderstand, Trond - I don't want to manipulate, I want to retain
>> it.  Right now all text inside of angle brackets gets dropped.  If I
>> enter "Joe <joe@domain.com>" on the form, by the time the text gets to
>> the program, all I have is "Joe ".  I lose the rest.  That's the whole
>> problem.
>
>Are you sure?How can you tell?
>Do you just print it to the browser to check it? I am betting you do.

you're "betting" ? .. why don't you read the original post BEFORE you 
make a fool of yourself .. in the original our misguided Gene tells 
where the strings are being outputted .. and it aint to the browser

>I could be way of base here and if so ignore these ramblings

too late .. you should put this at the top - then we would have the 
opportunity to ignore you before reading what you wrote

>...but this thread is huge for what just appears to be confusion by
>someone who doesn't comprehend the HTML spec.

too bad more of the thread wasn't comprehended by you .. then you might 
have saved us all the bother

Gene .. as it has always been .. the answer is that whatever function 
you're using to create the %FORM hash is stripping out everything in 
"<>"s .. so instead of using that function you need to use the CGI 
module included with the standard distribution

go get the standard Win32 port of Perl from 
http://www.activestate.com/ActivePerl/

then read up on the CGI module in the included documentation .. then use 
it

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 11 Aug 1999 18:48:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Question Exchange?
Message-Id: <m1k8r17or3.fsf@halfdome.holdit.com>


Uh, who *is* question exchange, and why are they hiding behind a pseudonym?

I object to such postings polluting up clpm.

Yeah, yeah, I know where the kill key is. :)

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 12 Aug 1999 02:01:51 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Question Exchange?
Message-Id: <slrn7r4ap9.74l.sholden@pgrad.cs.usyd.edu.au>

On 11 Aug 1999 18:48:32 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
>Uh, who *is* question exchange, and why are they hiding behind a pseudonym?

Seems to be some strange web page about questions and answers. 
I just hope this isn't their interpretation of an 'expert'

finger -l @questionexchange.com
[questionexchange.com]
Login: hgonzalez                        Name: hector gonzalez
Directory: /home/hgonzalez              Shell: /bin/bash
On since Wed Aug 11 20:53 (EDT) on ttyp0 from user-2ive9c4.dialup.mindspring.com
Last login Wed Aug 11 21:17 (EDT) on ttyp1 from user-2ive9c4.dialup.mindspring
No mail.
No Plan.


Anyway I'm pressing that 'k' key.



-- 
Sam

Computers in the future may weigh no more than 1.5 tons.
	--Popular Mechanics, 1949


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

Date: Wed, 11 Aug 1999 18:16:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: s/// and interpolation
Message-Id: <MPG.121bc033ad839a44989e40@nntp.hpl.hp.com>

In article <linberg-1108991523490001@ltl1.literacy.upenn.edu> on Wed, 11 
Aug 1999 15:23:49 -0400, Steve Linberg <linberg@literacy.upenn.edu> 
says...
 ...
> Like I said, any use of "eval" should throw up blasting red lights and 
> sirens.

Just to clarify for the unaware, you mean 'eval STRING'.  Uses of 'eval 
BLOCK' are quite different and quite benign.  Unfortunately, the same 
keyword is used for each.

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


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

Date: 12 Aug 1999 1:15:29 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: searching complex data structure
Message-Id: <794qx@questionexchange.com>

> The key structure that I've pared down my search looks
> something like
> this.
> /       \                       /         \
> | alpha |                       | apples  |
> | beta  |   /   \    /     \    | oranges |
> | gamma |-> | A | -> | dog | -> | bananas |-> [list of stuff]
> |   .   |   | B |    \     /    |    .    |
> |   .   |   \   /               |    .    |
> \       /                       \         /
>    V          W         X            Y             Z
> Where V is all possible keys at that level.
>       W only 2 possible keys
>       X only 1 possible key
>       Y is all possible keys at that level
>       Z all elements of the list
>      call the structure %stuff
> I am looking for a specific Y and Z (my search criteria).
> I can only think of 2 ways to search this.
> 1) loop through all levels and dump them into a list where the
> elements
> are basically flat text:
>    V:W:X:Y:Z[0]
>    V:W:X:Y:Z[1] ... ad nauseaum
>    Then I grep through that finding all matches.
>    This seems rather "wrong" on a gut level.
> 2) Loop through the keys thusly:
> $k4 = 'criterium1';
> $v  = 'criterium2';
> $k3 = 'dog';
> K1:foreach $k1 ( keys %stuff )
> {
>     K2:foreach $k2 ( qw/A B/ )
>     {
>         if ( exists ( $stuff{$k1}{$k2}{$k3}{$k4} ) )
>         {
>             push(@matches, grep( @{$stuff{$k1}{$k2}{$k3}{$k4}})
> )
>         }
>         else
>         {
>             next K2;
>         }
>     } # K2
> } # K1
> This is the search I am using, but I feel there is a more
> idiomatic
> method of doing this (and probably more efficient).
> TIA,
> joe
> --
> /===================================================\
> | Joe Kline                       | I used to be    |
> | E-Mail: Joe.Kline@sdrc.com      |   anonymous     |
> \===================================================/

The "next K2" command is superfluous and to me it would look
more idiomatic if you wrote the "if" *after* the command, i.e.
push(@matches, grep( @{$stuff{$k1}{$k2}{$k3}{$k4}}) )
 if $stuff{$k1}{$k2}{$k3}{$k4};
In fact, if you are not using "strict", you can just leave out
the if altogether in recent versions of Perl.
That's about as idiomatic as it's going to get.
If your structure is large etc. you might want to take a look
at SQL and DBI.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2614&cus_id=USENET&qtn_id=2121


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

Date: Thu, 12 Aug 1999 01:30:09 GMT
From: Joan Richards <richj@home.com>
Subject: Re: Stopping output
Message-Id: <37B1B39D.B17A6311@home.com>

> >RTFFAQ.
>
> Which one are you referring to ?

Michael - did you ever receive a response from abigail on this one?

JC - J




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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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