[23426] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5643 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 10 11:06:11 2003

Date: Fri, 10 Oct 2003 08:05:09 -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           Fri, 10 Oct 2003     Volume: 10 Number: 5643

Today's topics:
        Accepting HTTP Post <raj.kothary@thus.net>
        ANNOUNCE: HTML::KTemplate v1.30 <usenet@repsak.de>
        Bug in File::Copy or my mistake? <lausser@gmx.net>
    Re: data manipulation (Tad McClellan)
    Re: data manipulation (Tad McClellan)
    Re: data manipulation <bNOoONb@not.pilbara.net.au>
    Re: Debug Messages <konny@waitrose.com>
    Re: Debug Messages <kaspREMOVE_CAPS@epatra.com>
    Re: Debug Messages (Peter Scott)
    Re: Efficient field splitting? unpack or substr (Christopher Hamel)
    Re: How To activate command line history in debugger? (Peter Scott)
        Passing objects to a perl script via POST <jrendant@comcast.net>
    Re: Passing objects to a perl script via POST <ubl@schaffhausen.de>
    Re: Passing objects to a perl script via POST <ubl@schaffhausen.de>
        Remembering part of last matched string (Chandramohan Neelakantan)
    Re: strip text up to a keyword? (Anno Siegel)
    Re: strip text up to a keyword? (Tad McClellan)
    Re: strip text up to a keyword? (kw)
    Re: Teach me how to fish, regexp <HelgiBriem_1@hotmail.com>
    Re: Teach me how to fish, regexp <kuujinbo@hotmail.com>
    Re: Teach me how to fish, regexp <HelgiBriem_1@hotmail.com>
    Re: tree drawing toolkit <theaney@cablespeed.com>
    Re: tree drawing toolkit <peter@semantico.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Oct 2003 12:15:04 +0100
From: "Raj" <raj.kothary@thus.net>
Subject: Accepting HTTP Post
Message-Id: <bm64fh$3p0$1$8300dec7@news.demon.co.uk>

Hi,

I was wondering if it is straightforward to allow someone to post an XML
file to a Perl-CGI script on a web server and storing that file on the web
server?

Can anyone help?

Thanks in advance!

Regards
-- 
Raj Kothary :: one|concept
http://www.oneconcept.net
raj@oneconcept.net
+ 44 (0)79 5647 2746

oneconcept limited :: 2nd Floor West, 3-4A Little Portland Street, London
W1A 5AG

Confidentiality notice:
The information transmitted in this email and/or any attached document(s) is
confidential and intended only for the person or entity to which it is
addressed and may contain privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this in error, please contact the sender and
delete the material from any computer.




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

Date: Fri, 10 Oct 2003 08:00:55 GMT
From: Kasper Dziurdz <usenet@repsak.de>
Subject: ANNOUNCE: HTML::KTemplate v1.30
Message-Id: <HMJnBw.1szF@zorch.sf-bay.org>

HTML::KTemplate - Perl module to process HTML templates.

For more information about this module visit:

http://search.cpan.org/author/KASPER/HTML-KTemplate-1.30/KTemplate.pm


Changes in Version 1.30:

Added: process() method accepts a reference to a scalar, array or file
handle to initialize the template from memory.

Added: option to replace all template variables inside of a variable
with their assigned values.

Added: block loops can be created with the assign() method.

Added: block() method accepts names as a list to create nested blocks.

Changed: file handle has to be passed as a reference to print() method.

Changed: else statement can not be written as ELSE IF, ELSE UNLESS or
ELSE LOOP anymore (only ELSE and ELSE COND is allowed).

Fixed: non-default tags were sometimes not recognized in the template.

Fixed: pure ELSE and END caused an error without a space before the
ending tag.




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

Date: Fri, 10 Oct 2003 16:22:47 +0200
From: "Gerhard Lausser" <lausser@gmx.net>
Subject: Bug in File::Copy or my mistake?
Message-Id: <1065795809.74775@intranet.consol.de>

