[17668] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5088 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 12 09:05:40 2000

Date: Tue, 12 Dec 2000 06:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976629910-v9-i5088@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 12 Dec 2000     Volume: 9 Number: 5088

Today's topics:
        (Mis)understanding a parsed form <mtx064@coventry.ac.uk>
        embed Java in pelrl script? <mreddan@broadgate.ie>
    Re: embed Java in pelrl script? (Rafael Garcia-Suarez)
    Re: embed Java in pelrl script? (Abigail)
    Re: Faster than LWP <matt@sergeant.org>
    Re: Faster than LWP <pdcawley@bofh.org.uk>
    Re: fileupload with CGI <fozz@xmission.com>
    Re: fileupload with CGI <s.franke@unwired.nl>
        Help! Problem with file uploads using CGI module hroces@my-deja.com
        how do i kill a process created like this in win98 <nobody@nowhere.net>
    Re: how do i kill a process created like this in win98 (Bernard El-Hagin)
    Re: How to execute an external Perl script in a Perl sc <john@imining.com.tw>
    Re: How to execute an external Perl script in a Perl sc <fozz@xmission.com>
        How to put each line of a text area into a field <perry@in4me.tv>
    Re: huh ?? <fozz@xmission.com>
    Re: huh ?? (Abigail)
    Re: huh ?? (Abigail)
    Re: huh ?? <Waarddebon@chello.nl>
        net:ping - problem in windows 2000 mike_solomon@lineone.net
    Re: PostgreSQL access in Perl scripts <fozz@xmission.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  (Tad McClellan)
    Re: single quote hell <mkuin@globalrangers.com>
    Re: single quote hell <fozz@xmission.com>
    Re: srand() for CGI <fozz@xmission.com>
    Re: Testing deliverability with Perl and Sendmail -bv <vautourNO@SPAMunb.ca>
    Re: this cgi starts download why?? <schneider@xtewa.de>
    Re: time differences <mkuin@globalrangers.com>
        using s// on *()[]+ in perl regex <qhsand@ehpt.com>
    Re: using s// on *()[]+ in perl regex (Rafael Garcia-Suarez)
    Re: using s// on *()[]+ in perl regex <qhsand@ehpt.com>
    Re: using s// on *()[]+ in perl regex (Rafael Garcia-Suarez)
    Re: using s// on *()[]+ in perl regex <qhsand@ehpt.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 12 Dec 2000 09:33:50 +0000
From: Dominic Hibbs <mtx064@coventry.ac.uk>
Subject: (Mis)understanding a parsed form
Message-Id: <Pine.OSF.3.91.1001212091137.30849D-100000@leofric>

The code below gets an shtml page

	$request = HTTP::Request->new('GET',$url);
	$response = $ua->request($request);
	$form = HTML::Form->parse($response->content(),$response->base());

I have 
	print $form->inputs;

which gives a long unbroken list like

HTML::Form::ListInput=HASH(0x1404ba130)HTML::Form::ListInput=HASH(0x140481ef8)
HTML::Form::TextInput=HASH(0x1404bece8)

In the shtml page I can find the "variables" that I wish to set for example

  <td class="fill2" align=centre><span class="text2"><SELECT NAME="YEAR" >
  <OPTION VALUE="2000"> 2000
  <OPTION VALUE="2001"> 2001
</SELECT></span></td>

but I don't understand how I can relate the inputs to the variables or 
how I can set the variables and submit the completed form.

LWP::UserAgent is handling the username and password side of things 
transparently after a little initial difficulty - overcome with 
invaluable help from this newsgroup.

Dominic

-----------------------------------------------------
Dominic Hibbs (Senior Lecturer)
School of Maths and Information Sciences
Coventry University
Priory Street
Coventry
CV1 5FB
02476 631313 Ext 7063
-----------------------------------------------------



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

Date: Tue, 12 Dec 2000 10:13:42 -0000
From: "Michelle Reddan" <mreddan@broadgate.ie>
Subject: embed Java in pelrl script?
Message-Id: <5YmZ5.5206$Er5.3085@news.indigo.ie>

I am writing a perl script and I need java on the page but the perl script
does not seem to recognise the java code
Can anyone suggest a solution





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

Date: Tue, 12 Dec 2000 10:23:40 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: embed Java in pelrl script?
Message-Id: <slrn93bv7a.535.rgarciasuarez@rafael.kazibao.net>

Michelle Reddan wrote in comp.lang.perl.misc:
> I am writing a perl script and I need java on the page but the perl script
                                                    ^^^^
Are you speaking about an HTML page, produced by a CGI program, that
happens to be written in Perl? So, the subject of your post should be
"embed a Java applet in HTML" and you should post your question in a
more appropriate newsgroup, e.g. comp.infosystems.www.authoring.html.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 12 Dec 2000 11:53:18 GMT
From: abigail@foad.org (Abigail)
Subject: Re: embed Java in pelrl script?
Message-Id: <slrn93c4de.6jj.abigail@tsathoggua.rlyeh.net>

On Tue, 12 Dec 2000 10:13:42 -0000, Michelle Reddan (mreddan@broadgate.ie) wrote in comp.lang.perl.misc <URL: news:<5YmZ5.5206$Er5.3085@news.indigo.ie>>:
++ I am writing a perl script and I need java on the page but the perl script
++ does not seem to recognise the java code

Perl doesn't recognize Java, and you find that _surprising_?

++ Can anyone suggest a solution


Perhaps you need to find out what Perl and Java are.


Abigail


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

Date: Tue, 12 Dec 2000 10:06:16 +0000
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: Faster than LWP
Message-Id: <3A35F898.7070302@sergeant.org>

BUCK NAKED1 wrote:

