[14263] in Perl-Users-Digest
Perl-Users Digest, Issue: 1672 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 19 21:07:15 1999
Date: Sun, 19 Dec 1999 18:07:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <945655625-v9-i1672@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 19 Dec 1999 Volume: 9 Number: 1672
Today's topics:
Dynamic loading of variables <ephi79@hotmail.com>
Re: Dynamic loading of variables (Anno Siegel)
Re: Dynamic loading of variables tigerboy808@my-deja.com
Re: Dynamic loading of variables <cassell@mail.cor.epa.gov>
Re: Dynamic loading of variables <ephi79@hotmail.com>
Re: Dynamic loading of variables (Simon Cozens)
Emacs perl mode and hereis <bjrubble@shell16.ba.best.com>
escape characters (\\ \") brondsem@yahoo.com
Re: escape characters (\\ \") <bwalton@rochester.rr.com>
Re: escape characters (\\ \") (Martien Verbruggen)
Re: escape characters (\\ \") <lr@hpl.hp.com>
Re: escape characters (\\ \") (Sam Holden)
Re: escape characters (\\ \") <webtemp@ucsd-pps.ucsd.edu>
Re: escape characters (\\ \") <tony_curtis32@yahoo.com>
Executing CGI in WindowsNT <john@us.hsanet.net>
Re: Executing CGI in WindowsNT <tigertom@DELETETHISusa.net>
Re: Executing CGI in WindowsNT <john@us.hsanet.net>
Extracting data with Perl Help! <vivekvp@spliced.com>
Re: Extracting data with Perl Help! (Bart Lateur)
Re: Fail to copy a LONG datatype in Oracle to another t (Rich)
Fastest DNS Resolving? <khowe@performance-net.com>
Re: Fastest DNS Resolving? (Martien Verbruggen)
Re: Fastest DNS Resolving? (Esa Laitinen)
Re: Fastest DNS Resolving? (Martien Verbruggen)
File access mode problem with tie <jong@ebi.ac.uk>
Re: File access mode problem with tie (Charles DeRykus)
file existence test in Perl varies between shell and CG princepawn@my-deja.com
Re: file existence test in Perl varies between shell an <tony_curtis32@yahoo.com>
Re: file existence test in Perl varies between shell an (brian d foy)
Re: file existence test in Perl varies between shell an (Simon Cozens)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Dec 1999 23:39:43 +0200
From: "Ephraim Zaks" <ephi79@hotmail.com>
Subject: Dynamic loading of variables
Message-Id: <83bmc8$kna$1@lnews.actcom.co.il>
Hi!
I have a script which needs to set some global variables differently
according to an argument passed to the script. The problem is that if I put
my variables in a <package1>.pm and <package2.pm>, I can't call them with
"use" because that's at compile time and I don't know yet what package I
want to use.
I also thought of just putting them in a file with the format "name=value"
but I don't know how and if it's possible to dynamically load variables, in
other words, to specify the variable's name only at run-time (such as
${"new_var"} = new_value).
Thanks,
-- ephi
------------------------------
Date: 17 Dec 1999 13:53:39 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Dynamic loading of variables
Message-Id: <83df93$i82$1@lublin.zrz.tu-berlin.de>
Ephraim Zaks <ephi79@hotmail.com> wrote in comp.lang.perl.misc:
>Hi!
>I have a script which needs to set some global variables differently
>according to an argument passed to the script. The problem is that if I put
>my variables in a <package1>.pm and <package2.pm>, I can't call them with
>"use" because that's at compile time and I don't know yet what package I
>want to use.
Then require() it. That's done a run time.
>I also thought of just putting them in a file with the format "name=value"
>but I don't know how and if it's possible to dynamically load variables, in
>other words, to specify the variable's name only at run-time (such as
>${"new_var"} = new_value).
Just put the Perl code to initialize your variables in the file,
dollar and all. From what you say above, there is no need for
symbolic references (that's what ${"new_var"} is). Look it up,
and take note of the reasons why it is not to be used indiscriminately.
Anno
------------------------------
Date: Fri, 17 Dec 1999 18:31:47 GMT
From: tigerboy808@my-deja.com
Subject: Re: Dynamic loading of variables
Message-Id: <83dvik$491$1@nnrp1.deja.com>
I have a similar problem to Ephraim's, but it requires a different
solution I think.
I have a set of scripts, and a set of vars I want to declare and set
values for at the beginning of most of those scripts. I had tried
putting all the vars in a file and doing,
eval(`cat var-defns.pl`);
at the beginning of the scripts, but the var bindings persist only to
the end of the eval. I want to keep the var defns in their own file to
make maintenance/updates easier (so I don't have to change each
appearance of the var).
How can I load these vars into a script so they persist at least to the
end of the lexical/subroutine context in which they were loaded?
-dp-
In article <83df93$i82$1@lublin.zrz.tu-berlin.de>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> Ephraim Zaks <ephi79@hotmail.com> wrote in comp.lang.perl.misc:
> >Hi!
> >I have a script which needs to set some global variables differently
> >according to an argument passed to the script. The problem is that if
I put
> >my variables in a <package1>.pm and <package2.pm>, I can't call them
with
> >"use" because that's at compile time and I don't know yet what
package I
> >want to use.
>
> Then require() it. That's done a run time.
>
> >I also thought of just putting them in a file with the format
"name=value"
> >but I don't know how and if it's possible to dynamically load
variables, in
> >other words, to specify the variable's name only at run-time (such as
> >${"new_var"} = new_value).
>
> Just put the Perl code to initialize your variables in the file,
> dollar and all. From what you say above, there is no need for
> symbolic references (that's what ${"new_var"} is). Look it up,
> and take note of the reasons why it is not to be used
indiscriminately.
>
> Anno
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 17 Dec 1999 17:33:37 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Dynamic loading of variables
Message-Id: <385AE471.C985EF1E@mail.cor.epa.gov>
tigerboy808@my-deja.com wrote:
>
> I have a similar problem to Ephraim's, but it requires a different
> solution I think.
Then it probably should be in a new thread. That way, you can reach
the people who have already stopped reading this one, and get better
answers.
> I have a set of scripts, and a set of vars I want to declare and set
> values for at the beginning of most of those scripts. I had tried
> putting all the vars in a file and doing,
>
> eval(`cat var-defns.pl`);
>
> at the beginning of the scripts, but the var bindings persist only to
> the end of the eval.
That really is *not* a good way to do this. And backticks don't work
the
way you seem to expect.
Perhaps you would prefer to use require() to read in your file.
perldoc -f require
> I want to keep the var defns in their own file to
> make maintenance/updates easier (so I don't have to change each
> appearance of the var).
Then you might want to make this into a module, and use use()
perldoc -f use
perldoc perlmod
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist
mathematical statistician
------------------------------
Date: Sat, 18 Dec 1999 19:08:27 +0200
From: "Ephraim Zaks" <ephi79@hotmail.com>
Subject: Re: Dynamic loading of variables
Message-Id: <83gf7m$a4o$1@lnews.actcom.co.il>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:83df93$i82$1@lublin.zrz.tu-berlin.de...
> Ephraim Zaks <ephi79@hotmail.com> wrote in comp.lang.perl.misc:
> >Hi!
> >I have a script which needs to set some global variables differently
> >according to an argument passed to the script. The problem is that if I
put
> >my variables in a <package1>.pm and <package2.pm>, I can't call them with
> >"use" because that's at compile time and I don't know yet what package I
> >want to use.
>
> Then require() it. That's done a run time.
I think I should clarify the problem. I need a way to put the name of the
file in a variable so it can be decided at run-time. Neither require() nor
use() can accept variables as the name of the variable, as far as I can
tell.
In other words I want be to able to write:
$file = ARGV[0];
require ($file);
Is there a way to do this, or at least a better solution for putting
variables with the same name to be loaded dynamically.
>
> >I also thought of just putting them in a file with the format
"name=value"
> >but I don't know how and if it's possible to dynamically load variables,
in
> >other words, to specify the variable's name only at run-time (such as
> >${"new_var"} = new_value).
>
> Just put the Perl code to initialize your variables in the file,
> dollar and all. From what you say above, there is no need for
> symbolic references (that's what ${"new_var"} is). Look it up,
> and take note of the reasons why it is not to be used indiscriminately.
>
> Anno
------------------------------
Date: 18 Dec 1999 17:43:35 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Dynamic loading of variables
Message-Id: <slrn85nhu7.hkq.simon@othersideofthe.earth.li>
Ephraim Zaks (comp.lang.perl.misc):
>I think I should clarify the problem. I need a way to put the name of the
>file in a variable so it can be decided at run-time. Neither require() nor
>use() can accept variables as the name of the variable, as far as I can
>tell.
>In other words I want be to able to write:
>$file = ARGV[0];
>require ($file);
Change that ARGV to $ARGV, and watch it work.
--
BASIC is to computer programming as QWERTY is to typing.
-- Seymour Papert
------------------------------
Date: 16 Dec 1999 02:36:25 GMT
From: Adam Clark <bjrubble@shell16.ba.best.com>
Subject: Emacs perl mode and hereis
Message-Id: <38585029$0$214@nntp1.ba.best.com>
Hi, just wondering whether anyone here uses Emacs in the Perl mode, and
knows how to get it to properly indent around hereis blocks?
ie.
# My block is indenting properly at this point
my $text = <<END;
This is a block of text,
sometimes it seems to matter what
is in it, but I haven't figured that
out either
END
my $code = "Doesn't indent properly!";
This is really just an annoyance, but everything else in Emacs works
so well (<flamebait type=gratuitous>bite me, vi!</flamebait>) that I feel
like there should be a way to make this work.
Thanks mucho
Adam
yoda@dagobah.com
------------------------------
Date: Thu, 16 Dec 1999 02:31:56 GMT
From: brondsem@yahoo.com
To: brondsem@yahoo.com
Subject: escape characters (\\ \")
Message-Id: <839iut$2d0$1@nnrp1.deja.com>
What special characters can/must be escaped besides \ by \\ and " by
\"? Or are these two the only ones?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 15 Dec 1999 22:21:02 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: escape characters (\\ \")
Message-Id: <38585A9E.37F35AA4@rochester.rr.com>
brondsem@yahoo.com wrote:
>
> What special characters can/must be escaped besides \ by \\ and " by
> \"? Or are these two the only ones?
...
See perlop for details. The answer depends on where your character
string is. If it is a "..." string, then you've got to escape $ and @
in addition to \ and " unless you want variable interpolation. If it is
in a '...' string, then you've only got to escape ' . If it is in a
regular expression, then you've got to escape all the regular expression
metacharacters plus your pattern delimiter(s). That would be * + . [ ]
{ } ? \ ^ $ | ( ) and I hope I didn't leave any out (noting that
sometimes { } don't need escaping). And note that there are
subcontexts within regular expressions which require different
quoting rules, like within character classes for example.
See perlre for info. Backtick strings like `...` require quoting the
same as "...". There are other contexts, like pattern substitution,
that have yet other quoting rules, some of which get pretty hairy and
for which one really has to pay careful attention to the detail of the
documentation. And the documentation is the key: read it :-). If
you don't know how, try typing
perldoc perlop
for example, at your operating system's command prompt.
perldoc perldoc
is a good choice too.
--
Bob Walton
------------------------------
Date: 16 Dec 1999 07:40:43 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: escape characters (\\ \")
Message-Id: <slrn85h5rt.3v9.mgjv@martien.heliotrope.home>
On Wed, 15 Dec 1999 22:21:02 -0500,
Bob Walton <bwalton@rochester.rr.com> wrote:
> brondsem@yahoo.com wrote:
> >
> > What special characters can/must be escaped besides \ by \\ and " by
> > \"? Or are these two the only ones?
[snip]
> If it is in a
> regular expression, then you've got to escape all the regular expression
> metacharacters plus your pattern delimiter(s). That would be * + . [ ]
> { } ? \ ^ $ | ( ) and I hope I didn't leave any out
I know you know this, but just as an extra: if you just want to escape
all metacharacters for a regex, dont' try to do it yourself, use
quotemeta or \Q.
# perldoc perlre
# perldoc -f quotemeta
Martien
--
Martien Verbruggen |
Interactive Media Division | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Thu, 16 Dec 1999 00:15:01 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: escape characters (\\ \")
Message-Id: <MPG.12c23f4ed76edf6f98a383@nntp.hpl.hp.com>
In article <38585A9E.37F35AA4@rochester.rr.com> on Wed, 15 Dec 1999
22:21:02 -0500, Bob Walton <bwalton@rochester.rr.com> says...
> brondsem@yahoo.com wrote:
> >
> > What special characters can/must be escaped besides \ by \\ and " by
> > \"? Or are these two the only ones?
> ...
> See perlop for details. The answer depends on where your character
> string is. If it is a "..." string, then you've got to escape $ and @
> in addition to \ and " unless you want variable interpolation. If it is
> in a '...' string, then you've only got to escape ' .
And \ if you want it to be the last character in the string.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Dec 1999 09:02:34 GMT
From: sholden@mrmph.cs.usyd.edu.au (Sam Holden)
Subject: Re: escape characters (\\ \")
Message-Id: <slrn85hah2.jup.sholden@mrmph.cs.usyd.edu.au>
On Thu, 16 Dec 1999 00:15:01 -0800, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <38585A9E.37F35AA4@rochester.rr.com> on Wed, 15 Dec 1999
>22:21:02 -0500, Bob Walton <bwalton@rochester.rr.com> says...
>> brondsem@yahoo.com wrote:
>> >
>> > What special characters can/must be escaped besides \ by \\ and " by
>> > \"? Or are these two the only ones?
>> ...
>> See perlop for details. The answer depends on where your character
>> string is. If it is a "..." string, then you've got to escape $ and @
>> in addition to \ and " unless you want variable interpolation. If it is
>> in a '...' string, then you've only got to escape ' .
>
>And \ if you want it to be the last character in the string.
And also if you want the sequence \' in the string.
--
Sam
------------------------------
Date: Thu, 16 Dec 1999 11:54:43 -0800
From: Michael DeVicariis <webtemp@ucsd-pps.ucsd.edu>
Subject: Re: escape characters (\\ \")
Message-Id: <38594383.C7826C64@ucsd-pps.ucsd.edu>
You can escape any special character. If you are using a windows NT
server, you must escape the @ symbol when sending an email. Do you have
a specific problem or is this just a general qustion?
Michael DeVicariis
Web Administrator
UCSD Auxiliary & Plant Services
brondsem@yahoo.com wrote:
> What special characters can/must be escaped besides \ by \\ and " by
> \"? Or are these two the only ones?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 16 Dec 1999 19:47:42 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: escape characters (\\ \")
Message-Id: <wkyaau8y75.fsf@yahoo.com>
Michael DeVicariis <webtemp@ucsd-pps.ucsd.edu> writes:
> You can escape any special character. If you are using a windows NT
> server, you must escape the @ symbol when sending
> an email.
You must escape the @ in an interpolation context
(e.g. double-quoted string) otherwise perl will
arrayify (bad verbification :-) it.
It's a perl syntax issue, it's got nothing to do
with NT per se.
tony
------------------------------
Date: Sat, 18 Dec 1999 02:44:00 -0500
From: John Sadler <john@us.hsanet.net>
Subject: Executing CGI in WindowsNT
Message-Id: <pDhbOFzNPhPlr27o34tTkSupxKPu@4ax.com>
Need help getting a cgi script to execute on a WindowsNT server with
Perl running.
I used the following command with no luck.
<!-- #exec cgi"/cgi-bin/myscript.cgi" -->
There are no errors, and when I view the source, the line appears as
above.
I can run the same script using an <a href> call. The line looks like:
<a href="http://www.home.com/cgi-bin/script.cgi?start">Start
script</a>
Thanks
John
------------------------------
Date: Sat, 18 Dec 1999 15:05:55 +0000
From: tigertom <tigertom@DELETETHISusa.net>
Subject: Re: Executing CGI in WindowsNT
Message-Id: <385BA2D2.15B116E@DELETETHISusa.net>
Shouldn't that be :
<!-- #exec cgi="/cgi-bin/myscript.cgi" -->
John Sadler wrote:
> Need help getting a cgi script to execute on a WindowsNT server with
> Perl running.
>
> I used the following command with no luck.
>
> <!-- #exec cgi"/cgi-bin/myscript.cgi" -->
>
> There are no errors, and when I view the source, the line appears as
> above.
>
> I can run the same script using an <a href> call. The line looks like:
>
> <a href="http://www.home.com/cgi-bin/script.cgi?start">Start
> script</a>
>
> Thanks
> John
--
Tigertom
Please visit http://www.tigertom.com - getting a low cost international
merchant account - secure web stores, order encryption, promotion.
Also tarot readings, dating service with message board and photo personals
(free). File on how to attract women. Associate program available.
------------------------------
Date: Sat, 18 Dec 1999 10:32:49 -0500
From: John Sadler <john@us.hsanet.net>
Subject: Re: Executing CGI in WindowsNT
Message-Id: <u6hbOFMJxClPpMToY4TfaB7OULe2@4ax.com>
Yes, that was a typo on the first message I sent. I did in fact have
the '=' sign in the the html text.
On Sat, 18 Dec 1999 15:05:55 +0000, tigertom
>Shouldn't that be :
><!-- #exec cgi="/cgi-bin/myscript.cgi" -->
>
------------------------------
Date: Wed, 15 Dec 1999 21:44:49 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Extracting data with Perl Help!
Message-Id: <83924f$ls5$1@nnrp1.deja.com>
Hi - I am trying to extract certain text from a txt file.
I want to extract these lines of text:
http://www.centroin.com.br/mm/imprensa.ram
I want to extract all the urls with the 'ram' extension in them
here is an example of the text file - it is about 700 lines:
<LI><A HREF="http://www.tvitapoan.com.br/sociedad.htm">Radio
Sociedede</A> - <A
HREF="http://bahiamidia.telebahia.net.br/sociedade/sociedade.ram">Live
Feed<IMG SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0
HSPACE=3 ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.imprensa.com.br/">Radio Imprensa</A> - 102.1 FM
(Rio de Janeiro) - <A
HREF="http://www.centroin.com.br/mm/imprensa.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.tridio.com.br/caxias.htm">Radio Caxias</A> - 930
AM - <A HREF="http://www.tridio.com.br/caxias288.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.cpovo.net/radio/">Radio Guaiba</A> - 720
AM/6000/11785 SW - <A HREF="http://www.cpovo.net/guaiba.ram">Live
Feed<IMG SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0
HSPACE=3 ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.jbfm.com.br/">JBFM</A> - 99.7 FM (São Cristóvão)
- <A HREF="http://www.jbfm.com.br/jbfm.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.somzoom.com.br/">SomZoom-Sat</A> (Fortaleza) -
<A HREF="http://www.somzoom.com.br/player.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.convoy.com.br/~mundi/">Mundi FM</A> - 99.3 FM
(Ponta Grossa) - <A
HREF="http://www.convoy.com.br/mundi/mundi288.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.utranet.com.br/colonial/">Rádio Colonial</A> -
104.7 FM (Congonhas) - <A
HREF="http://www.utranet.com.br/colonial.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.guarani.com.br/index.html">Guarani FM</A> - 96.5
FM (Belo Horizonte) - <A HREF="http://www.guarani.com.br/real.ram">Live
Feed<IMG SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0
HSPACE=3 ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.capitalfm.com.br/">Capital FM</A> - 102.7 FM -
<A HREF="http://www.capitalfm.com.br/capital.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.tridio.com.br/studiof.htm">Rádio Studio FM</A> -
93.5 FM - <A HREF="http://www.tridio.com.br/studio288.ram">Live Feed<IMG
SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0 HSPACE=3
ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
<LI><A HREF="http://www.gazeta-oam.com.br/index.htm">Radio Gazeta</A>
(Maceió)
<ul type=square>
<LI>1260 AM - <A
HREF="http://www.gazeta-oam.com.br/radio_gazeta/radio/vivo.ram">Live
Feed<IMG SRC="../images/livespkr.gif" WIDTH=9 HEIGHT=12 BORDER=0
HSPACE=3 ALIGN="TEXTTOP" VSPACE=1 ALT=""></A>
Any help in how to extract those lines from this file?
THANK YOU!!
--
May your bad hair days be few. This does not
apply to the bald.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 15 Dec 1999 23:04:16 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Extracting data with Perl Help!
Message-Id: <385a19f9.1105365@news.skynet.be>
vivekvp wrote:
>Hi - I am trying to extract certain text from a txt file.
That's not a text file: it's a HTML file. MAybe you want a variation on
HTML::Parser.
>I want to extract these lines of text:
>
>http://www.centroin.com.br/mm/imprensa.ram
>
>I want to extract all the urls with the 'ram' extension in them
I won't do that with plain regexes. It's too risky. You could extract
stuff like
http://www.whatever.com/some.ram
from a URL like
http://www.whatever.com/some.ramifications/index.html
You *really should extract URL's, and throw away those you don't like.
So get one of the the latest versions of HTML::Parser off CPAN
(<www.cpan.org>), one that includes HTML::TokeParser. Well, 3.00 is out
since a few days, but it's not yet on every mirror.
The example in that module shows you a little script (about 5 lines) for
extracting every "<A>" element. All you need to do is check the URL for
matching /\.ram$/ and Bob's your uncle.
use HTML::TokeParser;
$p = HTML::TokeParser->new(shift||"index.html");
while (my $token = $p->get_tag("a")) {
my $url = $token->[1]{href} or next;
$url =~ /\.ram$/ or next;
push @url, $url;
}
# now all matched URL's are in the array @url
--
Bart.
------------------------------
Date: Fri, 17 Dec 1999 11:43:09 -0500
From: "Fu-Chiang (Rich) Tsui" <tsui@cbmi.upmc.edu>
Subject: Re: Fail to copy a LONG datatype in Oracle to another table
Message-Id: <385A681D.3D74065E@cbmi.upmc.edu>
Thank you all for answering my question. I did solve it by setting the
LongReadLen and LongTruncOk variables in perl.
Rich
Rich Tsui wrote:
>
> Hi Oracle gurus,
>
> I have trouble in copying a LONG datatype column of data to another
> table via
> "INSERT INTO tableA (A_col_NUM, A_col_LONG)
> SELECT B_col_NUM, B_col_LONG FROM tableB", where the A_col_LONG and
> B_col_LONG represent the LONG datatype.
>
> The error message I got from the sqlplus is:
> ORA-00997: illegal use of LONG datatype
>
> I suspect it's a bug in Oracle 8.0.4. If you know how to solve this
> problem, please let me know. Thank you in advance.
>
> Additionally, I even tried to use DBI in PERL to read a LONG datatype,
> and it also ended up with the following error message,
> DBD::Oracle::st fetchrow failed: ORA-24345: A Truncation or null fetch
> error occurred (DBD ERROR: ORA-01406 error on field 1 of 1, ora_type 8)
> at cp_table.pl line 25. (Line 25 has the command $sth->fetchrow())
>
> Here is the basic information,
> Server: Oracle 8.0.4.0.0
> OS: Solaris 2.5
> Box: Sun's enterprise 10K
> PERL: 5.00403
>
> Rich
------------------------------
Date: Sat, 18 Dec 1999 16:32:13 -0400
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Fastest DNS Resolving?
Message-Id: <McS64.198957$5r2.503035@tor-nn1.netcom.ca>
What is the fastest way to do DNS Resolving in Perl? Is there an even faster
solution that is non-Perl?
kh
------------------------------
Date: 18 Dec 1999 23:59:17 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Fastest DNS Resolving?
Message-Id: <slrn85o7t4.835.mgjv@martien.heliotrope.home>
On Sat, 18 Dec 1999 16:32:13 -0400,
Kevin Howe <khowe@performance-net.com> wrote:
> What is the fastest way to do DNS Resolving in Perl? Is there an even faster
> solution that is non-Perl?
The speed of DNS resolution is probably for 99% determined by your DNS
server, and its configuration, you bandwidth, the remoteness of the
resolution that needs to be done, whether or not there is a local cached
copy, and lots of other DNS specific things.
The client has no, or virtually no impact at all on this, and there
certainly is nothing Perl specific that could be done to the DNS
protocols and/or services to speed things up.
Net::DNS probably should be used from Perl as a client.
To talk about ways to speed up DNS:
# grep dns ~/.newsrc
comp.protocols.dns.bind!
comp.protocols.dns.ops!
comp.protocols.dns.std!
microsoft.public.windowsnt.dns!
net.internet.dns.names!
net.internet.dns.policy!
umich.umce.dns!
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Sun, 19 Dec 1999 00:50:57 GMT
From: punkki@suespammers.org (Esa Laitinen)
Subject: Re: Fastest DNS Resolving?
Message-Id: <8EA0AC8C8esalaitinenikifi@24.1.64.32>
mgjv@comdyn.com.au (Martien Verbruggen) wrote in
<slrn85o7t4.835.mgjv@martien.heliotrope.home>:
>The client has no, or virtually no impact at all on this, and there
>certainly is nothing Perl specific that could be done to the DNS
>protocols and/or services to speed things up.
That is probably true. But depending on the situation there are things that
can make application perform faster, especially if it does multitudes of
dns queries (normally you wouldn't really worry about the speed of DNS
anyway).
One of them is multithreading and doing multiple dns queries at the same
time, another is to use the asychronous calls so there could be multiple
outstanding queries at any given moment.
--
"A Sentry unmanned aerial vehicle crashed on Nov. 16. Industry sources said
the cause of the mishap was pilot error." -- from Dec. 1 Defense News
The suespammers.org mail server is located in California; do not send
unsolicited bulk e-mail or unsolicited commercial e-mail to my
suespammers.org address
------------------------------
Date: 19 Dec 1999 07:09:55 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Fastest DNS Resolving?
Message-Id: <slrn85p14b.89a.mgjv@martien.heliotrope.home>
On Sun, 19 Dec 1999 00:50:57 GMT,
Esa Laitinen <punkki@suespammers.org> wrote:
> mgjv@comdyn.com.au (Martien Verbruggen) wrote in
> <slrn85o7t4.835.mgjv@martien.heliotrope.home>:
>
> >The client has no, or virtually no impact at all on this, and there
> >certainly is nothing Perl specific that could be done to the DNS
> >protocols and/or services to speed things up.
>
> That is probably true. But depending on the situation there are things that
> can make application perform faster, especially if it does multitudes of
> dns queries (normally you wouldn't really worry about the speed of DNS
> anyway).
Yes, you write your application in such a way that it only queries for
the same name once.
And the perl content of this is?
> One of them is multithreading and doing multiple dns queries at the same
> time, another is to use the asychronous calls so there could be multiple
> outstanding queries at any given moment.
That may or may not be faster, and you may or may not piss of your
sysadmin.
And the Perl content of this is?
Once again, I refer this thread to one of the groups in an earlier post.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Thu, 16 Dec 1999 21:39:42 +0000
From: Jong Park <jong@ebi.ac.uk>
Subject: File access mode problem with tie
Message-Id: <38595C1E.6AC37936@ebi.ac.uk>
Hi,
I have created a few files with the following.
The file has the access mode of
'----------'
not like: -rwxr-xr-x
as I indicated in $access.
Can anybody tell me how to make the proper
access?
Thanks,
Jong
tie(%{$h}, NDBM_File, "$file", 'O_CREAT', "$access");
--
... Science is not a craftsmanship nor a simple clever discovery
of nature. It is not a task for any clever mind with a good
memory and a good understanding on the techniques involved with
a good class mark from previous schools. It requires a maturity
as an educated human personality with proper insights on the
processes and consequences of the work involved to the society
and all humanbeings in the far extent.
It is a scholastic activity with unselfish and unbiased causes..
------------------------------
Date: Fri, 17 Dec 1999 03:16:32 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: File access mode problem with tie
Message-Id: <FMv7rK.C1L@news.boeing.com>
In article <38595C1E.6AC37936@ebi.ac.uk>, Jong Park <jong@ebi.ac.uk> wrote:
>Hi,
>
>I have created a few files with the following.
>The file has the access mode of
>
>'----------'
>
>not like: -rwxr-xr-x
>
>as I indicated in $access.
>
>
>tie(%{$h}, NDBM_File, "$file", 'O_CREAT', "$access");
A couple of problems:
Don't quote the O_CREAT flag. That's a constant supplied by
the Fcntl module.
Don't quote the mode... again that's a numeric value and
(conventionally expressed in octal), e.g.,
$access = 0755;
tie(%{$h}, NDBM_File, $file, O_CREAT|O_RDWR, $access);
perldoc -f dbmopen
perldoc AnyDBM_File
--
Charles DeRykus
------------------------------
Date: Wed, 15 Dec 1999 17:46:35 GMT
From: princepawn@my-deja.com
Subject: file existence test in Perl varies between shell and CGI execution
Message-Id: <838k5p$anp$1@nnrp1.deja.com>
The results of this simple program varies depending on whether it is run
from the Linux shell or from a web browser... but it is a simple file
existence test AND all directories to the file are read and execute
enabled... any idea why?
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML>" . "\n";
print "<BODY>" . "\n";
print "UID: $<\n";
$file='/usr/end70/mnt/admin/webs/end70/intranet/interface/title.html';
$file_test_result =
(-e $file)
? 1
: 0;
print "FILE TEST RESULT: ", $file_test_result, "\n";
print "</BODY>" . "\n";
print "</HTML>" . "\n";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 15 Dec 1999 18:06:36 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: file existence test in Perl varies between shell and CGI execution
Message-Id: <wkogbs84er.fsf@yahoo.com>
princepawn@my-deja.com writes:
> The results of this simple program varies depending on whether it is run
> from the Linux shell or from a web browser... but it is a simple file
It is not run from a web browser. It is forked by
the web server.
> existence test AND all directories to the file are read and execute
> enabled... any idea why?
Perhaps your web server and/or CGI execution is
chrooted? You don't say what the permissions on the
file itself are though.
Have you looked here?
http://www.boutell.com/openfaq/cgi/
tony
------------------------------
Date: Wed, 15 Dec 1999 14:11:34 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: file existence test in Perl varies between shell and CGI execution
Message-Id: <brian-1512991412210001@rtp-cr45-dhcp-167.cisco.com>
In article <838k5p$anp$1@nnrp1.deja.com>, princepawn@my-deja.com wrote:
>>$file_test_result =
> (-e $file)
> ? 1
> : 0;
of course, that's extra typing just for
$file_test_result = -e $file;
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 18 Dec 1999 11:26:42 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: file existence test in Perl varies between shell and CGI execution
Message-Id: <slrn85mrri.hkq.simon@othersideofthe.earth.li>
brian d foy (comp.lang.perl.misc):
>> (-e $file)
>> ? 1
>> : 0;
>
>of course, that's extra typing just for
> $file_test_result = -e $file;
0 isn't the same as undef
--
Disillusion? I can make it for you at home!... Besides, why else did you
come to the City of Expiring Dreams (apologies to Matthew Arnold)?
-- Katherine Kaye, on Oxford.
------------------------------
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 1672
**************************************