Hi all,

File::Copy::copy($source, $target) destroys both files if they are hard
linked.

here is what i did:
lp0056:/tmp # echo "hihihihihi" > aaaa
lp0056:/tmp # ln aaaa bbbb
lp0056:/tmp # ln -s aaaa cccc
lp0056:/tmp # ls -l aaaa bbbb cccc
-rw-r--r--    2 root     root           11 Oct 10 16:07 aaaa
-rw-r--r--    2 root     root           11 Oct 10 16:07 bbbb
lrwxrwxrwx    1 root     root            4 Oct 10 16:08 cccc -> aaaa
lp0056:/tmp # perl -e 'use File::Copy; copy("/tmp/cccc", "/tmp/aaaa");'
'/tmp/cccc' and '/tmp/aaaa' are identical (not copied) at -e line 1
lp0056:/tmp # perl -e 'use File::Copy; copy("/tmp/bbbb", "/tmp/aaaa");'
lp0056:/tmp # ls -l aaaa bbbb cccc
-rw-r--r--    2 root     root            0 Oct 10 16:10 aaaa
-rw-r--r--    2 root     root            0 Oct 10 16:10 bbbb
lrwxrwxrwx    1 root     root            4 Oct 10 16:08 cccc -> aaaa

If i try to copy a softlink to its own target, copy complains.
However if i copy hard linked files onto each other, both get zeroed.
Looking at  sub copy in  File/Copy.pm i found code that tests if
you copy a symbolic link but nothing to handle the hard link scenario.

Is this the normal behaviour or is this a bug?

Greetings from Munich,
Gerhard

p.s.
You might ask "why do you want to do this?"
I use http://sourceforge.net/projects/systemconfig to configure my systems.
/etc/localtime is a copy of /usr/share/zoneinfo/Europe/Berlin
This could be a synbolic link, a copy of the original file or a hard link.
The latter is the case with SuSE Linux, where the zic command creates
the hard link at boot time.
If i run systemconfigurator, among other things it reads Europe/Berlin in
its
configuration and copies /usr/share/zoneinfo/Europe/Berlin to /etc/localtime
using File::Copy and empties out /etc/localtime.









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

Date: Thu, 9 Oct 2003 23:25:51 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: data manipulation
Message-Id: <slrnbocd6f.3od.tadmc@magna.augustmail.com>

Bob <bNOoONb@not.pilbara.net.au> wrote:
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:bm3848$i2lpa$1@ID-184292.news.uni-berlin.de...


[ Snip a whole bunch of lines not needed for context. ]


> there are only 2 lines I don't clearly
> understand
> 
> ->              push @chunks, $chunk if $chunk;


Or, if you like/understand it better written this way:

   if ( $chunk ) {
      push @chunks, $chunk;
   }


> ->              $chunk = '';
> 
> After reading the push function description from "learning Perl" I am
> failing to understand exactly what is happening here.


if $chunk is a true value, then the value of $chunk gets tacked onto
the end of the @chunks array (ie. @chunks gets one element larger).

The second line clears out the accumulator for the next go-round.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Oct 2003 07:26:25 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: data manipulation
Message-Id: <slrnbod9bh.4eg.tadmc@magna.augustmail.com>

Bob <bNOoONb@not.pilbara.net.au> wrote:


[ snip yet another full-quote. Please learn to quote followups properly ]