> Is there a faster way to grab a URL than using LWP? I've tried get and
> getstore from LWP/Simple and LWP/UserAgent. These methods appear to take
> so long that my webserver is timing out before grabbing the URL.

Use HTTP::GHTTP instead (assuming you can get libghttp running on your 
system). Its several times faster than LWP, and significantly less code.

Matt.



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

Date: 12 Dec 2000 12:21:42 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: Faster than LWP
Message-Id: <m2aea1ygmh.fsf@rt158.private.realtime.co.uk>

dennis100@webtv.net (BUCK NAKED1) writes:
> Is there a faster way to grab a URL than using LWP? I've tried get and
> getstore from LWP/Simple and LWP/UserAgent. These methods appear to take
> so long that my webserver is timing out before grabbing the URL.

Check out Matt Sergeant's HTTP::GHTTP, which uses the Gnome project's
libghttp (which surprisingly for Gnome code, appears to compile up
pretty easily in most places without requiring a pile of other
libraries) to do its stuff. It's quick. 

-- 
Piers


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

Date: Tue, 12 Dec 2000 02:54:51 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: fileupload with CGI
Message-Id: <3A35F5EB.A3449018@xmission.com>

Sven Franke wrote:
> 
> Hi,
> 
> I want to use the fileupload, but I can't get it work.
> 
> If  I'm correct, this would do the trick:
> $q = new CGI;
> $q->upload("Filename");
> 
> but what then?
> I want to do some translations with the file and then store it as a .txt
> file.
> 
> Can someone help me?

You can't just call upload() without assigning its return value to a
scalar variable. The return value is a open file handle. From the CGI
POD:

            $fh = $query->upload('uploaded_file');
            while (<$fh>) {
                  print;
            }

You can use the uploadInfo() function (part of the CGI.pm module) to get
information about the uploaded file (i.e. content type, size, etc.)

-=Fozz
--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: Tue, 12 Dec 2000 11:32:29 +0100
From: "Sven Franke" <s.franke@unwired.nl>
Subject: Re: fileupload with CGI
Message-Id: <914uls$3g2$1@enterprise.cistron.net>

<CUT>

Thanks all, it works now....
Why, i don't know. It seems to be the same code as yesterday. I just retyped
it and now it's running good.

Thanx All!!!

Sven Franke




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

Date: Tue, 12 Dec 2000 10:05:13 GMT
From: hroces@my-deja.com
Subject: Help! Problem with file uploads using CGI module
Message-Id: <914t8n$2lj$1@nnrp1.deja.com>

Hello,

I am trying to create a CGI to upload files from user to my server,
using a perl script, but I have a problem, I don´t receive a file
handle, and I don´t understand it.I only receive the path of the file,
but no the file handle.
The code is the following:

#This is the HTML page

use CGI;

#Constructor

$query=new CGI;

#Header

print $query->header;

#Form

print $query->start_multipart_form('GET','transferir.cgi');
print $query->filefield('uploaded_file','starting value',50,180);
print $query->br;
print $query->submit('attach','Attach');
print $query->endform();



#This is the CGI: transferir.cgi

use CGI;

#Constructor

$query=new CGI;

#Header

print $query->header;

#Obtain the info

$filename = $query->param('uploaded_file');
print $filename;
print $query->br;

#Is a valid file handle?

$fh = $query->upload('uploaded_file');
if ($fh eq '')
{
	print "Undefined";
	print $query->br;
}
else
{
	print "Defined";
	print $query->br;
}

# Read a text file and print it out

while (<$filename>)
{
 $linea=<$filename>;
 print $linea;
}



Thanks for the help.

Hugo Roces.


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


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

Date: Tue, 12 Dec 2000 18:18:25 +0800
From: "­»´ä¸}" <nobody@nowhere.net>
Subject: how do i kill a process created like this in win98
Message-Id: <914ugh$8bj$1@taliesin.netcom.net.uk>

like `notepad`




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

Date: Tue, 12 Dec 2000 12:35:58 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: how do i kill a process created like this in win98
Message-Id: <slrn93c6tc.7b.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 12 Dec 2000 18:18:25 +0800, nobody@nowhere.net
<nobody@nowhere.net> wrote:
>like `notepad`

Well, I hate it.

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: Tue, 12 Dec 2000 12:46:30 +0800
From: "John" <john@imining.com.tw>
Subject: Re: How to execute an external Perl script in a Perl script
Message-Id: <914at5$r9v@netnews.hinet.net>

Try
system("perl problem.cgi");
may work...

John Hsieh
john@imining.com.tw

Hank <chk1213@yahoo.com> wrote in message
news:t3b6utega6lh5e@corp.supernews.com...
> I have tried to find the answer from the news group, but I still couldn't
> make it work as the way I wanted.
>
> What I am trying to do:
> First, I know I can use this HTML code to execute a single perl script -
>
> <A HREF="problem.cgi">Go to this Problem </A>
>
> It's fine. But my problem is that I also want to write a status flag into
> a flat file before I execute this Perl script. So, that means I had to use
> some way like FORM, to "Submit" an "Action". In the "Action", I can
> implement the status flag file written and execute the Perl script
> "problem.cgi". I tried to use Exec() or System() to execute the Perl
> script, like -
>
> Exec ("problem.cgi");
> or
> System ("problem.cgi");
>
> What I got was a MS-DOS screen, then program seems hanging there forever.
>
> By the way, I am running Perl in Window 95 environment.
>
> Your help is much needed and thanks in advance.
>
> Hank
>
> --
> Posted via CNET Help.com
> http://www.help.com/




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

Date: Tue, 12 Dec 2000 02:38:36 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: How to execute an external Perl script in a Perl script
Message-Id: <3A35F21C.891AE5FE@xmission.com>

