[15591] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3004 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 10 14:05:51 2000

Date: Wed, 10 May 2000 11:05:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957981919-v9-i3004@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 10 May 2000     Volume: 9 Number: 3004

Today's topics:
    Re: a cgi.pm question - carrying variable state across  <jeff@vpservices.com>
    Re: after the whatever.cgi?  question? <nospam@devnull.com>
    Re: Array of Structs. <nospam@devnull.com>
    Re: Array of Structs. <uri@sysarch.com>
    Re: Array of Structs. <nospam@devnull.com>
    Re: BEGIN and use <aqumsieh@hyperchip.com>
        Beginner: 8bit-regexp ocromm@my-deja.com
    Re: conversion hex->ascii, ascii->mif, oder hex->mif <Matthias.Kleine@prs.de>
    Re: conversion hex->ascii, ascii->mif, oder hex->mif <lr@hpl.hp.com>
    Re: Converting Macintosh files to UNIX <nospam@devnull.com>
    Re: Converting Macintosh files to UNIX <nospam@devnull.com>
    Re: Converting Macintosh files to UNIX <nospam@devnull.com>
        DBD:ODBC basic question <digital_puer@hotmail.comet>
        Digest javascript within perl? <pautler@hawaii.edu>
    Re: Help Needed  - Perl Matching Operator <lr@hpl.hp.com>
    Re: Help Needed  - Perl Matching Operator (Abigail)
    Re: Help Needed  - Perl Matching Operator (Ilya Zakharevich)
    Re: Help Needed  - Perl Matching Operator (Ilya Zakharevich)
    Re: host checking <rootbeer@redcat.com>
    Re: How many times is it found? <aqumsieh@hyperchip.com>
    Re: Mass email question... (Abigail)
        Modem communication in Perl baeron@my-deja.com
    Re: NetworkSolutions - example of lapse security <rootbeer@redcat.com>
        Newbie looking for pointers <news@alba1314.demon.co.uk>
    Re: Newbie looking for pointers (Tad McClellan)
        Perl & Expect see_plus_plus@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 10 May 2000 09:25:17 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: a cgi.pm question - carrying variable state across multiple  invocations of the same script
Message-Id: <39198D6D.BE0DB64C@vpservices.com>

"Eric J. White" wrote:
> 
> Putting all the vars I want to carry over from page to page in hiddne fields
> works great.  Now I'm wondering if there's a way to do it w/o having to name
> each var individually on each page.  I'm going to end up with 100 or so vars
> that I want to carry over, so it's be nice to be able to just add each page's
> vars to an array or a hash. I've treid this but it doesn't seem to work.  Any
> 'foreach' construction that I use seems to only carry over the vars from the
> previous page, once again dropping, say the page 1 vars at page 3.

Did you try something like this:

First set up an array of arrays with the first array the number of the
form the variable is gathered on, and the second an array of variables
gathered on that form do that once for all forms and all variables:

my @vars;
$vars[1] = ['name','age','sex'...];
$vars[2] = ['famSize',...];
 ...

That should be a list of the *names* of the variables, not of their
values.  The values will be supplied automagically by CGI.pm's sticky
feature.

Then, as you create a new form, cycle through all the forms *prior* to
your current form (i.e. all the vars you already have values for):

my $last_form = number of last form filled out;
for(0..$last_form) {
    for(@{$vars[$_]}) {
        print hidden( -name => "$_" );
    }
}

Also, I forgot to mention yesterday that using hidden fields is only one
way of saving state in CGI.  Two others include cookies and files.  If,
instead of passing hidden fields, you keep writing the info to a cookie
file on the user's computer, you can refresh that file with an
ever-increasing hash like so:

             $cookie=$query->cookie(-name=>'family information',
                                    -value=>\%childrens_ages);

But cookies have various problems, e.g. that some users may not have
them or may have turned them off. For the file method, see the CGI.pm
docs section "Saving the state of the script to a file".  In fact you
should probably do a thorough read of the docs, paying special attention
to hidden fields, and stickiness, and to everything that mentions
"state".

One other thing I should mention, seeing as your subject matter is
potentially sensitive: storing the information in hidden fields means
that anyone who comes along and saves a particular form page or a cache
of it can view those hidden fields with the "view source" mechanism --
they are hidden only from those who don't look further than the page
that is shown to them, so you may have some privacy concerns here.

