[21949] in Perl-Users-Digest
Perl-Users Digest, Issue: 4171 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 25 03:06:06 2002
Date: Mon, 25 Nov 2002 00:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 25 Nov 2002 Volume: 10 Number: 4171
Today's topics:
Re: @INC, use, $LD_LIBRARY_PATH, & modules <family2@aracnet.com>
Re: a question on regular expression <gongwm@163.net>
Re: a question on regular expression <gongwm@163.net>
Re: automatic email anniversay script <jurgenex@hotmail.com>
Heartfelt Appologies!!! <hopeandlove2002@hotmail.com>
Re: My cgi can't write in a file <bwalton@rochester.rr.com>
Re: My cgi can't write in a file <flavell@mail.cern.ch>
Re: My cgi can't write in a file <wksmith@optonline.net>
Re: My cgi can't write in a file <nobody@dev.null>
Re: Perl/Tk (fafanie)
Urgent request for help -- posting to a FORM from a Per (RK)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 24 Nov 2002 20:36:59 -0600
From: Abernathey Family <family2@aracnet.com>
Subject: Re: @INC, use, $LD_LIBRARY_PATH, & modules
Message-Id: <3DE18CCB.64C50922@aracnet.com>
Benjamin Goldberg wrote:
>
> Dave Cross wrote:
> [snip]
> > use lib /path/to/perl/modules;
>
> This needs quotes:
>
> use lib "/path/to/perl/modules";
--snip--
Single or double quotes?
------------------------------
Date: Mon, 25 Nov 2002 14:38:41 +0800
From: "Kurt Gong" <gongwm@163.net>
Subject: Re: a question on regular expression
Message-Id: <arsgfi$2vvn$1@mail.cn99.com>
thanx everyone.
it is the first time i post questions here and i feel it is a very nice
place and there are so many friendly people here.
it is true that i wanna find all the inverted sequence from a long sequence.
i will test every solution above now.
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message
news:3DE12B44.269A676A@earthlink.net...
> David K. Wall wrote:
> >
> > Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> >
> > > David K. Wall wrote:
> > >>
> > >> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> > >>
> > >> > Kurt Gong wrote:
> > >> >>
> > >> [finding inverted repeats in a DNA sequence]
> > >>
> > >> [snip program]
> > >> >
> > >> > [untested]
> > >>
> > >> I think you should have tested it. Unless I'm mistaken (a
> > >> frequent occurrence), it misses things it should have found.
> > >
> > > Some sample data, please? In particular, show the outputs you
> > > expect to get.
> >
> > Sure. Consider the sequence below. (randomly-generated; ruler added
> > for convenience)
> >
> > 0----5----0----5----0----5----
> > tccttagcgagcacatatgcgcctcggcgt
> >
> > The program you posted gives the following output:
> >
> > ------
> > From 0 to 3 is 'tcc'
> > From 21 to 24 is 'cct' (it's mirror)
> > From 4 to 6 is 'ta'
> > From 16 to 18 is 'at' (it's mirror)
> > From 6 to 9 is 'gcg'
> > From 26 to 29 is 'gcg' (it's mirror)
> > From 10 to 12 is 'gc'
> > From 27 to 29 is 'cg' (it's mirror)
> > From 17 to 21 is 'tgcg'
> > From 26 to 30 is 'gcgt' (it's mirror)
> > From 24 to 26 is 'cg'
> > From 26 to 28 is 'gc' (it's mirror)
> > ------
> >
> > 'cg' is at offsets 7, 19, 24 (and 27, but there's no inverse of it
> > after that point). Inverses are at 10, 18, 20, 26. The program only
> > finds 'cg' at 24 and 27 and misses the others.
> >
> > Or consider 'ta' (offset 4). It has inverted repeats at 14 and 16,
> > but the outout above only shows the one at 16.
>
> Ok, I see what you are complaining about -- the OP never said that he
> needs to find all of the inverses, though. I suppose I could change my
> code to find such things.
>
> Furthermore, having just now reread it, I see "this kind of pattern can
> form stem-loop structure which is very important for various molecular
> interaction." This is quite important! A sequence of "AAAC" won't
> attach to a "CAAA" and form a loop; it needs to attach to the
> *complemented* and reversed form -- that is, "AAAC" can form a loop with
> "GTTT". (Yes, this means that the OP's example data is wrong; but I
> think his description should be considered more important than the
> sample data).
>
>
> $data = ....;
> while( $data =~ m[
> ( # match the forward part; it must have at least two
> # different characters to be of interest.
> (?> (.) \2* ) .+
> )
> (?= .* ( (??{
> (my $x = reverse $1) =~ tr/ATCG/TAGC/;
> $x;
> }) ) )
> ]xig ) {
> print "The sequence $1 can form a loop with $3\n";
> print "The start location for $1 is $-[1]\n";
> print "The start location for $3 is $-[3]\n";
> }
>
> This still doesn't print out later occurances of the reversed,
> complemented version, but I don't think that that's necessary.
>
> > --
> > David Wall - me@dwall.fastmail.fm
> > "Oook."
>
> Hey, lookit the monkey!
> *Twist* *Crunch* *Snap*
> "No... aargh! I meant Orangutan! Not monkey! Oowch!"
>
> --
> my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
> ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Mon, 25 Nov 2002 14:47:52 +0800
From: "Kurt Gong" <gongwm@163.net>
Subject: Re: a question on regular expression
Message-Id: <arsh0l$309i$1@mail.cn99.com>
thanx everyone.
it's true that i wanna find ALL inverted sequence in a long sequence. i will
try every solution above now.
Kurt Gong <gongwm@163.net> wrote in message
news:arnbmt$29ul$1@mail.cn99.com...
> hello, i wanna find inverted repeats in dna sequence. for example:
> there are 4 different nucleotides in dna sequence: A, T, C ,G
> A pairs with T, and C pairs with G.
> the inverted repeats is something like :
> XXXXATCGXXXXCGATXXX, X represents one random nucleotide of A, T, C, G.
> this kind of pattern can form stem-loop structure which is very important
> for various molecular interaction.
> my question is how to construct a regular expression to find out such a
> pattern from a long dna sequence which may contains many of this inverted
> repeats.
> thanx in advance.
> -
> Regards
> Kurt Gong
> Dep. of biology, Wuhan University.
>
>
>
>
------------------------------
Date: Mon, 25 Nov 2002 07:31:11 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: automatic email anniversay script
Message-Id: <3lkE9.12517$Ho2.10188@nwrddc04.gnilink.net>
itshardtogetone wrote:
> But I am talking about "sending" via my homepage, not my computer. So
> can this "automatic sending of greetings at a scheduled date" be done
> via a homepage.?
Well, please define 'homepage'. A homepage is a piece of HTML code. HTML by
definition is text (in a special format). How can some text send anything?
jue
------------------------------
Date: Mon, 25 Nov 2002 04:21:41 GMT
From: "Hope and Love" <hopeandlove2002@hotmail.com>
Subject: Heartfelt Appologies!!!
Message-Id: <pzhE9.99837$ka.2384957@news1.calgary.shaw.ca>
I would like to appologize to all the readers and anybody else affected by my indescretions, I felt that i was advertising a product that I know works and signed up as an affiliate to promote this product
so I listed it in the individual newsgroups with the URL I did not realize I was spamming, as I am an idividual and putting it in groups 1 at a time....well I thought wrong and ticked off a lot of people!!
For this I am sorry. The company that Im an affiliate for in did not have any knowledge of what I did, and as soon as they found out ordered me to stop immediatly..which I did and it will not happen again
I do hope that You will accept My appologies and not hold this against myself or the company whose product I was promoting.
Mike
------------------------------
Date: Mon, 25 Nov 2002 02:30:28 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: My cgi can't write in a file
Message-Id: <3DE18B42.3010907@rochester.rr.com>
Alvaro Giratá wrote:
> I have a simple cgi script counter that reads the counter value and
> writes the new value in the same counter file. The script can read the
> file info but cannot write on it. The file's path is correct and the
> cgi's permissions are setup to 755.
>
> What could be wrong ?
>
> This is the script!
> ========================================
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> $counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
> open (input,"$counterFile") or die "die";
> $/ = undef;
> $counterValue = <input>;
> close (input);
> $counterValue++;
> open (output,">$counterFile") or die "die";
> print output $counterValue;
> close (output);
> exit;
> ========================================
>
Please see the FAQ:
perldoc -q learn CGI
If you have read and followed everything there, especially including all
the references, post again indicating that. You will find the answer to
your very common problem there. Hint: It has nothing to do with Perl.
--
Bob Walton
------------------------------
Date: Mon, 25 Nov 2002 03:16:15 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: My cgi can't write in a file
Message-Id: <Pine.LNX.4.40.0211250254330.29048-100000@lxplus071.cern.ch>
On Nov 24, Alvaro Giratá inscribed on the eternal scroll:
> cgi's permissions are setup to 755.
>
> What could be wrong ?
Wrong file ownership, I guess, and nothing to do with Perl.
> This is the script!
> ========================================
> #!/usr/bin/perl
No warnings, no strict... Please review the posting guidelines before
risking this mistake again...
> print "Content-type: text/html\n\n";
Possibly. I don't see your DOCTYPE and <html...> stuff yet (well,
CGI.pm would take care of that, but you don't seem to be using it).
> $counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
hmmm... the single quotes were good, I liked that part...
> open (input,"$counterFile") or die "die";
No use of $! to explain what the problem was
Oh, and useless use of double quotes, by the way,
If this had been an appropriate thing to do (but in the context, it
isn't) then something like:
open (INPUT, $counterFile) or
die "couldn't open $counterfile for reading - $!";
(filehandles are by convention uppercase in Perl)
> $/ = undef;
> $counterValue = <input>;
> close (input);
No file locking, hence the procedure is doomed in a CGI context.
> $counterValue++;
> open (output,">$counterFile") or die "die";
This is probably where you most missed $!
But this is anyway too late. To update a file - in a CGI environment
or any other situation where simultaneous processes have access to
update the file - you need all the processes to lock it for updating
before reading it.
(Well, OK, if you're really clever you could handle it in other ways,
but if the system is designed to avoid deadlocks anyway, then there
seems little point in going to the extra complexity that's meant to
avoid deadlocks.)
With respect: this isn't a new problem. Solutions exist for reliable
counter updating in Perl scripts in a CGI context for years already.
There's no harm in learning from scratch - in a learning situation I'd
recommend it - but for real production work you ought to build on
what's already there, rather than making all the usual elementary
mistakes over again. No offence meant, just trying to get you
kick-started.
------------------------------
Date: Mon, 25 Nov 2002 02:50:40 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: My cgi can't write in a file
Message-Id: <4egE9.2316$Go1.2116@news4.srv.hcvlny.cv.net>
"Alvaro Giratá" <agirata@escolombia.net> wrote in message
news:ef53bf3a.0211241744.4f116fe3@posting.google.com...
> I have a simple cgi script counter that reads the counter value and
> writes the new value in the same counter file. The script can read the
> file info but cannot write on it. The file's path is correct and the
> cgi's permissions are setup to 755.
>
> What could be wrong ?
If cgi does not own the file, it probably does not have
write permission to it.
>
> This is the script!
> ========================================
> #!/usr/bin/perl
#please enable warnings with -w
> print "Content-type: text/html\n\n";
> $counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
> open (input,"$counterFile") or die "die";
# please include #! in your error message.
> $/ = undef;
> $counterValue = <input>;
> close (input);
# You should put error check on close especially if you will reopen
file.
> $counterValue++;
> open (output,">$counterFile") or die "die";
# please include #! in your error message. It probably would have
# answered you question.
> print output $counterValue;
> close (output);
> exit;
> ========================================
The script (with path altered for my system)
does work from my command line.
Bill
------------------------------
Date: Mon, 25 Nov 2002 03:59:04 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: My cgi can't write in a file
Message-Id: <3DE19FBE.4060301@dev.null>
Bill Smith wrote:
> "Alvaro Giratá" <agirata@escolombia.net> wrote in message
> news:ef53bf3a.0211241744.4f116fe3@posting.google.com...
>
>>I have a simple cgi script counter that reads the counter value and
>>writes the new value in the same counter file. The script can read the
>>file info but cannot write on it. The file's path is correct and the
>>cgi's permissions are setup to 755.
>>
>>What could be wrong ?
>>
>
> If cgi does not own the file, it probably does not have
> write permission to it.
>
>
>>This is the script!
>>========================================
>>#!/usr/bin/perl
>>
> #please enable warnings with -w
>
>
>>print "Content-type: text/html\n\n";
>>$counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
>>open (input,"$counterFile") or die "die";
>>
> # please include #! in your error message.
>>open (output,">$counterFile") or die "die";
>>
> # please include #! in your error message. It probably would have
> # answered you question.
What you probably mean is $!, not #!.
------------------------------
Date: 24 Nov 2002 23:47:25 -0800
From: fafanie99@yahoo.fr (fafanie)
Subject: Re: Perl/Tk
Message-Id: <31b33246.0211242347.419decb3@posting.google.com>
Bob Walton <bwalton@rochester.rr.com> wrote in message news:<3DE13DA3.4050808@rochester.rr.com>...
> fafanie wrote:
>
> ...
>
>
> > I want to build a graphical interface in Perl/Tk.
> > Via this interface, I want to run a script perl from a button.
> > For the moment, this script run via a console MS-Dos or a xterm unix.
> >
> > How to do?
> > The command system("perl test.pl") or system("start perl test.pl") fails.
> >
> > Thus, my script writes some messages in STDOUT (console,xterm).
> > How can I see theses outputs in my interface?
> ...
>
>
> > fafanie
> >
>
> If you would like to capture the standard output of a program which is
> run from within Perl, use:
>
> $output=`program command line`;
>
> Those are "grave accent" characters (to the left of the 1 key on many
> keyboards, although I don't know about French ones). See:
>
> perldoc perlop
>
> for additional information (look in the quote and quote-like operators
> section, or look for the qx operator (its other implementation).
I don't understand your answer.
Can you explain more?
Thanks
fafanie
------------------------------
Date: 24 Nov 2002 21:44:36 -0800
From: rizkar@hotmail.com (RK)
Subject: Urgent request for help -- posting to a FORM from a Perl Script
Message-Id: <fbbc3c30.0211242144.363d35f5@posting.google.com>
Any assistance on this issue (Which I have spent too many hours on)
will be greatly appreciated.
I'm need to log in to a form via Perl script:
http://www.domain.com/scripts/login.asp
The form takes 2 variables (userid, password), which can easily be
provided. The problem is that AFTER authentication, the form REDIRECTS
me to another URL:
http://www.domain.com/scripts/welcome.asp
So far, this is what I've done: I've used the LWP::Useragent module to
create a $request and execute it:
$request = new HTTP::Request POST => $url;
...
$response = $ua->request($request);
$body = $response->content;
However, after posting the form from my Perl script, the results of
$body above are "The object has been moved." and a reference to
"welcome.asp".
Any idea how I can then get the contents of "welcome.asp" from
www.domain.com? If I just try to simply "get()" it from the Perl
script, I get the logon screen again, so I'm not sure what to do.
Any assistance would be much appreciated.
Regards,
-RK.
------------------------------
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 4171
***************************************