Hank wrote:
> 
> I have tried to find the answer from the news group, but I still couldn't
> make it work as the way I wanted.
> 
> What I am trying to do:
> First, I know I can use this HTML code to execute a single perl script -
> 
> <A HREF="problem.cgi">Go to this Problem </A>
> 
> It's fine. But my problem is that I also want to write a status flag into
> a flat file before I execute this Perl script. So, that means I had to use
> some way like FORM, to "Submit" an "Action". In the "Action", I can
> implement the status flag file written and execute the Perl script
> "problem.cgi". I tried to use Exec() or System() to execute the Perl
> script, like -
> 
> Exec ("problem.cgi");
> or
> System ("problem.cgi");
> 
> What I got was a MS-DOS screen, then program seems hanging there forever.
> 
> By the way, I am running Perl in Window 95 environment.
> 
> Your help is much needed and thanks in advance.

I try not to do any Perl development in Windows if I don't have to, but
it seems like you should be looking at the do() function:

  do 'problem.cgi';

-=Fozz
--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: Tue, 12 Dec 2000 12:41:02 +0100
From: "Perry Smit" <perry@in4me.tv>
Subject: How to put each line of a text area into a field
Message-Id: <g2oZ5.25527$fy2.1731280@news.soneraplaza.nl>

I'm puzzling to get each line of a text area field into seperate fields.

I have two textarea's. One containing fieldnames and the other contains the
fieldvalues.

Now I want print this in an e-mail where each text line of the fieldname
textarea correspondent by the fieldvalue textarea.

You can find the interface on: http://www.in4me.tv/goldmine_crm/grabber.html

What's the formula to create a pair of fields which will give me the results
like this


<<Textare_fieldnames>  <<textareafieldvalue>>
Company  =  Firm Jansen
Address1  =   Dorpstraat 35
Zip  = 21523 RT
City  = Amsterdam
Phone1 = 383838993

I've tried already this (copied rom other sources and tried and
tried...wothj no result):-)

@fieldvalues = ();
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    if ($name eq "fieldvalue") {
 push(@fieldvalues,$value);
    } else {
 $FORM{$name} = $value;
    }
}


Any help appreciated to get this done,


Perry Smit






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

Date: Tue, 12 Dec 2000 02:30:58 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: huh ??
Message-Id: <3A35F052.5AAAF294@xmission.com>

Waarddebon wrote:
> 
> Well this is the actual code, I really hope you can help me...
> 
> $temp=$a1.$a2;
> $string = "temp=" . $temp . "&a1=" . $a1 . "&a2=" . $a2 . "&a3=" . $a3 .
> "&a4=" . $a4 . "&a5=" . $a5 . "&b1=" . $b1 . "&b2=" . $b2 . "&b3=" . $b3 .
> "&c1=" . $c1 . "&c2=" . $c2 . "&d1=" . $d1 . "&e1=" . $e1 . "&e2=" . $e2 .
> "&e3=" . $e3 . "&f1=" . $f1 . "&f2=" . $f2;
> dbmopen(%DB, "/data/database/sell", 0664) || die $!;
> $DB{$temp} = $string;
> dbmclose(%DB);

Are you aware that the & character is special in Perl? It usually
indicates a function call. Try this:

 $string = 'temp=' . $temp . '&a1=' . $a1 . '&a2=' . $a2 . '&a3=' . $a3
 .
  '&a4=' . $a4 . '&a5=' . $a5 . '&b1=' . $b1 . '&b2=' . $b2 . '&b3=' .
$b3 .
  '&c1=' . $c1 . '&c2=' . $c2 . '&d1=' . $d1 . '&e1=' . $e1 . '&e2=' .
$e2 .
  '&e3=' . $e3 . '&f1=' . $f1 . '&f2=' . $f2;

Your original code works fine in my interpretter, but your interpretter
may be picky. 

Another solution is to use sprintf instead of all these concatenations:

  $string = sprintf("temp=%s&a1=%s&a2=%s&a3=%s...",
     $temp,$a1,$a2,...);

-=Fozz


--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: 12 Dec 2000 13:02:01 GMT
From: abigail@foad.org (Abigail)
Subject: Re: huh ??
Message-Id: <slrn93c8e9.6jj.abigail@tsathoggua.rlyeh.net>

On Tue, 12 Dec 2000 04:44:49 GMT, Waarddebon (Waarddebon@chello.nl) wrote in comp.lang.perl.misc <URL: news:<53iZ5.195658$nj7.2186766@Flipper>>:
++ Well this is the actual code, I really hope you can help me...
++ 
++ $temp=$a1.$a2;
++ $string = "temp=" . $temp . "&a1=" . $a1 . "&a2=" . $a2 . "&a3=" . $a3 .
++ "&a4=" . $a4 . "&a5=" . $a5 . "&b1=" . $b1 . "&b2=" . $b2 . "&b3=" . $b3 .
++ "&c1=" . $c1 . "&c2=" . $c2 . "&d1=" . $d1 . "&e1=" . $e1 . "&e2=" . $e2 .
++ "&e3=" . $e3 . "&f1=" . $f1 . "&f2=" . $f2;
++ dbmopen(%DB, "/data/database/sell", 0664) || die $!;
++ $DB{$temp} = $string;
++ dbmclose(%DB);


Is that all the code? You haven't set $a1 or $a2 to anything, hence $temp
is empty.



Abigail


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

Date: 12 Dec 2000 13:02:58 GMT
From: abigail@foad.org (Abigail)
Subject: Re: huh ??
Message-Id: <slrn93c8g2.6jj.abigail@tsathoggua.rlyeh.net>