> if (@ARGV == "0" ) {


Why use a numeric operator and then force stringification?

If you want to test a number, use a number and a numeric operator:

   if (@ARGV == 0 ) {

If you want to test a string, use a string and a string operator

   if (@ARGV eq "0" ) {


>         print "\n\tqmail-qreadto \{ email to search for\} \n";
                                   ^                     ^
                                   ^                     ^

A useless use of backslashes.


>         print "\t\texample\: qmail-qreadto me\@example.net \n\n";
> exit 0


You should exit with a *non* zero value when an error occurs.


>         open (MyFILE, $file2);


You should always, yes *always*, check the return value from open():

   open(MyFILE, $file2) or die "could not open '$file2'  $!";


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Oct 2003 23:37:43 +0930
From: "Bob" <bNOoONb@not.pilbara.net.au>
Subject: Re: data manipulation
Message-Id: <1065795089.153636@cube.norcom.net.au>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbod9bh.4eg.tadmc@magna.augustmail.com...
> Bob <bNOoONb@not.pilbara.net.au> wrote:
>
>
> [ snip yet another full-quote. Please learn to quote followups properly ]
>
>
> > if (@ARGV == "0" ) {
>
>
> Why use a numeric operator and then force stringification?
>
> If you want to test a number, use a number and a numeric operator:
>
>    if (@ARGV == 0 ) {
>
> If you want to test a string, use a string and a string operator
>
>    if (@ARGV eq "0" ) {


Ok, what I am trying to test for is the existance of an argument,  - if
@ARGV is NULL .... do something..... what I use works, but if there is a
better way of testing for a NULL than a numerical comparison?  am open to
suggestions....  In this case, where the array is empty, a numeric test
returns "0", so the test made sense.

>
>
> >         print "\n\tqmail-qreadto \{ email to search for\} \n";
>                                    ^                     ^
>                                    ^                     ^
>
> A useless use of backslashes.
>
>

only quoted as when I was testing a warning was generated, but I later found
the real problem.....

> >         print "\t\texample\: qmail-qreadto me\@example.net \n\n";
> > exit 0
>
>
> You should exit with a *non* zero value when an error occurs.
>
>

I am exiting without an error here , simply if() do something exit   -this
is just as valid an exit from the code as any other exit, and no error has
occurred.

> >         open (MyFILE, $file2);
>
>
> You should always, yes *always*, check the return value from open():
>
>    open(MyFILE, $file2) or die "could not open '$file2'  $!";
>

In this case, I know that 1 of the 2 files will always exist, so I did not
"or die" here, but for the sake of consistency I will add it.


I appreciate the feedback given, and suggestions made.

Bob





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

Date: Fri, 10 Oct 2003 12:05:19 +0100
From: Mr I <konny@waitrose.com>
Subject: Re: Debug Messages
Message-Id: <gegi51-31a.ln1@sam.amaretti.net>

Charlton Wilbur wrote:

>>>>>>"MrI" ==   <konny@waitrose.com> writes:
> 
> 
>     MrI> But I think we (if you agree with me) are in the minority :)
> 
> Principally because it's not an especially useful thing to do.
Agree to differ.
IMHO it's very useful. I don't know how others debug faults /errors/ 
unexpected results (if they occur in your code), but I use perl -d were 
you can track variable / etc.. changes in state, and what caused them. I 
would just like a simple flag based option to do kinda the same thing. 
I'm not commenting on the complexity of the task (i.e. How it defines 
which state changes to report), as thats beyond the scope of this 
discussion :)


> 
>     MrI> Oh b4 I forget. To the best of my knowledge Perl DOES NOT
>     MrI> provide this functionality and I've yet to find a tool that
>     MrI> does this (perl -d does not meet the requirement. great for
>     MrI> me, not so great for non perl user).
> 
> What sense is a 'non perl user' going to make out of your proposed
> tool that spits out something every time a variable is changed?
> 
Kasp states:
"I want to give my client an option of running the script(again) with 
--debug option so that some trace messages can be logged into alog file.
The client sends me this trace file and I try to make sense of it as to 
whythe script is failing."

So its not for the non  perl users benefit. Its so Kasp can see what is 
happening.

K



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

Date: Fri, 10 Oct 2003 17:55:43 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Debug Messages
Message-Id: <bm68ko$g7k$1@newsreader.mailgate.org>

Let's not argue over whether I know Perl or not.
I do know (at least) about 'perl -d' ....but how effective is this for
clients who certainly don't know a word in Perl.
perl -d is for Perl programmers! Asking non-Perl people to make sense of it
is not very sensible.
-- 
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.




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

Date: Fri, 10 Oct 2003 14:48:37 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Debug Messages
Message-Id: <9Fzhb.58589$9l5.12231@pd7tw2no>

In article <gkcg51-v39.ln1@sam.amaretti.net>,
 Mr I <konny@waitrose.com> writes:
>What I believe you're *REALLY* asking is whether Perl has a builtin / 
>generic VERBOSE mode, so without adding any extra code [i.e. if(DEBUG) 
>statements] the variable + environment + state settings are some how 
>printed to STDOUT while the program executes.
>
>I 4 one have always thought this would be an ideal feature of Perl. Say 
>for example you could all your code like below:
>
>perl --DeBuG -L1 ./perlcode.pl <ARGV>
>
>Perl would then run the code displaying all the variable /environment 
>etc changes as the program is executed. The -L1 defines the depth of sub 
>routines /modules / functions it should print out this information for 
>(otherwise the output could be unreadable especailly with nested sub 
>routinues).

This is frequently suggested by people who have seen the -x argument of
the Bourne Shell in action.  And that is useful in a language whose only
variables are scalars with limited content ranges.  It is impractical in
Perl where so many variables can hold deeply structured information or
megabytes of detail.  Just imagine what would happen for a program like:

	$ua = LWP::UserAgent->new;
	$res = $ua->request(GET "http://cnn.com");
	$p = HTML::TreeBuilder->new;
	$p->parse($res->content);
	
You'd go insane watching tens of thousands of lines scroll by.  By the
time you limit the output of your option to something you can stand,
you'll have removed 99% of its usefulness.

This is why actions and watchpoints were invented in the debugger.

-- 
Peter Scott
http://www.perldebugged.com


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

Date: 10 Oct 2003 05:59:46 -0700
From: hamelcd@hotmail.com (Christopher Hamel)
Subject: Re: Efficient field splitting? unpack or substr
Message-Id: <4f60d5b3.0310100459.792e24e3@posting.google.com>

ifiaz@hotmail.com (ifiaz) wrote in message news:<93c1947c.0310092014.699ed304@posting.google.com>...
> I have a data that looks like this in a single line.
> 
> "01 17060757 EG 6880232  N 0131020321 17 060712 l 8828          TR6322
> 00030070 01 20030317060807749544 060645 244 PA1"
> 
 . . . 
> Using awk to perl converter, the same thing in perl took only 11.03
> seconds.
> (awk to perl used substr as well)
> 
>     Field Splitting in awk to perl, for your info
>     $F1 = substr($_, 1, 2);
>     $TiltTime = substr($_, 4, 8);
>     ....
>     ....
> 
> Now, I wrote a perl script, but only replaced the field splitting part
> with
> unpack. Now, the script takes 21.5 seconds.
> 
>    Field Splitting in perl using unpack, for your info
> 
>     ($F1, $TiltTime, ...) =
>     unpack("a2xa8xa2xa3a5xa1xa10xa2xa6xa1xa4xa8xa6xa8xa2xa20xa6xa3xa3",
> $_);
>     ....
>     ....
>   
> Why is unpack not efficient? Am I doing anything wrong?
> Should I stick to substr to do such field splitting in the future?
> Can I write it any other way to make it more efficient.
> 
> 
> - Fiaz Idris

I have found that unpack is significantly slower as well.  I can't say
conclusively why, but my guess is that it's built to do much more than
just extract certain characters from a string the way you appear to be
using it.

Believe it or not, a regex is very fast at this sort of thing if
performance is a major concern.

  my $string = 'one two three four';
  my ($o,$tw,$th,$f) = $line =~ /^(...).(...).(.....).(....)/;
                           # or /^(.{3}).(.{3}).(.{5}).(.{4})/
   
Benchmark this against substr with your data, and I think you'll find
that this is much faster.  In past cases where I've looked to do
something similar, the regex has won, except in cases where I've
needed only a small portion of the large string.


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

Date: Fri, 10 Oct 2003 14:38:22 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: How To activate command line history in debugger?
Message-Id: <yvzhb.58524$9l5.52425@pd7tw2no>

In article <bm5l68$p6l$02$1@news.t-online.com>,
 Kurt Kronschnabl <kurt.kronschnabl-nospam@ica-intercom-akademie.de> writes:
>But we have an Socks Proxy here running, Therefore
>
>CPAN: LWP::UserAgent loaded ok
>Fetching with LWP:
>   ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
>
>does not work.

CPAN.pm lets you use a proxy.  Look in its documentation for

	o conf http_proxy ...

>But I downloaded ReadKey.pm from the CPAN site and saved and changed the 
>owner:group to root the file in /usr/share/perl/5.8.0/Term which is part 
>on @INC.

That is not the way to install a CPAN module.  It may work in some cases,
but not others.  And it won't work in this case because there is a XS
component that needs to be compiled into a shared library.

>Is there another way  nessecary to make perl the new module known?

FTP to ftp.cpan.org, navigate to the module required, download the .tar.gz
file, then:

	tar zxf TermReadKey-2.21.tar.gz
	cd TermReadKey-2.21
	perl Makefile.PL
	make test
	make install

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Fri, 10 Oct 2003 08:28:34 -0500
From: "Jim Rendant" <jrendant@comcast.net>
Subject: Passing objects to a perl script via POST
Message-Id: <vx-dnZirmZfSLhuiXTWJkw@comcast.com>

I am new at web page design and was wondering if I created an object in java
script or an array can I pass it back to a perl script for processing.

One example my be where a customer has the ability to select multiple items
from a single page. By using checkboxes the end user selects multiple item
and enters quantities for those item. By passing some sort of data structure
(array or object) back the  script for processing.

I know I can build an object in JavaScript populating it with pertinent
information.

Let me know what you think?

Thanks
Jim Rendant




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

Date: Fri, 10 Oct 2003 16:51:11 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Passing objects to a perl script via POST
Message-Id: <bm6k40$riu$1@news.dtag.de>

Jim Rendant wrote:

> I am new at web page design and was wondering if I created an object in java
> script or an array can I pass it back to a perl script for processing.
> 
> One example my be where a customer has the ability to select multiple items
> from a single page. By using checkboxes the end user selects multiple item
> and enters quantities for those item. By passing some sort of data structure
> (array or object) back the  script for processing.

There is no simple solution for this problem, I'm afraid. You would have 
to serialize your JavaScript data structure and deserialize it with Perl.

I guess its time for an implementation of YAML in JavaScript :)
Drop the guys at yaml.org a note.


malte





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

Date: Fri, 10 Oct 2003 16:54:58 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Passing objects to a perl script via POST
Message-Id: <bm6kb3$riu$2@news.dtag.de>

Malte Ubl wrote:
> I guess its time for an implementation of YAML in JavaScript :)

which exists, but isnt done:
http://sourceforge.net/projects/yaml-javascript/



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

Date: 10 Oct 2003 05:43:32 -0700
From: knchandramohan@yahoo.com (Chandramohan Neelakantan)
Subject: Remembering part of last matched string
Message-Id: <69d11688.0310100443.17d4d8f8@posting.google.com>

Hello

I have output from 'pdftotext' command and I need to parse the
information in the text.
The text  is in a table format.
This is a hardware design  rules  file  and has associated information
in these tables for every rule.

For better understanding I have marked all  new lines  with \n and all
spaces with ^

Also
-  Each Rule begins with the number like 23.1 or 23.1.1
- The 'Description' column can be spanned over several lines/rows 
with blank lines in between
-  Devices column could be empty
-  It is not possible to ascertain the width of each column


-------------------------------------------------
Rule  	      Description	   Dimensions         Devices           Fig
-------------------------------------------------
23.1^^^^^^^^^Text ^^^^^^^^^^^^2.0 x 4.9^^^^^^^ All ^^^^^^^^^^^2,F1\n
                                                                      
      except NPN\n
\n
^^^^^^^^^^^^Text  Here\n




23.1.1^^^^^^Text ^^^^^^^^^^^^^2.0x4.9^^^^^^^^^^^^^^^^^^^^^^^ 1,F1\n
\n
\n
^^^^^^^^^^^^Text Here\n
^^^^^^^^^^^^Text Here\n



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


I want all the the columns in  each rule including additional text in
the following lines in foreach column.

This  is  what  I have done:

- Try to match each rule beginning with \d+\.\d+
 or \d+\.\d+\d+ operator for the  rule column
- using \s+(.*?)\s+ for the second column 
-  \d+ | \d+ x \d+  for the dimensions column
and so on.

To parse all the rules I  use the /g along with /^\d+\.\d+ operator
but this scans only lines beginning
with rule numbers. text information for the description and devices
column are lost


The problems are 
-  this is a row wise pattern matching approach and I do not know  the
end a rule until I see the start of another
-  Both the 'Description' and 'Devices' column contensts could be in
several lines with blank lines in between


I need to extract   the information in all the columns for every rule
and save it in a separate file.


I would appreciate if someone could give suggestions to improve my
approach or throw in a fresh approach altogether


Many thanks!!
CM


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

Date: 10 Oct 2003 11:42:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: strip text up to a keyword?
Message-Id: <bm65vo$oij$1@mamenchi.zrz.TU-Berlin.DE>

Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> kw <anon002001@yahoo.com> wrote:
> 
> > Is there a relatively simple way to strip/delete all text from a file,
> > up to a keyword? 
> 
> 
> No.

Well, there is, but the OP doesn't need it (because the text is in memory
anyway).  This prints blocks from "BEGIN" to "END" from a file:

    while ( <DATA> ) {
        print if s/.*(?=BEGIN)// .. s/(?<=END).*//;
    }
    
