[24502] in Perl-Users-Digest
Perl-Users Digest, Issue: 6682 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 11 21:05:47 2004
Date: Fri, 11 Jun 2004 18:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 11 Jun 2004 Volume: 10 Number: 6682
Today's topics:
Re: Extracting Text (Jake Gottlieb)
Re: Microsoft Word and Perl <usenet@morrow.me.uk>
Pattern matching problem <bryan@akanta.com>
Re: perl -e '%h=(a=>1,b=>2); for (keys %h) { s/a/b/ }; <gnari@simnet.is>
Re: perl IF DBI::errsrt moller@notvalid.se
Perl text-handling help <ignoromnibus@cochon.fr>
Re: Perl text-handling help <ittyspam@yahoo.com>
Re: Perl text-handling help <ittyspam@yahoo.com>
Re: Perl text-handling help <ignoromnibus@cochon.fr>
Re: Perl text-handling help <usenet@morrow.me.uk>
Re: Perl text-handling help <ignoromnibus@cochon.fr>
Re: Perl text-handling help <ignoromnibus@cochon.fr>
Re: Perl text-handling help <ittyspam@yahoo.com>
Re: Regular expressions <krahnj@acm.org>
Re: reverse IP lookup for check all doimains on the ser <gp@nospm.hr>
Taint mode and PERL5LIB <socyl@987jk.com>
Re: Taint mode and PERL5LIB <usenet@morrow.me.uk>
Re: Taint mode and PERL5LIB <MyFirstnameHere.News1@gustra.org>
What does this mean? (John Oliver)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jun 2004 15:01:18 -0700
From: jakegottlieb@hotmail.com (Jake Gottlieb)
Subject: Re: Extracting Text
Message-Id: <986e0b6a.0406111337.4a6a942d@posting.google.com>
Tore Aursand <tore@aursand.no> wrote in message news:<pan.2004.06.11.12.33.34.640009@aursand.no>...
> On Fri, 11 Jun 2004 11:08:59 +0000, Anno Siegel wrote:
> >>> next unless ( index($_, 'GO:000') >= 0 );
>
> >> index($_, 'GO:000') > -1 or next;
>
> > 1 + index $_, 'GO:000' or next;
>
> While we're at it: How about keeping those two lines (the check and the
> print) on one line?
>
> while ( <> ) {
> index($_, 'GO:000') and print;
> }
Thank you all. What is the command to save it to a text file. Thanks again.
------------------------------
Date: Fri, 11 Jun 2004 20:31:51 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Microsoft Word and Perl
Message-Id: <cad4rn$5t5$1@wisteria.csv.warwick.ac.uk>
[stop top-posting]
Quoth Ilaiy@hotmail.com (Ilaiyarasan):
>
> Ben Morrow <usenet@morrow.me.uk> wrote in message news:<cabdue$og7$4@wisteria.csv.warwick.ac.uk>...
> > Quoth Ilaiy@hotmail.com (Ilaiyarasan):
> > >
> > > my $newdoc = $word->ActiveDocument;
> > > foreach my $obj_Story ($newdoc->StoryRanges ){
> > > $obj_Story->Fields->{Update}; ==> Cannot find object
> >
> > I don't know much about OLE, but surely that should be
> >
> > $obj_Story->Fields->update;
> >
> > ? update is a method, not a property.
> >
> > > The equivalent in VBA is ..
> > >
> > > Dim obj_Story As Range
> > > For Each obj_Story In ActiveDocument.StoryRanges
> > > obj_Story.Fields.update
^^
lower case 'u'
> > > While Not (obj_Story.NextStoryRange Is Nothing)
> > > Set obj_Story = obj_Story.NextStoryRange
> > > obj_Story.Fields.update
> > > Wend
> > > Next obj_Story
> > > Set obj_Story = Nothing
>
> I think it still gives me a problem
>
> my $newdoc = $word->ActiveDocument;
> foreach my $obj_Story ($newdoc->StoryRanges ){
> $obj_Story->Fields->Update;
^^
upper case 'U'
> while (my $obj_Story = $obj_Story->NextStoryRange){
> $obj_Story->Fields->Update;
> }
>
> It srill gave me the same error i am not sure why it is doing that
> because it works perfectly in VB but when you get the same code in
> Perl it kind of acts really stange..
Be more careful.
If this is not the problem, please post your code and the *exact* error
message you get.
Ben
--
Joy and Woe are woven fine,
A Clothing for the Soul divine William Blake
Under every grief and pine 'Auguries of Innocence'
Runs a joy with silken twine. ben@morrow.me.uk
------------------------------
Date: Sat, 12 Jun 2004 00:37:37 GMT
From: Bryan <bryan@akanta.com>
Subject: Pattern matching problem
Message-Id: <lfsyc.69992$4j2.8621@newssvr29.news.prodigy.com>
Hi,
I have a large dna sequence (about 200000 bases) in a file, and in
another file with 23 smallish sub (about 100 bases) sequences that I
want to match in the large sequence.
The large sequence file is in fasta format, and I read it in without a
problem.
The subsequence file is a table, which I read in using the Data::Table
module:
my $subseqs= Data::Table::fromTSV("subseq.txt");
Then I loop through the $subseq table and do a pattern match for my
sequence like this:
if ($sequence =~ m/$subseq/g) {
# Match!
}
Here's where the problem starts... 18 out of 23 subsets match. But ALL
match if I do a search for the subsequence in any text editor (like vi)!
I have verified that everything is uppercased, and double checked that
all 23 subsequences are indeed correct in the main sequence. A lot of
testing and debugging shows that if I copy and paste any sequence or
subsequence then matches are okay. So Im thinking there is some hidden
characters messing things up that were missed.
But in vi, I use :set list to show all command characters. Nothing
unusual is there.
I read in the sequence file like this:
my $seq;
open (INFILE, "< $ARGV[0]") or die "Cannot open $ARGV[0] for read\n\n";
my @data = <INFILE>;
close INFILE;
foreach my $line (@data) {
# Strip off newlines
chomp $line;
# do some checks for other lines
$seq .= uc($line);
}
}
Does anyone see anything wrong with this, or my pattern match that may
explain the unexplainable?
Thanks,
Bryan
------------------------------
Date: Fri, 11 Jun 2004 22:58:57 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: perl -e '%h=(a=>1,b=>2); for (keys %h) { s/a/b/ }; print keys %h'
Message-Id: <caddc0$gs7$1@news.simnet.is>
"A. Farber" <Alexander.Farber@t-online.de> wrote in message
news:c9ccaf83.0406110314.4dfa34a5@posting.google.com...
>
> I have a hash where keys and values are file paths.
> I'm going to use that hash to generate a GNU Makefile.
> For some parts of the file paths I have shortcuts
> (like $(TOPDIR)) which I'd like to substitute into the
> paths. I.e. I'd like to go through the hash keys and
> perform a substitution on them, like in this test case:
>
> perl -e '%h=(a=>1,b=>2); for (keys %h) { s/a/b/ }; print keys %h'
perl -e '%h=(a=>1,b=>2); my @k=keys %h; for (@k) { s/a/b/ }; print @k'
gnari
------------------------------
Date: Fri, 11 Jun 2004 21:06:59 GMT
From: moller@notvalid.se
Subject: Re: perl IF DBI::errsrt
Message-Id: <84vfhxreh9.fsf@notvalid.se>
spamtotrash@toomuchfiction.com (Kevin Collins) writes:
> In article <841xkms3lg.fsf@notvalid.se>, moller@notvalid.se wrote:
> > Xaver Biton <javier@t-online.de> writes:
> >
> >> Hi,
> >>
> >> I'writing a program which will be used to migrate a mysql DB to
> >> another mysql DB.
> >>
> >> Because the data quantity is relative big, if an arror occur while
> >> inserting a record in the new db I would like to deviate this record
> >> error table.
> >>
> >> How ban achive that.
> >> If someone could make a little example I would be grathefull.
> >
> > Not an answer to your question but..
> >
> > In cases like this it's *almost* *always* better to use
> > the tools provided by the database.
>
> No, in cases like *this*, it is next to impossible to use the tools provided by
> the database. The OP said he wants to do something when an error occurs (other
> than fail, which is what would happen) and the tools provided by MySQL don't
> support that.
Hmm, I have never done this in MySQL but I find it strange that it doesen't
have any errorhandling besides failure. It should at least log the sql's that
failed, this then would give the OP a smaller subset to work with.
But as I'm not familiar with MySQL I really can't disagree with you.
An afterthought.
If the *somthing* the OP wants to do when somthing fails is nontrivial a perl
solution is probably best regardless of database. The most complicated I have
had to do is a few conditionals and/or followed by an alternative sql statment.
------------------------------
Date: Fri, 11 Jun 2004 12:50:17 -0500
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Perl text-handling help
Message-Id: <cacs5c010g0@news2.newsguy.com>
In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a set of
functions for handling "memo" files of text. Basically, a memo is a chunk
of text of any size whatever, and the functions include the ability to set
the desired width of output text, find the number of lines of text in the
memo (given the desired width), and get any given line of text (not simply
cutting it off, but respecting word divisions including punctuation - that
is, it might end a line on a ["] but not if it were [",]). This, as you
can understand, is very handy for displaying or printing stored text in a
tabular format with whatever width might be required.
I'm assuming (always dangerous) that a corresponding set of code is
available somewhere in the perl universe, but I haven't come across it
yet...
While I continue to search, if anyone knows of such code, I'd appreciate a
specific link to it.
--
The greatest unsolved problem in mathematics is why some people are
better at it than others.
------------------------------
Date: Fri, 11 Jun 2004 14:26:23 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Perl text-handling help
Message-Id: <20040611142447.B20623@dishwasher.cs.rpi.edu>
On Fri, 11 Jun 2004, Camelback Jones wrote:
> In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a set of
> functions for handling "memo" files of text. Basically, a memo is a chunk
> of text of any size whatever, and the functions include the ability to set
> the desired width of output text, find the number of lines of text in the
> memo (given the desired width), and get any given line of text (not simply
> cutting it off, but respecting word divisions including punctuation - that
> is, it might end a line on a ["] but not if it were [",]). This, as you
> can understand, is very handy for displaying or printing stored text in a
> tabular format with whatever width might be required.
>
> I'm assuming (always dangerous) that a corresponding set of code is
> available somewhere in the perl universe, but I haven't come across it
> yet...
>
> While I continue to search, if anyone knows of such code, I'd appreciate a
> specific link to it.
I haven't played with them very much, but Text::Wrap or Text::Format might
be what you're looking for. I *think* Text::Wrap is standard, so just do
perldoc Text::Wrap
whereas you can find documentation for Text::Format by searching at
http://search.cpan.org
Paul Lalli
------------------------------
Date: Fri, 11 Jun 2004 14:31:22 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Perl text-handling help
Message-Id: <20040611142849.I20623@dishwasher.cs.rpi.edu>
On Fri, 11 Jun 2004, Paul Lalli wrote:
> On Fri, 11 Jun 2004, Camelback Jones wrote:
>
> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a set of
> > functions for handling "memo" files of text. Basically, a memo is a chunk
> > of text of any size whatever, and the functions include the ability to set
> > the desired width of output text, find the number of lines of text in the
> > memo (given the desired width), and get any given line of text (not simply
> > cutting it off, but respecting word divisions including punctuation - that
> > is, it might end a line on a ["] but not if it were [",]). This, as you
> > can understand, is very handy for displaying or printing stored text in a
> > tabular format with whatever width might be required.
> >
> > I'm assuming (always dangerous) that a corresponding set of code is
> > available somewhere in the perl universe, but I haven't come across it
> > yet...
> >
> > While I continue to search, if anyone knows of such code, I'd appreciate a
> > specific link to it.
>
my $mypost = <<POST;
> I haven't played with them very much, but Text::Wrap or Text::Format might
> be what you're looking for. I *think* Text::Wrap is standard, so just do
> perldoc Text::Wrap
> whereas you can find documentation for Text::Format by searching at
> http://search.cpan.org
>
> Paul Lalli
>
POST
$mypost =~ s/Format/Autoformat/g;
print $mypost;
------------------------------
Date: Fri, 11 Jun 2004 14:40:00 -0500
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Re: Perl text-handling help
Message-Id: <cad2j302l0q@news3.newsguy.com>
Paul Lalli wrote:
> On Fri, 11 Jun 2004, Paul Lalli wrote:
>
>> On Fri, 11 Jun 2004, Camelback Jones wrote:
>>
>> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a set
>> > of functions for handling "memo" files of text. Basically, a memo is a
>> > chunk of text of any size whatever, and the functions include the
>> > ability to set
>> > the desired width of output text, find the number of lines of text in
>> > the memo (given the desired width), and get any given line of text (not
>> > simply cutting it off, but respecting word divisions including
>> > punctuation - that
>> > is, it might end a line on a ["] but not if it were [",]). This, as
>> > you can understand, is very handy for displaying or printing stored
>> > text in a tabular format with whatever width might be required.
>> >
>> > I'm assuming (always dangerous) that a corresponding set of code is
>> > available somewhere in the perl universe, but I haven't come across it
>> > yet...
>> >
>> > While I continue to search, if anyone knows of such code, I'd
>> > appreciate a specific link to it.
>>
>
> my $mypost = <<POST;
>
>> I haven't played with them very much, but Text::Wrap or Text::Format
>> might
>> be what you're looking for. I *think* Text::Wrap is standard, so just do
>> perldoc Text::Wrap
>> whereas you can find documentation for Text::Format by searching at
>> http://search.cpan.org
>>
>> Paul Lalli
>>
>
> POST
>
> $mypost =~ s/Format/Autoformat/g;
>
> print $mypost;
---------------- P R O G R E S S ---------------------
So far, so good... thanks, Paul!!
I've not looked for ::Format or ::Autoformat yet - maybe they're the answer
to the remaining...
Text::Wrap formats the text for output nicely, but leaves a bit to be
desired with regard to being able to retrieve a specific line. The problem
is that the formatted output is not consistent in length, so that direct
access by offset doesn't work reliably... I'm looking for a way to put the
output text in an array (list?) so that a desired line is found simply by
the array index.
use Text::Wrap;
$linelen = 53;
Text::Wrap::columns = $linelen;
$text = magic();
print wrap('','',$text);
print "\n\nso far, so good...";
--
The greatest unsolved problem in mathematics is why some people are
better at it than others.
------------------------------
Date: Fri, 11 Jun 2004 20:39:34 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl text-handling help
Message-Id: <cad5a6$5t5$2@wisteria.csv.warwick.ac.uk>
Quoth Camelback Jones <ignoromnibus@cochon.fr>:
> Paul Lalli wrote:
>
> > On Fri, 11 Jun 2004, Paul Lalli wrote:
> >
> >> On Fri, 11 Jun 2004, Camelback Jones wrote:
> >>
> >> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a set
> >> > of functions for handling "memo" files of text. Basically, a memo is a
> >> > chunk of text of any size whatever, and the functions include the
> >> > ability to set
> >> > the desired width of output text, find the number of lines of text in
> >> > the memo (given the desired width), and get any given line of text
>
> Text::Wrap formats the text for output nicely, but leaves a bit to be
> desired with regard to being able to retrieve a specific line. The problem
> is that the formatted output is not consistent in length, so that direct
> access by offset doesn't work reliably... I'm looking for a way to put the
> output text in an array (list?) so that a desired line is found simply by
> the array index.
>
> use Text::Wrap;
> $linelen = 53;
> Text::Wrap::columns = $linelen;
>
> $text = magic();
>
> print wrap('','',$text);
> print "\n\nso far, so good...";
my @wrapped = wrap '', '', $text;
print "line 6 is $wrapped[5]\n";
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. ben@morrow.me.uk
------------------------------
Date: Fri, 11 Jun 2004 16:46:07 -0500
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Re: Perl text-handling help
Message-Id: <cad9vj01fod@news2.newsguy.com>
Ben Morrow wrote:
>
> Quoth Camelback Jones <ignoromnibus@cochon.fr>:
>> Paul Lalli wrote:
>>
>> > On Fri, 11 Jun 2004, Paul Lalli wrote:
>> >
>> >> On Fri, 11 Jun 2004, Camelback Jones wrote:
>> >>
>> >> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a
>> >> > set of functions for handling "memo" files of text. Basically, a
>> >> > memo is a chunk of text of any size whatever, and the functions
>> >> > include the ability to set
>> >> > the desired width of output text, find the number of lines of text
>> >> > in the memo (given the desired width), and get any given line of
>> >> > text
>>
>> Text::Wrap formats the text for output nicely, but leaves a bit to be
>> desired with regard to being able to retrieve a specific line. The
>> problem is that the formatted output is not consistent in length, so that
>> direct access by offset doesn't work reliably... I'm looking for a way to
>> put the output text in an array (list?) so that a desired line is found
>> simply by the array index.
>>
>> use Text::Wrap;
>> $linelen = 53;
>> Text::Wrap::columns = $linelen;
>>
>> $text = magic();
>>
>> print wrap('','',$text);
>> print "\n\nso far, so good...";
>
> my @wrapped = wrap '', '', $text;
> print "line 6 is $wrapped[5]\n";
>
> Ben
Thanks, Ben, but it didn't work - came out empty ($text is about 12 lines
long at 50 char per line, so line 6 does exist).
print"12345678901234567890123456789012345678901234567890\n";
print wrap('','',$text);
print "\n\nThat was it...\n\n"; ## correct output
<STDIN>;
print "Now... about those individual lines...\n\n";
my @$wrapped = wrap '','',$text;
print "line 6 is $wrapped[5]\n";
print "... isn't it?\n"; ## nope - it was blank, empty, null... whatever.
<STDIN>;
However, plain old Text::Format does provide a rightFill() that creates
contant-length lines, so that'll work.
--
The greatest unsolved probem in mathematics is why some people are
better at it than others.
------------------------------
Date: Fri, 11 Jun 2004 16:54:04 -0500
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Re: Perl text-handling help
Message-Id: <cadaef11fod@news2.newsguy.com>
Camelback Jones wrote:
> Ben Morrow wrote:
>
>>
>> Quoth Camelback Jones <ignoromnibus@cochon.fr>:
>>> Paul Lalli wrote:
>>>
>>> > On Fri, 11 Jun 2004, Paul Lalli wrote:
>>> >
>>> >> On Fri, 11 Jun 2004, Camelback Jones wrote:
>>> >>
>>> >> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a
>>> >> > set of functions for handling "memo" files of text. Basically, a
>>> >> > memo is a chunk of text of any size whatever, and the functions
>>> >> > include the ability to set
>>> >> > the desired width of output text, find the number of lines of text
>>> >> > in the memo (given the desired width), and get any given line of
>>> >> > text
>>>
>>> Text::Wrap formats the text for output nicely, but leaves a bit to be
>>> desired with regard to being able to retrieve a specific line. The
>>> problem is that the formatted output is not consistent in length, so
>>> that direct access by offset doesn't work reliably... I'm looking for a
>>> way to put the output text in an array (list?) so that a desired line is
>>> found simply by the array index.
>>>
>>> use Text::Wrap;
>>> $linelen = 53;
>>> Text::Wrap::columns = $linelen;
>>>
>>> $text = magic();
>>>
>>> print wrap('','',$text);
>>> print "\n\nso far, so good...";
>>
>> my @wrapped = wrap '', '', $text;
>> print "line 6 is $wrapped[5]\n";
>>
>> Ben
>
> Thanks, Ben, but it didn't work - came out empty ($text is about 12 lines
> long at 50 char per line, so line 6 does exist).
>
> print"12345678901234567890123456789012345678901234567890\n";
> print wrap('','',$text);
> print "\n\nThat was it...\n\n"; ## correct output
> <STDIN>;
> print "Now... about those individual lines...\n\n";
> my @$wrapped = wrap '','',$text;
> print "line 6 is $wrapped[5]\n";
> print "... isn't it?\n"; ## nope - it was blank, empty, null... whatever.
> <STDIN>;
>
>
>
> However, plain old Text::Format does provide a rightFill() that creates
> contant-length lines, so that'll work.
>
>
By the way - I pasted this line from the working program
> my @$wrapped = wrap '','',$text;
and this was after trying various combinations with and without the $ and
the @ and in different orders... maybe I just skipped the one that really
works... but I know that
> my @wrapped = wrap '','',$text;
didn't work.
--
The greatest unsolved probem in mathematics is why some people are
better at it than others.
------------------------------
Date: Fri, 11 Jun 2004 20:04:29 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Perl text-handling help
Message-Id: <20040611195212.I20623@dishwasher.cs.rpi.edu>
On Fri, 11 Jun 2004, Camelback Jones wrote:
> Ben Morrow wrote:
>
> > Quoth Camelback Jones <ignoromnibus@cochon.fr>:
> >
> >> Paul Lalli wrote:
> >>
> >> > On Fri, 11 Jun 2004, Paul Lalli wrote:
> >> >
> >> >> On Fri, 11 Jun 2004, Camelback Jones wrote:
> >> >>
> >> >> > In the xBase languages (Clipper, FoxPro, *Harbour, etc) there is a
> >> >> > set of functions for handling "memo" files of text. Basically, a
> >> >> > memo is a chunk of text of any size whatever, and the functions
> >> >> > include the ability to set
> >> >> > the desired width of output text, find the number of lines of text
> >> >> > in the memo (given the desired width), and get any given line of
> >> >> > text
> >>
> >> Text::Wrap formats the text for output nicely, but leaves a bit to be
> >> desired with regard to being able to retrieve a specific line. The
> >> problem is that the formatted output is not consistent in length, so that
> >> direct access by offset doesn't work reliably... I'm looking for a way to
> >> put the output text in an array (list?) so that a desired line is found
> >> simply by the array index.
> >>
> >> use Text::Wrap;
> >> $linelen = 53;
> >> Text::Wrap::columns = $linelen;
> >>
> >> $text = magic();
> >>
> >> print wrap('','',$text);
> >> print "\n\nso far, so good...";
> >
> > my @wrapped = wrap '', '', $text;
> > print "line 6 is $wrapped[5]\n";
>
> Thanks, Ben, but it didn't work - came out empty ($text is about 12 lines
> long at 50 char per line, so line 6 does exist).
Like I said in my original post, I hadn't played with this module very
often. I did just run a few tests, however. It seems like wrap() always
returns the formatted data as scalar. I don't know why the documentation
shows the return value being assigned to an array. That being the case,
if you want to find the 6th line, there are a variety of ways you could do
it. Here's one. I'm willing to bet others will suggest more.
my $formatted = wrap('','', @orig);
my ($line) = $formatted =~ m|(?:.*$/){5}(.*)|;
(Note that I used $/ in the pattern instead of just \n just in case you've
decided to change your output record seperator, or in case your OS uses a
different definition. This may or may not be necessary for your
situation).
Paul Lalli
------------------------------
Date: Fri, 11 Jun 2004 20:57:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Regular expressions
Message-Id: <40CA1CB8.A7C48940@acm.org>
Paul Lalli wrote:
>
> On Fri, 11 Jun 2004, kapil_kaushik wrote:
>
> > in perl, to search for a ' we use \' but then i cannot
> > understand, what the following code searches for.
> > /^\s*\'0'\s*$/
> > Here the 1st ' is preceded by a \ meaning it is a normal '
> > but the 2nd ' puts me in confusion
> > I am new to this language
> > Kindly help
>
> From what source did you get that information? Whoever told you that is
> wrong. The following are the only characters that need to be escaped with
> a backslash in a regular expression:
> \ | ( ) [ { ^ $ * + ? .
>
> Note that you must add to this list whatever character you use as your
> delimiter, and also the @ character if whatever follows it could be an
> array name.
{ only needs to be backwacked if it can be interpreted as a quantifier.
perldoc perlre
[snip]
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
(If a curly bracket occurs in any other context, it is
treated as a regular character.)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 12 Jun 2004 00:59:00 +0200
From: "PHP2" <gp@nospm.hr>
Subject: Re: reverse IP lookup for check all doimains on the server
Message-Id: <caddhg$kb9$1@ls219.htnet.hr>
I have opened bid for $60 by rentacoder.com abot that:
http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=157535
Can you create this script for me?
"Bill" <wherrera@lynxview.com> wrote in message
news:jomdnV-SjJRlKFTdRVn-sQ@adelphia.com...
> PHP2 wrote:
> > Have someone any idea what I must to do?
> >
> > if I add some IP of server that I can see all domains on the same IP on
the
> > server.
> >
> > like here: http://whois.webhosting.info/216.127.92.54
> >
> > Mario
> >
> >
> Have you seen the docs for Net::DNS?
>
> use Net::DNS;
> my $res = Net::DNS::Resolver->new;
> my $query = $res->query("example.com", "NS");
>
> if ($query) {
> foreach $rr (grep { $_->type eq 'NS' } $query->answer) {
> print $rr->nsdname, "\n";
> }
> }
> else { warn "query failed: ", $res->errorstring, "\n" }
>
> -hth
>
------------------------------
Date: Fri, 11 Jun 2004 21:53:06 +0000 (UTC)
From: kj <socyl@987jk.com>
Subject: Taint mode and PERL5LIB
Message-Id: <cad9k1$3en$1@reader2.panix.com>
When running under taint mode (-T switch), $ENV{PERL5LIB} is ignored.
This presents a problem to CGI scripts that want to run in taint
mode but need libraries installed in directories not mentioned in
the default value of @INC [1].
Then again, is running under taint mode really necessary past the
development and testing phase? In other words, is taint mode
anything more than an additional check that the developer can make
prior to releasing the code to make sure that there are no security
gaps in the code, but once the code passes, taint mode can be safely
turned off?
Thanks!
kj
[1] I realize that I could add appropriate "use lib /path/to/my/libs"
lines to the CGI scripts, but at installation time this is a royal
pain, especially if many CGI scripts are involved, since every user
installing this software would have to mung these lines in all its
CGI scripts. At the very least, make would have to do the munging,
which gives me the creeps; I'd prefer to find some other solution.
--
NOTE: In my address everything before the period is backwards.
------------------------------
Date: Fri, 11 Jun 2004 23:14:05 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Taint mode and PERL5LIB
Message-Id: <cadebt$d8u$1@wisteria.csv.warwick.ac.uk>
Quoth kj <socyl@987jk.com>:
>
> When running under taint mode (-T switch), $ENV{PERL5LIB} is ignored.
> This presents a problem to CGI scripts that want to run in taint
> mode but need libraries installed in directories not mentioned in
> the default value of @INC [1].
>
> Then again, is running under taint mode really necessary past the
> development and testing phase? In other words, is taint mode
> anything more than an additional check that the developer can make
> prior to releasing the code to make sure that there are no security
> gaps in the code, but once the code passes, taint mode can be safely
> turned off?
No.
> [1] I realize that I could add appropriate "use lib /path/to/my/libs"
> lines to the CGI scripts, but at installation time this is a royal
> pain, especially if many CGI scripts are involved, since every user
> installing this software would have to mung these lines in all its
> CGI scripts. At the very least, make would have to do the munging,
> which gives me the creeps; I'd prefer to find some other solution.
I am presuming you are looking for a solution you can write into new
scripts, rather than one which will work with existing ones?
At the start of each script, examine $ENV{PERL5LIB}, untaint it, check
that its value looks like a reasonable Perl library dir, etc., split it
on colons and 'use lib'. You can (obviously) put all this in a module,
so you can just say something like
use MyApp::Perl5Lib;
at the top of each individual script.
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* ben@morrow.me.uk *
------------------------------
Date: Sat, 12 Jun 2004 01:53:36 +0200
From: Gunnar Strand <MyFirstnameHere.News1@gustra.org>
Subject: Re: Taint mode and PERL5LIB
Message-Id: <cadglt$qn0$1@hudsucker.umdac.umu.se>
Ben Morrow wrote:
> Quoth kj <socyl@987jk.com>:
>
>>When running under taint mode (-T switch), $ENV{PERL5LIB} is ignored.
>>This presents a problem to CGI scripts that want to run in taint
>>mode but need libraries installed in directories not mentioned in
>>the default value of @INC [1].
>>
>>Then again, is running under taint mode really necessary past the
>>development and testing phase? In other words, is taint mode
>>anything more than an additional check that the developer can make
>>prior to releasing the code to make sure that there are no security
>>gaps in the code, but once the code passes, taint mode can be safely
>>turned off?
>
>
> No.
That is interesting. According to the Perl taint faq i found
(http://gunther.web66.com/FAQS/taintmode.html):
Run-time checking means that you need to test all logical paths of
execution your script might take so that "legal operations" do not
get halted because of taint mode.
I get the impression that if the testing is thorough enough, taint
mode could be turned off for release code. I do *not* argue that
it *should* be turned off, I am just curious to know if there are
situations after testing which could cause taint to fail, for
instance that it would object to the contents of input, despite
untainting?
Kind regards,
/Gunnar
------------------------------
Date: Sat, 12 Jun 2004 00:16:27 GMT
From: joliver@john-oliver.net (John Oliver)
Subject: What does this mean?
Message-Id: <5946e4272dcfdc239c0228e4e2f3a4e7@news.teranews.com>
Jun 11 16:36:34 mail kernel: application bug: perl5.8.0(4468) has
SIGCHLD set to SIG_IGN but calls wait().
Jun 11 16:36:34 mail kernel: (see the NOTES section of 'man 2 wait').
Workaround activated.
Google isn't turning anything up.
--
* John Oliver http://www.john-oliver.net/ *
* California gun owners - protect your rights and join the CRPA today! *
* http://www.crpa.org/ Free 3 month trial membership available *
* San Diego shooters come to http://groups.yahoo.com/group/sdshooting/ *
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6682
***************************************