On Tue, 12 Dec 2000 02:30:58 -0700, Doran Barton (fozz@xmission.com) wrote in comp.lang.perl.misc <URL: news:<3A35F052.5AAAF294@xmission.com>>:
++ Waarddebon wrote:
++ > 
++ > Well this is the actual code, I really hope you can help me...
++ > 
++ > $temp=$a1.$a2;
++ > $string = "temp=" . $temp . "&a1=" . $a1 . "&a2=" . $a2 . "&a3=" . $a3 .
++ > "&a4=" . $a4 . "&a5=" . $a5 . "&b1=" . $b1 . "&b2=" . $b2 . "&b3=" . $b3 .
++ > "&c1=" . $c1 . "&c2=" . $c2 . "&d1=" . $d1 . "&e1=" . $e1 . "&e2=" . $e2 .
++ > "&e3=" . $e3 . "&f1=" . $f1 . "&f2=" . $f2;
++ > dbmopen(%DB, "/data/database/sell", 0664) || die $!;
++ > $DB{$temp} = $string;
++ > dbmclose(%DB);
++ 
++ Are you aware that the & character is special in Perl? It usually
++ indicates a function call.

Rubbish. The & is *INSIDE* quotes. Hence, & isn't special at all.



Abigail


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

Date: Tue, 12 Dec 2000 13:56:23 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: Re: huh ??
Message-Id: <b8qZ5.205175$nj7.2270178@Flipper>

The variables $a1 and $a2 get their value by reading out the parameter
$a1=$q->param('a1');
 $a2=$q->param('a2');


> ++
> ++ $temp=$a1.$a2;
> ++ $string = "temp=" . $temp . "&a1=" . $a1 . "&a2=" . $a2 . "&a3=" . $a3
 .
> ++ "&a4=" . $a4 . "&a5=" . $a5 . "&b1=" . $b1 . "&b2=" . $b2 . "&b3=" .
$b3 .
> ++ "&c1=" . $c1 . "&c2=" . $c2 . "&d1=" . $d1 . "&e1=" . $e1 . "&e2=" .
$e2 .
> ++ "&e3=" . $e3 . "&f1=" . $f1 . "&f2=" . $f2;
> ++ dbmopen(%DB, "/data/database/sell", 0664) || die $!;
> ++ $DB{$temp} = $string;
> ++ dbmclose(%DB);
>
>
> Is that all the code? You haven't set $a1 or $a2 to anything, hence $temp
> is empty.
>
>
>
> Abigail




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

Date: Tue, 12 Dec 2000 12:47:07 GMT
From: mike_solomon@lineone.net
Subject: net:ping - problem in windows 2000
Message-Id: <9156ob$91f$1@nnrp1.deja.com>

I am trying to use Net::Ping to find out if an IP address is available

I am using ActivePerl under Windows 2000

I used the following code:

	use Net::Ping;
	if (pingecho(${fip},5)) {
		print "\n\nPing Succeeded - IP ${fip} in use\n";
		$pop++;
	} else {
		print "\n\nPing Failed - ${fip} OK TO USE\n";
		$ok = 1;
	}

Where $fip is the ip address

Which gave me the following error message:

The Unsupported function alarm function is unimplemented at
        C:/Perl/lib/Net/Ping.pm line 308, <STDIN> line 3 (#1)

    The function indicated isn't implemented on this architecture,
according
    to the probings of Configure.

Uncaught exception from user code:
        The Unsupported function alarm function is unimplemented at
C:/Perl/lib/
Net/Ping.pm line 308, <STDIN> line 3.
        Net::Ping::ping_tcp('Net::Ping=HASH(0x214164c)', 'M-TX%^G', 10)
called a
t C:/Perl/lib/Net/Ping.pm line 151
        Net::Ping::ping('Net::Ping=HASH(0x214164c)', 212.99.99.99)
called at C:/P
erl/lib/Net/Ping.pm line 46
        Net::Ping::pingecho(212.99.99.99, 10) called at
E:\scripts\ipinsert.pl li
ne 120
255 returned

Does anyone have any idea if there is a solution to this

I have read the documentation for Net:Ping but it hasn't helped me

Thanks


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


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

Date: Tue, 12 Dec 2000 03:01:06 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: PostgreSQL access in Perl scripts
Message-Id: <3A35F762.9B38E55E@xmission.com>

Peter Grossi wrote:
> Can anybody help me access PostgreSQL database from a Perl script? I
> have set up databases on a Linux server, and have no problem
> processing them in Java apps on the network. I also have no problem
> running Perl scripts to process dynamic data in web pages.
> 
> I would like to access PostgreSQL data via Perl in dynamic web pages.

See < http://www.cpan.org/ > for information on the CPAN (Comprehensive
Perl Archive Network) - a worldwide-mirrored repository of useful Perl
code in the form of CPAN modules. 

There is a Pg module which is a direct interface between Perl 5.x and a
PostgreSQL database, but I don't recommend it. Most of us use the DBI
module which provides a useful abstraction layer between Perl and your
database. This makes it easy to port your code from one database backend
to another and it lets you do all your Perl database programming in one
style regardless of the database backend you're using.

So... get the DBI module.

Then, you'll need a DBD (driver) module to work with DBI. Get the
DBD::Pg module.
Read the documentation included with each and you should be on your way.

--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: Tue, 12 Dec 2000 06:43:40 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <slrn93c7bs.s1.tadmc@maxim.metronet.com>


Here is a start on some Posting Guidelines for our newsgroup.

Please review it and _post_ your comments (no email).

Design goals:

   Keep the total size below 400 lines (about 8 pages maximum).

   Don't use our (the group's) point of view, use the targeted
   audience's (new posters) point of view. (ie. what's in it
   for them, not for us)

   Maintain the rough outline capability mentioned below.

   Do our best to avoid lengthy descriptions of _why_ these
   rules are rules. It will get too long if we include too
   much justification. We can make a stand-off supplement
   with the reasons if there are enough of them.