Anno


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

Date: Fri, 10 Oct 2003 07:15:24 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: strip text up to a keyword?
Message-Id: <slrnbod8ms.4eg.tadmc@magna.augustmail.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
>> kw <anon002001@yahoo.com> wrote:
>> 
>> > Is there a relatively simple way to strip/delete all text from a file,
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> > up to a keyword? 
>> 
>> 
>> No.
> 
> Well, there is, but the OP doesn't need it (because the text is in memory
> anyway).  This prints blocks from "BEGIN" to "END" from a file:
> 
>     while ( <DATA> ) {
>         print if s/.*(?=BEGIN)// .. s/(?<=END).*//;
>     }


But that does not modify the file, as stated in the spec (which
was my point: the spec was imprecise).

Add a line and change a line of your code, _then_ I'll be wrong.  :-)


   $^I = '';        # no backup!
   while ( <> ) {


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 10 Oct 2003 07:43:30 -0700
From: anon002001@yahoo.com (kw)
Subject: Re: strip text up to a keyword?
Message-Id: <b7675d5e.0310100643.75de19d2@posting.google.com>

> $webpage =~ s/^.*$string//s; 

> $_[0] =~ s/.*$keyword//s;    

Do these work through multiple linefeeds (if keyword is on the 100th
line of the file/variable)?  Or do the previous lines do something to
help out?  I think I have tried similar RE's that only work on one
line.


> How is get_webpage() different from LWP::Simple::get() ?

It's probably not, I was just trying to show the high level functions
I wanted to accomplish.

> I'd be willing to bet a dollar that strip_html() has bugs in it.
> 
> If you show it to us, we can show you some of its bugs.

Probably true, all code has bugs :-)  FWIW, I didn't write this
myself, I found one of the suggestions in the FAQ or somewhere online.