That ought to be enough to keep you busy for a while :-)

-- 
Jeff


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

Date: 10 May 2000 15:33:15 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: after the whatever.cgi?  question?
Message-Id: <8fbvfr$op6$0@216.155.32.13>

In article <gb_R4.431$94.21316@news.uswest.net>, 
jerome@activeindexing.com (Jerome O'Neil) wrote:

 | In article <8f9nsg$4a4$5@216.155.32.13>,
 | 	The WebDragon <nospam@devnull.com> writes:
 | 
 | > Erick, your effrontery is only exceeded by your behindery. =:P
 | 
 | You owe me a new keyboard, and I have to go fill my coffee cup, and
 | change my shirt.
 | 
 | Stop that!

I do believe I did mention earlier that I was only a newbie to perl, and 
not to USENET in general :D 

*chuckles* and slips Jerome a Dogfish Head Shelter Pale Ale 
<http://www.dogfish.com> to 'pay' for the drycleaning.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 10 May 2000 15:49:36 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Array of Structs.
Message-Id: <8fc0eg$op6$1@216.155.32.13>

In article <39187336.C156BB3@walgreens.com>, "Andrew N. McGuire" 
<andrew.mcguire@walgreens.com> wrote:

 | nfin8axs@hotmail.com wrote:
 | > 
 | > I am fairly new to perl, and am having one primary difficulty:
 | > I have so far been unsuccessful with crating an array of structs.
 | > eg I want an array with 50,000 slots, but I want each slot to contain 
 | > a
 | > record with three slots (something like : array[30].A = 'something' 
 | > the
 | > a field of the 30th box in the array contains the string "something") 
 | > .
 | > What is the syntax for declaring such a data type can someone provide 
 | > an
 | > example of how do do such a thing without having to use a hash table?
 | 
 | #!/usr/bin/perl -w
 | 
 | use strict;
 | 
 | # A list of lists.
 | my @LoL = ( [ 0, 1, 2 ],
 |             [ 3, 4, 5 ],
 |             [ 6, 7, 8 ] );
 | 
 | # Print all elements in matrix.

 | print @{$_} for @LoL;

this line generates a syntax error on my system.. however this works 
fine : 

for (@LoL) {
    print "@{$_} \n"
};

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 10 May 2000 15:57:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Array of Structs.
Message-Id: <x7vh0mtn28.fsf@home.sysarch.com>

>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:

  TW> In article <39187336.C156BB3@walgreens.com>, "Andrew N. McGuire" 
  TW> <andrew.mcguire@walgreens.com> wrote:

  TW>  | print @{$_} for @LoL;

  TW> this line generates a syntax error on my system.. however this works 
  TW> fine : 

the for statement modifier was added in 5.005. you probably have an
earlier version of perl. at least you should upgrade to that if not 5.6.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 10 May 2000 18:00:27 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Array of Structs.
Message-Id: <8fc83r$dd4$2@216.155.32.13>

In article <x7vh0mtn28.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 | >>>>> "TW" == The WebDragon <nospam@devnull.com> writes:
 | 
 |   TW> In article <39187336.C156BB3@walgreens.com>, "Andrew N. McGuire" 
 |   TW> <andrew.mcguire@walgreens.com> wrote:
 | 
 |   TW>  | print @{$_} for @LoL;
 | 
 |   TW> this line generates a syntax error on my system.. however this 
 |   works 
 |   TW> fine : 
 | 
 | the for statement modifier was added in 5.005. you probably have an
 | earlier version of perl. at least you should upgrade to that if not 5.6.
 | 
 | uri

damn.. there's not a newer build of MacPerl than 520r4 (perl 5, Mac 
revision 2.0 patchlevel 4) 

Tried looking up some of the FAQ's on the web, but none seem to have any 
info regarding pending future releases.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 10 May 2000 17:03:29 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: BEGIN and use
Message-Id: <7an1lyqqvx.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


Larry Rosler <lr@hpl.hp.com> writes:

> In article <391852C5.7C00E935@walgreens.com> on Tue, 09 May 2000 
> 13:02:45 -0500, Andrew N. McGuire <andrew.mcguire@walgreens.com> says...
> > Larry Rosler wrote:
> 
> ...
> 
> > > That all makes sense, though I wonder how many Perl programmers writing
> > > a block like
> > > 
> > >     {
> > >         STATEMENT;
> > >         STATEMENT;
> > >     }
> > > 
> > > realize that there are *three* statements in the body of the block.
> > > (Operationally, it doesn't matter, of course.)
> > 
> > I am afraid I don't follow you here.  Could you please explain
> > this in a little more detail?
> 
> Well, as we now know, a semicolon is a statement separator, not a 
> statement terminator.  So there is a null statement after the second 
> semicolon and before the closing brace.

I hope that any difference between 

	{
		STATEMENT;
	}

and

	{
		STATEMENT
	}

is compiled away before the script starts running though!

--Ala


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

Date: Wed, 10 May 2000 15:29:43 GMT
From: ocromm@my-deja.com
Subject: Beginner: 8bit-regexp
Message-Id: <8fbv8o$7ui$1@nnrp1.deja.com>

Hello,

I'm using regexps to find similar strings in a dictionary (to describe
it easily), but they're all in German, and perl doesn't like my
non-7bit-characters in regexps (fine with strings, though).

A quick search shows me that it has to do with uing the locale, but how
do I do it? Where can I find example code?

The standard locale on my computer is Japanese, and should remain so.

Many thanks for any advice.

Oliver Cromm



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 10 May 2000 17:42:43 +0200
From: Matthias Kleine - Patzschke + Rasp Software AG <Matthias.Kleine@prs.de>
Subject: Re: conversion hex->ascii, ascii->mif, oder hex->mif
Message-Id: <39198373.2A0701F5@prs.de>

Hi there!

Sorry for writing my last posting in German, I thougt I was writing 
for the de.comp... newsgroup ...

Here is another description, now in English:

I am looking for an function which converts hexadecimally written 
characters in their plain format.

Moreover, I was looking for a module for textprocessing in mif 
(Maker Interchange Format) documents. I found a FrameMaker module
in the CPAN module list, but the link was simply cold, so I hope 
to get some more information about this.

Thanks for any hint.

- Matthias


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

Date: Wed, 10 May 2000 10:23:33 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: conversion hex->ascii, ascii->mif, oder hex->mif
Message-Id: <MPG.13833af2d4f90c0498aa4c@nntp.hpl.hp.com>

In article <39198373.2A0701F5@prs.de> on Wed, 10 May 2000 17:42:43 
+0200, Matthias Kleine - Patzschke + Rasp Software AG 
<Matthias.Kleine@prs.de> says...

 ...

> I am looking for an function which converts hexadecimally written 
> characters in their plain format.

Use the pack function with the 'H*' format specifier.

perldoc -f pack

> Moreover, I was looking for a module for textprocessing in mif 
> (Maker Interchange Format) documents. I found a FrameMaker module
> in the CPAN module list, but the link was simply cold, so I hope 
> to get some more information about this.

Sorry, no help here.  These are unrelated questions, and each is 
entitled to a post of its own.

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


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

Date: 10 May 2000 15:57:44 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <8fc0to$op6$2@216.155.32.13>

In article <MPG.13821f307231515598aa3b@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:

 | Well, I haven't posted a Benchmark in a long time, so here goes.
 | 
 | 
 | #!/usr/local/bin/perl -w
 | use strict;
 | use Benchmark;
 | 
 | $a = "xyz\rabc\n" x 10;
 | %& = ("\n", "\r", "\r", "\n");
 | 
 | timethese(1 << (shift || 0), {
 |   Expr0 => '(my $x = $a) =~ s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg',
 |   Expr1 => '(my $x = $a) =~ s/[\r\n]/$& eq "\r" ? "\n" : "\r"/eg',
 |   Hash0 => '(my $x = $a) =~ s/([\r\n])/$&{$1}/g',
 |   Hash1 => '(my $x = $a) =~ s/[\r\n]/$&{$&}/g',
 |   Hash2 => 'my %h = ("\n", "\r", "\r", "\n");
 |             (my $x = $a) =~ s/([\r\n])/$h{$1}/g',
 |   Hash3 => 'my %h = ("\n", "\r", "\r", "\n");
 |             (my $x = $a) =~ s/[\r\n]/$h{$&}/g',
 | });
 | __END__