I developed most of the points by reviewing several killfiles
that I have access to. You might want to review yours for
additional points to include.

I have only reviewed the output from pod2html and pod2text. If
you like a different format, please test how it looks in your
preferred format.



   tadmc



----------------------------------------------------------------------
=head1 Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)

The comp.lang.perl.misc (clpmisc) Usenet newsgroup is for the discussion
of using the Perl programming language.

Since clpmisc is such a high-traffic newsgroup (more than 100 articles
per day), there are some "crowd control" measures that have evolved
to keep things manageable.

This article describes things that you should, and should not, do
to increase your chances of getting an answer to your Perl question.

You can get a rough outline of the points made here by running:

   perl -ne 'print "   $_" if /^=item/; print if /^=head/' thisfile.pod

Do B<NOT> send email to the maintainer of these guidelines. It will
be discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary
that writes down the consensus of the group.


=head1 Before posting to comp.lang.perl.misc

=head2 Must

This section describes things that you B<must> do before
posting to clpmisc. 

=over 4

=item Check the Perl Frequently Asked Questions (FAQ)

Checking the FAQ before posting is required in Big 8 newsgroups
in general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.

=item Check the other standard Perl docs (*.pod)

The perl distribution comes with much more documentation than
is available for most other newsgroups, so in clpmisc you should
also see if you can find an answer in the other (non-FAQ) standard 
docs before posting.

=back

It is B<not> required, or even expected, that you actually I<read>
all of Perl's standard docs, only that you spend a few minutes
searching them before posting.

Try doing a word-search in the standard docs for some words/phrases 
taken from your problem statement or from your very carefully 
worded C<Subject:> header.


=head2 Really Really Should

This section describes things that you B<really should> do
before posting to clpmisc.

=over 4

=item Lurk for a while before posting

It is standard 'netiquette to monitor (lurk) a newsgroup for a few
days or weeks before posting. By doing so you will be able to see
what is socially acceptable in the newsgroup.

You can "power lurk" by reading 20-30 posts a day for the last
several days at a Usenet archive.


=item Search a Usenet archive

There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if
you can find where it has already been answered.

One such searchable archive is <URL:http://www.deja.com/home_ps.shtml>.

=back


=head2 If You Like

This section describes things that you B<can> do before 
posting to clpmisc.

=over 4

=item Check Other Resources (optional)

You may want to check in books or on web sites to see if you can
find the answer to your question.

But you need to consider the source of such information, there are
a lot of very poor Perl books and web sites, and several good
ones too, of course.

=back

=head1 Posting to comp.lang.perl.misc

There can be 200 messages in clpm in a single day. Nobody is going 
to read every article. So they must decide somehow which articles 
they are going to read, and which they will skip.

Your post is in competition with 199 other posts. You need to 
"win" before a person who can help you will even read your question.

These sections describe how you can help keep your article from 
being one of the "skipped" ones.

=head2 Is there a better place to ask your question?

=over 4

=item Question should be about Perl, not about the application area

It can be difficult to separate out where your problem really is, 
but you should make a conscious effort to post to the most 
applicable newsgroup. That is, after all, where you are the most 
likely to find the people who know how to answer your question. 

Being able to "partition" a problem is an essential skill for 
effectively troubleshooting programming problems. If you don't 
get that right, you end up looking for answers in the wrong places.

It is understood that you may not know that the root of your problem 
is not Perl-related (the two most frequent ones are CGI and Operating 
System related). So off-topic postings will happen from time to time. 
Be gracious when someone helps you find a better place to ask your 
question by pointing you to a more applicable newsgroup.

=back

=head2 How to participate (post) in the clpm community

=over 4

=item Carefully choose the contents of your Subject header

You have 40 precious characters of Subject to win out and be one 
of the posts that gets read. Don't waste them. Take care while 
composing them, they are the key that opens the door to getting 
an answer. 

Spend them indicating what aspect of Perl others will find if 
they should decide to read your article.

Do not spend them indicating "experience level" (guru, newbie...).

Do not spend them pleading (please read, urgent, help!...).

Do not spend them on non-Subjects (Perl question, one-word Subject...)

=item Use an effective followup style

When composing a followup, quote only enough text to establish the 
context for the comments that you will add. Never quote an entire 
article. Never quote a .signature (unless that is what you are 
commenting on). 

Intersperse your comments B<following> the sections of quoted text
that your comment applies to.

=item Speak Perl rather than English, when possible

Perl is much more precise than natural language. Saying it in
Perl instead will avoid misunderstanding your question or problem.

Do not say: I have variable with "foo\tbar" in it.

Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).

=item Do not expect people to do a machine's work

You can ask perl itself to help you find common programming mistakes 
by doing two things: enable warnings (perldoc warnings) and enable 
"strict"ures (perldoc strict).

You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find
your problem. It is degrading to be asked to do the work
of a machine. It will annoy the readers of your article.

You can look up any of the messages that perl might issue to
find out what the message means and how to resolve the
potential mistake (perldoc perldiag).

=item Do not type in Perl code

Use copy/paste or your editor's "import" function or something
rather than attempting to type in your code. If you make a typo
you will get followups about your typos instead of about the
question you are trying to get answered.

=item Provide enough information

If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.

First make a short (less than 20-30 lines) and B<complete> program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article.
(You will find that doing this step very often reveals your 
problem directly. Leading to an answer much more quickly and
reliably than posting to Usenet.)

Provide the input to your program. If you need to show file input,
use the __DATA__ token (perldata.pod) to provide the file contents
inside of your Perl program.

