[11786] in Perl-Users-Digest
Perl-Users Digest, Issue: 5386 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 14 22:17:32 1999
Date: Wed, 14 Apr 99 19:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 14 Apr 1999 Volume: 8 Number: 5386
Today's topics:
Re: $variables in <FILES> <ebohlman@netcom.com>
Re: ActivePerl for NT and HTTPS ? <sspringett@cwe2.com>
Re: Best books to use... <not@gonna.tell>
Re: Best books to use... <not@gonna.tell>
Re: Best books to use... <cassell@mail.cor.epa.gov>
Can PERL be used to do block editing? <matthew.dewell@Sun.COM>
Re: Current Date <ebohlman@netcom.com>
Re: Current Date (Ronald J Kimball)
Re: FAQ 1.1: What is Perl? <ebohlman@netcom.com>
Re: flocking question - worried <ebohlman@netcom.com>
Re: flocking question - worried (Ronald J Kimball)
Flocking, Locking, DBM's & TXT's NOSPAMcrstlblu@planet.eon.net
Formats & Writes (Arthur Merar)
Re: Formats & Writes <tchrist@mox.perl.com>
Re: Grabbing Link Text with HTML:LinkExtor <ebohlman@netcom.com>
Re: Help on Sendmail! <sugalskd@netserve.ous.edu>
How to stop LWP::Simple getstore command? gleparc@bidmc.harvard.edu
Re: ide advice wanted <ebohlman@netcom.com>
Re: Interacting with a perl program in execution <ebohlman@netcom.com>
Re: need to modify 'discus' scripts/config files <listed-perl@parv-et-ceteraFreeHolyCow.com>
Re: Need to print \n - Not do a carrage return (Ronald J Kimball)
Re: Newbie Question: String Manipulation <ebohlman@netcom.com>
Re: No echo on a socket connection kevin_collins@my-dejanews.com
Odbc won't work for database on network <qsun@kitco.ca>
Perl 5 DBI MySQL Win32 Package? timespinner@my-dejanews.com
Re: perl question... ordering from dbm (Bob Trieger)
Perl Regex Q? andrewg6969@my-dejanews.com
position in s///g? (Andrew Allen)
Re: position in s///g? (Andrew Allen)
Re: Quick DBM Question <ebohlman@netcom.com>
Send HTML via email <wade@onsetinc.com>
Re: Sending data to HTML from perl script <basvreek@xs5all.nl>
Re: Unitialized var errors & -w flag <ebohlman@netcom.com>
Re: Unitialized var errors & -w flag (Ronald J Kimball)
Re: Unitialized var errors & -w flag <tchrist@mox.perl.com>
Using CGI with NT <nlammers@gionline.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Apr 1999 00:28:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: $variables in <FILES>
Message-Id: <ebohlmanFA7FzJ.MAx@netcom.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
: Ouch. What if one of the values you insert is '$blah', and $macros{blah}
: exists too. You'd better do a single pass substitution to avoid that.
: Plus, this solution is a LOT faster.
: while(<FILE>) {
: s/\$(\w+)/$macros{$1}/g;
: print "$_";
: }
For ease of debugging, I'd change that to:
s/\$(\w+)/(exists $macros{$1})?$macros{$1}:$1/ge;
so that misspelled macro names will stick out like sore thumbs in the
translated text instead of quietly disappearing.
------------------------------
Date: Wed, 14 Apr 1999 23:23:56 GMT
From: "Steve Springett" <sspringett@cwe2.com>
Subject: Re: ActivePerl for NT and HTTPS ?
Message-Id: <gs9R2.1026$DZ3.278986829@dca1-nnrp1.news.digex.net>
I'm running ActivePerl 5.07 (I think) on WinNT 4.0 sp4 and Netscape
Enterprise Server 3.6. There shouldn't be anything you need to do in order
to get perl to work under SSL.
Kras Gadjokov wrote in message <7f2o0k$ngj$1@nnrp1.dejanews.com>...
>Hey, guys
>
>Does anybody know what additional Perl modules for NT do I need to install
in
>order to use HTTPS POST/GET? Is it some SSL module?
>
>Thanks!
>
>Kras
>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 14 Apr 1999 19:59:03 -0400
From: "Doug Crabtree" <not@gonna.tell>
Subject: Re: Best books to use...
Message-Id: <7f39u5$27t$1@camel25.mindspring.com>
Firstly, let me apologize for mangling your name. I was in a hurry to get
to work and wanted to leave this message before I left.
Anyhow, I was just browsing through the (<insert bookstore here>.com) and
seeing the reviews there. Nothing was BAD per se, it just wasn't reviewed
as favorably.
Again, sorry about the name :)
Dug
Randal L. Schwartz <merlyn@stonehenge.com> wrote in message
news:m1g1632itv.fsf@halfdome.holdit.com...
> I was gonna ask you in private "what bad things", but you mangled your
> return address. Please don't do that. So now I'll have to ask in
> public. <sigh> I'm always open to criticism on my works... in hopes
> that my next work will be better.
------------------------------
Date: Wed, 14 Apr 1999 20:01:40 -0400
From: "Doug Crabtree" <not@gonna.tell>
Subject: Re: Best books to use...
Message-Id: <7f3a31$l61$1@camel25.mindspring.com>
> If you're just learning your first computer language, Randal's [note:
> only one 'l' in there] book may not be the optimal choice. It assumes
> some exposure to programming: concepts like array, subroutine, ...
Oops <sigh>. No, this is not my first language, so those should all be
pretty easy for me.
> It really depends on your starting point and your goals. What do you
> want to do with your future Perl expertise?
I don't quite know that yet. I have a certain task I am wanting to perform,
but with my projects (as usual) it will probably mushroom.
> David [no need for redundant lettering with a well-chosen name :-]
You CHOSE yours!!! Not fair...
Dug
------------------------------
Date: Wed, 14 Apr 1999 17:10:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Best books to use...
Message-Id: <37152E67.44D291A4@mail.cor.epa.gov>
Doug Crabtree wrote:
>
> > If you're just learning your first computer language, Randal's [note:
> > only one 'l' in there] book may not be the optimal choice. It assumes
> > some exposure to programming: concepts like array, subroutine, ...
>
> Oops <sigh>. No, this is not my first language, so those should all be
> pretty easy for me.
Well, some of the things you may have learned that make it easier to
learn Perl include C, unix, sed & awk, regular expressions, and shell
programming. An interest in linguistics seems to help too, but it
doesn't need to be a formal interest.
> > It really depends on your starting point and your goals. What do you
> > want to do with your future Perl expertise?
>
> I don't quite know that yet. I have a certain task I am wanting to perform,
> but with my projects (as usual) it will probably mushroom.
>
> > David [no need for redundant lettering with a well-chosen name :-]
>
> You CHOSE yours!!! Not fair...
But I did it before I was born. I used the alpha-alpha version of
Perl's PSI::ESP module. It worked that once, but still isn't too
reliable. :-)
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Wed, 14 Apr 1999 17:56:06 -0600
From: Trout <matthew.dewell@Sun.COM>
Subject: Can PERL be used to do block editing?
Message-Id: <37152B16.82E783A1@Central.Sun.Com>
I'm new to using PERL and wanted to know if there is a way that I can
replace a block of ASCII code in a HTML file with another block of ASCII
code. These two blocks of code are in ASCII files, so optimally I would
maybe like to pass in the file to be searched (*.html) and the "good"
and "bad" block files, i.e. switcheroo foo.html good bad. The trick is
the blocks start with a <TD> and end with a </TD> so I can't just search
for the <TD> and do the replacement, since there a lot of lone <TD>'s
through out the document. I have to match the whole block of code
before replacing. What is the best way to go about this?
I was thinking of PUSHing and POPing the HTML file line by line with a
compare of the next line to the first line in the code between the <TD>
and </TD> and starting the replacement. For the next line of text after
the <TD> does not match any other line in the file, and then has a few
lines after it to be replaced until the </TD>. I'm just not sure about
how to do this even.
Oh, you might be thinking, well why not just search for that line of
text that's unique and do replacement from there. The problem is the
data that needs to replace this bad section, starts right after the <TD>
(i.e.) no newline and does not have a newline until it needs the </TD>
It probably sounds simple to most of you, but I'm new to PERL. I tried
finding a way to implement this using awk, but couldn't. As well in the
future I want to use this to add some HTML code to files quickly and
recursively through a directory structure, using the unix find -exec
command. So, I'm wondering if PERL can even do this, and if I'm
thinking in the proper vain.
thanks in advance
please send information to my email:Matthew.Dewell@Central.Sun.Com
Trout
--
No matter where you go,
There you are
------------------------------
Date: Thu, 15 Apr 1999 00:51:23 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Current Date
Message-Id: <ebohlmanFA7H1n.1Gq@netcom.com>
Terra Landry <terral@cyberplex.com> wrote:
: I want to get the current date in javascript.. but in my books it says that
: it will only return a 2 digit value for the year... is there any way I can
: get a 4 digit value for the year? The only thing I can find is using the
: date object, but that doesn't seem to work!!
I would just like to point out to those posters who have in the past
complained that Perl's handling of years is "broken" that they ought to
look at the way JavaScript handles dates if they want to see a truly
broken implementation (I'm not familiar enough with JavaScript to be able
to say anything more than that the implementation is broken). At least
all versions of Perl on all platforms use the same convention for the year
field returned by localtime()...
------------------------------
Date: Wed, 14 Apr 1999 21:06:39 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Current Date
Message-Id: <1dq9qh9.1tt20jbqymxv2N@p78.block2.tc1.state.ma.tiac.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
> > When you want a new hard drive do you go and ask the
> > the McDonalds for one?
>
> Sure I do. It comes with a nice artificial-bread `bun' for padding,
> and is pre-lubricated with ketchup and mustard.
In other words, it's free. ;)
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Apr 1999 00:00:54 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: FAQ 1.1: What is Perl?
Message-Id: <ebohlmanFA7EpI.K6B@netcom.com>
Marc Haber <Marc.Haber-usenet@gmx.de> wrote:
: stanley@skyking.OCE.ORST.EDU (John Stanley) wrote:
: >Instead of splitting the FAQs up into little pieces and stuffing them
: >onto the net in dribs and drabs, can you please just post the updated
: >FAQs whole?
: The idea is to make Newbies searching DejaNews or their local spool
: find something in the subject.
The idea is just as much to get comments and suggested revisions on the
FAQs (peer review, the killer secret of open source development) and those
are going to be much easier to get when they're posted one question per
article.
------------------------------
Date: Thu, 15 Apr 1999 00:12:08 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: flocking question - worried
Message-Id: <ebohlmanFA7F88.L1L@netcom.com>
Graham Ashton <billynospam@mirror.bt.co.uk> wrote:
: if you want to unlock a file after you've finished writing to it, and
: you unlock it with flock() just before you close() it, do you have a
: potential race condition?
: i.e. could the buffers be flushed in between calling flock() and
: close(), allowing another process to obtain a lock on the file before
: the first process has finished writing?
With current versions of Perl, no. flock() will flush any buffers before
unlocking the file. With older versions, yes there is a race condition.
Check out the perldelta*.pod documents to find out when the change was
made. If there's *any* chance of the script migrating, by intention or
not, to a system with an older version of Perl, I'd avoid this construct.
------------------------------
Date: Wed, 14 Apr 1999 21:06:40 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: flocking question - worried
Message-Id: <1dq9qoj.y76wsn1wp99s0N@p78.block2.tc1.state.ma.tiac.com>
Graham Ashton <billynospam@mirror.bt.co.uk> wrote:
> if you want to unlock a file after you've finished writing to it, and
> you unlock it with flock() just before you close() it, do you have a
> potential race condition?
Yes.
> are there any fully portable solution to this problem? I'm currently not
> bothering unlock files, but am letting close() do it for me.
That is the correct solution.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 14 Apr 1999 23:08:36 GMT
From: NOSPAMcrstlblu@planet.eon.net
Subject: Flocking, Locking, DBM's & TXT's
Message-Id: <37122b01.4016562@news.planet.eon.net>
On Wed, 14 Apr 1999 13:08:29 GMT, snowhare@long-lake.nihongo.org (Benjamin >>
or must one use the FULL NAME ?
>>eg: flock "dbmname.DIR",2; or,
>> flock "dbmname.PAG",8; ????
>No. This won't work, either. 'flock' works on
>_file handles_ - not _file names_.
thanks,
if a text file one would say:
$Handle="dbmfile.txt";
flock $Handle, 2;
if a DBM , isn't the "%ass_arr" a sort of a HANDLE too?
dbmopen(%Handle,"thedbmfile",0666)
isn't the "%Handle" associative array therefor "TIED" already to the DBM file?
I've tried this:
flock %Handle,2; # where %Handle is the ass arr that was (PSEUDO-TIED)
# to the DBM file
flock %Handle,8;
and the script "FUNCTIONS" normally, as far as EVERYTHING ELSE IN IT GOES!
as to whether or not the dbmfile is ACTUALLY being locked whilst the operations
are conducted on it's HASH are going on normally, - I HAVE ABSOLUTELY NO IDEA!
>The answer is: Don't use 'dbmopen/dbmclose' if you want to use
>file locking. Use GDBM_File or DB_File via 'tie' and use either
>GDBM's built in locking support (for GDBM_File) or the method
>documented in the DB_File (for DB_File) perldocs to do it.
>And don't forget to 'sync' before unlocking.
>Benjamin Franz
thanks Benjamin:
you mean, native GDBM, DB, have built-in locking?
NDBM , does this one have it too?
Should I do a search for perldocs & *_File on the
1) web
2) CPAN
3) Newsgroup
4) my cgi-host-server's help info files somewhere?
5) the directories in my win95 local install of perl5
thanks,
wj
------------------------------
Date: Thu, 15 Apr 1999 01:23:15 GMT
From: amerar@unsu.com (Arthur Merar)
Subject: Formats & Writes
Message-Id: <37153e28.253855946@news.chaven.com>
Hello,
I am trying to use a format and a write statement, but nothing is
being written out....here is a clip of my code:
#!/opt/bin/perl
# Format for report heading
format RPTHEADING =
@|||||||||||||||||||||||||||||
$heading
open (TMPFILE,"/tmp/tmplog");
open (LOGFILE,">/tmp/load_$dte");
while (<TMPFILE>) {
chop;
if (index($_,"LOADING") >= 0) {
&print_heading;
} elsif (index($_,"RECEIVED") >= 0) {
&files_received;
} elsif (index($_,"FIXLOG") >= 0) {
&fixlog_detail;
} elsif (index($_,"BAD") >= 0) {
&bad_files;
} elsif (index($_,"MOVING") >= 0) {
&temp_to_cash;
}
}
# Print the heading on the report
sub print_heading {
$heading = "LOADING STATUS FOR $m/$d/$y";
$~ = "RPTHEADING";
select(LOGFILE);
write RPTHEADING;
}
I get nothing in LOGFILE. However, if I just print to STDOUT, then I
get output just fine. I have about 15 formats I need to use. Any
idea why the write is not working? Is there something I could have
forgotten?
Please send replies to my e-mail.......Thanks.
Arthur
amerar@unsu.com
------------------------------
Date: 14 Apr 1999 19:50:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Formats & Writes
Message-Id: <371545e2@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
amerar@unsu.com (Arthur Merar) writes:
:# Print the heading on the report
:sub print_heading {
: $heading = "LOADING STATUS FOR $m/$d/$y";
: $~ = "RPTHEADING";
: select(LOGFILE);
: write RPTHEADING;
:}
:
:
:I get nothing in LOGFILE.
Of course not. Does it say write LOGFILE? No. You didn't write
to LOGFILE. You wrote to RTPHEADING, which presumably you didn't open.
Did you read what the perlfunc manpage says about write()? Do you
have a clarity patch?:
--tom
--
As far as the laws of mathematics refer to reality, they are not
certain; and as far as they are certain, they do not refer to reality.
--Albert Einstein
------------------------------
Date: Thu, 15 Apr 1999 00:55:07 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Grabbing Link Text with HTML:LinkExtor
Message-Id: <ebohlmanFA7H7w.1sn@netcom.com>
rpearse@my-dejanews.com wrote:
: i'm using HTML::LinkExtor to grab URL's just fine. hey, i can even get images!
: however, i'm interested in matching up the URL with the link text (y'know the
: part that's underlined ;-)
: $parser = HTML::LinkExtor->new(undef, $base_url);
: $parser->parse_file($link_file);
: @links = $parser->links;
: @text = $parser->text;
: @links gets created just fine. @text is the problem. any suggestions?
HTML::LinkExtor doesn't save link texts. You'll need to write your own
subclass of HTML::Parser to do that.
------------------------------
Date: 15 Apr 1999 01:47:17 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Help on Sendmail!
Message-Id: <7f3gf5$6ve$1@news.NERO.NET>
CUKSA <cuksa@cuksa.monisys.ca> wrote:
: Please, help!
: I would like to know how to specify the name of the sender and reply
: address.
: This is my code.
Run, do not walk, to your nearest RFC repository and read RFC822. It's a
must-read if you're going to be sending mail, *especually* if you're going
to be playing with headers and suchlike things. (Yes, not as useful as
saying 'do x, y and z', but simple responses like that will likely lead
you to do things that will later on cause someone else serious headaches
when you send out mail with bogus or mail-loop-inducing headers)
Dan
------------------------------
Date: Wed, 14 Apr 1999 23:25:32 GMT
From: gleparc@bidmc.harvard.edu
Subject: How to stop LWP::Simple getstore command?
Message-Id: <7f3852$6d5$1@nnrp1.dejanews.com>
Hi everyone,
I wrote a PERL script that uses the www-perl (LWP::Simple) enhancements,
for the purpose of submitting protein sequences to a remote server and
saving the resulting HTML output to a file locally.
This script uses the getstore command to make an HTTP request to a remote
server with some parameters already included (basically a remote POST to a
remote HTML FORM). The problem is, that sometimes the remote server is slow,
gets stuck, or does not respond for a long time.. and so therefore, I
attempted to include some sort of a "timeout" in case the HTTP request takes
too long. I have included a command line flag (-t) for the amount of time in
secs to wait before terminating. However, what I find is that the "timeout"
wait only occurs afterwards.. it does not stop the process even after -t 1
secs! How to I fix this problem? I want to stop this getstore command if it
takes too long (generally, greater than 90 secs).
Thanks for reading,
German
Here is my program:
#!/usr/local/bin/perl -w
# ask.pl, interactive prompt
#
$REPLY = "Done!\n";
use Getopt::Long ;
use LWP::Simple ;
sub alarm_h {
alarm(0);
terminate();
}
sub terminate {
print $REPLY;
exit 0;
}
MAIN: { print "Getting File..."; Getopt::Long::GetOptions("time=i") || die
"Usage:$0 -time <seconds>\n"; $SIG{'ALRM'} = \&alarm_h; alarm($opt_time ?
$opt_time : 1);
getstore("http://pfam.wustl.edu/cgi-bin/nph-hmmsearch?&evalue=1.0&protseq=MAK
ERDVEPWMQTPCTIKITHKNQMPMLMGPPPRSTNFFGFLS","result.html"); terminate(); }
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 14 Apr 1999 23:50:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: ide advice wanted
Message-Id: <ebohlmanFA7E87.JIz@netcom.com>
Jeremy Gurney <c4jgurney@my-dejanews.com> wrote:
: In article <371446CA.DC2D346@ix.netcom.com>,
: ranen@ix.netcom.com wrote:
: > I just got a new computer with NT 4.0, got Perl installed and
: > ready-to-rock. It's been so long since I used windoze i forgot about
: > the backwards backslashes!
: >
: > How can I use my UNIX scripts and keep the fullpath directory names
: > intact?
: Forward slashes work just fine, in fact they're an awful lot safer to use in
: code than having to remember to double backslahes.
The one exception to this is arguments passed to the shell or external
programs. They typically require backslashes in file paths (because the
shell and some programs treat forward slashes as option separators). But
IMHO it's better to work with forward slashes, and do a simple tr on any
string that contains a filepath when it needs to be passed to system(),
exec(), used in backticks or open()'d as part of a pipe.
------------------------------
Date: Thu, 15 Apr 1999 01:05:55 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Interacting with a perl program in execution
Message-Id: <ebohlmanFA7Hpw.2qB@netcom.com>
Peter Doyle <syzygy@indigo.ie> wrote:
: I have program which requires a large file to be loaded and turned into
: a hash every time an operation is to performed. I want to have this hash
: in memory at all times and have the operations performed through cgi.
: The problem is a new instance of the hash has to be made every time the
: request comes in. Can I not have a process running which contains the
: hash and answer the requests???
You might want to consider populating a DBM file with your data (needs to
be done each time the large file gets changed) and tie()'ing it to a hash
in your CGI script. This will speed things up drastically if the large
file gets changed infrequently compared to the number of times the script
is run. If the large file has to change frequently, then I'd look into
some sort of persistent-process scheme like mod_perl or FastCGI instead.
------------------------------
Date: Wed, 14 Apr 1999 21:46:02 -0400
From: parv <listed-perl@parv-et-ceteraFreeHolyCow.com>
Subject: Re: need to modify 'discus' scripts/config files
Message-Id: <371544DA.ACA1D4F9@parv-et-ceteraFreeHolyCow.com>
David Cassell wrote:
>
> parv wrote:
...
> > of course, i could sit for few hours, and do it myself...but, then,
> > being lazy is one of three virtues of a perl programmer
...
> ...when Larry said that laziness is the first great virtue of a
> programmer, he meant "the quality that makes you go to great effort
> to reduce overall energy expenditure." Not the quality that makes
> you go to *no* effort to reduce your personal energy expenditure
> while increasing overall energy expenditure for everyone else. :-)
may be i was not clear...i was thinking on the why-reinvent-the-wheel
line.
- parv
------------------------------
Date: Wed, 14 Apr 1999 21:06:42 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Need to print \n - Not do a carrage return
Message-Id: <1dq9r0m.hbxqxz3pxj5aN@p78.block2.tc1.state.ma.tiac.com>
Steve Springett <sspringett@cwe2.com> wrote:
> I am trying to actually print a \n to the browser but do not know how.
Escape the backslash, silly.
print "\\n";
Or use single quotes.
print '\n';
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'
------------------------------
Date: Thu, 15 Apr 1999 00:22:45 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Newbie Question: String Manipulation
Message-Id: <ebohlmanFA7Fpx.Lw1@netcom.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
: Ummm, I think you made a braino there, Tim. Your regex is going to
: match 'xxxxx' instead. Try it. Perhaps
: $cgi1 =~ s#.*/(.*?)\?.*#$1#;
: is more what he had in mind. {Match everything to last `/', non-greedy
: grab up to next `?' in case there are more `?' following, and eat the
: rest.}
: However, IMHO, for general parsing of html, you're better off going to
: HTML::Parser and letting the module do the dirty work.
True, but what the original poster has was an HTTP request line, not a
piece of HTML. It is true, though, that URI::URL has methods for
splitting up and putting together URLs, and those should be used, if
applicable, instead of trying to wing it with regexen.
------------------------------
Date: Thu, 15 Apr 1999 00:49:38 GMT
From: kevin_collins@my-dejanews.com
Subject: Re: No echo on a socket connection
Message-Id: <7f3d31$a9d$1@nnrp1.dejanews.com>
In article <1dq94ml.irewlx1t3bh9tN@[192.168.1.2]>,
cwis@dial.oleane.com (Christopher Allene) wrote:
> <kevin_collins@my-dejanews.com> wrote:
>
> > The 1st bit works like a charm, but the second print causes a "+ over a -"
> > character to display. Any help on that?
>
> Maybe you forgot to swap the \n and \r -- the correct line is:
>
> > print $handle "\377\374\001\r\n";
>
> On Unixes.
> If you did swap them, I see no reason why the escape sequence is not
> recognized.
I did swap them - I even tried both sequences. It is recognizing the
sequences, its stops and restarts echoing, but it adds that additional
character to the output...Weird...
Thanks,
Kevin
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 14 Apr 1999 19:26:37 -0400
From: qinqiang sun <qsun@kitco.ca>
Subject: Odbc won't work for database on network
Message-Id: <3715242C.D490BF26@kitco.ca>
Hi,
I use perl Win32:odbc WinNT4.0. The Database is access97 and ODBC
driver version is 3.50. If use database on local driver there is no
problem. When I tried to use database on network driver, I got error:
**********
Error:[-1032] [] "[Microsoft][ODBC Microsoft Access 97 Driver] The
Microsoft Jet database engine cannot open the file '(unknown)'. It is
already opened exclusively by
another user, or you need permission to view its data."
************
could you please give some clue so I can fix the problem>
Thank you.
Qinqiang
------------------------------
Date: Thu, 15 Apr 1999 01:44:17 GMT
From: timespinner@my-dejanews.com
Subject: Perl 5 DBI MySQL Win32 Package?
Message-Id: <7f3g9f$d1i$1@nnrp1.dejanews.com>
Does anyone know if there is a Win32 package for Perl 5 out to work with a
Win32 MySQL database? If so, where can this be obtained?
Thanks,
TS
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 14 Apr 1999 23:37:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: perl question... ordering from dbm
Message-Id: <7f38l5$sli$1@oak.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"Terra Landry" <terral@cyberplex.com> wrote:
[ snippizola ]
>how do I order by $FullApplyDate???
I believe it is Perlfaq4
How do I sort an array (by anything)
------------------------------
Date: Thu, 15 Apr 1999 00:42:57 GMT
From: andrewg6969@my-dejanews.com
Subject: Perl Regex Q?
Message-Id: <7f3cmg$9tc$1@nnrp1.dejanews.com>
Given the following data:
Filesystem kbytes used avail capacity Mounted on
fd 0 0 0 0% /dev/fd
/dev/dsk/c0t3d0s4 144799 53546 76774 42% /var
swap 394672 1512 393160 1% /tmp
/dev/dsk/c0t2d0s7 1015695 771887 182867 81% /export/home
catbert:/export/home 192800 13224 177648 7% /mnt
What is wrong with this line that it doesn't pass over the line containing
"catbert:" ?
last if ($Line !~ /\w:\//); # ditch Local entries
also tried
last if ($Line !~ /\b:\//);
ANy help appreciated
Drew
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 15 Apr 1999 00:11:00 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: position in s///g?
Message-Id: <7f3aqk$eos$1@fcnews.fc.hp.com>
Is there a way to get the position in a substitution. pos() only
works in m//g. I'm trying to do something like:
$a="0520001250025";
$b="weasgnkweplhk";
$a=~/0/substr($b,pos($a)-1,1)/ge;
which obviously doesn't work. I know there's several other ways to do
this, but I was wondering if I was missing somethat that would enable
this approach.
Andrew
------------------------------
Date: 15 Apr 1999 00:32:07 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: position in s///g?
Message-Id: <7f3c27$f9o$1@fcnews.fc.hp.com>
Andrew Allen (ada@fc.hp.com) wrote:
: Is there a way to get the position in a substitution. pos() only
: works in m//g. I'm trying to do something like:
: $a="0520001250025";
: $b="weasgnkweplhk";
: $a=~/0/substr($b,pos($a)-1,1)/ge;
: which obviously doesn't work. I know there's several other ways to do
: this, but I was wondering if I was missing somethat that would enable
: this approach.
Sorry about the followup to my own post, but I just had an "a-ha!":
$a=~/0/substr($b,length($`),1)/ge;
Yow!
Andrew
------------------------------
Date: Thu, 15 Apr 1999 00:58:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Quick DBM Question
Message-Id: <ebohlmanFA7HDq.24y@netcom.com>
Mike Watkins <mwatkins@promotion4free.com> wrote:
: I was just wondering, how reliable are DBM files if using large amounts of
: text for one entry. Would everything work ok if I put entire docuements as
: entries in a DBM file, or are DBM files for small things like, passwords,
: ect...?
Some of the DBM implemenations have size limits on entries; others
don't. perldoc AnyDBM_File for a list.
------------------------------
Date: Wed, 14 Apr 1999 18:07:03 -0700
From: "Wade Eilrich" <wade@onsetinc.com>
Subject: Send HTML via email
Message-Id: <924138416.213.10@news.remarQ.com>
I found out how to send HTML via email. Here are two methods. Method one
uses CDONTS and ASP. Method Two uses wsendmail.exe and Perl.
Method one:
Using CDONTS using VBScript on the server side in an Active Server Page.
Sending HTML via email using CDONTS is simple, e.g.
<%
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From="someone@somewhere.com"
objMail.To="recipient@somewhere.com"
objMail.Subject="CDONTS Test Mail"
' send HTML
objMail.BodyFormat = 0
' use MIME
objMail.MailFormat = 0
objMail.Body="<HTML><HEAD></HEAD><BODY><H1 align=center><FONT
color=red>Test</FONT></H1><PThis is a test mail using CDO<P></BODY></HTML>"
objMail.importance=1
objMail.Send
Set objMail = nothing
%>
Method two:
Since my web host is NT based the provide wsendmail.exe as an alternative to
the UNIX sendmail. I tried using CGI Perl scripts to send HTML formatted
email to no avail. I found out that this was because the Content-Type:
text/plain is set in the source code of wsendmail.exe. I modified the source
and have posted a link to a version that will output HTML on my corporate
web page: http://www.staffordware.com/wsendmail.htm
The ZIP archive contains the full source and documentation. Please note that
wsendmail is free-ware and copyrighted by Jarle Aase.
Wade
------------------------------
Date: Thu, 15 Apr 1999 02:05:13 +0200
From: "Bas van Reek" <basvreek@xs5all.nl>
Subject: Re: Sending data to HTML from perl script
Message-Id: <7f3aeq$4bm$1@weber.a2000.nl>
> print "Content-type: text/html\n\n";
> print"hello world";
> 1. I want to define the background that the browser uses when it
displays
> the output from the script. Is there a command for this?
Just html.
print "<body bgcolor=00000>";
>
> 2. Can I print to the current page?
No
------------------------------
Date: Thu, 15 Apr 1999 00:18:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Unitialized var errors & -w flag
Message-Id: <ebohlmanFA7FJ2.LI0@netcom.com>
Gordon Shannon <gordon.shannon@Central.Sun.COM> wrote:
: A point of philosophy. I disagree with the way Perl acts when
: -w is on, with regard to unitialized variables. Can anyone
: change my mind?
[snip]
: Issue 2: I don't think either should produce a warning! I don't see
: the harm in using unitialized variables. Indeed, I think using
: them is reasonably in keeping with the spirit of Perl, with its
: loose types. I've yet to see this warning actually point out bad code.
: After all, this isn't C/C++ where an uninitialized variable might
: have garbage (at least the automatic ones). I know, I can just not
: use -w, but I still want it, so it can find *real* problems.
: As it is, if I have a list of vars to declare, I end up doing stuff like
: my ($a, $b, $c, $d, $e) = ('', '', '', '', '');
: which seems like too much work for Perl code.
If I write some code in which I use a variable called $count but
absent-mindedly type it as $counter a couple times, spending several
hours, or even several minutes, trying to figure out why the code doesn't
work seems like too much work for a Perl coder.
------------------------------
Date: Wed, 14 Apr 1999 21:06:44 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Unitialized var errors & -w flag
Message-Id: <1dq9rrt.1gx4u8g1pmrcamN@p78.block2.tc1.state.ma.tiac.com>
Tim Herzog <therzog@knotech.com> wrote:
> I still have a problem with unitialized variable warnings for global
> variables declared in one file and referenced in another, e.g.:
>
> ------ test1.pl ------
> #!/usr/bin/perl
>
> require "test2.pl";
>
> $global_var = "boohoo";
>
> PrintBooHoo();
>
> ------ test2.pl ------
>
> sub PrintBooHoo
> {
>
> print "$global_var\n";
> }
>
> ----------------------
>
> Anyone know if there is some trick or workaround to either disable the
> "unitialized variable" warning (but not the other warnings), or do the
> equivalent of an "extern" declaration (as much as I'd hate having to do
> that)?
There is no need to disable the "unitialized variable" warning, since
the code you gave does not produce that warning.
Perhaps you meant the "used only once" warning?
use vars qw($global_var);
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 14 Apr 1999 19:23:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Unitialized var errors & -w flag
Message-Id: <37153f7c@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
:Perhaps you meant the "used only once" warning?
:use vars qw($global_var);
That's because he's using a run-time inclusion, not
a compile-time one. It's his own fault.
--tom
--
If you want to program in C, program in C. It's a nice language. I
use it occasionally... :-)
--Larry Wall in <7577@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Wed, 14 Apr 1999 18:54:24 -0500
From: "Nick lammers" <nlammers@gionline.net>
Subject: Using CGI with NT
Message-Id: <7f39pv$mp8$1@news.inconnect.com>
I'm familar with Front Page and would like to use some CGI scripts on my web
site. Most of the instructions I've found refer to UNIX servers. Does anyone
know of a reference for placing CGI scripts on NT servers with Front Page
extensions.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5386
**************************************