Tried this on Macperl, but all I get is this: 

Benchmark: timing 1 iterations of Expr0, Expr1, Hash0, Hash1, Hash2, 
Hash3...
     Expr0:  0 secs ( 0.00 usr  0.00 sys =  0.00 cpu)
            (warning: too few iterations for a reliable count)
etc etc 

possible error with Macperl? 
possible error with outdated Benchmark? 

 | Name "main::a" used only once: possible typo at e:\Test\b3.txt line 5.
 | Benchmark: timing 16384 iterations of Expr0, Expr1, Hash0, Hash1, Hash2, 
 | Hash3...
 |      Expr0:  3 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
 | 4661.17/s (n=16384)
 |      Expr1:  4 wallclock secs ( 3.22 usr +  0.00 sys =  3.22 CPU) @ 
 | 5089.78/s (n=16384)
 |      Hash0:  3 wallclock secs ( 3.81 usr +  0.00 sys =  3.81 CPU) @ 
 | 4296.88/s (n=16384)
 |      Hash1:  2 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
 | 4661.17/s (n=16384)
 |      Hash2:  4 wallclock secs ( 3.94 usr +  0.00 sys =  3.94 CPU) @ 
 | 4161.54/s (n=16384)
 |      Hash3:  4 wallclock secs ( 3.64 usr +  0.00 sys =  3.64 CPU) @ 
 | 4499.86/s (n=16384)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 10 May 2000 16:48:15 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <8fc3sf$7pv$0@216.155.32.13>

In article <MPG.13821f307231515598aa3b@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:


 | Well, I haven't posted a Benchmark in a long time, so here goes.

had to tweak the program slightly in order to get it to run on my 
machine. also ran a somewhat longer test, of 65535 iterations just to 
see..

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

$a = "xyz\rabc\n" x 10;
%& = ("\n", "\r", "\r", "\n");

timethese(65535, {
  'Expr0' => '(my $x = $a) =~ s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg',
  'Expr1' => '(my $x = $a) =~ s/[\r\n]/$& eq "\r" ? "\n" : "\r"/eg',
  'Hash0' => '(my $x = $a) =~ s/([\r\n])/$&{$1}/g',
  'Hash1' => '(my $x = $a) =~ s/[\r\n]/$&{$&}/g',
  'Hash2' => 'my %h = ("\n", "\r", "\r", "\n"); (my $x = $a) =~ 
s/([\r\n])/$h{$1}/g',
  'Hash3' => 'my %h = ("\n", "\r", "\r", "\n"); (my $x = $a) =~ 
s/[\r\n]/$h{$&}/g',
});
__END__


 | Name "main::a" used only once: possible typo at e:\Test\b3.txt line 5.
 | Benchmark: timing 16384 iterations of Expr0, Expr1, Hash0, Hash1, Hash2, 
 | Hash3...
 |      Expr0:  3 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
 | 4661.17/s (n=16384)
 |      Expr1:  4 wallclock secs ( 3.22 usr +  0.00 sys =  3.22 CPU) @ 
 | 5089.78/s (n=16384)
 |      Hash0:  3 wallclock secs ( 3.81 usr +  0.00 sys =  3.81 CPU) @ 
 | 4296.88/s (n=16384)
 |      Hash1:  2 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
 | 4661.17/s (n=16384)
 |      Hash2:  4 wallclock secs ( 3.94 usr +  0.00 sys =  3.94 CPU) @ 
 | 4161.54/s (n=16384)
 |      Hash3:  4 wallclock secs ( 3.64 usr +  0.00 sys =  3.64 CPU) @ 
 | 4499.86/s (n=16384)

my results: 

Benchmark: timing 65535 iterations of Expr0, Expr1, Hash0, Hash1, Hash2, 
Hash3...
     Expr0:  8 secs ( 8.77 usr  0.00 sys =  8.77 cpu)
     Expr1:  9 secs ( 8.17 usr  0.00 sys =  8.17 cpu)
     Hash0:  9 secs ( 9.43 usr  0.00 sys =  9.43 cpu)
     Hash1:  9 secs ( 8.63 usr  0.00 sys =  8.63 cpu)
     Hash2:  9 secs ( 9.38 usr  0.00 sys =  9.38 cpu)
     Hash3:  7 secs ( 8.93 usr  0.00 sys =  8.93 cpu)