Show the output (including the verbatim text of any messages)
of your program.

Describe how you want the output to be different from what you
are getting.

If you have no idea at all of how to code up your situation, be
sure to at least include the 2 things that you I<do> know: input and
desired output.

=item Do not provide too much information

Do not just post your entire program for debugging. Most 
especially do not post someone B<else's> entire program.

=back


=head2 Social faux pax to avoid

The first two below are symptoms of lots of FAQ asking here
in clpmisc. It happens so often that folks will assume that it
is happening yet again. If you have looked but not found, or
found but didn't understand the docs, say so in your article.

=over 4

=item Asking a Frequently Asked Question

It is understood that you may have missed the applicable FAQ when
you checked, which is not a big deal. But if the Frequently 
Asked Question is worded similarly to your question, folks will 
assume that you did not look at all.  Don't become indignant 
at pointers to the FAQ, particularly if it solves your problem.

=item Asking a question easily answered by a cursory doc search

If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.

If you are flamed for not checking when you I<did> check, then
just shrug it off (and take the answer that you got).

=item Asking for emailed answers

Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your question,
then you can take the time to go get the answer in the same place
where you asked the question.

It is OK to ask for a B<copy> of the answer to be emailed, but
many will ignore such requests anyway. If you munge your address,
you should never expect (or ask) to get email in response to a 
Usenet post.

Ask the question here, get the answer here (maybe).

=item Beware of saying "doesn't work"

This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you want.

=item Count to ten before composing a followup when you are upset

This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all!
They are most often for what was seen as a breach of netiquette.
If you have lurked for a bit, then you will know what is expected
and won't make such posts in the first place.

But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.

=item Count to ten after composing and before posting when you are upset

After you have written your followup, wait B<another> 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.

=back

=head1 AUTHOR

Tad McClellan <tadmc@metronet.com>








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


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

Date: Tue, 12 Dec 2000 09:41:26 +0100
From: "Mark Kuin" <mkuin@globalrangers.com>
Subject: Re: single quote hell
Message-Id: <914ocd$2o5$1@news1.xs4all.nl>

If you don't use the g, you only replace the first occurence.

"Tommy Martin" <tmartin1@telocity.com> wrote in message
news:GPhZ5.30028$C2.6665098@newsrump.sjc.telocity.net...
> Thanks.... That got it...
>
> I could swear I tried $var =~ s/'/''/; but maybe I didn't. It sure got it
> though.
>
> Out of curiosity what is the g for as in s/'/''/g;
>
> Thanks again.
>
> Tommy
>
> "Richard Zilavec" <rzilavec@tcn.net> wrote in message
> news:3a35a768.347618406@news.tcn.net...
> > On Mon, 11 Dec 2000 21:55:37 -0600, "Tommy Martin"
> > <tmartin1@telocity.com> wrote:
> >
> > >in a variable and replace where the user entered a single quote ' mark
> with
> > >2 of them '' so my sql statement will add that string the to the
> database.
> >
> > $string =~ s/'/''/g;
> >
> > >I have tried q() qq() /s and /tr and have not been able to get any of
> them
> > >to work on that character.
> >
> > q() is a substitute for ' so
> >
> > $path = '/this';
> > $path = q(/this);
> >
> > qq() is just a double quote or a sustitute for "
> >
> > $path = "$somepath/here";
> > $path = qq($somepath/here);
> >
> > perldoc perlop
> > for tr///;
> >
> >
> > --
> >  Richard Zilavec
> >  rzilavec@tcn.net
>
>




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

Date: Tue, 12 Dec 2000 02:35:16 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: single quote hell
Message-Id: <3A35F154.DD838B47@xmission.com>

Tommy Martin wrote:
> 
> Thanks.... That got it...
> 
> I could swear I tried $var =~ s/'/''/; but maybe I didn't. It sure got it
> though.
> 
> Out of curiosity what is the g for as in s/'/''/g;

g = global. It matches all occurances of the pattern.

I thought I should also mention... if you're using DBI to interact with
your database (and it is usually a good idea to use DBI), you may want
to use the quote() function that comes with the DBI package. Below is an
excerpt from the DBI POD:

             $sql = $dbh->quote($value);
             $sql = $dbh->quote($value, $data_type);


           Quote a string literal for use as a literal value in
           an SQL statement, by escaping any special characters
           (such as quotation marks) contained within the string
           and adding the required type of outer quotation marks.

             $sql = sprintf "SELECT foo FROM bar WHERE baz = %s",
                           $dbh->quote("Don't");

           For most database types, quote would return 'Don''t'
           (including the outer quotation marks).

I think that's what you want to do. Instead of reinventing the wheel,
use the quote() method available through DBI. 

-=Fozz
--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: Tue, 12 Dec 2000 02:25:02 -0700
From: Doran Barton <fozz@xmission.com>
Subject: Re: srand() for CGI
Message-Id: <3A35EEEE.23685E63@xmission.com>

sluppy wrote:
> 
> I wrote a short subroutine to produce a random string that I plan to
> use as a session ID on a cookie-less web site.
> 
> The problem is that I can duplicate the "random" string simply by _very
> quickly_ running the subroutine twice from the command line.
> 
> I'm assuming that srand() is equivalent to srand(time) which AFAIK
> doesn't get any finer than the current second.
> 
> So... I assume that two visitors to my web site during the exact same
> second would be issued the exact same session ID. (This, of course,
> would be bad.)
> 
> Is there a way I can minimize the possibility of two or more visitors
> to the web site getting the same random result?

One way to increase the entropy in your case is to use the visitor's IP
address (usually found in $ENV{REMOTE_ADDR}). 

You may also want to use the Math::TrulyRandom module available from
your local neighborhood CPAN site.

