[19176] in Perl-Users-Digest
Perl-Users Digest, Issue: 1371 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 24 18:05:36 2001
Date: Tue, 24 Jul 2001 15:05:14 -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: <996012314-v10-i1371@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 24 Jul 2001 Volume: 10 Number: 1371
Today's topics:
Re: Any perl module for XML Explorer tree display/edit? <stephh@nospam.com>
call a sub defined in a script from the command line (Christopher Mooney)
Re: call a sub defined in a script from the command lin <pne-news-20010724@newton.digitalspace.net>
Re: call a sub defined in a script from the command lin (Gary E. Ansok)
CGI.pm Question <curtish@ourtownusa.net>
Re: CGI.pm Question <mbudash@sonic.net>
Re: CGI.pm Question <curtish@ourtownusa.net>
changing a field value in a particular line (Balaji)
Re: creating another file <pne-news-20010724@newton.digitalspace.net>
Re: Deciphering Carp::carp message <stephh@nospam.com>
Detecting cookies. <nathan.randle@ntlworld.com>
Directory Diff <swan@peak2peak.com>
Re: don't laugh (case usage for variables) (remove the obvious)
Re: encrypt a password <rsherman@ce.gatech.edu>
Re: encrypt a password <stephh@nospam.com>
FAQ: How do I find the week-of-the-year/day-of-the-year <faq@denver.pm.org>
Re: How can I determine how many charcters to represnt (Abigail)
Re: How do I count the number of characters in a string <subscriber@novastar.dtdns.net>
HTML::Parser Help <tong_po_and_malene@hotmail.com>
Re: HTML::Parser Help <bjoern@hoehrmann.de>
Re: IO::Socket-Question (Konstantinos Agouros)
Re: IO::Socket-Question <bart.lateur@skynet.be>
Re: IO::Socket-Question <buggs-clpm@splashground.de>
Re: mod_perl for NT <curtish@ourtownusa.net>
Re: mod_perl for NT <bjoern@hoehrmann.de>
modify report before output to file <mdulrich@unity.ncsu.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Jul 2001 23:44:55 +0200
From: stephh <stephh@nospam.com>
Subject: Re: Any perl module for XML Explorer tree display/edit?
Message-Id: <240720012344551395%stephh@nospam.com>
Have you guys tried to use Softquad XMetal ?
It's a PC XML Editor, the best I know.
No use rewriting one!
Now the module you really need is XML::Parser.
It's the only one that really does any job,
but you'll have to get hands in it, because it is
built on the top of a C library called expat, that does great XML
parsing.
In article <c95b1060.0107220210.78e0965c@posting.google.com>, sriram
<s_swami@yahoo.com> wrote:
> "M.L." <mel2000@hotmaildot.com> wrote in message
> news:<9j6v8s$mltff$1@ID-19545.news.dfncis.de>...
> > I'm a newbie to XML currently reading up on various Perl modules to
> > manipulate XML. My first goal is to find a module that can easily slurp an
> > XML tree into a hash, and then back to an XML tree. With all the
> > possibilities, I'm having trouble making up my mind.
> >
> > After that task my greatest concern will be displaying and modifying the
> > tree. Ideally, I would like to:
> >
> > 1. Convert my spreadsheet-like database to an expanding/collapsing XML
> > folder tree resembling that of Windows Explorer
> >
> > 2. Tree display should collapse to 1 folder by default (stylesheet needed?)
> >
> > 3. User must be able to add new record(s) to top of folder tree just as in
> > Explorer
> >
> > 4. User must be allowed to add new tag(s) to each record, but since each
> > record is symmetrical, each new tag must be added to all records/folders in
> > the tree.
> >
> > I'd like to know if there is a Perl or Javascript module that can do most of
> > what I am asking for as far as displaying and modifying the XML tree (as
> > well as slurping/restoring).
> >
> > Thanks
>
> I think the best way is XML::Simple module. Please checkout the http://www.cpan.org
>
> Thanks!!
> --Sriram.
--
$tephh;
Don't forget to visit http://www.grc.com/dos/grcdos.htm
------------------------------
Date: 24 Jul 2001 13:10:40 -0700
From: cmooney1@email.mot.com (Christopher Mooney)
Subject: call a sub defined in a script from the command line
Message-Id: <f569dec.0107241210.568f611f@posting.google.com>
I'd like some input on a small problem.
I am trying to write a script that takes as its first argument the
name of a subroutine and then a list of arguments to be passed to the
subroutine.
For example, if my script is named 'dog', then:
% dog beg for food
Would call &beg(for,food).
I could use a hash, like this:
###
$command{beg}=sub { ... begging code ... };
$command{speak}=sub { ... speaking code ... };
$command{sit}=sub { ... sitting code ... };
&{$command{$sub_name}}(@sub_args);
###
or i could use an eval:
###
sub beg { ... begging code ...}
sub speak { ... speaking code ...}
sub sit { ... sitting code ...}
eval '$sub_name @sub_args';
###
or i could use an if-statement:
###
if ($sub_name eq 'beg')
{
... begging code ...
}
elsif ($sub_name eq 'speak')
{
... speaking code ...
}
elsif ($sub_name eq 'sit')
{
... sitting code ...
}
###
Any thoughts? Know where i might be able to find info on something
like this? It must be a pretty standard issue.
Thanks!
------------------------------
Date: Tue, 24 Jul 2001 22:30:45 +0200
From: Philip Newton <pne-news-20010724@newton.digitalspace.net>
Subject: Re: call a sub defined in a script from the command line
Message-Id: <ikmrltkouglfkiuqtsim86oc0703aefhpr@4ax.com>
On 24 Jul 2001 13:10:40 -0700, cmooney1@email.mot.com (Christopher
Mooney) wrote:
> % dog beg for food
>
> Would call &beg(for,food).
Well, more like &beg('for', 'food') I would imagine.
> I could use a hash, like this:
That's probably what I would do.
> &{$command{$sub_name}}(@sub_args);
I'd probably write that as
$command{$sub_name}->(@sub_args);
, however, since I prefer the arrow syntax to the &{ ... } one.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 24 Jul 2001 21:58:55 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: call a sub defined in a script from the command line
Message-Id: <9jkr2v$8jb@gap.cco.caltech.edu>
In article <f569dec.0107241210.568f611f@posting.google.com>,
Christopher Mooney <cmooney1@email.mot.com> wrote:
>I am trying to write a script that takes as its first argument the
>name of a subroutine and then a list of arguments to be passed to the
>subroutine.
>
>For example, if my script is named 'dog', then:
>
>% dog beg for food
>
>Would call &beg(for,food).
>
[snip]
>
>or i could use an eval:
>
>###
>
>sub beg { ... begging code ...}
>sub speak { ... speaking code ...}
>sub sit { ... sitting code ...}
>
>eval '$sub_name @sub_args';
I wouldn't use this style (you'd need double quotes, anyway).
By the time you got around to making sure the command line didn't look
like
% dog system rm -rf / # bad dog!
you'd end up doing as much or more work as one of the other two ideas.
I'd probably go with the hash, myself, but use $command{$word}->(@args)
-- Gary Ansok
------------------------------
Date: Tue, 24 Jul 2001 15:22:41 -0500
From: "Curtis Hawthorne" <curtish@ourtownusa.net>
Subject: CGI.pm Question
Message-Id: <POk77.14039$fo2.2337@newsfeed.slurp.net>
I have a cgi script written in Perl that uses CGI.pm for sending headers and
interpreting parameters passed to it by web browerrs. My problem is that
when I use a statement like print
redirect("http://server.com/cgi-bin/script.pl?var1=$var1"); where $var1 =
"This, that, & other stuff", the & stays in the URL and messes up the data
so that the script only gets var1 as "This, that, ". My question is, why
doesn't CGI.pm automatically enode the & into something that will go into a
URL without causing problems? And, if it can't do that, what's the best way
to work around it?
Thanks!
Curtis H.
I would have posted this to comp.infosystems.www.authoring.cgi, but I can't
seem to get past their moderation system.
------------------------------
Date: Tue, 24 Jul 2001 21:42:49 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: CGI.pm Question
Message-Id: <mbudash-71D78B.14424924072001@news.sonic.net>
In article <POk77.14039$fo2.2337@newsfeed.slurp.net>, "Curtis
Hawthorne" <curtish@ourtownusa.net> wrote:
> I have a cgi script written in Perl that uses CGI.pm for sending headers
> and
> interpreting parameters passed to it by web browerrs. My problem is that
> when I use a statement like print
> redirect("http://server.com/cgi-bin/script.pl?var1=$var1"); where $var1 =
> "This, that, & other stuff", the & stays in the URL and messes up the
> data
> so that the script only gets var1 as "This, that, ". My question is, why
> doesn't CGI.pm automatically enode the & into something that will go into
> a
> URL without causing problems? And, if it can't do that, what's the best
> way
> to work around it?
mr. stein most likely thought that giving the programmer the ultimate
decision of what to escape and how to escape it would be a better
choice. per the docs (@ http://stein.cshl.org/WWW/software/CGI/ ):
escape(), unescape()
use CGI qw/escape unescape/;
$q = escape('This $string contains ~wonderful~ characters');
$u = unescape($q);
These functions escape and unescape strings according to the URL hex
escape rules. For example, the space character will be converted into
the string "%20".
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Tue, 24 Jul 2001 16:46:19 -0500
From: "Curtis Hawthorne" <curtish@ourtownusa.net>
Subject: Re: CGI.pm Question
Message-Id: <D1m77.14071$fo2.2217@newsfeed.slurp.net>
Thanks, I must have missed that part in the documentation.
Curtis H.
"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-71D78B.14424924072001@news.sonic.net...
> In article <POk77.14039$fo2.2337@newsfeed.slurp.net>, "Curtis
> Hawthorne" <curtish@ourtownusa.net> wrote:
>
> > I have a cgi script written in Perl that uses CGI.pm for sending headers
> > and
> > interpreting parameters passed to it by web browerrs. My problem is
that
> > when I use a statement like print
> > redirect("http://server.com/cgi-bin/script.pl?var1=$var1"); where $var1
=
> > "This, that, & other stuff", the & stays in the URL and messes up the
> > data
> > so that the script only gets var1 as "This, that, ". My question is,
why
> > doesn't CGI.pm automatically enode the & into something that will go
into
> > a
> > URL without causing problems? And, if it can't do that, what's the best
> > way
> > to work around it?
>
> mr. stein most likely thought that giving the programmer the ultimate
> decision of what to escape and how to escape it would be a better
> choice. per the docs (@ http://stein.cshl.org/WWW/software/CGI/ ):
>
> escape(), unescape()
>
> use CGI qw/escape unescape/;
> $q = escape('This $string contains ~wonderful~ characters');
> $u = unescape($q);
>
> These functions escape and unescape strings according to the URL hex
> escape rules. For example, the space character will be converted into
> the string "%20".
>
> hth-
> --
> Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 24 Jul 2001 15:00:19 -0700
From: srinivasanbala@netscape.net (Balaji)
Subject: changing a field value in a particular line
Message-Id: <86e0f1f4.0107241400.e57893a@posting.google.com>
Hi Gurus
I am new to this..but it creates lot of interest.
I am ok with scripts like forms creating/printing to a
datafile/creating results page by printing correct fields etc..getting
a timestamp/modification time etc..
But I am stuck here totally.
my data file is abc.dat
it has following values for e.g.
california,sfo,goldengate,80,60,localtime
arizona,grandcanyon,northrim,70,40,locatime
This values are submitted using a form.
now the same form is used to change
"california,sfo,goldengate,80,60,localtime" to
"california,sfo,IMAX,80,60,localtime"
but i can either append the abc.dat or overwriting the whole file
which certainly i don't want to do.I am not been to overwrite that
particular line.
I read couple of postings and perlfaq5 etc..but for me right now it is
tough..
can somebody show me the simple way?
Thanks a lot for your help.
------------------------------
Date: Tue, 24 Jul 2001 22:17:02 +0200
From: Philip Newton <pne-news-20010724@newton.digitalspace.net>
Subject: Re: creating another file
Message-Id: <6ilrltkp07ks4k71uv53082d7lpgb099na@4ax.com>
On Tue, 24 Jul 2001 09:24:44 -0500, "cp" <cpryce@pryce.net> wrote:
> Try perldoc -f open
And if your Perl is new enough, `perldoc perlopentut`.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 24 Jul 2001 23:51:12 +0200
From: stephh <stephh@nospam.com>
Subject: Re: Deciphering Carp::carp message
Message-Id: <240720012351124004%stephh@nospam.com>
echo " myscript: Use of uninitialized value at (eval 13) line 17." |
splain
In article <9jged0$1gmi$1@agate.berkeley.edu>, Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> kj0
> <kj0@mailcity.com>], who wrote in article <9jfkt1$5nl$1@panix3.panix.com>:
> > Carp::carp is giving me the error
> >
> > myscript: Use of uninitialized value at (eval 13) line 17.
>
> Use croak() instead. If this is not your code, there is a way to
> globally up grade each carp() to a croak().
>
> Ilya
--
$tephh;
Don't forget to visit http://www.grc.com/dos/grcdos.htm
------------------------------
Date: Tue, 24 Jul 2001 20:02:58 +0100
From: "Nathan Randle" <nathan.randle@ntlworld.com>
Subject: Detecting cookies.
Message-Id: <LEj77.18309$SK6.2111666@news6-win.server.ntlworld.com>
I'm am writing a script to detect if a cookie is there. I want the cookie to
die once the browser is closed. So how do you do all this?
if (cookie doesn't exist) {
Do all this
}
how do you say the 'cookie doesn't exist' bit?
and how do you declare a cookie in a Meta tag that will die once the browser
is closed?
I know i've worded that whole thing really bad but i'm tired and it's the
best I could do. someone please help me
Thanks in advance.
Nathan
------------------------------
Date: Tue, 24 Jul 2001 21:13:52 GMT
From: "Ross" <swan@peak2peak.com>
Subject: Directory Diff
Message-Id: <3b5ded5b$1@news.peakpeak.com>
I've done a backup on a UNIX directory
to a temporary location and I'd like to find
the files that have been changed from my
current version of the directory. Has anyone
written a utility to do this? What makes it a
little tricky is that the directory has many sub-
directories.
--Ross
------------------------------
Date: Tue, 24 Jul 2001 19:23:43 GMT
From: "--Rick" <no_trick@my-de(remove the obvious)ja.com>
Subject: Re: don't laugh (case usage for variables)
Message-Id: <3Xj77.50788$C81.4281160@bgtnsc04-news.ops.worldnet.att.net>
"Abigail" <abigail@foad.org> wrote in message
news:slrn9lpbf5.9a2.abigail@alexandra.xs4all.nl...
| Steve Holland (holland@origo.ifa.au.dk) wrote on MMDCCCLXXIX September
| MCMXCIII in <URL:news:w47ofqgbqiy.fsf@origo.ifa.au.dk>:
| ## abigail@foad.org (Abigail) writes:
| ## > Jeff Zucker (jeff@vpservices.com) wrote:
| ##
| ## > -: 3. no big deal but all-caps are good for filehandles but bad
for
| ## > -: variables just on legibility
| ##
| ## > Is it? If you take a look in 'man perlvar' and look at the
| ## > predefined variables in Perl, you see that all caps variables
| ## > massively outnumber the all lowercase variables.
| ##
| ## These are predefined variables. In general it is a good idea
to
| ## reserve all-caps for the predefined variables so that they stand
out
| ## from the user-defined and package-defined variables. However,
| ## different folk have different tastes.
|
|
| Ah, so, for non-predefined variables, it's good to use all lowercase
| variables, except when they are filehandles, then they should be all
| uppercase. Because predefined variables are all uppercase as well.
| Or something like that.
|
| I'm sorry, but I find the rules arbitrary and not actually based on
| readability. They are a convention, and we could have used as a
| convention that filenames only had vowels and other variables only
| had consonants too.
|
Yes.. It looks that way at first and you are certainly the one to
decide whether to use upper case for your own labels. The advantage to
using lower-case for your own variables is that you don't have to worry
about conflicting with future reserved words. In addition to that,
conforming to common practice makes it easier to collaborate with
others.
--
--Rick
------------------------------
Date: Tue, 24 Jul 2001 14:08:16 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: encrypt a password
Message-Id: <3B5D3B00.B5A360B@ce.gatech.edu>
> Maybe in the end what I want, as you suggest, is to simply compile the script.
> I'm kind of new to Perl: how does one do this? (Yes I'll look it up in the
> docs).
perldoc -q compile
------------------------------
Date: Tue, 24 Jul 2001 23:57:48 +0200
From: stephh <stephh@nospam.com>
Subject: Re: encrypt a password
Message-Id: <240720012357487791%stephh@nospam.com>
> my $password = "uirtqzfguls" ^ "likujyhtgrf" ^ "tyFqzp}d}lq";
> print "$password\n";
Cool!
How do you encode ?
> In article <u94rs2nu6a.fsf@wcl-l.bham.ac.uk>, <nobull@mail.com> wrote:
> Patrick Flaherty <Patrick_member@newsguy.com> writes:
>
> > I'm not going to worry yet about what form of the password travels over the
> > wire
> > during the ftp transaction. I just don't want the plaintext of my password
> > sitting in my Perl source.
>
> Your problem is:
> 1) Fundamentally insoluable.
> 2) Nothing to do with Perl (because of (1)).
> 3) Frequently asked here.
>
> There is no way to write a program such that running the program will
> output a secret and such that a person with access to the code of the
> program cannot determine the secret.
>
> You can obscure the password such that a person looking at the source
> and not deliberately trying to discover the password will not
> unintensionally become aware of the password.
>
> If this is your goal then the simplest obscuring algorithm to
> implement in Perl is a simple XOR:
>
> my $password = "uirtqzfguls" ^ "likujyhtgrf" ^ "tyFqzp}d}lq";
> print "$password\n";
--
$tephh;
Don't forget to visit http://www.grc.com/dos/grcdos.htm
------------------------------
Date: Tue, 24 Jul 2001 18:16:59 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I find the week-of-the-year/day-of-the-year?
Message-Id: <vYi77.19$os9.170716160@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I find the week-of-the-year/day-of-the-year?
The day of the year is in the array returned by localtime() (see the
section on "localtime" in the perlfunc manpage):
$day_of_year = (localtime(time()))[7];
or more legibly (in 5.004 or higher):
use Time::localtime;
$day_of_year = localtime(time())->yday;
You can find the week of the year by dividing this by 7:
$week_of_year = int($day_of_year / 7);
Of course, this believes that weeks start at zero. The Date::Calc module
from CPAN has a lot of date calculation functions, including day of the
year, week of the year, and so on. Note that not all businesses consider
``week 1'' to be the same; for example, American businesses often
consider the first week with a Monday in it to be Work Week #1, despite
ISO 8601, which considers WW1 to be the first week with a Thursday in
it.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.10
--
This space intentionally left blank
------------------------------
Date: 24 Jul 2001 19:11:11 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How can I determine how many charcters to represnt a given int value?
Message-Id: <slrn9lri3t.aik.abigail@alexandra.xs4all.nl>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDCCCLXXXIII September
MCMXCIII in <URL:news:9ji2o4$q38$1@charity.cs.utexas.edu>:
!! In article <9ji21t$gh9$1@panix6.panix.com>, Stan Brown <stanb@panix.com> wrote:
!! >I'm doing something (wrong perhaps) with PerlTK that requires that I tell
!! >the widget how much space to reserve for a given number (integer).
!! >
!! >How can I do this in perl? In C I would kust printf it into a temporary
!! >char array, anddo len() on it.
!!
!! You mean strlen()?
!!
!! Anyway, something like this:
!!
!! $widget_string = sprintf ("%d", $given_number);
!! $widget_length = length $widget_string;
And that's an improvement over:
$widget_length = length $given_number;
because of?
Abigail
--
print 74.117.115.116.32;
print 97.110.111.116.104.101.114.32;
print 80.101.114.108.32;
print 72.97.99.107.101.114.10;
------------------------------
Date: Tue, 24 Jul 2001 23:41:02 +0300
From: "novastar" <subscriber@novastar.dtdns.net>
Subject: Re: How do I count the number of characters in a string
Message-Id: <9jkmei$c31$1@usenet.otenet.gr>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3B5CEDF9.EC1EAADC@acm.org...
> [top-posting fixed]
>
> novastar wrote:
> >
> > "J.D. Fieldsend" <u9jdf@csc.liv.ac.uk> wrote in message
> > news:3B5C0795.A79D7050@csc.liv.ac.uk...
> > >
> > > I want to be able to tabulate text without knowing beforehand how many
> > > characters are in each string.
> >
> > you could also do th following
> > print $myline=~s/././g ;
>
> Which has the nasty side effect of replacing every character in $myline
> (except the newline) with a period.
>
>
>
> John
> --
> use Perl;
> program
> fulfillment
Oups !!! right ! this one maybe ...
print $var=~s/(.)/\1/g ;
------------------------------
Date: Tue, 24 Jul 2001 22:38:06 +0100
From: "Lee" <tong_po_and_malene@hotmail.com>
Subject: HTML::Parser Help
Message-Id: <9jkpn9$5te$1@news6.svr.pol.co.uk>
Hi all,
I've installed this module from CPAN fine. I have read the documentation and
jus can't get it functioning. All I want to do is remove the HTML tags from
a given text string and return just the remaining non-HTML text.
Has anyone used this module for this type of purpose? Some sample code would
be useful!
Thanks in advance,
Lee.
------------------------------
Date: Wed, 25 Jul 2001 00:00:41 +0200
From: Bjoern Hoehrmann <bjoern@hoehrmann.de>
Subject: Re: HTML::Parser Help
Message-Id: <3b78edc7.34553234@news.bjoern.hoehrmann.de>
* Lee wrote in comp.lang.perl.misc:
>I've installed this module from CPAN fine. I have read the documentation and
>jus can't get it functioning. All I want to do is remove the HTML tags from
>a given text string and return just the remaining non-HTML text.
One simple approach would be
#!perl -w
use strict;
use warnings;
use HTML::Parser;
my $text;
my $p = HTML::Parser->new(
text_h => [ sub { $text .= $_[0] }, 'dtext' ]
);
$p->parse('some <em>highlighted</em> text');
$p->eof;
print $text;
--
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/
------------------------------
Date: 24 Jul 2001 21:26:31 +0200
From: elwood@news.agouros.de (Konstantinos Agouros)
Subject: Re: IO::Socket-Question
Message-Id: <elwood.996002573@news.agouros.de>
In <9jk8cq$u6i$06$1@news.t-online.com> Buggs <buggs-clpm@splashground.de> writes:
>Konstantinos Agouros wrote:
>> Hi,
>>
>> I wrote an application that uses IO::Socket::Inet to connect to a server.
>> This server seems to be buggy and lock up. However this gets me with an
>> print $sock "something" where my perl-process locks up. I tried setting
>> $sock-> timeout but this didn't help. Do I really have to go to select and
>> everything?
>>
>> Konstantin
>You migth have to avoid buffering.
>Keywords
>autoflush ,flushing, $| , syswrite
$| is 1
IO::Socket sets sockets to autoflush by default
I hope to avoid syswrite / select
>perldoc perlipc
>You may also consider posting a short programm,
>which demonstrates the behavior.
>Buggs
There isn't much about it:
somewhere I do an IO::Socket::Inet new to the server... since the server some-
times closes the connection I do something like:
if(!$sock->connected())
{ # reconnect
}
print STDERR "Before\n";
print $sock "commandforserver"
print STDER "after\n";
'After' is never reached
If the server really has a bug (which I suspect) I would like to be able to
catch this. But I guess I will have to vec/select it before I print. Will be
interesting though if the select call will claim, that I could write...
Konstantin
--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres
------------------------------
Date: Tue, 24 Jul 2001 20:34:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: IO::Socket-Question
Message-Id: <f2nrltcs9d9k5e4jep5g88cbpef1ofgogl@4ax.com>
Konstantinos Agouros wrote:
>print $sock "commandforserver"
Shouldn't commands end in a newline, or even CRLF?
--
Bart.
------------------------------
Date: Tue, 24 Jul 2001 23:42:37 +0200
From: Buggs <buggs-clpm@splashground.de>
Subject: Re: IO::Socket-Question
Message-Id: <9jkpr1$ju4$07$1@news.t-online.com>
Konstantinos Agouros wrote:
> In <9jk8cq$u6i$06$1@news.t-online.com> Buggs <buggs-clpm@splashground.de>
> writes:
>
>>Konstantinos Agouros wrote:
>
--chop--
> IO::Socket sets sockets to autoflush by default
Modul up to date?
> I hope to avoid syswrite / select
what's wrong with syswrite?
--chop--
> There isn't much about it:
> somewhere I do an IO::Socket::Inet new to the server... since the server
> some- times closes the connection I do something like:
IO::Socket::INET
> if(!$sock->connected())
> { # reconnect
> }
> print STDERR "Before\n";
> print $sock "commandforserver"
Note Barts post.
You can import CRLF from IO::Socket.
See if telnet(1) also blocks.
> print STDER "after\n";
>
> 'After' is never reached
> If the server really has a bug (which I suspect) I would like to be able
> to catch this. But I guess I will have to vec/select it before I print.
> Will be interesting though if the select call will claim, that I could
> write...
>
> Konstantin
Consider using the ->timeout() method.
Cheers,
Buggs
------------------------------
Date: Tue, 24 Jul 2001 13:53:08 -0500
From: "Curtis Hawthorne" <curtish@ourtownusa.net>
Subject: Re: mod_perl for NT
Message-Id: <iuj77.13972$fo2.1992@newsfeed.slurp.net>
Well, I tried the PerlIS and it didn't give me much of a speed increase (at
least, it wasn't noticeable) and it didn't always do the HTTP headers like I
wanted them. I did some looking around and it looks like Fast CGI used to
be available for IIS, but not any more, unfortunately. I might just have to
run Apache.
Thanks for the help!
Curtis H.
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:gn9rltk8qo916ab9nv1l719pv4pa1sm8qc@4ax.com...
> Curtis Hawthorne wrote:
>
> >Is there an equivalent to mod_perl for Windows NT 4.0 and IIS 4.0?
>
> There is a mod_perl for NT. Just not for IIS.
>
> And look into ActiveState's PerlIIS. Er... here?
> <http://www.iisanswers.com/Top10FAQ/t10-installperl.htm>
>
> And maybe into PerlEx as well (although I don't know the product
> myself):
>
<http://aspn.activestate.com/ASPN/Perl/Reference/Products/PerlEx/Welcome.htm
l>
>
> --
> Bart.
------------------------------
Date: Wed, 25 Jul 2001 00:00:44 +0200
From: Bjoern Hoehrmann <bjoern@hoehrmann.de>
Subject: Re: mod_perl for NT
Message-Id: <3b7aee8b.34749877@news.bjoern.hoehrmann.de>
* Bart Lateur wrote in comp.lang.perl.misc:
>Curtis Hawthorne wrote:
>
>>Is there an equivalent to mod_perl for Windows NT 4.0 and IIS 4.0?
>
>There is a mod_perl for NT. Just not for IIS.
Is there a mod_perl for Apache 2.0 _and_ NT? The last time I tried to
get the latest CVS version running for this envoirement, I failed...
--
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/
------------------------------
Date: Tue, 24 Jul 2001 15:52:27 -0400
From: Marc Ulrich <mdulrich@unity.ncsu.edu>
Subject: modify report before output to file
Message-Id: <3B5DD1FB.1F918DF0@unity.ncsu.edu>
I am creating a report with values that are usually meaningful, but
ocassionally meaningless. To distinquish that in a report, I would like
to have the reporting function put a "-----" in place of the meaningless
data but display the actual number when it is meaningful. if/else
determines whether it is meaningful or not. If I change the value to be
reported to "-----", it reports it as "0.000" because my format for that
value is @#.###.
Currently the only thing I can think of is to write the report & then
load it back in and do search & replace regexps. Surely there is a
better way?
Thanks,
Marc
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 1371
***************************************