[12483] in Perl-Users-Digest
Perl-Users Digest, Issue: 6083 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 21 22:07:16 1999
Date: Mon, 21 Jun 99 19:00:19 -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, 21 Jun 1999 Volume: 8 Number: 6083
Today's topics:
Re: 2 simple (not to me tho) questions <tchrist@mox.perl.com>
Re: 2 simple (not to me tho) questions (Casey R Tweten)
Re: 2 simple (not to me tho) questions (Randal L. Schwartz)
Re: 2 simple (not to me tho) questions (Steve Lamb)
Re: 2 simple (not to me tho) questions (Casey R Tweten)
Re: A buggy intersection-method (M.J.T. Guy)
ANN: XML::Dumper 0.4 eisen@pobox.com
ANNOUNCE: HTTPi/0.99 released <ckaiser@stockholm.ptloma.edu>
ANNOUNCE: WWW::Search 1.024 released <johnh@isi.edu>
ANNOUNCEMENT: NEW VERSION: HTML::Template 0.04 <sam@tregar.com>
Array elements <jcsavage@tampabay.rr.com>
Re: Breaking up is hard to do (Bob Trieger)
Re: compare two big files? <rootbeer@redcat.com>
Fun PERL JOB opening in Escondido, CA mike@pec.net
Re: function to read a line & return it <rick.delaney@home.com>
Re: Graphing tools for use with Perl <ppith@my-deja.com>
Having a little problem with changing multiple lines in <v0xman@yahoo.com>
Re: Having a little problem with changing multiple line <walton@frontiernet.net>
hello looking for script P-aCMa-N@webtv.net (=?ISO-8859-1?Q?/^P=E2=C7`M=E2=D1^=5C=5C=29?=
Re: How to output the current perl script in memory <rootbeer@redcat.com>
HTML Redirection bandhunt@my-deja.com
Re: Network Address Translation (David Efflandt)
Re: newbie question... <rick.delaney@home.com>
Re: Please Help with Perl 5 <rootbeer@redcat.com>
Re: Question about writing to a file in perl.. (David Efflandt)
Re: Sending a mail from LOTUS NOTE (winNT) <rootbeer@redcat.com>
www.economite.com kkling@economite.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Jun 1999 18:26:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <376ed843@cs.colorado.edu>
:On 21 Jun 1999 17:19:25 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
:>Why is that quoted?
: Anyway, you would get the same answer if you had asked me, "Why is that in
:parens?" Just my style to do it that way even though neither are really
:needed.
They aren't harmless, you know. Double quoted compose a
*brand*new*string*. This isn't necessarily what you always want.
There are enough situations where fn("$var") is different from fn($var)
that you would be doing yourself a favor if you were to get out of
the habit. It's confusing at best, dangerous at worst.
--tom
--
Maturity is only a short break in adolescence.
-- Jules Feiffer
------------------------------
Date: Tue, 22 Jun 1999 00:10:12 GMT
From: crt@highvision.com (Casey R Tweten)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <376ed420.608528053@news.kiski.net>
On 21 Jun 1999 17:19:25 -0700, Tom Christiansen <tchrist@mox.perl.com>
wrote:
::foreach (@animal){
:: print("$_");
::}
:
:Why is that quoted?
I agree, in fact, why is that so long?
my @animal=("c","a","t");
print foreach @animal;
--
Casey R. Tweten|HighVision Associates
Web Developer |www.highvision.com
<joke> This is 100% certified,
virus and bug free code </joke>
------------------------------
Date: 21 Jun 1999 17:35:51 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <m1909doyvs.fsf@halfdome.holdit.com>
>>>>> "Weborium" == Weborium <weborium@aol.com> writes:
Weborium> print @animal; #gets the length of the array.
No. Try again. It does what you want. :)
Weborium> 2. How can I convert a string with both upper-and lower-case letters into all
Weborium> lowercase?
Weborium> $string="America" to $string="america"?
Weborium> I don't know the contents of the variable in question, otherwise I'd just
Weborium> assign the new value.
$string = lc $string;
Weborium> PS. I don't have the perl docs, so I can't do the perldoc
Weborium> thing. I'm testing the scripts on a DOS version with only
Weborium> perl.exe.
You need to reinstall Perl. Don't be deleting things. :)
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 22 Jun 1999 00:41:19 GMT
From: morpheus@despair.rpglink.com (Steve Lamb)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <slrn7mtmtf.2o8.morpheus@rpglink.com>
On Tue, 22 Jun 1999 00:10:12 GMT, Casey R Tweten <crt@highvision.com> wrote:
>I agree, in fact, why is that so long?
Because I dislike unstrucured code, which is my perogative. :P
--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
ICQ: 5107343 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
------------------------------
Date: Tue, 22 Jun 1999 01:31:14 GMT
From: crt@highvision.com (Casey R Tweten)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <376ee725.613397794@news.kiski.net>
On 21 Jun 1999 17:35:51 -0700, merlyn@stonehenge.com (Randal L.
Schwartz) wrote:
:>>>>> "Weborium" == Weborium <weborium@aol.com> writes:
:
:Weborium> print @animal; #gets the length of the array.
:
:No. Try again. It does what you want. :)
Quite right, I shortened another example out of fun, this is even
shorter:
my @animal=("c","a","t");
print @animal;
--
Casey Tweten HighVision Associates
Web Developer http://www.highvision.com
<joke> This is 100% certified,
virus and bug free code </joke>
------------------------------
Date: 21 Jun 1999 23:42:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: A buggy intersection-method
Message-Id: <7kmiln$5hu$1@pegasus.csx.cam.ac.uk>
In article <7kmaip$iht$2@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <1dtpvth.12vqbdzjqzudqN@p7.tc8.metro.ma.tiac.com>,
> rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
>: But that's overkill, because how would @ARGV get undefined values
>: anyway? It's very hard to pass undef in from the command line...
>
>It can be useful to lie to yourself about the contents of @ARGV.
>
> local @ARGV = ( '/some/file', 'ps auxww |' );
> while (<>) { ... }
That's not a lie, to yourself or anyone else. It's a straightforward
redefinition of truth.
Mike Guy
------------------------------
Date: 22 Jun 1999 00:28:12 GMT
From: eisen@pobox.com
Subject: ANN: XML::Dumper 0.4
Message-Id: <7kmlas$iog$1@play.inetarena.com>
This release is a bug fix to balanced nested hashes.
It will be available at your local CPAN mirror or from
http://www.perlxml.com/modules/XML-Dumper-0.4.tar.gz
NAME
XML::Dumper Version 0.4
DESCRIPTION
XML::Dumper dumps Perl data to a structured XML format.
XML::Dumper can also read XML data that was previously dumped
by the module and convert it back to Perl.
This might be useful for dumping Perl objects to files
using an XML format that can be reloaded or accessed by
other programs. Maybe even other languages.
Feel free to contact me at eisen@pobox.com if you have
problems and/or suggestions.
REQUIREMENTS
This module requires version 2.16 or greater of the XML::Parser module.
The latest version is available at any CPAN archive.
------------------------------
Date: 22 Jun 1999 00:27:59 GMT
From: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: ANNOUNCE: HTTPi/0.99 released
Message-Id: <7kmlaf$io9$1@play.inetarena.com>
HTTPi, the 100% Perl hyperextensible miniature webserver, is now in its final
beta (version 0.99). HTTPi is a small, less-than-10K in size webserver designed
for minimal footprint and system resource usage. No modules required -- just
your Perl executable.
New in HTTPi/0.99:
* HTTP authentication through the restriction matrix
* User filesystems (a la http://host/~user/)
* IP-less virtual hosting (with the Host: header)
* Enhanced HTTP/0.9 and /1.1 compliance
* Statistics module (Demonic HTTPi only)
* DNS lookups now configurable for optimal speed
Version 0.99 has been clocked at average 53 req/s on HP/UX 10.20 (Demonic,
no DNS/restriction matrix), versus mhttpd 0.8 at 18 req/s on the same machine.
HTTPi comes in three flavours: one designed to be run in inetd, one for the
xinetd clone, and a daemonized "Demonic" version. Win32 HTTPi is expected soon.
Download the distribution, get manuals and read the FAQ at
http://httpi.ptloma.edu/
0.99 will shortly be uploaded to CPAN.
--
Cameron Kaiser * ckaiser@stockholm.ptloma.edu * posting with a Commodore 128
http://calvin.ptloma.edu/~spectre/ * "When in doubt, take a pawn." -- M:I
** Supporting the Commodore 64 and 128: http://www.armory.com/~spectre/cwi/ **
** <cdkaiser@concentric.net> is no longer valid -- please use new address **
------------------------------
Date: 22 Jun 1999 00:29:01 GMT
From: John Heidemann <johnh@isi.edu>
Subject: ANNOUNCE: WWW::Search 1.024 released
Message-Id: <7kmlcd$ioo$1@play.inetarena.com>
WWW::Search and AutoSearch
==========================
WHAT IS NEW WITH WWW::Search 1.024? (15-Jun-99)
------------------------------------------------
overview: primarily bug fixes for back ends
- BUG FIX: HotBot (from Martin Thurn)
- NEW: Profusion (from Jim Smyser)
- BUG FIX: documentation clarification on required SearchResult fields
(based on comment from Chris P. Acantilado
- BUG FIX: Excite, WebCrawler, Infoseek (from Martin Thurn).
Infoseek::News and ::Companies are broken.
- NEW: Metapedia, ZDNet, Open Directory, HotFiles (from Jim Smyser)
- NEW: Lycos now supports advanced queries (from Jim Smyser)
- BUG FIX: Profusion, NorthernLight, Snap (from Jim Smyser)
- NEW MAINTAINER: Future WWW::Search releases will come from
Martin Thurn <mthurn@tasc.com>.
The paucity of releases in the last six months has been
because I've been way to busy to maintain it.
Unfortunately, WWW::Search requires a fair amount of
maintenence. I trust that Martin will be able to
give it the attention it needs. THANKS! -John
WHAT IS WWW::Search?
--------------------
WWW::Search is a collection of Perl modules which provide an API to
WWW search engines. Currently WWW::Search includes back-ends for
variations of AltaVista, Dejanews, Excite, HotBot, Infoseek, Lycos,
Magellan, PLweb, SFgate, Verity, WebCrawler, and Yahoo. We include
two applications built from this library: AutoSearch (an program to
automate tracking of search results over time), and WebSearch, a small
demonstration program to drive the library. Back-ends for other
search engines and more sophisticated clients are currently under
development.
Because WWW::Search depends on parsing the HTML output of web search
engines it will fail of the search engine operators change their
format (an unfortunately frequent occurrence). WWW::Search includes a
test suite for most back-ends which verifies that it's functioning
correctly. As of the day of the release the current back-end
status is:
AltaVista working
Crawler partially working
Dejanews working
Excite partially working
ExciteForWebServers not working
Fireball not working
FolioViews working
Gopher not working? (not in test suite)
HotBot working
HotFiles not working? (not in test suite)
Infoseek working (Companies partially working)
Livelink not working? (not in test suite)
Lycos working
Magellan working
Metapedia not working? (not in test suite)
MSIndexServer not working
NorthernLight partially working (doesn't handle multi-page returns)
Null working
PLweb working
Profusion not working
Search97 working
SFgate working
Simple not working? (not in test suite)
Snap partially working
Verity not working (not in test suite)
WebCrawler partially working
Yahoo working
ZDNet not working? (not in test suite)
``Paritially working'' indicates that some tests passed and some failed.
(others are currently under development, see contributors below for details)
WHAT IS AutoSearch?
-------------------
WWW::Search's primary client is AutoSearch. AutoSearch performs a
web-based search and puts the results set in a web page. It
periodically updates this web page, indicating how the search changes
over time. Sample output from WWW::Search can be found at
<http://www.isi.edu/lsam/tools/autosearch/>. Output format is configurable.
See the man page for AutoSearch details, or Demonstration section
below for the quick-start instructions.
REQUIREMENTS
------------
WWW::Search requires Perl5 and libwww-perl.
For information on Perl5, see <http://www.perl.com>.
For libwww-perl, see <http://www.sn.no/libwww-perl/>.
Both are also available from the Comprehensive Perl Archive
Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN
site near you.
At this time WWW::Search is tested under Perl version 5.004_04.
AVAILABILITY
------------
The latest version of WWW::Search should always be available from
<http://www.isi.edu/lsam/tools/WWW_SEARCH/>. Alpha releases are only
available here (not at CPAN).
WWW::Search is also available as part of CPAN. Visit
<http://www.perl.com/CPAN/> to find a CPAN site near you.
Feedback about WWW::Search is encouraged. If you're using it for a
neat application, please let us know. If you'd like to (or have)
implemented a new back-end for WWW::Search, let us know so we don't
duplicate work.
------------------------------
Date: 22 Jun 1999 00:28:48 GMT
From: Sam Tregar <sam@tregar.com>
Subject: ANNOUNCEMENT: NEW VERSION: HTML::Template 0.04
Message-Id: <7kmlc0$ioh$1@play.inetarena.com>
ANNOUNCEMENT: NEW VERSION: HTML::Template 0.04
NAME
HTML::Template - a Perl module to use HTML Templates
CHANGES
0.04 Fri June 18 12:00:00 1999
- fixed cacheing - under certain conditions it was totally broken!
- changed {param} to {param_values} - some older perls complained.
- die_on_bad_params => 0 now also applied to loop body.
- added copious comments about how bad m//i is to avoid future
bug reports about [tT][hH][iI][sS]!
- added numerous bug fixes and optimizations submitted by Mike
Blazer, Adriano Nagelschmidt Rodrigues, Andrej Mikus and
DESCRIPTION
This module attempts to make using HTML templates simple and natural.
It extends standard HTML with a few new tags - <TMPL_VAR> and
<TMPL_LOOP>. The file written with HTML and these new tags is called
a template. It is usually saved separate from your script - possibly
even created by someone else! Using this module you fill in the
values for the variables and loops declared in the template. This
allows you to seperate design - the HTML - from the data, which you
generate in the Perl script.
This module is licenced under the GPL. See the LICENCE section of the
README.
AVAILABILITY
The module is available on CPAN. You can get it using CPAN.pm or go
to:
http://www.cpan.org/authors/id/S/SA/SAMTREGAR/
MOTIVATION
It is true that there are a number of packages out there to do HTML
templates. On the one hand you have things like HTML::Embperl which
allows you to freely mix Perl with HTML. On the other hand lie
home-grown variable substitution solutions. Hopefully the module can
find a place between the two.
One advantage of this module over a full HTML::Embperl-esque solution
is that it enforces an important divide - design and programming. By
limiting the programmer to just using simple variables and loops in
the HTML, the template remains accessible to designers and other
non-perl people. The use of HTML-esque syntax goes further to make
the format understandable to others. In the future this similarity
could be used to extend existing HTML editors/analyzers to support
this syntax.
An advantage of this module over home-grown tag-replacement schemes is
the support for loops. In my work I am often called on to produce
tables of data in html. Producing them using simplistic HTML
templates results in CGIs containing lots of HTML since the HTML
itself could not represent loops. The introduction of loop statements
in the HTML simplifies this situation considerably. The designer can
layout a single row and the programmer can fill it in as many times as
necessary - all they must agree on is the parameter names.
For all that, I think the best thing about this module is that it does
just one thing and it does it quickly and carefully. It doesn't try
to replace Perl and HTML, it just augments them to interact a little
better. And it's pretty fast.
DOCUMENTATION
The documentation is in Template.pm in the form of POD format
perldocs. Even the above text might be out of date, so be sure to
check the perldocs for the straight truth.
CONTACT INFO
This module was written by Sam Tregar (sam@tregar.com) for Vanguard
Media (http://www.vm.com). I'll be out of email range (in Tunisia!)
from June 27th to July 20th of 1999. During this period bugs and
suggestions can be sent to my boss here at Vanguard - Jesse
(jesse@belfry.com).
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 22 Jun 1999 01:49:34 GMT
From: "John Savage" <jcsavage@tampabay.rr.com>
Subject: Array elements
Message-Id: <OYBb3.4211$xJ.61505@newse3.tampabay.rr.com>
I'm attempting to make a continuously scrolling marquee, whole pages, not
just a scrolling banner. Using a 20 second http meta timeout and the
copying a new file to /tmp/index.html every 20 seconds seemed to make sense.
This is what I've gotten so far:
#!/usr/bin/perl
#test script
#List shell commands
use Shell qw(ls cp);
#Put the file list into an array
@file_list_array = (ls "/status/html");
#Loop thorough the directory list forever
for (;;) {foreach $file_list_array (@file_list_array)
{cp $file_list_array, "/tmp/index.html"; sleep ("20");};}
How do I go about calling the array elements as file names? If I do:
for (;;) {foreach $file_list_array (@file_list_array) { print
$file_list_array, "\n"; sleep("20");};}
I can print out all the array members, but can't use them as file names. Am
I going about this wrong? I got this far reading the Camel book. I'm
currently stumped, any help would be greatly appreciated.
John Savage
jcsavage@tampabay.rr.com
------------------------------
Date: Tue, 22 Jun 1999 01:11:03 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Breaking up is hard to do
Message-Id: <7kmlmf$sv1$2@fir.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
Jacques Rall <rall@trema.com> wrote:
>Hi all,
>
>I have a very long string, about 1000 characters, which I need to split
>up into 80 character lines or fields.
>
>I've tried the following but this still leaves us with one long line:
>
> if ($field =~ /.{1,35}/) {
> $field =~ s/(.{1,35})/\1\n/g;
> }
>
>The resulting line is very hard to manipulate in seperate segments.
>
>Is there an easier way to do this breakup thing?
I'm just taking a stab in the dark, but you may be looking for the
Text::Wrap module.
------------------------------
Date: Mon, 21 Jun 1999 18:41:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: compare two big files?
Message-Id: <Pine.GSO.4.02A.9906211840350.1698-100000@user2.teleport.com>
On Mon, 21 Jun 1999 bing-du@tamu.edu wrote:
> Can anybody suggest me what is the best way to compute difference
> between two big files in Perl?
Maybe by running diff?
> I also tried unix system command 'sdiff'. But I noticed this command
> compares two files line by line and the result is not that accurate.
Maybe you should check with a newsgroup about Unix utilities. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 21 Jun 1999 22:46:05 GMT
From: mike@pec.net
Subject: Fun PERL JOB opening in Escondido, CA
Message-Id: <7kmfba$o0l$1@nnrp1.deja.com>
Greetings,
If this is not appropriate - let me know - yell as loud as you like!
Seriously, where can I post a job for a PERL programmer, as we need a
good perler here in Escondido ASAP?
Thanks,
Mike Reed
CEO
Planet Earth Communications
http://PEC.net
mike@pec.net
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 22 Jun 1999 00:36:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: function to read a line & return it
Message-Id: <376EDA3B.B68E58FA@home.com>
[posted & mailed]
Abigail wrote:
>
> Rick Delaney (rick.delaney@home.com) wrote on MMCXX September MCMXCIII in
> <URL:news:376D9527.92A7C7C3@home.com>:
> \\
> \\ Abigail wrote:
> \\ >
> \\ > I'd suggest returning 4 fried chicken and a coke.
> \\
> \\ Legs or wings, honey?
>
> All chickens I know have 2 legs, 2 wings, and a lot of meat in between.
That's not the next line.
> Perhaps you should rent more movies.
Perhaps. Maybe your line is from the sequel, which I haven't seen.
ObPerl:
for (1 .. 2) {
print ARETHA "Freedom\n";
print BACKUP "Freedom\n";
}
print ARETHA "Freedom\n";
select fork ? ARETHA : BACKUP;
print "Freedom!\n";
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 21 Jun 1999 22:42:30 GMT
From: Howard Jow <ppith@my-deja.com>
Subject: Re: Graphing tools for use with Perl
Message-Id: <7kmf4k$ntr$1@nnrp1.deja.com>
In article <376DE7ED.CA018D85@se.bel.alcatel.be>,
spillemw@se.bel.alcatel.be wrote:
> I'm very happy with the perl gifgraph package.
>
I like GD.pm myself. Check it out, there should be a link
to download it somewhere on perl.com in the modules section.
Here's a great link for learning how to use it:
http://www-genome.wi.mit.edu/pub/software/WWW/GD.html
Have fun.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 21 Jun 1999 21:51:17 -0300
From: "Vox" <v0xman@yahoo.com>
Subject: Having a little problem with changing multiple lines in an html file
Message-Id: <k7Bb3.159822$r_1.34201902@newscontent-02.sprint.ca>
I am making a program that can read the beginning and end of tags and
replace the text in between, but I ran into a problem when reading more than
one line
I know you assign this...
if ($line =~ /\<li\>\<a href\=\"([^\"]+)\">([^<]+)<\/a>/)
to read urls such as:
<li><a href="http://www.whatever.com"></a>
or
<li><a href="http://www.somethingelse.com"></a>
And I know that the square brackets means neither the beginning of the line
and not the last quotation only allowing the url to be read in this
statement
([^\"]+). Or in this statement ([^<]+) it won't read the < on the end.
Only reading the title of the link. I know how to read one
line, but not multiple.
I wanted a perl program to read more than one line such as:
<!--beginheader-->
<table border=0 width=90%>
<tr><td>
Text inside of table here and maybe gifs
</tr></td>
<!--endheader-->
Here is the beginning of one of the many things I tried to get it to read
those lines above. Of course it doesn't work, but I can't think of a
solution to getting it to read the above html text. What solutions does
anyone have to this? This is something I have already tried below
if ($line =~ /^<!--beginheader-->([.*]+)<!--endheader-->$/)
Thanks for your help
Chad
------------------------------
Date: Mon, 21 Jun 1999 21:50:57 -0400
From: Bob Walton <walton@frontiernet.net>
To: Vox <v0xman@yahoo.com>
Subject: Re: Having a little problem with changing multiple lines in an html file
Message-Id: <376EEC00.29727585@frontiernet.net>
Vox wrote:
> I am making a program that can read the beginning and end of tags and
> replace the text in between, but I ran into a problem when reading more than
> one line
>
> ...I wanted a perl program to read more than one line such as:
>
> <!--beginheader-->
> <table border=0 width=90%>
> <tr><td>
> Text inside of table here and maybe gifs
> </tr></td>
> <!--endheader-->
>
> ...
> Thanks for your help
> Chad
Chad, try the "s" modifier on your regular expression match, plus read the whole
file into a string, instead of a line at a time:
open IN,"junk6.txt" or die "Oops, $!\n";
$in=join('',<IN>);
close IN or die "Whoops, $!\n";
if($in=~/<!--beginheader-->(.*)<!--endheader-->/s){
print "stuff in header: $1\n";
}
On your sample file, this generates:
H:\Bob\junk>perl junk6.pl
stuff in header:
<table border=0 width=90%>
<tr><td>
Text inside of table here and maybe gifs
</tr></td>
H:\Bob\junk>
Note that you would have to get a bit fancier if you have more than one end tag,
making your regular expression so it won't match everything to the *last* end
tag. One way to do that is to use a non-greedy match. I'll leave it to you to
read perlre to figure out how to do that.
------------------------------
Date: Mon, 21 Jun 1999 21:25:05 -0400 (EDT)
From: P-aCMa-N@webtv.net (=?ISO-8859-1?Q?/^P=E2=C7`M=E2=D1^=5C=5C=29?=
Subject: hello looking for script
Message-Id: <8530-376EE5F1-100@newsd-621.iap.bryant.webtv.net>
theres a script that lets you Upload to any server that has ftp access
to your account on that server. theres places called TransLoader and
FreeLoader. can someone please find this fo rme. i need it and im on
webtv which is a needed thing. heres one of the addys.
http://transload.starblvd.net i dont know if u can view the page but if
u need more info please post or email me. thannx :^)
------------------------------
Date: Mon, 21 Jun 1999 18:29:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to output the current perl script in memory
Message-Id: <Pine.GSO.4.02A.9906211824210.1698-100000@user2.teleport.com>
On Mon, 21 Jun 1999, Shannon McCoy wrote:
> I have been wondering how to output the current script in memory to
> disk, as I plan to make a program that can be changed while it is
> running, and need those changes to be reflected in the original file.
> I would be doing an eval on an input string that redefines subroutines
> and I can't seem to find a way to output all the changes.
That's not eval, that's evil. :-)
There's nowhere in memory that the original text of your program exists
while it's running. You _could_ update a text file of some code and load
it in, but that's pretty dang frightening to think about debugging. On the
other hand, anyone who wishes to try do-it-yourself brain surgery should
probably be encouraged to do so, so don't let me talk you out if it.
I heartily suggest that you think about your programming problem a little
longer to see whether there's some way which you could avoid this tactic.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 22 Jun 1999 00:28:53 GMT
From: bandhunt@my-deja.com
Subject: HTML Redirection
Message-Id: <7kmlbp$q06$1@nnrp1.deja.com>
I was hoping someone could tell me how to
redirect HTML using Perl/CGI.
I have a search script for my website and instead
of displaying a list of matches using
Content-type: text/html\n\n" to print out the
HTML output, I want the script to take the user
directly to a specific URL based on the search
query.
Any help would be great.
Thanks,
Donn
email: bloodlet19@hotmail.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 22 Jun 1999 01:20:10 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Network Address Translation
Message-Id: <slrn7mtp26.ki.efflandt@efflandt.xnet.com>
On Mon, 21 Jun 1999 18:11:27 -0400, Clayton Schutz
<clayton.schutz@autodesk.com> wrote:
>I would like to know if it is possible to run several websites from one IP
>address using Network Address Translation.
>
>Any help would be appreciated.
>Thanks
>Clayton
You probably intended to post this to a webserver newsgroup (been there,
done that) since it is not a perl question.
You probably have to use different ports if the servers are on different
machines. But it would probably be better to see your webserver docs
about virtual hosting which can use the same port for multiple vhosts on
a single machine.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Tue, 22 Jun 1999 00:08:00 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: newbie question...
Message-Id: <376ED3A0.54C465F8@home.com>
[posted & mailed]
RABM@prodigy.net wrote:
>
> BTW, what does ITYM mean?
I Think You Mean.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 21 Jun 1999 18:59:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Please Help with Perl 5
Message-Id: <Pine.GSO.4.02A.9906211858530.1698-100000@user2.teleport.com>
On Mon, 21 Jun 1999, Ron Lukawitski wrote:
> I need to know if Perl 5 is capable of compiling the information from
> the enclosed e-mail responses to a musicians (Bass Players) survey
> that I am conducting on the internet.
Yes, it should be capable of that. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 22 Jun 1999 01:29:02 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Question about writing to a file in perl..
Message-Id: <slrn7mtpir.ki.efflandt@efflandt.xnet.com>
On Mon, 21 Jun 1999 21:04:00 GMT, bobo_the_monkey@my-deja.com
<bobo_the_monkey@my-deja.com> wrote:
>I want to know if it's possible to edit a file by writing to it in the
>middle of the file. I have a list that I want to add items to through
>the web, but I want to keep it alphabetical. Can I insert items into it
>without putting my list in an array, editing it, and then rewriting it
>all to the file? Thanks.
>
>bobo
While you can open a file for read and write, if you write something to
it, previous data at that location is overwritten and subsequent data will
NOT magically move out of the way. So you would probably need to at least
rewrite data following the insertion. Or if the file is large, you could
write it to a tmp file with the insertions and then copy it back and
delete (unlink) the tmp file.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Mon, 21 Jun 1999 18:40:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Sending a mail from LOTUS NOTE (winNT)
Message-Id: <Pine.GSO.4.02A.9906211836230.1698-100000@user2.teleport.com>
On Mon, 21 Jun 1999, Michel GANGLOFF wrote:
> open (MAIL,"| mail test@oneaddress.com") ||
> die "Error: Can't start mail program - Please report this error to
> test@oneaddress.com";
What error message does perl give you when you try running this program?
Is it listed in the perldiag manpage?
> The script is compiled and correctly executed,
Really. Hmmmm.
> but the mail is not send and the server tell me that it don't found
> the executable trying to be called (MAIL.EXE). This script has been
> writed for UNIX (found in Teach yourself CGI programming).Anyone could
> it tell to me what is the agent that replace 'MAIL' for a LOTUS NOTE
> server under WIN NT???
Maybe someone in a newsgroup about mail, lotus notes, or Windows could
tell you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 22 Jun 1999 01:29:58 GMT
From: kkling@economite.com
Subject: www.economite.com
Message-Id: <376ee702.21259589@news.erols.com>
http://www.economite.com
The Linux Revolution
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6083
**************************************