> You can write strip_text_up_to() so that it will modify its
> argument, then you wouldn't need to assign it back to itself:

These are the things I try to avoid in perl, I like having the code a
little more obvious.  I don't write perl everyday, so when I come back
to this script in 6 months, I don't want to spend too much time
decrypting things like this.  If it is functionally the same but
simpler (or looks more like C), that is all I care about for now :-)


I'll try to pick "keywords" that are more unique.


Thanks for everyone's help!  I'll try these ideas out this weekend.


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

Date: Fri, 10 Oct 2003 10:24:40 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: Teach me how to fish, regexp
Message-Id: <142dov8lf3eoehs4koov0p075pdoap1qqa@4ax.com>

On Thu, 9 Oct 2003 20:19:03 +0000 (UTC), "David H. Adler"
<dha@panix.com> wrote:

>Rather than check the book and then check the current docs to make sure
>it wasn't something that had changed, I'd rather just read the docs. :-)

Plus of course, the digital documentation on your hard disk
is infinitely handier and more accessible than any paper
format.  Cutting and pasting the superb examples covers
most eventualities.

Buy the book if you must, but leave it in the bathroom
where it belongs.


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

Date: Fri, 10 Oct 2003 20:47:22 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Teach me how to fish, regexp
Message-Id: <bm66ca$lem$1@pin3.tky.plala.or.jp>