Ahh, RTFM. The POD documentation for srand() gives an excellent example:

  srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);

Nice.

-=Fozz

--
Doran L. Barton -- < fozz@xmission.com > 
"Some people don't know Unix from Meuslix. Others claim to dream in
Perl."


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

Date: Tue, 12 Dec 2000 09:17:07 -0400
From: Gil Vautour <vautourNO@SPAMunb.ca>
Subject: Re: Testing deliverability with Perl and Sendmail -bv
Message-Id: <3A362552.889A0D9F@SPAMunb.ca>

Ok, here's a clarification.  I figured out Sendmail won't do what I need.
What I want to do is for my file of email addresses (which are all
internal) is query our CCSO (Ph) nameserver to determine if the address is
valid.  I'm just not sure about how to do the query and test the result.
We already have a CGI script for public queries, so I was thinking of
somehow calling that from my script and test the results...  Any ideas?

Thanks,

Gil Vautour wrote:

> Hello,
>
> I was wondering if anyone knew a way using Perl and Sendmail to test an
> email
> address to see if it is deliverable before sending the message?  I'm
> using Perl to call Sendmail to send a standard message to a large file
> of email addresses and I would like to check to see if the message will
> get bounced and if so not send it at all.  I know there is the -bv
> option, will this do the job?  More specifically how
> in Perl would I be able to test the the result of -bv in order to send
> or not?
>
> Thanks,



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

Date: Tue, 12 Dec 2000 11:39:53 GMT
From: SimBean <schneider@xtewa.de>
Subject: Re: this cgi starts download why??
Message-Id: <9152qa$6ao$1@nnrp1.deja.com>


> With that out of the way, the answer is taht you forgot the content-
type
> header:
Hmh, but that is not the solution to the problem AFAIK.

He should be configurating his webserver so that it executes perl
scripts instead of handling them like text-files (=> downloading or
opening them from location) ...

Still, he won't get output until he prints the header first ... :)


Ciao,
SimBean.


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


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

Date: Tue, 12 Dec 2000 09:48:51 +0100
From: "Mark Kuin" <mkuin@globalrangers.com>
Subject: Re: time differences
Message-Id: <914oqa$47v$1@news1.xs4all.nl>

Why don't you use the local time? (I'm assuming your computer is in the same
time zone as you are in...)

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

<qwex@my-deja.com> wrote in message news:914hrn$pm0$1@nnrp1.deja.com...
> I'm building a simple news site using Perl. the front page will show 3
> days of news, which is retrieved from files called mm-dd-yyyy.txt
> (primitive, but I'm a beginner :) ). anyway, I live in the CST time
> zone, so I figured it would be easiest simply to do all news updates in
> CST. I can use gmtime(time) to get GMT time, but how do I convert that
> to CST? not just the hour, but also the day: if it's 8:00pm CST, it's
> the next day in GMT, so how do I account for that?
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Tue, 12 Dec 2000 11:10:50 +0100
From: Andreas Burmester HG/EHS/FD <qhsand@ehpt.com>
Subject: using s// on *()[]+ in perl regex
Message-Id: <3A35F9A9.767B24A8@ehpt.com>

This is a multi-part message in MIME format.
--------------D37524D7A59C6C71EA6AF5D5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



--------------D37524D7A59C6C71EA6AF5D5
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Path: newstoo.ericsson.se!not-for-mail
From: Andreas Burmester HG/EHS/FD <qhsand@ehpt.com>
Newsgroups: comp.lang.perl
Subject: using s// on *()[]+ in perl regex
Date: Tue, 12 Dec 2000 10:52:55 +0100
Organization: ericsson
Message-ID: <3A35F576.861BC21B@ehpt.com>
NNTP-Posting-Host: vkhp34.ericsson.se
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.7 [en] (X11; I; HP-UX B.11.00 9000/778)
X-Accept-Language: en
Xref: newstoo.ericsson.se comp.lang.perl:11050

Hello,

Im writing a script that convert a SGML DTD to another.
Im using s// alot to change tags, like this

From <command>This is a command</command>
To <input>This is a command</input>

To do this im using s/<command>(.*)<\/command>/<input>$1<\/input>/; ,
but if there is a * in $1 i get a perl regex error.

Is there any way to get perl to "see" all chars in the reqex as "real"
chars and not as operators?

I have read the regex documention a few times but i cant find anything
there, please help.

Best Regards
Andreas Burmester



--------------D37524D7A59C6C71EA6AF5D5--



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

Date: Tue, 12 Dec 2000 10:20:56 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: using s// on *()[]+ in perl regex
Message-Id: <slrn93bv26.535.rgarciasuarez@rafael.kazibao.net>

Andreas Burmester HG/EHS/FD wrote in comp.lang.perl.misc:
> This is a multi-part message in MIME format.

Please don't post MIME in newsgroups.

> To do this im using s/<command>(.*)<\/command>/<input>$1<\/input>/; ,
> but if there is a * in $1 i get a perl regex error.

The problem probably comes from another point in your program.
Can you post some more code?

You should also be aware that your s/// pattern may fail on some cases;
e.g, it will transform the line
  <command>foo</command><command>foo</command>
into
  <input>foo</command><command>foo</input>

A way to fix this is to use a non-greedy operator :
  s/<command>(.*?)<\/command>/<input>$1<\/input>/g;

Another different solution, that may or may not fill your needs:
  s/<(\/?)command>/<$1input>/g;

> Is there any way to get perl to "see" all chars in the reqex as "real"
> chars and not as operators?

The \Q metacharacter (defined in perlre) do this. But as it doesn't
apply to the right side of s///, I don't think your problem comes from
here.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 12 Dec 2000 13:39:53 +0100
From: Andreas Burmester HG/EHS/FD <qhsand@ehpt.com>
Subject: Re: using s// on *()[]+ in perl regex
Message-Id: <3A361C99.689DE78E@ehpt.com>

Sorry about the MIME, i tryed to remove it now.

Here's a sample of the sub that im using,

Its used to take a tag (<foo>) and remove all tags inside it until it
finds the endtag (</foo>).

$body_line is the current line my script is working with.

sub intag {
	$intag_end = "0";	# has the end tag been found?
	$intag_nr = "0";	# how many lines past $body_line is it working
	($tag) = @_;		# tag to look for
	if($body_line =~ /<$tag>(.*)<\/$tag>/) {	# is the start and end tag on
the same line?
		$intag = $1;				# getting text betwin the tags.
		$intag_old = $intag;			# saving old text for later s//
		$intag =~ s/<\w*>//g;			# removes all start tags
		$intag =~ s/<\/\w*>//g;			# removes all end tags
		unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag =~
/\|/ || $intag =~ /\]/) {
			$body_line =~ s/$intag_old/$intag/;	#
s/old_text/new_text_with_out_tags/
		}
		$intag_end = "1";	# end tag has been found
			
	} elsif($body_line =~ /<$tag>(.*)/) {	# is the start tag on this line?
		$intag = $1;
		$intag_old = $intag;
		$intag =~ s/<\w*>//g;
		$intag =~ s/<\/\w*>//g;
		unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag =~
/\|/ || $intag =~ /\]/) {
			$body_line =~ s/$intag_old/$intag/;
		}
	}
	while($intag_end eq "0") {	# until the end tag is found
		if(@input[$line + $intag_nr] =~ /(.*)<\/$tag>/) {	# is the end tag on
this line?
			$intag = $1;
			$intag_old = $intag;
			$intag =~ s/<\w*>//g;
			$intag =~ s/<\/\w*>//g;
			unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag
=~ /\|/ || $intag =~ /\]/) {
				@input[$line + $intag_nr] =~ s/$intag_old/$intag/;
			}
			$intag_end = "1";	
		
		} else {	# this is a line inside the tag
			$intag = @input[$line + $intag_nr];
			$intag_old = $intag;
			$intag =~ s/<\w*>//g;
			$intag =~ s/<\/\w*>//g;
			unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag
=~ /\|/ || $intag =~ /\]/) {
				@input[$line + $intag_nr] =~ s/$intag_old/$intag/;
			}
		}
		$intag_nr++;	# search next line because the end tag wasnt found
	}
}	

