[17139] in Perl-Users-Digest
Perl-Users Digest, Issue: 4551 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 8 03:05:36 2000
Date: Sun, 8 Oct 2000 00:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970988710-v9-i4551@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 8 Oct 2000 Volume: 9 Number: 4551
Today's topics:
Active Perl: Question regarding PerlApp (Bob Nolte)
Re: attaching a gif : Content-Transfer-Encoding <jtjohnston@courrier.usherb.ca>
Re: Best definition of Perl so far in 19100 (brian d foy)
Re: Best definition of Perl so far in 19100 <elaine@chaos.wustl.edu>
Re: Best definition of Perl so far in 19100 (brian d foy)
Comparing Perl and Java <shadsluiter@my-deja.com>
Critique/Comments: daemon() <jdb@wcoil.com>
Re: Critique/Comments: daemon() <uri@sysarch.com>
Re: currency format <theborg@usa.com>
Re: how to remove this using subsitute (Martien Verbruggen)
Re: how to remove this using subsitute <flavell@mail.cern.ch>
How to set appache server for Perl in Win32 <mshen@idirect.com>
Re: How to set appache server for Perl in Win32 (Martien Verbruggen)
Re: how to unlink this file? (Helgi Briem)
Re: lexical for loops <nospam@david-steuber.com>
Re: looking for links to Perl+mysql how-to's - tutorial <nospam@nospam.com>
Re: looking for links to Perl+mysql how-to's - tutorial (Martien Verbruggen)
Re: MySQL BLOB types and DBD::mysql <nospam@nospam.com>
Re: Netscape supports Perl ? (Martien Verbruggen)
Re: Newbie ?, Removing Whitespace at End <admin@salvador.venice.ca.us>
Re: OT - silly (was: Re: A matter of style (was Re: Sea <nospam@david-steuber.com>
Re: PP, 3rd ed.??? <elaine@chaos.wustl.edu>
Re: Problems with Perl2exe ... <nospam@nospam.com>
Re: Problems with Perl2exe ... (Martien Verbruggen)
Re: Serial-Timeout on Solaris <elaine@chaos.wustl.edu>
Server Side Includes <jtjohnston@courrier.usherb.ca>
Re: STDIN question <philipg@atl.mediaone.net>
Re: STDIN question <kulabocca69@hotmail.com>
Re: Text file manipulation <dale@emmons.dontspamme.com>
Re: Text file manipulation <nospam@nospam.com>
Re: Text file manipulation (Martien Verbruggen)
Re: Text file manipulation (Martien Verbruggen)
Re: Text file manipulation (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 08 Oct 2000 06:03:31 GMT
From: bob.nolte@pc4u.com (Bob Nolte)
Subject: Active Perl: Question regarding PerlApp
Message-Id: <T6UD5.11422$he1.625648@typhoon.mn.mediaone.net>
I'm a perl wannabe. I have just downloaded and install the most recent version
of active perl from activestate. I'm running on Win98, NT and Win2000 boxen.
Question:
When a perl script is processed with perlapp, what files are needed in addition
to the executable produced by perlapp?
The reason I'm asking is that I get an error "Unable to load perlapp.dll" on a
computer that has no perl on it. I am working on a test diskette. I
put perlapp.dll on the diskette and the same error occurs. If I put all of the
dlls from the perl\bin directory onto the diskette everything runs.
I would think that perlapp would produce a standalone exe. Am I wrong?
TIA
Bob Nolte
------------------------------
Date: Sat, 07 Oct 2000 17:24:17 -0400
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: Re: attaching a gif : Content-Transfer-Encoding
Message-Id: <39DF9481.6F02@courrier.usherb.ca>
That would be great if I could install it. I was lucky enough to
convince my sysop to install what he did. Real paranoid crowd.
> and look for "MIME". Specifically, MIME::Lite sounds
> perfectly suited to your task.
------------------------------
Date: Sat, 07 Oct 2000 22:23:00 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <brian-ya02408000R0710002223000001@news.panix.com>
In article <39DF96B7.437DEF94@netstorm.net>, Jim Mauldin <mauldin@netstorm.net> posted:
> brian d foy wrote:
> > In article <MPG.144942fa6e1d490b9896e1@usenet.plus.net>, rosie@dozyrosy.plus.com posted:
> > > 1) What is CGI?
> > > CGI (or Perl) is a specail Internet language that allows you
> > > to run 'programs'.....
> > The Common Gateway Interface is not a langauge. it does not
> > allow you to run programs. it only specifies the interface
> > between two programs.
> > > 2) What is it useful for?
> > > Perl is EXTREMELY useful. It's main purpose is to add
> > > interactivity to a website.....
> > whatever. very little of Perl's use is for the web even
> > though Perl might be a lot of the web programming out there.
> Again, the subject line (19100) and general tenor of the message should
> give you a hint as to the OP's intent.
you give the general public too much credit for determining
such things without being explicitly told that false and
dangerous statements are made in jest. i hear these statements
so often from people that really beleive them that i'm not inclined
to give someone the benefit of the doubt -- especially when it is
posted to a global messaging system.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sun, 08 Oct 2000 03:06:40 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <B6055CFF.78FC%elaine@chaos.wustl.edu>
in article brian-ya02408000R0710002223000001@news.panix.com, brian d foy at
brian@smithrenaud.com quoth:
> you give the general public too much credit for determining
> such things without being explicitly told that false and
> dangerous statements are made in jest. i hear these statements
> so often from people that really beleive them that i'm not inclined
> to give someone the benefit of the doubt -- especially when it is
> posted to a global messaging system.
C'mon brian, remove that pesky broomstick from it's rather unpleasant
lodging. No amount of 'perl for idiots' books will rectify the fact that
some get it and some don't or won't ever.
When people start taking things so seriously that a joke can't be posted
without pedantry I start to wonder where the fun has gone to and why. Is
someone going to die not knowing that this was a joke or being misinformed
by clpm [ *gasp* ] and looking like an ass around the coffee machine on
Monday morning? No. But, people taking all of this far too seriously may
reduce life-expectancy by a few years due to the stress.
e.
------------------------------
Date: Sun, 08 Oct 2000 02:07:13 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <brian-ya02408000R0810000207130001@news.panix.com>
In article <B6055CFF.78FC%elaine@chaos.wustl.edu>, Elaine Ashton <elaine@chaos.wustl.edu> posted:
> in article brian-ya02408000R0710002223000001@news.panix.com, brian d foy at
> brian@smithrenaud.com quoth:
>
> > you give the general public too much credit for determining
> > such things without being explicitly told that false and
> > dangerous statements are made in jest. i hear these statements
> > so often from people that really beleive them that i'm not inclined
> > to give someone the benefit of the doubt -- especially when it is
> > posted to a global messaging system.
>
> C'mon brian, remove that pesky broomstick from it's rather unpleasant
> lodging. No amount of 'perl for idiots' books will rectify the fact that
> some get it and some don't or won't ever.
try being the one that has to teach them ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sun, 08 Oct 2000 03:25:45 GMT
From: shad sluiter <shadsluiter@my-deja.com>
Subject: Comparing Perl and Java
Message-Id: <8ropfl$8pt$1@nnrp1.deja.com>
I'm sure there are plenty of opinions about this one...
I started learning Perl about a year ago to write typical scripts for a
web site (guest books, chat rooms, search engines, discussion boards).
I used Perl because my web host uses UNIX and perl was available, but
have been curious about Java. One would have to live in a cave to not
hear the Java hype in the media.
Perl has it's nice points such as its text processing abilities that
can split input strings into nicely managed lists. I can see how it
works with the cgi interface of my UNIX web server. I do wish that the
Perl syntax was a little more readable.
My experience in Java is very limited, but I'm getting into a project
to explore the possibilities of XML programming. Sun seems to think
that Java and XML are the "Ying and Yang" of cross-platform
programming.
Does anyone here use Perl AND Java and can list some strengths of
each? I assume Perl can perform XML decoding as good as any text
processing language. Any opinions on this issue?
p.s.
I notice a while ago that Deja.com was looking for Perl programmers.
Perl must still be a valuable language in the marketplace.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Oct 2000 03:29:29 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: Critique/Comments: daemon()
Message-Id: <8ropmp$eno$0@206.230.71.46>
greets perlfolk,
Looking for critique/comments/security bug/holes in TCP daemon I wrote.
I have had many years experience in Perl, writing many types and sizes of
scripts. One of the things that I have not yet had the pleasure to write yet
is a TCP server, though. My first humble try at a TCP server works
delightully well (to me at least)... it is basically an exact copy of what
is in perldoc perlipc with a few simple modifications to fit my application.
Below is the relevant code. This is the exact same function under the same
name as in Lingua::EN::Dict which I released last week onto CPAN.
I would kindly ask that anyone who may have a chance to that knows about
security in TCP servers of that sort in Perl...could you take a look at the
code below and let me know if you find any security holes/hazzards/etc? If
you need more context information, grab Lingua::EN::Dict off CPAN (quik
note, flush() is just a small wrapper i wrote for autoflush() from
IO::Handle - it seems that I always have to call flush after a print - the
autoflush doesnt seem to 'stick' to the handle... odd, if you ask me...).
Also, if anyone feels like it, i'd welcome even rigirous general
syntax/style/code critique. But the main thing is the security of the TCP
server...
thankyou all!
cheers!
--
$josiah;
#=== begin code
sub daemon {
my $port = shift || 7778;
my $file = shift || 'words.xml';
my $inad = shift || INADDR_ANY;
my $dict = Lingua::EN::Dict->new(file=>$file,warn=>1);
socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die
"socket: $!";
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die
"setsockopt: $!";
bind(SERVER, sockaddr_in($port, $inad)) || die "bind: $!";
listen(SERVER,SOMAXCONN) || die "listen:
$!";
logmsg "server started on port $port";
my $paddr;
for (; $paddr = accept(CLIENT,SERVER); close Client) {
my($port,$iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr($iaddr,AF_INET);
logmsg "connection from $name [",inet_ntoa($iaddr),"]
at port $port";
RXLOOP:
$_=<CLIENT>; chomp; chomp;
logmsg "received command $_
at port $port";
/^DICT-PING/ && do
print CLIENT "DICT-PING: Ping? Pong! : You are: $name
[",inet_ntoa($iaddr),"] at port $port", EOL;
flush *CLIENT;
goto RXLOOP;
};
/^DICT-QUERY/ && do
/^(DICT-QUERY:)([\w]+)/;
my $dump=Dumper($dict->{$2}); $dump=~s/\$VAR1 = / /g;
print CLIENT $dump,EOL;
flush *CLIENT;
goto RXLOOP;
};
/^DICT-KEYS/ && do
my @keys = keys %{$dict};
print CLIENT '[\''.join('\',\'',@keys).'\']', EOL;
flush *CLIENT;
goto RXLOOP;
};
/^DICT-TENSE/ && do {
/^(DICT-TENSE:)([\w]+)/;
print CLIENT $dict->tense($2), EOL;
flush *CLIENT;
goto RXLOOP;
};
/^DICT-TYPES/ && do {
/^(DICT-TYPES:)([\w]+)/;
my $type = $2;$type =~ s/\r//g;$type =~ s/\n//g;
print CLIENT '[\''.join('\',\'',@{$dict->types($type)}).'\']',EOL;
flush *CLIENT;
goto RXLOOP;
};
/^DICT-SET/ && do {
/^(DICT-SET:)([\w]+)/;
my $word = $2;$word =~ s/\r//g;$word =~ s/\n//g;
s/^(DICT-SET:$word)//g;
$dict->{$word} = eval;
$dict->{$word}->{modified_by} = { name => $name, ip =>
inet_ntoa($iaddr) }
if(inet_ntoa($iaddr) ne '127.0.0.1');
};
/^DICT-WRITEOUT/ && do {
$dict->save;
};
/^DICT-CLOSE/ && do
next
};
!/^DICT/ && do
print CLIENT "Erroneous command: $_",EOL;
flush *CLIENT;
next
};
}
}
--
Josiah Bryan
jdb@wcoil.com
-----------------------------------------------------------------------
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, ¢227,
Any and all nonsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500.00 US.
E-Mailing denotes the acceptance of these terms
-----------------------------------------------------------------------
------------------------------
Date: Sun, 08 Oct 2000 04:05:08 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Critique/Comments: daemon()
Message-Id: <x7lmw02d1u.fsf@home.sysarch.com>
>>>>> "J" == Josiah <jdb@wcoil.com> writes:
J> sub daemon {
J> my $port = shift || 7778;
J> my $file = shift || 'words.xml';
J> my $inad = shift || INADDR_ANY;
J> my $dict = Lingua::EN::Dict->new(file=>$file,warn=>1);
J> socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die
J> "socket: $!";
J> setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die
J> "setsockopt: $!";
J> bind(SERVER, sockaddr_in($port, $inad)) || die "bind: $!";
J> listen(SERVER,SOMAXCONN) || die "listen:
J> $!";
use IO::Socket::INET. you are doing too much work yourself there.
J> for (; $paddr = accept(CLIENT,SERVER); close Client) {
it might help to have the case of client match there. and that is an odd
use of a c style for loop. again, using IO::Socket will make this
cleaner as you can use handle objects. using fixed name handles is not
good if you ever want to accept multiple simultaneous connections.
J> RXLOOP:
why not put this code in a block and use next or redo. goto's are so ugly.
J> $_=<CLIENT>; chomp; chomp;
why the double chomp? and regarding the block i mentioned above, you
could just make a while loop like:
while( <CLIENT> ) {
and convert all your goto's to nexts. much nicer.
J> logmsg "received command $_
J> at port $port";
J> /^DICT-PING/ && do
yech. just use if statements. you seem to be choosing ugly idioms all
over the place. do blocks are best used when you need a return value
from the block or a few other places. just say:
if ( /^DICT-PING/ ) {
J> print CLIENT "DICT-PING: Ping? Pong! : You are: $name
J> [",inet_ntoa($iaddr),"] at port $port", EOL;
J> flush *CLIENT;
no need for flush if you set $| on the handle. you can call the
autoflush method if they are handle objects.
J> /^DICT-KEYS/ && do
J> my @keys = keys %{$dict};
J> print CLIENT '[\''.join('\',\'',@keys).'\']', EOL;
what is this EOL? and that string you have there is impossible to
parse. use q{} instead of escaping ' in a single quote string. how about
this:
print '[', join( ',', map( "'$_'", @keys ) ), ']', EOL ;
isn't that clearer?
J> flush *CLIENT;
J> goto RXLOOP;
J> };
J> /^DICT-TENSE/ && do {
J> /^(DICT-TENSE:)([\w]+)/;
why grab the first part when you don't use it? also why match twice? and
if you have only a single char in a class, you don't need the []
if ( /^DICT-TENSE:(\w+)/ ) {
print CLIENT $dict->tense($1), EOL;
J> /^DICT-TYPES/ && do {
J> /^(DICT-TYPES:)([\w]+)/;
same as above
J> my $type = $2;$type =~ s/\r//g;$type =~ s/\n//g;
use tr/\n\r//d ; it is faster and simpler
J> print CLIENT '[\''.join('\',\'',@{$dict->types($type)}).'\']',EOL;
use the same code as i show above.
J> /^DICT-SET/ && do {
J> /^(DICT-SET:)([\w]+)/;
J> my $word = $2;$word =~ s/\r//g;$word =~ s/\n//g;
$word can't have \r\n since it only matches \w chars. stop blindly
cutting and pasting your own code.
J> s/^(DICT-SET:$word)//g;
/g makes no sense if the regex is anchored. (unless you set /m and allow
internal anchors).
also why not do all that in one line:
if ( s/^DICT-SET:(\w+)// ) {
$word = $1 ;
J> $dict->{$word} = eval;
SECURITY ALERT!!
you are evaling what is left in $_ which is sent by the client. they can
send anything and you would just execute it. this is just as bad as
having an open account they could login to.
J> /^DICT-CLOSE/ && do
J> next
here you could do a last which would break out of the while( <CLIENT> )
loop.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sat, 07 Oct 2000 22:34:17 GMT
From: borg <theborg@usa.com>
Subject: Re: currency format
Message-Id: <39DFA4EA.8DE60CDA@usa.com>
Bingo ... that did the trick thank you :-)
Jeff Zucker wrote:
>
> borg wrote:
> >
> > Is there a quick a way to get output into a currency format? ie.
> > $12,000.00
> >
> > Right now I am using: $var=("%4.2f", $var);
> >
> > But that does not place the commas in there.
>
> perldoc -q commas
>
> --
> Jeff
------------------------------
Date: Sun, 8 Oct 2000 10:19:41 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to remove this using subsitute
Message-Id: <slrn8tvbsd.jr6.mgjv@martien.heliotrope.home>
On Sat, 7 Oct 2000 14:42:10 +0200,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Sat, 7 Oct 2000, Martien Verbruggen wrote:
>
> [much useful advice snipped]
>
> > Note that this can break on things like
> >
> > <script>
> > // <!-- </script> -->
> > var banana = "</script>";
> > document.write("</script>");
> > </script>
>
> which contain three samples of incorrect HTML syntax anyway: according
> to HTML4, just like HTML3.2 before it, the <script> element contains
> CDATA. See
> http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2.1 for
I will actually read the HTML spec fully once I need it :)
> explanation and a resolution if the issue, which will incidentally
> address that particular point, as far as HTML is concerned. (XHTML is
> different, but I don't think you were covering that).
Nope. I haven't read anything about XHTML yet.
I wasn't exactly trying to cover valid HTML, but was trying to show that
there are possibilities that will break the RE. That these possibilities
in my case all are invalid HTML doesn't mean that they don't occur in
reality.
You are right, however; next time I'll include a statement that says
that I don't guaratee the validity of the .HTML
> Well, that only deals with one of the details. To do the job
> properly, you really do need an HTML parser. As your next specimen
> exemplifies:
And that was the message I was trying to get across. The RE will do a
quick and dirty job. But given enough monkeys and typewriters (even ones
that produce correct HTML), some day it will break.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on
Commercial Dynamics Pty. Ltd. | till you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Sun, 8 Oct 2000 01:50:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how to remove this using subsitute
Message-Id: <Pine.GHP.4.21.0010080143060.25426-100000@hpplus03.cern.ch>
On Sun, 8 Oct 2000, Martien Verbruggen wrote:
> > http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2.1 for
> I wasn't exactly trying to cover valid HTML, but was trying to show that
> there are possibilities that will break the RE.
I didn't mean to undermine your basic point - indeed I was trying to
reinforce it at the same time as saying there were a few detailed
issues that weren't quite right.
> That these possibilities
> in my case all are invalid HTML doesn't mean that they don't occur in
> reality.
Oh, indeed: I'm sure there's statistically much more javascript that
is invalid HTML than there is which applies the paragraph cited above.
Indeed, there's a popular superstition amongst javascripters that
javascript is incapable of being valid in HTML, and that therefore
anyone who calls for valid HTML is by definition calling for
javascript to be stamped out. They love this sort of self-built
enemy, but of course they wouldn't think of checking the HTML spec for
details.
Anyhow, that's enough OT for now, I'm sure.
> And that was the message I was trying to get across. The RE will do a
> quick and dirty job. But given enough monkeys and typewriters (even ones
> that produce correct HTML), some day it will break.
Indeed. Nice picture that conjures up. All the best.
------------------------------
Date: Sun, 08 Oct 2000 04:25:58 GMT
From: "mark shen" <mshen@idirect.com>
Subject: How to set appache server for Perl in Win32
Message-Id: <qHSD5.45495$M%3.482685@quark.idirect.com>
Can you tell me how to set appache server for Perl in Win95?How to set
httpd.conf,access.con and srm.conf?
Thank you in advance.
Mark
------------------------------
Date: Sun, 8 Oct 2000 16:22:10 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How to set appache server for Perl in Win32
Message-Id: <slrn8u0142.2tj.mgjv@martien.heliotrope.home>
On Sun, 08 Oct 2000 04:25:58 GMT,
mark shen <mshen@idirect.com> wrote:
> Can you tell me how to set appache server for Perl in Win95?How to set
> httpd.conf,access.con and srm.conf?
http://www.apache.org/ to get apache, and for configuration information.
http://www.activestate.com/ to get Perl.
Ask in one of the groups that talks about the Apache server or HTTP
servers in general for more information. This is not a Perl issue.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd. | Then things get worse.
NSW, Australia |
------------------------------
Date: Fri, 06 Oct 2000 11:56:34 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: how to unlink this file?
Message-Id: <39ddbb8a.789107386@news.itn.is>
On Thu, 05 Oct 2000 14:32:38 GMT, bing-du@tamu.edu wrote:
>I tried to use the following script to delete the
>file
>/usr/home/me/tmp/c24b18d4bb4afdf052330678af9a601d_attach_H:\tmp\zz.txt.
>
>===============
>#!/usr/local/bin/perl
>
>$tmp = "/usr/home/me/tmp";
>$uid = "c24b18d4bb4afdf052330678af9a601d";
>
>unlink("$tmp/$uid_attach_*") || die "file can not be deleted\n";
>exit;
>===============
>
Change die "file can not be deleted\n";
to the more informative:
die "file can not be deleted:$!\n";
$! will return the actual error such
as File dies not exist, or Permission denied.
In your case, $! will tell you that
$tmp/$uid_attach_* does not exist
beacuse perl does not understand
the * unless you specifically use the glob
function or a readdir and grep. The unlink
function will not fileglob by itself.
Try for example:
@files_to_delete = glob("$tmp/$uid_attach_*");
for (@files_to_delete) { unlink or die "$!\n"; }
Regards,
Helgi Briem
------------------------------
Date: Sat, 07 Oct 2000 23:53:59 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: lexical for loops
Message-Id: <m3og0wi4x5.fsf@solo.david-steuber.com>
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
' Why don't you test this syntax and discover?
' This would be eminently logical.
With the added benefits of being faster and not looking like a fool in
a public news group.
I hate learning things the hard way.
--
David Steuber | Perl apprentice, Apache/mod_perl user,
NRA Member | and general Internet web wannabe.
ICQ# 91465842
*** http://www.david-steuber.com/ ***
------------------------------
Date: Sun, 8 Oct 2000 00:54:20 -0400
From: "muddy" <nospam@nospam.com>
Subject: Re: looking for links to Perl+mysql how-to's - tutorials etc
Message-Id: <8routd012gl@enews4.newsguy.com>
this guy used to maintain a really helpful site. My link no longer worked,
though so you may want to email him. mailto:ken@photoflux.com
"Robert Chalmers" <robert@chalmers.com.au> wrote in message
news:IkvD5.63$Kq1.2910@nsw.nnrp.telstra.net...
> Looking for links to sites with howto's - tutorials - examples - code
> examples and so on.
>
> Does anyone know of a couple of good ones they can recommend. I know - I
> could spend hours searching but maybe someone can offer a short cut.
>
> Thanks a lot for any help
>
> BC
>
>
------------------------------
Date: Sun, 8 Oct 2000 17:01:00 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: looking for links to Perl+mysql how-to's - tutorials etc
Message-Id: <slrn8u03cs.2tj.mgjv@martien.heliotrope.home>
[please, in the future, post your reply AFTER the suitably trimmed down
text you reply to]
On Sun, 8 Oct 2000 00:54:20 -0400,
muddy <nospam@nospam.com> wrote:
[snip]
> "Robert Chalmers" <robert@chalmers.com.au> wrote in message
> news:IkvD5.63$Kq1.2910@nsw.nnrp.telstra.net...
> > Looking for links to sites with howto's - tutorials - examples - code
> > examples and so on.
>
> this guy used to maintain a really helpful site. My link no longer worked,
> though so you may want to email him. mailto:ken@XXXXXXXXX.com
[mangled email address]
I am sure that the person whose email address you just posted to Usenet
will be terribly happy that you've published their contact details for
spammers to harvest, and for others to abuse.
Next time, if you really feel you must give out other people's contact
details, do so without munging your own address, so that I can email
you, and so that the person whose email address you provided can contact
you about it as well.
I really don't understand how you can just give out someone's email
address over Usenet, but you munge your own. Amazing. Have you no shame?
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia |
------------------------------
Date: Sun, 8 Oct 2000 00:48:12 -0400
From: "muddy" <nospam@nospam.com>
Subject: Re: MySQL BLOB types and DBD::mysql
Message-Id: <8rouht01285@enews4.newsguy.com>
I have had that problem before. If I remember correctly the server only
'went away' when the service I was using was bogged down for some reason.
I use blobs of all kinds to accommodate pictures in mySQL - when the server
is up there is no problem.
"Andrea Novara" <andrea@defiant.stru.it> wrote in message
news:39DF6630.16D748DC@defiant.stru.it...
> I hope that's the right place to post such a question otherwise I
> apologize in advance.
>
> I have a MySQL server handled by perl CGI scripts. In such a script I
> have to upload
> data in a MEDIUMBLOB column. MySQL server ends connection with perl with
> a message
> like this:
>
> DBD::mysql::st execute failed: MySQL server has gone away at
> /www/cgi-bin/stru.pl line 29.
>
> I have also tried to bind the var to the placeholder using
> SQL_LONGVARBINARY type
> but that don't helped solve the problem.
>
> The deamon just accept first 1045000 bytes or so and than disconnect!!!
>
> Anyone have a suggestion, please?
>
> Many thanks in advance!!
>
> Andrea
>
------------------------------
Date: Sun, 8 Oct 2000 10:22:06 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Netscape supports Perl ?
Message-Id: <slrn8tvc0u.jr6.mgjv@martien.heliotrope.home>
On Sat, 07 Oct 2000 18:08:07 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Martien Verbruggen wrote:
>
> >To discuss browsers specific stuff, go to one of the
> >comp.infosystems.www.* groups.
>
> I think he was talking about Netscape's server.
In which case the comment becomes:
To discuss HTTP server specific stuff, please go to one of the
comp.infosystems.www.* groups.
:)
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Sat, 07 Oct 2000 23:38:50 -0700
From: Pan <admin@salvador.venice.ca.us>
Subject: Re: Newbie ?, Removing Whitespace at End
Message-Id: <39E0167A.71469A5A@salvador.venice.ca.us>
"Alan J. Flavell" wrote:
> > How do I remove extra whitespace at the end of a string?
>
> By reading your FAQs, for example with the perldoc command
>
> perldoc -q space
Teaching how to use the faq is a good idea. But as someone who has only
recently broken with my overuse of regular expressions, I'd just like to
mention that there are cases where substitution and RE's aren't the best
way of doing things.
Depending on the type of data you are working with, it might be a good
idea to use unpack to strip off trailing whitespace before it gets read
into the scalar. '$datafile' below will read 2 three character fields
and 1 one character field and place each into its own indexed array.
The following use of unpack() obviates the need for a regular expression
to clear trailing whitespace on fixed width fields. To test it, just
stick a file with a record layout of 331 in the proper path.
Curiously, I didn't find this use of unpack in any documentation
included with my perl 5.x builds or in the faq...
#!/usr/local/bin/perl
# unpack_test.pl
$datafile = "A3 A3 A1";
open(DAT, '/path/to/test.dat') or die "Can't Open!\n";
while (<DAT>)
{
($first[$x], $middle[$x], $last[$x]) = unpack($datafile,
$_);
$x++;
}
close DAT or die "Can't close!\n";
print "\nStart Printing!\n\n";
while ($t < $x) {
print ":: $first[$t] :: $middle[$t] :: $last[$t] :: \n";
$t++;
}
print "\nDone Printing!\n";
--
Pan
admin@salvador.venice.ca.us
http://www.la-online.com
------------------------------
Date: Sat, 07 Oct 2000 23:48:04 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: OT - silly (was: Re: A matter of style (was Re: Search and Destroy))
Message-Id: <m3snq8i570.fsf@solo.david-steuber.com>
dha@panix.com (David H. Adler) writes:
' You want to be a general internet web???
Well, I've already got spiders crawling all over me...
' dha, ducking and running...
You can run, but a motercycle is much faster.
Why did I even look at this? Now I need to think up a new sig :-/.
--
David Steuber | Perl apprentice, Apache/mod_perl user,
NRA Member | and general Internet web wannabe.
ICQ# 91465842
*** http://www.david-steuber.com/ ***
------------------------------
Date: Sun, 08 Oct 2000 02:38:43 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: PP, 3rd ed.???
Message-Id: <B6055674.7883%elaine@chaos.wustl.edu>
in article 39DE9B10.2EDB600F@stomp.stomp.tokyo, Godzilla! at
godzilla@stomp.stomp.tokyo quoth:
> I show no mercy for those who deliberately steal a
> bit of my life to satiate their malice intent.
Oh! The Irony! LOL.
e.
------------------------------
Date: Sun, 8 Oct 2000 00:59:30 -0400
From: "muddy" <nospam@nospam.com>
Subject: Re: Problems with Perl2exe ...
Message-Id: <8rov73012pf@enews4.newsguy.com>
I have heard two different stories about whether people can get your code or
not. I think it has a lot to do with your web server configuration and
where you store your scripts. Can someone answer the question definitively:
Is there a way to protect your scripts from being downloaded by users??
(aside from a security breach?)
"CDM" <cdemaeyer1@mmm.com> wrote in message
news:8rkhcu$mq8$1@magnum.mmm.com...
> go to a search engine and search on 'obfuscate perl'
> should be a number of sites there...
>
> "T. GUIRADO" <tguirado@iterra-team.com> wrote in message
> news:8ri4g7$jlh$1@s1.read.news.oleane.net...
> > Thanks to reply directly by Email, at vbezard@iterra-team.com
> >
> > Well,
> >
> > I've got CGI programs in PERL, and I don't want someone to be able to
read
> > my codes. So, I've tried Perl2exe ... It seems working well, but
> sometimes,
> > I have problems ...
> >
> > Does someone have experience with Perl2exe ??
> > Does someone have another idea to make my codes unreadable?
> >
> > Thnaks in advance ...
> >
> >
> > Vincent
> >
> >
>
>
>
>
> Opinions expressed herein are my own and may not represent those of my
employer.
>
------------------------------
Date: Sun, 8 Oct 2000 17:05:42 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Problems with Perl2exe ...
Message-Id: <slrn8u03lm.2tj.mgjv@martien.heliotrope.home>
[Please, in the future, post your reply AFTER the suitably trimmed down
text you reply to]
On Sun, 8 Oct 2000 00:59:30 -0400,
muddy <nospam@nospam.com> wrote:
> I have heard two different stories about whether people can get your
> code or not. I think it has a lot to do with your web server
> configuration and where you store your scripts. Can someone answer
> the question definitively: Is there a way to protect your scripts from
> being downloaded by users?? (aside from a security breach?)
1 - What you say here has only very little to do with the subject that
was being discussed. if you want to start a new subject, start a new
thread, or at least change the subject line.
2 - What you say here has NOTHING at all to do with Perl. Please refer
to one of the groups in the comp.infosystems.www.* hierarchy.
[Jeopardectomy performed]
[Note f'ups'
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Sun, 08 Oct 2000 02:50:07 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Serial-Timeout on Solaris
Message-Id: <B605591C.7884%elaine@chaos.wustl.edu>
in article 39DE051C.673CC8F5@compoint.de, Lothar Schuette at
schuette@compoint.de quoth:
> Is it possible that a special sequence of bytes sent to the sun makes
> the port hang? Does the OS or maybe HW interpret the data?
With modems and serial lines almost everything is possible and
impossible...I had a Sparc at home that used to dial-up the university modem
bank that would randomly drop the PPP connection. I talked to the network
admin who claimed it was the hot weather and the phone lines in my house.
Later, after I gave up and just got an ISP account that never dropped the
line we figured out it was a problem with Courier modems and the Cisco. I
don't mind finding bugs in IOS as long as it doesn't interfere with my own
personal connection :)
The moral of the story is that these things are impossible to troubleshoot
via news if they are esoteric in the least. It sounds like you have
something that doesn't totally agree with your sparc which could be anything
from a dip switch on the modem, to a weird register on the modem to who
knows what. http://www.stokely.com/ has a bunch of good sun serial resources
you might find helpful. Exorcism is not an unreasonable solution either ;)
May the force and the static cling be with you.
e.
------------------------------
Date: Sun, 08 Oct 2000 01:53:15 -0400
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: Server Side Includes
Message-Id: <39E00BCB.7848@courrier.usherb.ca>
This is interesting. Yahoo does this with server side:
<script language=javascript
src="http://ss.webring.yahoo.com/navbar?f=j&y=eslcafe2&u=97051503810017724"></script>
My server doesn't have SSI. Is there a way to emulate it?
John
------------------------------
Date: Sat, 07 Oct 2000 22:48:56 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: STDIN question
Message-Id: <sLND5.1728$oA2.946625@typhoon.southeast.rr.com>
nougat <kulabocca69@hotmail.com> wrote in message
news:tNLD5.463$C71.34943@bgtnsc06-news.ops.worldnet.att.net...
> Hi - In a simple while loop prompting the user for input:
>
> $j = "y";
> while ($j ne "n") {
> print "Please enter your message: ";
> $msg .= <STDIN>;
> print "Add more messages? (y/n)";
> $j = getc(STDIN);
> }
>
[snip]
The problem here is that getc() retrieves the first character typed, but
leaves the enter key in the buffer, so the next time <STDIN> is requested,
it returns the newline left over from the getc() call.
Probably the easiest way to accomplish what you want would be to just read
in $j with <>, then chomp it, i.e. chomp( $j = <> );
If you really want to get one character at a time, look at Term::ReadKey.
hth,
p
------------------------------
Date: Sun, 08 Oct 2000 00:35:21 GMT
From: "nougat" <kulabocca69@hotmail.com>
Subject: Re: STDIN question
Message-Id: <djPD5.541$C71.48552@bgtnsc06-news.ops.worldnet.att.net>
Thanks much - that did the trick.
Philip Garrett <philipg@atl.mediaone.net> wrote in message
news:sLND5.1728$oA2.946625@typhoon.southeast.rr.com...
> nougat <kulabocca69@hotmail.com> wrote in message
> news:tNLD5.463$C71.34943@bgtnsc06-news.ops.worldnet.att.net...
> > Hi - In a simple while loop prompting the user for input:
> >
> > $j = "y";
> > while ($j ne "n") {
> > print "Please enter your message: ";
> > $msg .= <STDIN>;
> > print "Add more messages? (y/n)";
> > $j = getc(STDIN);
> > }
> >
> [snip]
>
> The problem here is that getc() retrieves the first character typed, but
> leaves the enter key in the buffer, so the next time <STDIN> is requested,
> it returns the newline left over from the getc() call.
>
> Probably the easiest way to accomplish what you want would be to just read
> in $j with <>, then chomp it, i.e. chomp( $j = <> );
> If you really want to get one character at a time, look at Term::ReadKey.
>
> hth,
> p
>
>
------------------------------
Date: Sat, 7 Oct 2000 20:19:26 -0500
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: Text file manipulation
Message-Id: <stvip2654qd740@corp.supernews.com>
Since you used outlook to send the message, I assume you can use windows to
process the file. If you only have a few files to do, it may be easier to
just grab edit plus (www.editplus.com), open the text file and use edit
plus's text replacement dialog box. (ctrl + H)
Replace >NAME='< with >< (nothing)
Replace >'\n\tNAME1='< with >;<
Replace >'< with ><. Done.
-Dale
<@tampabay.rr.com> wrote in message
news:HJMD5.83750$1H2.3855153@typhoon.tampabay.rr.com...
> Hello,
>
> I would like to make a perl script that does the following:
>
> Given is a textfile with content like this:
>
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
>
> I need to convert it into:
>
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
>
> The perl script will be called by another script and will get the name of
> the text file there.
> How would I do that?
>
> Thanks
> Henning
>
>
------------------------------
Date: Sun, 8 Oct 2000 00:41:59 -0400
From: "muddy" <nospam@nospam.com>
Subject: Re: Text file manipulation
Message-Id: <8rou68011v3@enews4.newsguy.com>
I agree that if you only have a few files you should simply edit them
yourself with a text editor, however if this is not the case I would use
regular expressions that search the pattern and reassemble the data how you
like it.
<@tampabay.rr.com> wrote in message
news:HJMD5.83750$1H2.3855153@typhoon.tampabay.rr.com...
> Hello,
>
> I would like to make a perl script that does the following:
>
> Given is a textfile with content like this:
>
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
>
> I need to convert it into:
>
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
>
> The perl script will be called by another script and will get the name of
> the text file there.
> How would I do that?
>
> Thanks
> Henning
>
>
------------------------------
Date: Sun, 8 Oct 2000 16:43:58 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Text file manipulation
Message-Id: <slrn8u02ct.2tj.mgjv@martien.heliotrope.home>
On Sat, 07 Oct 2000 21:38:47 GMT,
@tampabay.rr.com <@tampabay.rr.com> wrote:
> Hello,
>
> I would like to make a perl script that does the following:
>
> Given is a textfile with content like this:
>
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
> NAME='var1;var2;var3;var4'
> NAME1='var5;var6;var7'
>
> I need to convert it into:
>
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
> var1;var2;var3;var4;var5;var6;var7
>
> The perl script will be called by another script and will get the name of
> the text file there.
> How would I do that?
#!/usr/local/bin/perl -wp
$_ .= <>;
s/.*'(.*?)'.*'(.*)'/$1;$2/s;
This script reads from standard input, or from files given as arguments,
and produces output on STDOUT.
# ./script foo.banana.input > foo.banana.output
if you want it to change the file you're looking at directly, add a i to
the options.
#!/usr/local/bin/perl -wpi
Martien
PS. This will work on your input. If the REAL input is more complex,
then please, next time, post some REAL input. I'm really going to be
pissed off if you come back with something like 'But, the real input can
contain single quothes in other places'.
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Sun, 8 Oct 2000 16:49:25 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Text file manipulation
Message-Id: <slrn8u02n5.2tj.mgjv@martien.heliotrope.home>
[Please, in the future, post your replies AFTER the suitably trimmed
text you reply to. It makes the whole thing easier to read, and is in
line with the quoting style generally used here]
On Sat, 7 Oct 2000 20:19:26 -0500,
Dale Emmons <dale@emmons.dontspamme.com> wrote:
> <@tampabay.rr.com> wrote in message
> news:HJMD5.83750$1H2.3855153@typhoon.tampabay.rr.com...
> >
> > The perl script will be called by another script and will get the name of
> > the text file there.
> > How would I do that?
>
> Since you used outlook to send the message, I assume you can use windows to
> process the file. If you only have a few files to do, it may be easier to
> just grab edit plus (www.editplus.com), open the text file and use edit
> plus's text replacement dialog box. (ctrl + H)
We all appreciate your desire to help, however, your post is very
offtopic. If you want to suggest something like this, then at least also
answer the question. The OP clearly stated that this script needs to be
called from some other script, suggesting some sort of automatic task.
You 'deduced' a few things that all together might make your solution
viable, however, you assume too much. I have collegues that work on MS
Win all the time, but all our production level computing happens on
Unix. your assumption would have been wrong. What if these files are 4
GB large? or even 8 MB? A text editor isn't the right place to do this
stuff then.
Deductions are fine, but they should be based on reasonable assumptions.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes
Commercial Dynamics Pty. Ltd. | so later I can ask him what he meant
NSW, Australia | - Steven Wright
------------------------------
Date: Sun, 8 Oct 2000 16:56:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Text file manipulation
Message-Id: <slrn8u033o.2tj.mgjv@martien.heliotrope.home>
[Please, in the future, put your reply AFTER the suitably trimmed down
text you reply to. It makes the posts much easier to read, conserves
bandwidth and disk space, and is the generally accepted quoting style
here]
On Sun, 8 Oct 2000 00:41:59 -0400,
muddy <nospam@nospam.com> wrote:
> <@tampabay.rr.com> wrote in message
> news:HJMD5.83750$1H2.3855153@typhoon.tampabay.rr.com...
> > I would like to make a perl script that does the following:
> >
> > Given is a textfile with content like this:
[snip]
> > I need to convert it into:
[snip]
> I agree that if you only have a few files you should simply edit them
> yourself with a text editor, however if this is not the case I would use
> regular expressions that search the pattern and reassemble the data how you
> like it.
I appreciate that you're eager to help, but how much help have you
actually provided? Where is the code, or the general outline of what
needs to be done? 'Regular expressions that search the pattern'? Which
pattern? What else are regular expressions supposed to do? 'reassemble
the data'? How? With which commands?
Do you see that your post hasn't actually provided any content that
could be of help to the OP?
You might as well have said: You need to read the file, change the data,
and then write it. Or, you should transform the data in the file. The
only thing you mentioned are regular expressions, and those aren't
necessarily the best solution anyway. I've posted a solution that uses
them, but it's hardly elegant.
Next time you feel the urge to follow up, make sure that you have
something to say. Following up for the sake of it doesn't help anyone.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on
Commercial Dynamics Pty. Ltd. | till you come to the end; then stop.
NSW, Australia |
------------------------------
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 4551
**************************************