methinks I need to update my Benchmark.pm :) 

 | The performances are slightly in favor of the expression, even when the 
 | small penalty of setting up the hash is amortized out of the lookup.  
 | The potential penalty on $& on the rest of the program isn't considered.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 10 May 2000 17:36:30 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <8fc6mu$dd4$0@216.155.32.13>

In article <8fc3sf$7pv$0@216.155.32.13>, The WebDragon 
<nospam@devnull.com> wrote:

 | methinks I need to update my Benchmark.pm :) 

ok, Benchmark.pm is NOT a separate file on CPAN? what gives?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 10 May 2000 10:32:50 -0700
From: Digital Puer <digital_puer@hotmail.comet>
Subject: DBD:ODBC basic question
Message-Id: <39199D42.36756A05@hotmail.comet>

I would like to run a perl script with DBD:ODBC from a solaris
machine to a Windows machine running MS SQL. I am completely lost.
Do I need to install some sort of driver on the server as well?
I have no installation permission on the server.


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

Date: Wed, 10 May 2000 17:33:38 GMT
From: David Pautler <pautler@hawaii.edu>
Subject: Digest javascript within perl?
Message-Id: <8fc6hh$gdm$1@nnrp1.deja.com>

I want to scrape webpages with Perl, but many pages include
JavaScript as actions for html forms or for generating
sections of html that recur over many pages.

Is there a module that runs JS?

I've searched this group and www.perl.com and found nothing,
but this must be a very common problem.

	-dp-


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 10 May 2000 09:54:51 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help Needed  - Perl Matching Operator
Message-Id: <MPG.1383343ab62323c698aa49@nntp.hpl.hp.com>

In article <gUbS4.47393$g4.1299874@newsread2.prod.itd.earthlink.net> on 
Wed, 10 May 2000 11:39:56 GMT, jake <jakemsr@earthlink.net> says...

 ...

> ...  And no one explained the backslash excape.
> /@/ -> wrong   /\@/ -> right

What makes you say that /@/ is 'wrong'?  Did you try it before posting?  
If not, why not?

Bald assertions don't cut it.  This is supposed to be 'science', not 
religion.

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


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

Date: 10 May 2000 17:14:46 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Help Needed  - Perl Matching Operator
Message-Id: <slrn8hj686.tf8.abigail@ucan.foad.org>

On Tue, 09 May 2000 21:34:45 GMT, Kelvin <k2_1999@hotmail.com> wrote:
++ I'm little confusing of how to use the matching operator in perl!
++ I'm writing a function to check if the user enter a valid email address,
++ but I don't sure how to use the m// operator.
++ 
++ sub checkemail {
++     $_ = $enteredEmail;
++     m/"@"//;
++ }
++ is that correct?
++ Or how can I make sure the $enteredEmail included a "@" in it?


Well, I would use the index() function if I wanted to check whether a
string has a '@' in it.

But what's that got to do with checking for valid email addresses?
There are lots of strings that contain '@', but aren't valid email
addresses, and lots of valid email addresses that don't contain a '@'.

You might as well check if the string contains a '7'.



Abigail


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

Date: 10 May 2000 17:44:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Help Needed  - Perl Matching Operator
Message-Id: <8fc76c$prl$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Kelvin
<k2_1999@hotmail.com>],
who wrote in article <Vv%R4.7203$%u6.427214@news1.telusplanet.net>:
>     m/"@"//;

Why do you think this is different from

  m/"@{'"'}/

?

Ilya


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

Date: 10 May 2000 17:47:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Help Needed  - Perl Matching Operator
Message-Id: <8fc7b3$pu4$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler 
<lr@hpl.hp.com>],
who wrote in article <MPG.1383343ab62323c698aa49@nntp.hpl.hp.com>:

> What makes you say that /@/ is 'wrong'?  Did you try it before posting?  
> If not, why not?

Please explain where it is documented what 

  $a = "@";

means.  And why it is different from "@{ *{$main::{''}}{ARRAY} }".

Ilya



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

