[13628] in Perl-Users-Digest
Perl-Users Digest, Issue: 1038 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 11 09:05:42 1999
Date: Mon, 11 Oct 1999 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939647112-v9-i1038@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 11 Oct 1999 Volume: 9 Number: 1038
Today's topics:
Re: character count (Abigail)
Re: character count <crdevilb@mtu.edu>
Dedicated Server <irishcream@iname.com>
digit grouping function <igor@rtsnet.ru>
Re: digit grouping function (Sam Holden)
downloading and comparing all bookmarks out of a bookma <stefan.goerres@xsc.net>
Re: Hash size limit ? (longish) <csaba.raduly@sophos.com>
Re: Help with parsing input (M.J.T. Guy)
Re: Hosts running Mason and ImageMagic (Martien Verbruggen)
Re: howto load modules to an ISP website? (Martien Verbruggen)
Re: howto load modules to an ISP website? (Martien Verbruggen)
Re: I need some Perl help (Abigail)
Installing Fly on remote server <nik@cheddarcheese.de>
Re: IO::Select->has_exception() (Martien Verbruggen)
Re: Is $$variable allowed like in PHP ? (Martien Verbruggen)
Is there an easy Perl equivalent to SSIs including some <stuw@dial.pipex.com.nospam>
Re: Is there an easy Perl equivalent to SSIs including <gellyfish@gellyfish.com>
Re: Is there an easy Perl equivalent to SSIs including <stuw@dial.pipex.com.nospam>
Re: Receiving e-Mail Messages via Mail::POP3Client, wit (Samuel)
Re: Simple flock question (M.J.T. Guy)
Re: Simple flock question (M.J.T. Guy)
Re: What is THE book for PERL? <jjyooi@dcs.qmw.ac.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Oct 1999 06:08:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: character count
Message-Id: <slrn803h9p.gep.abigail@alexandra.delanet.com>
tmac@transport.com (tmac@transport.com) wrote on MMCCXXXII September
MCMXCIII in <URL:news:3801A034.37221669@transport.com>:
`` Perhaps something like this:
``
`` $_ = "hello world";
`` $l_count = push (@each_l, /(l)/gi);
``
`` I'd get a second opinion though:-)
*boggle* Why the push?
$_ = "hello, world";
$l_count = y/l//;
Or:
$l_count = () = "hello, world" =~ /l/g;
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 11 Oct 1999 12:37:02 GMT
From: Colin R. DeVilbiss <crdevilb@mtu.edu>
Subject: Re: character count
Message-Id: <7tslle$l4u$1@campus3.mtu.edu>
Abigail <abigail@delanet.com> wrote:
> tmac@transport.com (tmac@transport.com) wrote on MMCCXXXII September
> MCMXCIII in <URL:news:3801A034.37221669@transport.com>:
> `` Perhaps something like this:
> ``
> `` $_ = "hello world";
> `` $l_count = push (@each_l, /(l)/gi);
> ``
> `` I'd get a second opinion though:-)
> *boggle* Why the push?
> $_ = "hello, world";
> $l_count = y/l//;
> Or:
> $l_count = () = "hello, world" =~ /l/g;
*boggle boggle*
if all the poster wanted was to count instances of a char, why didn't
anyone give him the FAQ?
perldoc perlfaq4/How do I count occurences of a substring in a string?
perldoc perlop (tr//)
Colin DeVilbiss
crdevilb@mtu.edu
------------------------------
Date: Mon, 11 Oct 1999 12:56:00 +0200
From: "John" <irishcream@iname.com>
Subject: Dedicated Server
Message-Id: <7tsfo8$nkm$1@wanadoo.fr>
Hi,
I know this is not a Perl/CGI question, but I thought
some of you could helpt it. Please accept
my appologizes If I am bothering.
Does anybody know a good company that offers
reliable Linux dedicated servers ? DN offers this
at 300 dollars a month, which I think is a little
bit expensive. Any Help would be highly appreciated.
Thank you,
John
------------------------------
Date: 11 Oct 1999 16:37:04 +0400
From: Igor Vinokurov <igor@rtsnet.ru>
Subject: digit grouping function
Message-Id: <3801d9f0@news.rtsnet.ru>
Hi!
I would like if anyone advise digit grouping function, which
can do following translation:
123456789 -> 123,456,789
Now we use:
return scalar reverse(join(',', reverse($digit) =~ m/\d{1,3}/g));
Any alternatives?
--
Igor Vinokurov
------------------------------
Date: 11 Oct 1999 12:42:32 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: digit grouping function
Message-Id: <slrn803mpo.872.sholden@pgrad.cs.usyd.edu.au>
On 11 Oct 1999 16:37:04 +0400, Igor Vinokurov <igor@rtsnet.ru> wrote:
>Hi!
>
>I would like if anyone advise digit grouping function, which
>can do following translation:
>
>123456789 -> 123,456,789
>
>Now we use:
>
>return scalar reverse(join(',', reverse($digit) =~ m/\d{1,3}/g));
>
>Any alternatives?
You could find some yourself by reading the FAQ...
--
Sam
Simple rule: include files should never include include files.
--Rob Pike
------------------------------
Date: Mon, 11 Oct 1999 14:08:39 +0200
From: "Stefan Goerres" <stefan.goerres@xsc.net>
Subject: downloading and comparing all bookmarks out of a bookmark file
Message-Id: <7tsk0e$amv$1@fu-berlin.de>
Well ... I want to write a script that is downloading all my bookmarked
pages and automatically checks if they changed. Is that possible .. normally
I'm not a perl programmer... so have you some handy ideas for me as a perl
beginner? Is there maybe someone out there who tried thator maybe is having
a ready to take script?
Thanks
Steve
------------------------------
Date: Mon, 11 Oct 1999 10:58:23 +0100
From: Csaba Raduly <csaba.raduly@sophos.com>
Subject: Re: Hash size limit ? (longish)
Message-Id: <3801B4BF.E615A303@sophos.com>
Csaba Raduly wrote:
>
> Csaba Raduly wrote:
> >
> > I've written a log file analyser used to test our new virus engine.
> > Basically it checks that the right viruses are found in the various
> > test files. The log files look like this:
> > (first character is a \t : )
> > M:\path...\filename
> > >>> Virus 'Melissa' found in M:\path...\filename
> >
> > There's an HTML document describing which files contain which viruses.
> > Another perl script parses it and produces perl include files
> > with the following format:
> > ----cut here-------------chapter32.exp----------
> > %expected = (
> > 'file1', 'virus1',
> > 'file2', 'virus2',
> > );
> > ----cut here-------------chapter32.exp-end------
> >
> > The basename of the file is the same as the log file for the
> > corresponding chapter (i.e. chapter23.log and chapter32.exp)
> > The correct exp file is included via do $expfile
> > (it used to be require, if you remember my previous post
> > about "How to undo a require")
> >
> > During processing the filename is isolated and then used
> > as a key into the hash, and the value (expected virus)
> > is checked against the actual virus detected.
> >
> > Yesterday I decided that it's time to do things on a grand scale
> > and took the log file generated by the "official" version run
> > over the entire virus collection, and passed it through
> > yet another perl script to generate a big exp file
> > (and I mean big: it's over 3M in size)
> > But when I try to include the big one using do,
> > the hash appears to be empty.
> > ( foreach $key (keys %expected){ print $key } does nothing )
> > No error message is generated.
> >
> > I started to chop it down to see where it stops working.
> > Apparently the limit is around 1761 lines or a file of 93500 bytes.
> > I suspect the problem isn't some limit in the hash size;
> > rather an input buffer size limit (?)
> >
> > I'm using perl 5.0 patchlevel 5 subversion 53 on OS/2
> >
> > Any ideas what's up ?
> >
> > Csaba
> >
>
Read and laugh: here's the mysterious line 1762
'm:\path...\scotts.co', 'Scott's Valley',
That single quote wasn't very nice :-(
What I don't understand now is why there was no error message.
After all, from now on everything is a mess syntactically,
barewords, missing commas and the like.
Csaba
--
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/>GMU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK-----
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: 11 Oct 1999 12:34:01 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Help with parsing input
Message-Id: <7tslfp$laf$1@pegasus.csx.cam.ac.uk>
Larry Rosler <lr@hpl.hp.com> wrote:
>
>Also, if only the first two fields are of interest, why split the entire
>string?
>
> my ($first, $second) = split /\|/, $response, 3;
But Perl will automatically choose a third argument of 3, without you
needing to specify it.
You are paying insufficient attention to Laziness. :-)
Mike Guy
------------------------------
Date: 11 Oct 1999 12:12:10 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Hosts running Mason and ImageMagic
Message-Id: <slrn803l1c.8kq.mgjv@wobbie.heliotrope.home>
> the overall perl connection . Since you think that connection tenuous at
> best (though I respectfully disagree), do you have any suggestions on which
> newsgroup might be a better venue for such a question? I thought this one
> might be since ImageMagick comes up quite a bit on the ActivePerl Win32
> users maillist. Given most ISPs run Unix, I was going to this group for a
> broader perspective than I could get there.
Well, most of ImageMagick is written in C. I haven't seen you ask this
question on comp.lang.c. I hope that clarifies the point a bit more?
If I were you, I would hit the web with this question. There are
several pages (on yahoo for example) that talk about ISPs. Maybe one
of the comp.infosystems.www.* groups. I dunno. I don't visit those.
What I do know is that we are really here to talk about the language
Perl, and perl and that's really it. clp.modules is there to talk
about modules for use with perl. There, unfortunately, is no clp.cgi
or clp.isps-with-perl, otherwise you could ask there.
Maybe someone here knows of an ISP that provides the services you
need, but I sincerely hope they will answer you in private email, and
that next time you have a question, you will think a bit better about
where it should go.
I don't want to sound like a cranky old git, even though I do, but the
traffic on this group is bad enough as it is. Most of the recurring
crud I can filter out, but some stuff slips through. This was one of
them.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: 11 Oct 1999 12:41:43 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: howto load modules to an ISP website?
Message-Id: <slrn803moq.8kq.mgjv@wobbie.heliotrope.home>
On Sun, 10 Oct 1999 20:50:56 -0500,
Dan Baker <dtbaker_@busprod.com> wrote:
> Alan, on one hand I have to thank you because you did provide the
> answer, but on the other I just have to wonder why this newsgroup gets
> so snippy?! People waste so much energy on being negative... I'll have
Because you are not the only one. We get masses of questions here
every single day that are off-topic or answered in the documentation,
or ansered in the FAQ, or answered a day before on this same group.
Because it has become almost impossible to find the few threads in
this group that are actually interesting, and that talk about Perl.
Because the enormous amount of crud posted here discourages new people
to at least read a few of the post before adding their own crud to it.
Because, after the thousands of times that people here have posted
answers that included details about how to use perldoc to interrogate
the FAQs that came shipped with perl, we still get people posting
questions that contain at least one keyword that would have given them
a decent answer straight from perldoc -q.
Yes, I know, we don't know how many people actually do benefit from
all these posts, and how many people don't post their question,
because they read a few posts and figured out how to get to the
documentation. But that doesn't invalidate my earlier points.
Don't take it personally. It's nothing against you personally. It's
just a reaction against the tide of posts that are not necessary or
offtopic. The idiotic notion out there that Perl eq CGI is mainly to
blame for that, I suppose.
> you know I spent quite a while poking thru docs, FAQs, search engines
> and dejanews without happening to stumble on the answer.
You may have done that, but we don't know. If you had said: "I looked
in the FAQ and documentation, but couldn't find it.", you might have
received an answer that included the chapter and question in the FAQ.
I don't know. I won't speak for Abigail, but I personally tend to
react much more friendly to people who show or at least mention that
they've done their part of the work. (And from my experience, Abigail
tends to give very good answers to people who show this, too)
> I do thank you for the tip to check in pod/perlfaq8.pod and after
> reading, it looks like the makefile is designed to handle this sort of
> localize site install. I will give it a try! I'm sorry that you consider
> it whining, I just get frustrated by people that make snide and unkind
> followup posts indicating that they know the answer, but dont give any
> hints where to look. If they feel the question is stupid, then why dont
> they just ignore it.
If you want, you can do some searches on dejanews, and you will notice
that about 10% of the posts on this group are actually devoted to that
subject. And this is another lengthy one. Most people here don't
believe that ignoring it will make the problem go away. it may make
the individual poster go away, but not the problem. I agree, it could
be done less brusquely, but people's patience runs short.
> I do appreciate the helpful content of your followup. Hopefully this
> newsgroup will someday become a kinder, place to ask a question.
I wouldn't count on that happening until people have learned that CGI
is not Perl, and that perl comes with an enormous amount of
documentation and the tools to look through it.
All we ask is for people to show us they've tried.
Martien
--
Martien Verbruggen |
Interactive Media Division | My friend has a baby. I'm writing down all
Commercial Dynamics Pty. Ltd. | the noises the baby makes so later I can
NSW, Australia | ask him what he meant - Steven Wright
------------------------------
Date: 11 Oct 1999 12:45:26 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: howto load modules to an ISP website?
Message-Id: <slrn803mvp.8kq.mgjv@wobbie.heliotrope.home>
On Mon, 11 Oct 1999 02:58:17 GMT,
dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com> wrote:
> In article <Pine.HPP.3.95a.991010185703.7619F-100000@hpplus01.cern.ch>,
> "Alan J. Flavell" <flavell@mail.cern.ch> wrote
> >
> > perldoc -q module
>
> -----------------
>
> is the -q option a new thing for 5.005? I am running an older version
> and my perldoc doesnt have a -q option.....
Yes, it is. it was introduced in 5.005. If you don't feel like
installing a full 5.005_03 yet (and there are perfectly valid reasons
for that [*]), you can just grab the perldoc from a 5.005_03
distribution and install it separately.
Martien
[*] For one, 5.005 is binary incompatible with 5.004, meaning you will
need to recompile all the modules that have C extensions. For two, the
library directory structures changed, the biggest effect of this is
that modules get installed in different places, and you end up with a
big disorganised mess. I'm still planning to scrap it all at work,
some Saturday, and start with a clean 5.005_03 distribution, and a
clean list of modules.
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing but
Commercial Dynamics Pty. Ltd. | mean your mother.
NSW, Australia |
------------------------------
Date: 11 Oct 1999 06:03:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I need some Perl help
Message-Id: <slrn803gvm.gep.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCCXXXII September MCMXCIII
in <URL:news:3801878c.855786@news.skynet.be>:
@@ Abigail wrote:
@@
@@ >%% One fewer byte in each hash key. :-)
@@ >
@@ >Nah. It's still there. chomp only changes the length field, it
@@ >doesn't actually reallocate a smaller string.
@@
@@ But $hash{$_} uses a (shorter) *copy* of the original string, not the
@@ original string, as the hash key, doesn't it?
Oh gosh, don't tell me Perl is making needless copies. It shouldn't
do that.
@@ >%% Actually, if they're not chomped, the printed output will include
@@ >%% extraneous newlines after each key printed, won't it?
@@ >
@@ >Not if you don't print the "\n" ....
@@
@@ It changes *where* the newline is printed. If you do
@@
@@ print "$_: $hash{$_}";
Oh. Don't do that then. ;-)
print "$hash{$_}: $_\n";
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 14:08:10 +0200
From: Nik Gare <nik@cheddarcheese.de>
Subject: Installing Fly on remote server
Message-Id: <494f4fe699nik@pop.onlinehome.de>
Hi,
Firstly, if this is the wrong newsgroup, please let me know the right one to
ask this question.
I want to install the Fly module onto my webprovider's server. If I managed to
get hold of a precompiled version of Fly, is it simply a matter of putting on
the server and then using something like
$flyprog = "/where/the/flyprog/is/fly";
$outfile = "image.gif" ;
or do I need to do something to the Fly module before I can use it?
Alternatively, is there an 'Installing Fly on webprovider's server for
dummies' type page somewhere on the web?
Thanks in advance,
Nik
--
nik@cheddarcheese.de
http://www.cheddarcheese.webprovider.com
Occasional interactive software list
* alternative desktop & Pluto sprites
- updated for version 1.13a
------------------------------
Date: 11 Oct 1999 12:29:11 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: IO::Select->has_exception()
Message-Id: <slrn803m1a.8kq.mgjv@wobbie.heliotrope.home>
On 10 Oct 1999 21:18:19 +0200,
Benjamin Schweizer <SternSZ@gmx.de> wrote:
> Hi there,
>
> Iīve installed the latest Perl-release from the sources, but
> IO::Select->has_exception() still not exists. As some people said that
> 5.005_3 would include this method I also grepīd the source tree. Has
> anybody an idea? May be that this method is part of the CPAN?
# perl -v
This is perl, version 5.005_03 built for i386-linux
[snip]
# perldoc -m IO::Select
[snip]
sub has_exception
{
my $vec = shift;
[snip]
# perl -MIO::Select -le 'print $IO::Select::VERSION'
1.13
# grep VERSION /src/pkgs/perl5.005_03/ext/IO/lib/IO/Select.pm
use vars qw($VERSION @ISA);
$VERSION = "1.10";
#
(and indeed, no has_exception in 1.10)
You just need to update your version of IO::Select from CPAN.
# perl -MCPAN -e shell
cpan> install IO::Select
> My script crashes if the connection is cutted and I hope this function
> can help me to handle an exception...
I doubt that a crash (whatever exactly you mean by that) can be caught
by this, but here's the man page entry:
# man IO::Select
[snip]
has_exception ( [ TIMEOUT ] )
Same as can_read except check for handles that have an
exception condition, for example pending out-of-band
data.
[snip]
can_read ( [ TIMEOUT ] )
Return an array of handles that are ready for reading.
TIMEOUT is the maximum amount of time to wait before
returning an empty list. If TIMEOUT is not given and
any handles are registered then the call will block.
[snip]
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: 11 Oct 1999 12:58:16 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <slrn803nnn.8kq.mgjv@wobbie.heliotrope.home>
On Sun, 10 Oct 1999 12:04:24 -0700,
Larry Rosler <lr@hpl.hp.com> wrote:
> In article <krjpt7.11q.ln@magna.metronet.com> on Sun, 10 Oct 1999
> 04:47:48 -0400, Tad McClellan <tadmc@metronet.com> says...
> > Jonathan Stowe (gellyfish@gellyfish.com) wrote:
> > : On Fri, 08 Oct 1999 11:59:20 -0700 David Cassell wrote:
> > : I think the question is why people want to do it in Perl and not in C,
> > : COBOL or BCPL ?
> >
> >
> > The answer to that one is simple.
> >
> > Because those languages have such a high barrier to entry,
> > that there are very few folks who can get anywhere with
> > them unless they have trained as a programmer.
>
> I disagree completely.
>
> I think the answer is simply that symbolic referncing can be done in
> Perl, but not in the other languages you name.
But most people who ask wouldn't know that it is possible. They just
have this idea, and want to know _if_ it is possible, and if so, how.
Very rarely do you see a post of someone stating they know they can do
it, but just don't know how. And anyone clueful enough to find the
right entries in the documentation will most likely not even try doing
it. And if they still try, at least they know what they're doing.
> Personal confession introduced as evidence:
>
> In my very first Perl program (three years ago), which used hand-crafted
> CGI, it seemed very natural that the final line of the parameter-parsing
> loop be '$$name = $value;'. After all, I had control over the contents
> of '$name', so nothing could go wrong, go wrong, go wrong... (I also
> saw the symbolic reference as a model in one of the dumb books that I
> bought first and soon threw away.)
Only in my very first beginning perl years, somewhere in 92 or 93, I
felt the urge to use symbolic references, and that was because back
then, there were no hard ones. Since hard references were introduced in
perl, I never use symrefs anymore. Unless I have to. Or unless I
can gain some speed. Or unless it looks cool.
But really, I have no production level code with a symref in it. Not
even much test code with them. And I never found them natural. Maybe
my C background is showing, but I always felt they were awkward.
> Even the Blue Camel has lots
> about Symbolic References and little about 'use strict;',
which is one of its -- very few -- weaknesses.
> or about 'use
> CGI;', for that matter.
I don't miss that entry :) But I agree, it would be useful. Not
because I believe it's such an integral part of the language or
distribution, but because of the large number of people out there
using Perl for CGI, and consistently reinventing the wheel.
I agree with you that the presence of the symbol tables makes it
easier, and sometimes a bit alluring to use symbolic references. I
don't agree that programming background is irrelevant, however. And I
propose that most people asking the question that triggered this
thread have never even heard of the symbol table. They just want to do
something, and think that that is what should happen.
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd. | negative.
NSW, Australia |
------------------------------
Date: Mon, 11 Oct 1999 11:58:20 +0100
From: "Stuart Wright" <stuw@dial.pipex.com.nospam>
Subject: Is there an easy Perl equivalent to SSIs including some HTML ?
Message-Id: <939639565.17512.0.nnrp-08.c2d95102@news.demon.co.uk>
Hi,
I want to output some HTML using Perl, but include some existing HTML in
a separate file. Normally using SSI #include is great when setting up a
single 'footer' file containing HTML copyright notice and other stuff. This
one file is then included into all the pages on the site.
But I was wondering if there is a quick way to include such a file in the
output of a Perl script?
As alternatives I have considered 'hard coding' the text - which isn't a
good solution. I have also thought about reading in and then printing out
the file. Haven't tried this, though.
Any help appreciated.
Many thanks
Stuart
------------------------------
Date: 11 Oct 1999 12:15:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is there an easy Perl equivalent to SSIs including some HTML ?
Message-Id: <3801c6df_2@newsread3.dircon.co.uk>
Stuart Wright <stuw@dial.pipex.com.nospam> wrote:
> Hi,
> I want to output some HTML using Perl, but include some existing HTML in
> a separate file. Normally using SSI #include is great when setting up a
> single 'footer' file containing HTML copyright notice and other stuff. This
> one file is then included into all the pages on the site.
> But I was wondering if there is a quick way to include such a file in the
> output of a Perl script?
Yes it usually involves opening the file and printing its contents.
/J\
--
"Gary Glitter pulls out of Children in Need" - BBC News Website
------------------------------
Date: Mon, 11 Oct 1999 12:36:36 +0100
From: "Stuart Wright" <stuw@dial.pipex.com.nospam>
Subject: Re: Is there an easy Perl equivalent to SSIs including some HTML ?
Message-Id: <939641868.18385.0.nnrp-08.c2d95102@news.demon.co.uk>
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:3801c6df_2@newsread3.dircon.co.uk...
> Stuart Wright <stuw@dial.pipex.com.nospam> wrote:
> > Hi,
> > I want to output some HTML using Perl, but include some existing
HTML in
> > a separate file. Normally using SSI #include is great when setting up a
> > single 'footer' file containing HTML copyright notice and other stuff.
This
> > one file is then included into all the pages on the site.
> > But I was wondering if there is a quick way to include such a file in
the
> > output of a Perl script?
>
> Yes it usually involves opening the file and printing its contents.
>
In my original post I wrote that I had considered this - but not being a
Perl expert (actually it baffles me - I tend to copy existing Perl and hope
it works without knowing how), opening a file and printing it's contents is
not *necessarily* a quick solution for some people.
But thanks anyway.
------------------------------
Date: Mon, 11 Oct 1999 07:45:54 -0400
From: sleidy_keinSpam_@_bitte_voicencet.com (Samuel)
Subject: Re: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <1dzhz46.1ph8z201cpre1gN@dialup0309-pri.voicenet.com>
Sean Dowd <dowd@spam-free.home.com> wrote:
> Get version 2.2. It fixes this problem for MacPerl (having to do with
> extra CRs sitting on the socket connection, causing matches to fail).
>
> It should be on CPAN soon. If you can't wait, you can grab it from
> http://www.dowds.net/POP3Client
First - thank you both ['Paul J. Schinder' and 'Sean Dowd'] for replying
and the valuable Information.
Second - I did download 'POP3Client.tar.gz' and after de-encoding and
de-compressing it I placed only the newly created 'POP3Client.pm' into
the 'lib:Mail' Folder as per 'Choice 2' in the accompanying 'README'
File.
----- 'Choice 2' reprinted - starts here -----
Or you can create a directory called Mail somewhere and just put
POP3Client.pm in there. You will then have to put this directory into
your include path (@INC) either on the command line or in you code
(i.e. push(@INC,"/path/to/directory"); ). You need to include the
directory above Mail.
----- 'Choice 2' reprinted - ends here -----
However, the new 'POP3Client' requires 'MD5'. Inside the new
'POP3Client.pm' File is a 'require MD5' Statement.
I found, on the 'MacPerl Power and Ease' CD-ROM Disk, a few Folders
whose titles began with 'MD5'. I chose the one titled 'MD5-1.7' and
dragged it to the 'ext' Folder - which is located in the 'MacPerl
<option>-f' Folder where my 'MacPerl', 'MacPerl [Big]', and 'MacPerl
[CFM68k]' Applications reside.
I use the 'CFM68K' Version of MacPerl.
I then renamed the Folder from 'MD5-1.7' to 'MD5'.
This is from the 'README' File in the 'MD5' Folder:
----- README File Instructions starts here -----
To build the extension, unpack this distribution under the ext/
directory of your Perl source distribution, create the Makefile using
'perl Makefile.PL' and do a 'make'.
----- README File Instructions ends here -----
When trying to 'Run' the 'MD5' supplied 'MakeFile.PL' File 'MacPerl
[CFM68K]' reports:
----- MacPerl [CFM68K] Report starts here -----
Checking if your kit is complete...
Looks good
# On MacOS, we need to build under the Perl source directory or have the
MacPerl SDK
installed in the MacPerl folder.
----- MacPerl [CFM68K] Report ends here -----
Naturally, without the 'MD5' Object File I cannot run the new
'POP3Client.pm' File.
Question(s):
Question 01:
What do I do now? - with respect to 'make'ing 'MD5'.... and where does
the created File go?
Question 02:
Is not the 'MacPerl <option>-f' [Please read <option>-f as the fancy 'f'
created when the <option> Key is pressed and the 'F' Key tap'ed] Folder
the 'Perl source distribution' Folder? - as per the '----- MacPerl
[CFM68K] Report...' states above? I did drag the 'POP3Client' Folder to
the 'MacPerl <option>-f' and tried 'Choice 1' there, with no success.
See the above '----- MacPerl [CFM68K] Report...' for what was displayed.
That is why I just dragged the new 'POP3Client.pm' File to the
'lib:Mail' Folder.
Note: I created an "Old '.pm's" Folder in the 'MacPerl <option>-f'
Folder. In it I created a 'lib' Folder. In it a 'Mail' Folder. In which
I placed my origianl 'POP3Client.pm' File. Now I have a Place to
relocate old '.pm' Files - mirroring where they came from.... just in
case I need them again.
Question 03:
Nowhere on the 'MacPerl Power and Ease' CD-ROM Disk is a 'MacPerl SDK'
File or Folder. [Please see '----- MacPerl [CFM68K] Report....' above].
Nor any places on the Internet I tried, with repect to 'MacPerl' did I
find a 'MacPerl SDK'. Can you supply any Information [a WebSite, Book,
CD-ROM...] as to where such ['MacPerl SDK'] exists?
Again, thanks for your assistance,
Samuel
P.S. I have had success in sending e-Mail with 'Net::SMTP'!
------------------------------
Date: 11 Oct 1999 12:59:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Simple flock question
Message-Id: <7tsmup$mm9$1@pegasus.csx.cam.ac.uk>
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>On Sun, 10 Oct 1999 02:34:55 +0000,
> Warren Bell <wjbell@ERASEjps.net> wrote:
>> If I use flock to lock files in my perl script but the machine it's
>> running on doesn't have flock will the script still work, just not lock
>> the file?
>
>I don't think it will magically work..
>
>From pp_sys.c:
>
>PP(pp_flock)
>{
> djSP; dTARGET;
> I32 value;
> int argtype;
> GV *gv;
> PerlIO *fp;
>
>#ifdef FLOCK
>[removed code]
>#else
> DIE(no_func, "flock()");
>#endif
>}
>
>Looks like perl will die if you call flock, but it isn't present.
But to clarify, flock(2) being present and Perl supporting flock() are
different. As perldoc -f flock says
flock FILEHANDLE,OPERATION
Calls flock(2), or an emulation of it, on
^^^^^^^^^^^^^^^^^^^^^
FILEHANDLE. Returns TRUE for success, FALSE on
failure. Produces a fatal error if used on a
machine that doesn't implement flock(2), fcntl(2)
locking, or lockf(3).
And in addition, there's a further maze of twisty passages, all different,
for Windows. But I've never explored them.
Mike Guy
------------------------------
Date: 11 Oct 1999 13:03:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Simple flock question
Message-Id: <7tsn7a$mqm$1@pegasus.csx.cam.ac.uk>
Jeff Zucker <jeff@vpservices.com> wrote:
>Warren Bell wrote:
>
>> How would I test for flock?
>
>use constant HAS_FLOCK => eval { flock STDOUT, 0; 1 };
>...
>if( HAS_FLOCK ) {
> # do flock stuff
>}
But note that there are circumstances where that doesn't work. There
was a previous thread here discussing this - I forget the details
but I think the platform was DOS or one of the older Windows. It
seems that HAS_FLOCK will be true although an attempt to flock()
subsequently will fail. Or something.
Of course, this is a BUG. But the previous discussion never got to
the bottom of *why* it was happening.
Mike Guy
------------------------------
Date: Mon, 11 Oct 1999 13:05:07 +0100
From: Johnny 'Loopy' Ooi <jjyooi@dcs.qmw.ac.uk>
Subject: Re: What is THE book for PERL?
Message-Id: <3801D273.461FA15B@dcs.qmw.ac.uk>
Lauren Smith wrote:
>
> And after that, there is a ton of documentation that comes with Perl.
> It is the most up-to-date collection of documents that you can get for
> Perl. It is *the* definitive reference. :-)
Yeah, I took a look at that, but it seems to rely on you having a prior
knowledge of Perl/UNIX or something like that. I don't so I need
something that is for a (near) complete beginner.
--
Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
E-Mail : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
WWW : http://www.dcs.qmw.ac.uk/~jjyooi/
ICQ No : 6155774
"Stay sane guys!"
===============================================================
------------------------------
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 1038
**************************************