Helgi Briem wrote:
> On Thu, 9 Oct 2003 20:19:03 +0000 (UTC), "David H. Adler"
> <dha@panix.com> wrote:
> 
> 
>>Rather than check the book and then check the current docs to make sure
>>it wasn't something that had changed, I'd rather just read the docs. :-)
> 
> 
> Plus of course, the digital documentation on your hard disk
> is infinitely handier and more accessible than any paper
> format.  Cutting and pasting the superb examples covers
> most eventualities.
> 
> Buy the book if you must, but leave it in the bathroom
> where it belongs.

Am I reading this right?!? Programming Perl, a book by  Larry Wall, Tom 
Christiansen, and Jon Orwant belongs in the bathroom?!?



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

Date: Fri, 10 Oct 2003 12:37:51 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: Teach me how to fish, regexp
Message-Id: <lv9dov09q6b6dhgsek6bieneli17h2jg96@4ax.com>

On Fri, 10 Oct 2003 20:47:22 +0900, ko <kuujinbo@hotmail.com> wrote:

>> Buy the book if you must, but leave it in the bathroom
>> where it belongs.
>
>Am I reading this right?!? Programming Perl, a book by  Larry Wall,  
>Tom Christiansen, and Jon Orwant belongs in the bathroom?!?

Of course.  That's where you have peace and quiet for
reading.


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