Date: Wed, 10 May 2000 08:34:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: host checking
Message-Id: <Pine.GSO.4.10.10005100831090.3921-100000@user2.teleport.com>

On Tue, 9 May 2000, A-Tuin ® wrote:

> each host:port is on a single line, my problem is that all these hosts
> are not online at the same time, can anyone give me a few pointers for
> using this file as a master list, checking to see which hosts can be
> connected to and putting these into a separate file.

You could use a technique analogous to the one Randal used in his
WebTechniques column number 35 to check bad links. It allows for the
possibility that a site is temporarily down and can save it to check it
again later.

    http://www.stonehenge.com/merlyn/WebTechniques/

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 10 May 2000 15:07:03 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: How many times is it found?
Message-Id: <7ar9baqwa0.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


andrew-johnson@home.com (Andrew Johnson) writes:

> In article <slrn8hi1p9.k8q.garcia_suarez@r-garcia.kazibao.net>,
>  Rafael Garcia-Suarez <garcia_suarez@hotmail.com> wrote:
> > Larry Rosler wrote in comp.lang.perl.misc:
> > >In article <slrn8hhbc0.efl.abigail@ucan.foad.org> on 10 May 2000 
> > >00:29:52 GMT, Abigail <abigail@foad.org> says...
> [snip]
> > >> 
> > >>     my %count;
> > >>     map {$count {$_} ++} split /\s+/ => $string;
> > >
> > >      my %count;
> > >      $count {$_} ++ for split /\s+/ => $string;
> > >
> > >War, anyone?
> > 
> > Yes:
> > 
> >       my %count;
> >       $count {lc $_} ++ for split /\W+/ => $string;
> > 
> > Because it must count 'this' twice, and there is a 'This',
> > and because is must count 'string' three times, and there is a 'string.'.
> 
> How about:
> 
>     my %count;
>     $count {lc $_} ++ for /\w+/g;

Too much use of $_!

	$count {lc $_} ++ for $string =~ /\w+/g;

--Ala


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

Date: 10 May 2000 17:28:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Mass email question...
Message-Id: <slrn8hj71e.tf8.abigail@ucan.foad.org>

On Fri, 28 Apr 2000 01:20:28 GMT, Clinton A. Pierce <clintp@geeksalad.org> wrote
++ 
++ Your one real bug:
++ 
++ 	unlink('$TMP_MAIL');
++ 
++ If this code is what you've got in production...I'll bet your temp
++ files never get deleted.  Because you're trying to delete the literal
++ filename dollar-tee-em-pee-underscore-em-ah-eye-ell -- which probably
++ doesn't exist.  The single quotes prevent interpolation which is
++ what you want.  
++ 
++ You don't need quotes at all there.
++ 
++ Besides, you would have caught this if you had followed the rule:
++ ALL SYSTEM CALLS CAN FAIL, ALWAYS CHECK THE RETURN VALUE.
++ 
++ 	unlink($TMP_MAIL) || warn "Cannot delete $TMP_MAIL: $!";


Well, if he had added the warn(), he would have written:

        unlink ('$TMP_MAIL') || warn "Cannot delete $TMP_MAIL: $!";

which would have given the message

        Cannot delete /tmp/whatever: No such file or directory

That would have not been helpful at all, as the file in the warning *does*
exists.



Abigail


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

Date: Wed, 10 May 2000 15:55:28 GMT
From: baeron@my-deja.com
Subject: Modem communication in Perl
Message-Id: <8fc0pb$9a5$1@nnrp1.deja.com>

Hey-  I've gotten lots of great solutions from the Perl usenet groups
without having to post, but this one's kicking my butt.

I working on a Perl script that will run on a unix box, and needs to
dial out through a modem and send a single file, then retrieve a single
file using xmodem from a remote host system.  Currently we're doing
this with a shell script that calls the cu command, but I'm trying to
do this in perl.  I've heard of the comm.pl module which I can't find
anywhere, and the chat2 module, which I also can't find.  Can someone
point me in the right direction?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 10 May 2000 08:29:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: NetworkSolutions - example of lapse security
Message-Id: <Pine.GSO.4.10.10005100803190.3921-100000@user2.teleport.com>

On 10 May 2000 nobull@mail.com wrote:

> The information from web forms is tainted so cannot be used to open a
> file.

Actually, this turns out not to be the case. If the file is to be opened
for read access only (as, I believe, it is in this case) taint checking is
not done. So merely opening the password file and dumping it out is okay.
:-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 10 May 2000 17:30:00 +0100
From: Russell Horn <news@alba1314.demon.co.uk>
Subject: Newbie looking for pointers
Message-Id: <39198E88.5AD05BB5@alba1314.demon.co.uk>

I am brand new to perl, but am just looking for some pointers.

I want to read in a web page and parse it.

The bit I am looking appears three times, and always appears two lines
after a specific tag, for example <h1>

The line itself starts with a number of spaces and I am after the entire
line up until a closing HTML tag, e.g. </P>

I want to run this script, say once an hour to check if the web page has
changed. Therefore, the program should read the three lines acquired
above and store them somewhere. Each time it is run, it should check if
the line read is different to any of the 3 lines read the last time the
program was run. If so, the program should email the line to a single
email address.

Is this appropriate for a newcomer to Perl? Can anyone give me any
indications as to what I should be studying and where I might find some
online guidance.

The system will be running on BSD, so I will be scheduling the program
using Cron. 

My thought at the moment is that I can use Grep to extract the nine
lines from the HTML page which are relevant. I.e. the line containing
the unique tag, and the following two lines. Can I use Perl to grab the
web page, pass it to Grep -A2 <H1> filename? , and then work on the
input from grep?

Any help will be appreciated.

Many thanks,

-- 
Russell.


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

Date: Wed, 10 May 2000 12:06:36 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie looking for pointers
Message-Id: <slrn8hj28c.ijr.tadmc@magna.metronet.com>

On Wed, 10 May 2000 17:30:00 +0100, Russell Horn <news@alba1314.demon.co.uk> wrote:

>I am brand new to perl, but am just looking for some pointers.


You won't find any with Perl.

Perl has "references" instead of "pointers".

:-)


>I want to read in a web page 


   use HTML::Simple;
   my $htmlpage = 'http://www.perl.com/';


>and parse it.


There are several modules for parsing HTML on CPAN.


   perldoc -q CPAN


>The bit I am looking appears three times, and always appears two lines
>after a specific tag, for example <h1>
>
>The line itself starts with a number of spaces and I am after the entire
>line up until a closing HTML tag, e.g. </P>


That sounds more like "pattern matching" than "parsing".


>I want to run this script, say once an hour to check if the web page has
>changed. Therefore, the program should read the three lines acquired
>above and store them somewhere. 


   perldoc -f open


>Each time it is run, it should check if
>the line read is different to any of the 3 lines read the last time the
>program was run. If so, the program should email the line to a single
>email address.


There a modules for sending mail on CPAN too.


>Is this appropriate for a newcomer to Perl? 


It is rather ambitious for a newcomer.

I would try to do it via stepwise refinement, rather than trying
to get it working fully formed.

e.g.

   write program to fetch web page

   modify to match the "interesting data"

   modify to save the data to a file

   modify to read file and web page, and write a message on STDOUT

   modify to send email instead of writing to STDOUT


>Can anyone give me any
>indications as to what I should be studying and where I might find some
>online guidance.
 ^^^^^^

I don't know about that.

My cites above are on your hard disk if you have a properly
installed perl.


>The system will be running on BSD, so I will be scheduling the program
>using Cron. 


>My thought at the moment is that I can use Grep to extract the nine
>lines from the HTML page which are relevant. I.e. the line containing
>the unique tag, and the following two lines. Can I use Perl to grab the
>web page, pass it to Grep -A2 <H1> filename? , and then work on the
>input from grep?


Yes, but you don't need Grep (you don't need grep either, I have
not heard of your Grep program before).

You can do it with native Perl.


>Any help will be appreciated.


Good luck!


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


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

Date: Wed, 10 May 2000 16:58:37 GMT
From: see_plus_plus@my-deja.com
Subject: Perl & Expect
Message-Id: <8fc4fh$e1v$1@nnrp1.deja.com>

Is there an Expect module for Perl somewhere?
Please give me pointers how to use Perl & Expect?

Cpp


Sent via Deja.com http://www.deja.com/
Before you buy.


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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


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