[7259] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 884 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 18 11:17:15 1997

Date: Mon, 18 Aug 97 08:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 18 Aug 1997     Volume: 8 Number: 884

Today's topics:
     2 quick dumb questions. (Michael Christopher Hyzer)
     Re: 2 quick dumb questions. (Nathan V. Patwardhan)
     Re: 2 quick dumb questions. <rootbeer@teleport.com>
     Adding Modules for Distribution <clark@s3i.com>
     call other programms <kuefner@informatik.tu-muenchen.de>
     Re: call other programms <rra@stanford.edu>
     Re: Capitals (Ed Vielmetti)
     Re: Directory searching (Eric Bohlman)
     Re: emacs?  No thank you <mattias.lonnqvist@-NO-SPAM-.uidesign.se>
     Re: emacs?  No thank you <kevinl@ascend.com>
     Re: Getting a perl script to run with cron <rootbeer@teleport.com>
     Re: GREAT PRICES ON WEB HOSTING...GOTTA SEE TO BELIEVE, <rootbeer@teleport.com>
     Re: help with this search pattern problem!! (Tad McClellan)
     Re: help with this search pattern problem!! (Sami Sandqvist)
     how can I read compressed files in perl <bobh@metrica.co.uk>
     Re: How can I read one single character? (Honza Pazdziora)
     Re: How can I read one single character? (Tad McClellan)
     Re: How do I find the system date/time? <rootbeer@teleport.com>
     how to parse only the lines between <pre> and </pre> (Xu Chu)
     Re: how to parse only the lines between <pre> and </pre (Honza Pazdziora)
     Intermittent form data transfer delays <bhatti@cableinet.co.uk>
     Re: NT Perl Sources and problem <llamashe@microtec.de>
     pb with cgi-script <scrivenaj@cv.port.ac.uk>
     Re: perl -v seems to be lying (Brendan O'Dea)
     Re: Perl books suggestions <gdunn@lis.net.au>
     Re: Perl Performance FAQ? (Andrew M. Langmead)
     perl5.004_01 special character problems <fl@dmc.de>
     Re: perl5.004_01 special character problems (Nathan V. Patwardhan)
     Re: perl5.004_01 special character problems <rootbeer@teleport.com>
     Re: Q: assoc. arrays as subroutine argument <sfairey@adc.metrica.co.uk>
     Re: Q: IPC between Perl and C <seay@absyss.fr>
     Re: URL validation (Eric Bohlman)
     WWW::Search not returning anything (Tony Bowden)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 18 Aug 1997 10:38:07 GMT
From: mchyzer@red.seas.upenn.edu (Michael Christopher Hyzer)
Subject: 2 quick dumb questions.
Message-Id: <5t98mf$l1l$1@netnews.upenn.edu>

Hey,
I pretty much taught myself perl, and I have written some scripts which I 
want to convince my sys-admin to let me run on the server.  Basically, I 
dont really know that much about perl, and my coding is very non-elegant, 
(i am coming from different languages), but my stuff works.
I was wondering about security.  
Does anyone know of a good website which addresses the security issues 
that sys-admins are concerned about?
Also, if I have a perl script up and running from a homepage, is there 
any way someone could read the perl code?  I dont care about sharing 
code, but my problem is that I am parsing the input to the form, and 
cross-referencing with a database (text-file) in that directory.
But, I dont want that database to be read by anyone.
So...  All I could figure was that the text file is world readable, the 
directory is not.  So, no one could get the name of the textfile unless 
they could read the code of the perl script.  Kind of shady...  is there 
another way to read files, fram a script run from a browser, and not have 
that file be read by others?  what if the file were in the script?  would 
that be better?  i could put it in the parent directory, but that 
wouldnt do any good because this is a university, and the students 
can get into that directory as well.  anyway, if a URL would answer 
these questions, let me have it.  
Thanks,

-Chris


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

Date: 18 Aug 1997 13:21:25 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: 2 quick dumb questions.
Message-Id: <5t9i8l$lnj@fridge-nf0.shore.net>

Michael Christopher Hyzer (mchyzer@red.seas.upenn.edu) wrote:

: Does anyone know of a good website which addresses the security issues 
: that sys-admins are concerned about?

Check all your warnings, use strict checking, AND see if you can check
for tainted variables.  You might also look into the perlsec manpage.
It might not be a bad idea to run you script as: perl -c <scriptname>

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 18 Aug 1997 07:14:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Christopher Hyzer <mchyzer@red.seas.upenn.edu>
Subject: Re: 2 quick dumb questions.
Message-Id: <Pine.GSO.3.96.970818070636.25618G-100000@julie.teleport.com>

On 18 Aug 1997, Michael Christopher Hyzer wrote:

> Does anyone know of a good website which addresses the security issues 
> that sys-admins are concerned about?

    http://www.genome.wi.mit.edu/WWW/faqs/www-security-faq.html

> Also, if I have a perl script up and running from a homepage, is there
> any way someone could read the perl code? 

Yes. Your system administrator could. :-)  But if your webserver is
properly set up, it won't give remote access to the text of your script. I
think that's what you're asking, but you should be aware that access
doesn't have to go through the webserver; your FTP server (to give one
example) may be giving out access to every file on your system - maybe
even read/write access! Eek! :-) (Seriously, few FTP servers are so badly
misconfigured. But if you're really worried about people seeing your data,
don't put it on a machine which connects to the Internet! :-) 

> I dont care about sharing code, but my problem is that I am parsing the
> input to the form, and cross-referencing with a database (text-file) in
> that directory. 

In general, it's a good idea to keep your data separate from your CGI
scripts. (Among other things, that allows the directory which holds the
CGI scripts not to be writable by the process which runs those scripts.) 

> is there another way to read files, fram a script run from a browser,
> and not have that file be read by others? 

Yes, if you use a set-id script. Those have their own set of major
security worries; start with the perlsec(1) manpage.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 18 Aug 1997 09:45:48 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Adding Modules for Distribution
Message-Id: <dafifhaer.fsf@s3i.com>


Greetings,
	I am working on some perl code that is going to be distributed
to several people in remote locations (Dayton, OH, for example, which
has always seemed pretty remote to me).  Anyway, they are not exactly
computer people so I want to make things as easy as possible for
them.  Installing perl itself is pretty easy, since I just tell them
to do the ./configure, make, make install, and it works (at least in
the one case I have tried).  

However, as it stands, my code requires some of the non-standard
modules.  What is the best way to bundle a non-standard module with
the perl distibution to provide the least amount of work on the far
end?  Let's say that I want Curses to be there.  How do I ensure that,
along with the standard modules, that get's installed as well? 

-- 
Clark


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

Date: Mon, 18 Aug 1997 15:35:40 +0200
From: Mathias Kuefner <kuefner@informatik.tu-muenchen.de>
Subject: call other programms
Message-Id: <33F84FAC.3D3A@informatik.tu-muenchen.de>

I tried to call other programms with perl, 
which just run in the background and dont give me anything back.

The Problem is, that most/all commands that I have found,
made the main program wait until the subprogram which was
supposed to run in the background had been finished.

Are there any common solutions for this?
Do I have to  or  should I  use the fork command?

Thanx!


Mathias



-- 
---------------------------------------------------------------------------
Mathias Kuefner                     Munich University of Technology
Elisabethstrasse 110                Department of  Computer Science
D-85716 Unterschleissheim           Phone: +49 (089) 310 18 65
Germany               
email: kuefner@informatik.tu-muenchen.de        IRC-Nickname: confusor   
URL:   http://www.informatik.tu-muenchen.de/~kuefner/


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

Date: 18 Aug 1997 07:00:05 -0700
From: Russ Allbery <rra@stanford.edu>
To: Mathias Kuefner <kuefner@informatik.tu-muenchen.de>
Subject: Re: call other programms
Message-Id: <m3hgcnd21m.fsf@windlord.Stanford.EDU>

Mathias Kuefner <kuefner@informatik.tu-muenchen.de> writes:

> I tried to call other programms with perl, which just run in the
> background and dont give me anything back.

[snip]

> Are there any common solutions for this?  Do I have to or should I use
> the fork command?

Yes and yes.

$pid = fork;
if (not defined $pid) {
    die "unable to fork: $!";
} elsif ($pid == 0) {
    # in child
    exec 'program_to_run_in_background', 'argument', 'another_argument';
} else {
    # in parent, child's PID is in $pid
}

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


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

Date: 14 Aug 1997 16:14:12 GMT
From: emv@umich.edu (Ed Vielmetti)
Subject: Re: Capitals
Message-Id: <5svask$2k7$1@hawk.branch.com>

the count (eglamkowski@mathematica-mpr.com) wrote:
: John Grimm wrote:
: > How can I convert a string to all capitals?

: I was contemplating almost the exact opposite problem:  Given a string
: that is in all uppercase, how to make all but the first letter 
: lowercase?  I wanted to use regular expressions and substition, but
: I am not sure how.

: Pseudo code:
: s/not first character in string/substitute corresponding lower char/g;

Perl has a couple of weird operators that it gets from 
some features in vi(1) that I didn't even know about,
let alone use.  Let me illustrate with some examples:

	print "\LCamel Book" ;
	  camel book
        $d = "dromedary" ;
	$x = "\l\U$d"; print $x ;
	  dROMEDARY
        $x = lcfirst uc "abc"; print $x ;
	  fOO

These are hiding on page 40 of the Camel book, without
enough examples for my taste to get them right.

Look for the functions "uc", "ucfirst", "lc", and "lcfirst"
if you want to do the same thing.  You can also accomplish
the same approach with "tr", a la
	if ($d =~ m/(.)(.$)/) { $head = $1; $tail = $2; }
	$head =~ tr/A-Z/a-z/;
	$tail =~ tr/a-z/A-Z/;
	$d = $head . $tail ;  # same as "\l\U$d"
that's more typing albeit perhaps more clear if the reader
of the code hasn't seen those escape sequences before.

"\u\LedWarD \u\LviELMettI"
emv@umich.edu




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

Date: Mon, 18 Aug 1997 09:56:00 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Directory searching
Message-Id: <ebohlmanEF3sxC.Dro@netcom.com>

Anne Kumar (annek@nortel.ca) wrote:
: I was wondering if there was anyway to search hierarchically through
: directories and replace items in those files. I've tried the chdir and
: opendir but they seem to only work with one subdirectory and no other
: directories below that level. If you have any suggestions please let 
: me know.

File::Find is your friend.



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

Date: Mon, 18 Aug 1997 11:35:51 +0200
From: "Mattias Lvnnqvist" <mattias.lonnqvist@-NO-SPAM-.uidesign.se>
Subject: Re: emacs?  No thank you
Message-Id: <33F81777.14AB7A8D@-NO-SPAM-.uidesign.se>

Kenneth Vogt wrote:

> Kevin Lambright wrote:
> >
> {snip:  lots of good stuff about the benefits of emacs}
>
> Thank you for all the details, Kevin.  I didn't realize most of them.
> I
> guess I still go back to the same thing:  why can't emacs be less
> cryptic or even (dare I say) visual?  My research (and a lot of
> comments
> from good folks like you) have lead me to believe what I want does not
>
> yet exist.

[M-x off-topic-mode-on]

If you get a fairly new version (I myself am running 19.34.1 under
windows 95) the basic commands exists as menues a mouse click away,
which is useful until you learn the keysequences. I myself started with
knowing only how to save & load in a plain text emacs, and have since
then added on with more and more knowledge.

The only thing I personally find annoying is that anything that is
standard in Unix, requires a lot of extra work in the windows version.
For example printing, using awk/grep/diff, and things like that.

[M-x off-topic-mode-off]

/Mattias

--
Mattias Lonnqvist * M.Sc. * Software consultant * Remove -NO-SPAM-
from email adress to reply. * no mail-to: link here, sorry.
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.uidesign.se/~malo/mail.html> for more info.




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

Date: 18 Aug 1997 08:56:58 -0400
From: Kevin Lambright <kevinl@ascend.com>
Subject: Re: emacs?  No thank you
Message-Id: <yhfen7rwsx1.fsf@ascend.com>

Kenneth Vogt <KenVogt@rkymtnhi.com> writes:

> Thank you for all the details, Kevin.  I didn't realize most of them.  I
> guess I still go back to the same thing:  why can't emacs be less
> cryptic or even (dare I say) visual?  My research (and a lot of comments
> from good folks like you) have lead me to believe what I want does not
> yet exist.
> 
> I come from the PC world, not the Unix world.  I've got yet *another*
> learning curve to go through here (Perl is language number 14(!) and
> counting).  I'm trying to make this as easy on myself as possible.  Oh
> well, I guess this is why we make the big bucks!  (Don't we?)

You are correct that emacs is cryptic and has a big learning curve.  What
I forgot to mention in my last post is that Xemacs is more visually
oriented than "regular" emacs.  I do not know if there is a Win95/NT port
of Xemacs, but you may want to check this out.

It's funny, but I think the people that use emacs extensively tend to
enjoy the more cryptic tools, command lines, etc.  I personally find 
that I can be much more productive and do things much quicker in emacs
with the various key bindings than any visual environment where I have
to click on various menus, etc.  

Anyhow, check out Xemacs and see if this gives you what you want (assuming
there is a port).

Kevin
-- 
------------------------------------------------------------------------------
Kevin Lambright                                    email: kevinl@casc.com
Ascend Communications                              voice: 508-952-7407
1 Robbins Road                                     fax:   508-692-1510
Westford, Ma. 01886


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

Date: Mon, 18 Aug 1997 07:04:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Cantrell <Mark_Cantrell@fws.gov>
Subject: Re: Getting a perl script to run with cron
Message-Id: <Pine.GSO.3.96.970818065157.25618F-100000@julie.teleport.com>

On 18 Aug 1997, Mark Cantrell wrote:

> Subject: Getting a perl script to run with cron

> does anyone have a clue to what I might be doing wrong and what I need
> to do to fix it? 

Cron jobs, like CGI scripts, tend to not supply the environment variables
which you may have come to expect. Perl doesn't (usually) mind, but your
script and other processes it starts may need some. (Especially, your PATH
may not include paths to utilities you're used to having.) You can put any
variable settings you wish into %ENV, of course, before launching any
other process. 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 18 Aug 1997 06:50:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Patrick Cooper <pcooper@pobox.com>
Subject: Re: GREAT PRICES ON WEB HOSTING...GOTTA SEE TO BELIEVE, 5megs and CGI: $2.00
Message-Id: <Pine.GSO.3.96.970818064813.25618E-100000@julie.teleport.com>

On Sun, 17 Aug 1997, Patrick Cooper wrote:

> I'm sorry for adding another commercial posting to your newsgroup 

Don't be sorry. Just don't do it.

Here's a reference to an article called "Advertising on Usenet: How To Do
It, How Not To Do It"

    http://www.danger.com/advo.html

Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 18 Aug 1997 07:31:01 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: help with this search pattern problem!!
Message-Id: <5af9t5.rn.ln@localhost>

Xu Chu (xuchu@iscs.nus.edu.sg) wrote:
: I am badly in help for this search pattern matching problem. i wanna extract the url link address from a file obtained from 
: altavista search results. the file is like this:

: <html><head>
: <title>Altavista Simple Query Perl
: </title></head>
: About <b>66666</b>  documents match your query<br><pre>
:  1.<a href="http://www.perlbook.com/" target="other"> Applied Perl</a> 21-May-97 Some Introductions
:  2.<a href="http://www.perl.com/">Perl</a> An Example only
: </pre>
: </html>

: what i write is:
: 	open(FP1,"infile");
: 	while(<FP1>) {
: 	 die "unknown format for $_"
: 	  unless s#^[\s\S]*<pre>\n((<a href=.*\n)*)</pre>[\s\S]*$#$1#is;
                    ^^^^^^

This is the same as just using a dot with the s///s modifier.


: 	 print;
: 	}
: 	close(FP1);

: i think the 's' in the search pattern can deal the whole file as a single line but failed. the above program died 
: immediately at the first line of the file. can anyone tell me what's wrong with my problem and how to make it run properly?


 2.<a href="http://www.perl.com/">Perl</a> An Example only
^^^

Your pattern has nothing that will match this part...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 18 Aug 1997 10:02:55 GMT
From: sami@d246a.mtalo.ton.tut.fi (Sami Sandqvist)
Subject: Re: help with this search pattern problem!!
Message-Id: <slrn5vg7g8.ai.sami@d246a.mtalo.ton.tut.fi>

On 18 Aug 1997 03:10:27 GMT, Xu Chu <xuchu@iscs.nus.edu.sg> wrote:
>I am badly in help for this search pattern matching problem. i wanna
extract the url  link address from a file obtained from 
>altavista search results. the file is like this:
>
><html><head>
><title>Altavista Simple Query Perl
></title></head>
>About <b>66666</b>  documents match your query<br><pre>
> 1.<a href="http://www.perlbook.com/" target="other"> Applied
Perl</a> 21-May-97 Some  Introductions
> 2.<a href="http://www.perl.com/">Perl</a> An Example only
></pre>
></html>
>
>what i write is:
>	open(FP1,"infile");
>	while(<FP1>) {
>	 die "unknown format for $_"
>	  unless s#^[\s\S]*<pre>\n((<a href=.*\n)*)</pre>[\s\S]*$#$1#is;
>	 print;
>	}
>	close(FP1);
>
>i think the 's' in the search pattern can deal the whole file as a
single line  but failed. the above program died 
>immediately at the first line of the file. can anyone tell me what's
wrong with  my problem and how to make it run properly?
>

I see two serious problems and one smaller problem. The serious ones:
1. You are not checking the return value of open().
2. You only read the first line of the infile before using the s///
-operator.

There is also a small problem with your regexp. It will not match
because the href-lines begin with a " \d+\.".

Try this:

#!/bin/perl -w
open(FP1,"infile") or die "Couldn't open infile";
$_ = join '',<FP1>; #read the entire file to $_
close(FP1);
s#^[\s\S]*<pre>\n([ \d.]*?(<a href=.*\n)*)</pre>[\s\S]*$#$1#is 
    or die "unknown format for $_\n"; 
print;

However, this reads the whole file into memory. If you process large
files, you might want to try something like this:

#!/bin/perl -w
open(FP1,"infile") or die "Couldn't open infile";
while ( ($_ = <FP1>) !~ /<pre>/){};
while ( ($_ = <FP1>) !~ /<\/pre>/) {
    print;
}
close(FP1);

HTH.

Sami
-- 
#################################################
#Sami Sandqvist		#Finger for PGP key	#
#samiss@cc.tut.fi	#			#
#################################################


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

Date: Mon, 18 Aug 1997 15:47:16 +0100
From: Bob Hannaford <bobh@metrica.co.uk>
Subject: how can I read compressed files in perl
Message-Id: <33F86074.41C6@metrica.co.uk>

I am writting an application that needs to handle files compressed
by the standard unix compress command and possible by 'gzip'.

I have found the alpha version of a perl extension Compress::Zlib-0.50
and successfully uncompressed 'gzip' files, does it also handle files
compressed with the standard unix compress.  If so how do I do it?  I 
have not been able to.

If Compress::Zlib-0.50 doesn't handle files compressed by the standard
unix compress, what is a good way of doing the uncompress from perl?
(Other than forking a process using the 'system' function which I will
resort to, if all else fails.)

Thanks in advance for any help.

Bob Hannaford

email bob.hannaford@adc.metrica.co.uk


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

Date: Mon, 18 Aug 1997 09:56:56 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How can I read one single character?
Message-Id: <adelton.871898216@aisa.fi.muni.cz>

daberkow@bln.sel.alcatel.de (Markus Daberkow) writes:


> Hi,
> 
> a simple question from a newbie:
> 
> How can I read one single char from STDIN? I don't want to press the 
> return key after typing that char.
> 
> Any ideas?

Check the Term::ReadKey module that does that.

Hope this helps!

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: Mon, 18 Aug 1997 07:24:34 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How can I read one single character?
Message-Id: <2ue9t5.qm.ln@localhost>

Markus Daberkow (daberkow@bln.sel.alcatel.de) wrote:

: a simple question from a newbie:

: How can I read one single char from STDIN? I don't want to press the 
: return key after typing that char.

: Any ideas?


Perl FAQ, part 5:

   "How can I read a single character from a file?  From the keyboard?"


: Thanks in advance


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Mon, 18 Aug 1997 06:40:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Anderson <IMS@wwwebspace.co.uk>
Subject: Re: How do I find the system date/time?
Message-Id: <Pine.GSO.3.96.970818063935.25618C-100000@julie.teleport.com>

On Sun, 17 Aug 1997, David Anderson wrote:

> Subject: How do I find the system date/time?

    $date = localtime;		# Get the date and time

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 18 Aug 1997 12:46:16 GMT
From: scip7075@leonis.nus.sg (Xu Chu)
Subject: how to parse only the lines between <pre> and </pre>
Message-Id: <5t9g6o$l78@nuscc.nus.sg>

i wanna parse only the lines between a <pre> and </pre>. Look at the 
original files like this:
<html>
<head>head</head>
<body>
<map name="header">
<AREA SHAPE=RECT COORDS="21,8,29,16" HREF="http://some.place.com/">
</map>
<pre>
<a href="http://www.example.com/">example</a>
</pre>

i am only interested in the url in the part between the <pre> and </pre> 
tags. but using the HTML::LinkExtor->new(\&callback) and set the tag 
comparing with 'a' will return both (http://some.place.com and 
http://www.example.com). how to solve the problem? pls help!! thanks.



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

Date: Mon, 18 Aug 1997 13:34:03 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: how to parse only the lines between <pre> and </pre>
Message-Id: <adelton.871911243@aisa.fi.muni.cz>

scip7075@leonis.nus.sg (Xu Chu) writes:

> <map name="header">
> <AREA SHAPE=RECT COORDS="21,8,29,16" HREF="http://some.place.com/">
> </map>
> <pre>
> <a href="http://www.example.com/">example</a>
> </pre>
> 
> i am only interested in the url in the part between the <pre> and </pre> 
> tags. but using the HTML::LinkExtor->new(\&callback) and set the tag 

print if m#<pre># .. m#</pre>#i;

will filter only the lines you want. So if you add this test into your
skript, it should work.

Hope this helps!

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: Mon, 18 Aug 1997 12:31:28 +0100
From: Nadeem Bhatti <bhatti@cableinet.co.uk>
Subject: Intermittent form data transfer delays
Message-Id: <33F83290.20BE@cableinet.co.uk>

Has anyone else experienced the intermittent delays on submitting a form
to cgi scripts ?

 For some reason the program just hangs after the form has been
submitted. The problem is intermittent and there is no discernible
pattern to its occurrence. 

Could the problem be on the server,to do with the new version of
Netscape or with the internet provider itself ? 

Please help.


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

Date: Mon, 18 Aug 1997 11:49:52 +0200
From: Helmut Llamas Stuhne <llamashe@microtec.de>
To: Kitty Smith <smith@twsuvm.uc.twsu.edu>
Subject: Re: NT Perl Sources and problem
Message-Id: <33F81AC0.8D5DDAC7@microtec.de>

> I am looking for NT Perl sources on the Web.

ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/ports/winNT/Perl5/ftp://ftp.cdrom.com/pub/perl/CPAN/ports/nt/Gurusamy_Sarathy/

> In particular, I am
> looking for some way to determine the username of the person accessing
>
> the page, as opposed to their IP address.  Is this possible?  There
> are all kinds of ENV variables for the server, but I didn't see
> anything for the client apart from their IP.

The CGI-environment variables get's only an IP-addresses and most of it
it's the IP-adresse
of an pool/provider-server.
To get detailed information about an client you need a program who runs
on the client, select these informations and resend it to you. To be
portable for all plattform you can only use an JAVA-applet.

regards
    helmut






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

Date: Mon, 18 Aug 1997 12:17:24 +0100
From: John Scriven <scrivenaj@cv.port.ac.uk>
Subject: pb with cgi-script
Message-Id: <33F82F3E.267A@cv.port.ac.uk>

Good morning!

Thank ou for your help!
I have succeed to install Perl5 under NT.

I am new in CGI script and I am trying to write some simple script
before making some more difficult.
But I have got a little problem : my script doesn't seems to work very
well.

- I wonder I there is something to be done while or after the
installation of NT in order to enable NT to run CGI script?
I know there are several things to do with UNIX.
All we have done to install Perl was to install it from a CDROM on
Windows 95 and then copy it in
Winnt/profiles/all users/start menu/programs/perl/perl5
and it work well if you use it manualy (e.g. perl test.pl is ok)
Perhaps it is not the best way to install it?!

- I use Microsoft Internet Explorer as browser. For the moment we are
disconnected from our network and I can't download Netscape any more.
Does it make any difference to use MIE instead of Netscape for CGI
purposes?

- The problem : all I try to do for the moment is to load a HTML
document using a link which contains the address of a CGI program.
I have read the book "Teach yourself CGI programming with Perl5 in a
week" from E. Herrmann. (I realize that a week is a bit short :) ) 
Therefore I have done a program like one I found in the book.
The document which call another one contains the following line:
<A HREF ="Winnt/profiles/all users/start
menu/programs/perl/perl5/test.cgi">text</A>
and the file test.cgi is a simple one with

print "Content-type: text/html\n\n;

print <<'end'
<html>
 ......
</html>
end
[and of course the first line with the hash sign]
When I try to use it I have got a message :
Unable to open "....../perl5/test.chi" the required Internet protocol
is not installed or the name may be invalid.
That is why I think I should have done something after the installation.

Thank you for helping me.

Stephane Michaut

please reply to : michauts@adc.port.ac.uk


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

Date: 18 Aug 1997 10:25:57 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: perl -v seems to be lying
Message-Id: <5t97vl$g7v$1@diablo.compusol.com.au>

In article <eli$9708151601@qz.little-neck.ny.us>,
Eli the Bearded  <usenet-tag@qz.little-neck.ny.us> wrote:
>Anyone want to suggest where I have gone wrong applying the 
>perl 5.0401 patch?
>
>:r! make 2>&1 | tail -2
> 
>        Everything is up to date.
>
>:r! head -2 patchlevel.h
>#define PATCHLEVEL 4
>#define SUBVERSION 1
>
>:r! ./perl -v | head -2
>
>This is perl, version 5.004
>
>I am strongly guessing that perl is finding the libperl.so from
>my previous version, but I do not want to remove that until I
>can complete 'make test'. Unfortuneately 'make test' has lots
>of tests that check the version number.... The LD_LIBRARY_PATH
>variable seems to be ignored.

I have had this problem when recompiling the *same* version of perl,
since the RPATH (set by LD_RUN_PATH or -rpath at compile time) is
searched before LD_*_PATH or the default path of /usr/lib.

So it is possible that you are getting the old shared library,
although it is unlikely since the default path for libperl.so
should include the version number.

You can easily check which library is being loaded if your machine has
ldd:

    $ ldd ./perl
    libperl.so => ./libperl.so
    ...

Regards,
-- 
Brendan O'Dea                                        bod@compusol.com.au
Compusol Pty. Limited                  (NSW, Australia)  +61 2 9809 0133


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

Date: Sun, 17 Aug 1997 02:02:11 +1000
From: Geoffrey Dunn <gdunn@lis.net.au>
Subject: Re: Perl books suggestions
Message-Id: <33F5CF03.6D94@lis.net.au>

Aitor wrote:
> 
> I'm learning Perl and I want to get  some Perl books,
> (I've got good programming background)
> 
> any suggestion apart "Programming Perl ".
> 
> Wanted Perl to use on the WWW.

I've used a few books (including above but would not recommend it) adn
recommend from the list
PERL in 21 days (kind of old but fat and easy to read. Good reference).
the CGI Book by William E Weinman (Also easy to read with CGI examples
in Shell, PERL and C)

Also I'd recommend getting one other CGI/PERL book but leave which up to
you. You can have too many so start with those to lacking any better
options. Then have a look at getting more technical books (like
Programming PERL).

Good luck

				Geoff
				PERL is both my friend and enemy.

-- 

Geoffrey Dunn  gdunn@lis.net.au
http://spike.scu.edu.au/~gdunn10/
If you take my comments seriously, please
take two aspirins and see me in the morning.
Member of Australians United Against Gherkins.


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

Date: Mon, 18 Aug 1997 13:07:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl Performance FAQ?
Message-Id: <EF41rz.896@world.std.com>

mlehmann@prismnet.com (Mark A. Lehmann) writes:

>However, I would like to have a FAQ or common respository of hints, tips, and
>testimonies on increasing perl performance.  

Along with the other's suggestions, here is my contribution.

The perl profiler <URL:http://www.perl.com/CPAN/modules/by-module
/Devel/DProf-19960930.tar.gz> can give you statistics for the speed of
various portions of your code. The obvious first step in speeding up
code is to find the places that are too slow. (I can't imagine a
program where changing all of the instances of a single character
substitution s/// with translate tr/// would turn the program from
being unacceptable slow to incredibly fast.)

The Benchmark module (which comes with the standard perl distribution)
can give a help in finding which of various methods of doing something
is the most efficient.


-- 
Andrew Langmead


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

Date: Mon, 18 Aug 1997 06:33:27 -0600
From: Florian Laws <fl@dmc.de>
Subject: perl5.004_01 special character problems
Message-Id: <871903202.5265@dejanews.com>

After installing Perl5.005_01 on Solaris 2.5 and Linux systems, I
encountered problems with Perl complaining about illegal special
characters in my perl scripts, but with the earlier versions it worked
fine.
Can anybody help?

Thanks in advance,

Florian

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 18 Aug 1997 13:24:00 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: perl5.004_01 special character problems
Message-Id: <5t9idg$lnj@fridge-nf0.shore.net>

Florian Laws (fl@dmc.de) wrote:

: Can anybody help?

It might not be a bad idea to perl -cw <scriptname>.  You should also
be using strict.

Would it be a problem to post some code for us to look at?  I'm sure
that a number of us could offer some insights into why perl5.004_01 is
complaining.

Thanks.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 18 Aug 1997 07:20:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Florian Laws <fl@dmc.de>
Subject: Re: perl5.004_01 special character problems
Message-Id: <Pine.GSO.3.96.970818071454.25618H-100000@julie.teleport.com>

On Mon, 18 Aug 1997, Florian Laws wrote:

> Newsgroups: comp.lang.perl.misc, comp.lang.perl

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

> After installing Perl5.005_01 on Solaris 2.5 and Linux systems, I
> encountered problems with Perl complaining about illegal special
> characters in my perl scripts, but with the earlier versions it worked
> fine.

Probably these are scripts which were incorrectly transferred from
DOS/Windows systems to Unix. Whenever you transfer a text file (which a
Perl script is), it's important to convert the line endings. Your FTP
client will normally do this automatically if you tell it you're
transferring text files.

Try something like this to fix the files.

    perl -pi.bak -e 's/\r\n/\n/' fix_us*

Why is Perl suddenly so intolerant of this problem? It's because these
invisible characters could mess up your script in subtle, hard to debug
ways. It was a bug to have ever allowed them, so it's fixed now.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 18 Aug 1997 15:46:46 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Sascha Kerschhofer <e9127005@stud1.tuwien.ac.at>
Subject: Re: Q: assoc. arrays as subroutine argument
Message-Id: <33F86056.1CFB@adc.metrica.co.uk>

Sascha Kerschhofer wrote:
> 
> i'm a litte confused.
> how can i handle an assoc. array as argument for a subroutine.
> eg: all of my cgi values are stored in the assoc. array "%data". i nedd a
> subroutine, which replaces all the non HTML conform charqacter (like "&,
> <, >") in their html equivalents:
> 
> sub ascii2html {
> foreach $wert (keys @_[0]) {
>   $_{$wert} =~ s/&/&amp;/g;  # i'm sure this is wrong!
>   $_{$wert} =~ s/</&lt;/g;
>   $_{$wert} =~ s/>/&gt;/g; }
> }
> 
> the routine is invoked by "ascii2html(%data)"
> 
> but this doesn't work. what am i doing wrong?
> any help is appreciated. thank you!
> 
> Sascha Kerschhofer, Vienna

You want to be passing a reference so that any changes you make to the
hash from within the subroutine are reflected in the calling function.
Try looking at the perlref man page. Essentially what you want is
something like the following:

sub ascii2html {
  my $hashref = shift;
  
  foreach $wert ( %$hashref ) {
    print "Key = $wert, Value = $$hashref{$wert}\n";
  }
  return;
}

ascii2html(\%data);

If you get stuck with references try playing around with some simple
examples, they are not easy to grasp immediately but once you have got
the knack they make life much better.

Simon


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

Date: Mon, 18 Aug 1997 16:34:10 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Q: IPC between Perl and C
Message-Id: <33F85D62.AF0BB0E@absyss.fr>

Joachim Wunder wrote:
> 
> Hi!
> 
> I am trying to figure out how to do InterProcessCommunication (IPC) between a C
> program and a Perl 5 program.
> 
> Any hints and/or code examples will be appreciated!

What sort of IPC?  I have Perl scripts that are clients of C servers
using TCP/IP.  I've never had any sort of problem with mixing the two
languages.  What sort of problems have you seen?

- doug


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

Date: Mon, 18 Aug 1997 10:05:29 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: URL validation
Message-Id: <ebohlmanEF3tD5.E1z@netcom.com>

Ben Sandler (ben@remove.this.part.samet.com) wrote:
: How can I look up a URL from a [command line] Perl script to see if it
: is valid?

Use the head() function in LWP::Simple.



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

Date: 18 Aug 1997 12:48:54 GMT
From: tony@niweb.com (Tony Bowden)
Subject: WWW::Search not returning anything
Message-Id: <5t9gbm$t2v$1@sparc.tibus.net>

I've been trying to get the WWW::Search modules to work, but I can't
actually get the query to return anything ...

The script I'm using is:

---
#!/usr/local/bin/perl 

use strict;
use WWW::Search;

my $query = "manic street preachers";
my $result;

my($search) = new WWW::Search('AltaVista');
$search->native_query(WWW::Search::escape_query($query));
my @results = $search->results();
foreach (@results) {
   print "$_: $_->url\n";
}

exit;
---

But it returns nothing.

Adding a -w, I get a: 
  Use of uninitialized value at /usr/local/lib/perl5/site_perl/WWW/Search.pm 
   line 221
 
which I can't place. Is there something else I need to set-up or define?

Tony
--
-----------------------------------------------------------------------------
 Tony Bowden |      tony@tmtm.com / t.bowden@qub.ac.uk / http://www.tmtm.com/
 Belfast, NI |      i look a lot like narcissus, a dark abyss of an emptiness
-----------------------------------------------------------------------------


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 884
*************************************

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