###

unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag =~
/\|/ || $intag =~ /\]/) {
	$body_line =~ s/$intag_old/$intag/;
}

, this is where i get the error if i remove the unless line.

Regards
Andreas Burmester


Rafael Garcia-Suarez wrote:
> 
> Andreas Burmester HG/EHS/FD wrote in comp.lang.perl.misc:
> > This is a multi-part message in MIME format.
> 
> Please don't post MIME in newsgroups.
> 
> > To do this im using s/<command>(.*)<\/command>/<input>$1<\/input>/; ,
> > but if there is a * in $1 i get a perl regex error.
> 
> The problem probably comes from another point in your program.
> Can you post some more code?
> 
> You should also be aware that your s/// pattern may fail on some cases;
> e.g, it will transform the line
>   <command>foo</command><command>foo</command>
> into
>   <input>foo</command><command>foo</input>
> 
> A way to fix this is to use a non-greedy operator :
>   s/<command>(.*?)<\/command>/<input>$1<\/input>/g;
> 
> Another different solution, that may or may not fill your needs:
>   s/<(\/?)command>/<$1input>/g;
> 
> > Is there any way to get perl to "see" all chars in the reqex as "real"
> > chars and not as operators?
> 
> The \Q metacharacter (defined in perlre) do this. But as it doesn't
> apply to the right side of s///, I don't think your problem comes from
> here.
> 
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 12 Dec 2000 13:15:10 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: using s// on *()[]+ in perl regex
Message-Id: <slrn93c98t.5i1.rgarciasuarez@rafael.kazibao.net>

Andreas Burmester HG/EHS/FD wrote in comp.lang.perl.misc:
> Here's a sample of the sub that im using,
> 
> Its used to take a tag (<foo>) and remove all tags inside it until it
> finds the endtag (</foo>).
> 
> $body_line is the current line my script is working with.
> 
> sub intag {
>   $intag_end = "0"; # has the end tag been found?

Apparently you don't 'use strict'. Do: it helps.
And quotes are unnecessary around numbers.

>   $intag_nr = "0";  # how many lines past $body_line is it working
>   ($tag) = @_;    # tag to look for
>   if($body_line =~ /<$tag>(.*)<\/$tag>/) {
>     $intag = $1;        # getting text betwin the tags.
>     $intag_old = $intag;      # saving old text for later s//
>     $intag =~ s/<\w*>//g;     # removes all start tags
>     $intag =~ s/<\/\w*>//g;     # removes all end tags

Could be shrinked into
      $intag =~ s/<\/?\w*>//g;     # removes all tags

>     unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag =~
> /\|/ || $intag =~ /\]/) {
>       $body_line =~ s/$intag_old/$intag/;
>     }

Here's your problem. $intag_old is some text, but it's interpreted here
as a regular expression. You should do:
    $body_line =~ s/\Q$intag_old\E/$intag/;
and remove the tests for the presence of +*[|].

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 12 Dec 2000 14:56:10 +0100
From: Andreas Burmester <qhsand@ehpt.com>
Subject: Re: using s// on *()[]+ in perl regex
Message-Id: <3A362E7A.61975676@ehpt.com>

Thank you, its working now. :-)

/Andreas Burmester


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

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


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