Date: Fri, 10 Oct 2003 07:19:08 -0400
From: Tim Heaney <theaney@cablespeed.com>
Subject: Re: tree drawing toolkit
Message-Id: <871xtl49xv.fsf@mrbun.watterson>

Peter Hickman <peter@semantico.com> writes:
>
> I have lots of data in the form of
>
> root is note A
> node A links to node B
> node B links to node C
> node B links to node D
> node D links to node E
>
> This is a straight forward tree, no loops and (hopefully) no cross links.
>
> Is there any module that could take this data and produce an image from it?

The GraphViz module gives you access to GraphViz

  http://www.graphviz.org/

from Perl. That should make short work of it.

I hope this helps,

Tim


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

Date: Fri, 10 Oct 2003 12:56:49 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: tree drawing toolkit
Message-Id: <3f869e81$0$11458$afc38c87@news.easynet.co.uk>

Tim Heaney wrote:
> Peter Hickman <peter@semantico.com> writes:
> 
>>I have lots of data in the form of
>>
>>root is note A
>>node A links to node B
>>node B links to node C
>>node B links to node D
>>node D links to node E
>>
>>This is a straight forward tree, no loops and (hopefully) no cross links.
>>
>>Is there any module that could take this data and produce an image from it?
> 
> 
> The GraphViz module gives you access to GraphViz
> 
>   http://www.graphviz.org/
> 
> from Perl. That should make short work of it.
> 
> I hope this helps,
> 
> Tim

Thanks that looks like just the thing I need, and a bit more.



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 5643
***************************************


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