[12533] in Perl-Users-Digest
Perl-Users Digest, Issue: 6133 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 26 05:07:19 1999
Date: Sat, 26 Jun 99 02:00:21 -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 Sat, 26 Jun 1999 Volume: 8 Number: 6133
Today's topics:
Active State perl and Personal Oracle 8 sonigopi@hotmail.com
Re: ASCII character coversion (Bart Lateur)
Re: Backsniffing <carvdawg@patriot.net>
Re: Breaking up is hard to do <gellyfish@gellyfish.com>
Deleting lines from a file rt_daemon@yahoo.com
Re: Deleting lines from a file <rick.delaney@home.com>
Re: Deleting lines from a file (William Herrera)
Re: Deleting lines from a file <tchrist@mox.perl.com>
Determining limit on size of data that a Perl CGI progr <nmorison@ozemail.com.au>
Re: faqs, beginner question (Jon Bell)
HELP-THE-GEEK-CONTEST: How can I understand the type of (blueman)
Re: HELP: Can't delete ONE stinking file with Unlink! <ehpoole@ingress.com>
Re: How can I read a whole file in one go ? (J. Moreno)
Re: Neet Perl Obfucation Program <firespring@nfx.net>
Re: Regex question (i think) <Gened@ohinter.net>
rename dose not work vitanut@my-deja.com
Re: rename dose not work (David Efflandt)
Re: rename dose not work <tchrist@mox.perl.com>
Re: should be how to remove ^M from middle of variable? <jbc@shell2.la.best.com>
Re: simple question. (Bart Lateur)
Socket Programming Help kennedy_clark@my-deja.com
Talking to remote machines on a network <ianp.smith@virgin.net>
Re: Testing Perl scripts on Win 95/98/NT; and CGI too! <gellyfish@gellyfish.com>
Re: timing for socket connect (Bart Lateur)
Re: Unix CGI > Win/Mac <rootbeer@redcat.com>
Re: Unix CGI > Win/Mac (Thomas Fischer)
Re: validating a regexp from a CGI form (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 26 Jun 1999 03:20:42 GMT
From: sonigopi@hotmail.com
Subject: Active State perl and Personal Oracle 8
Message-Id: <7l1gu3$mfo$1@nnrp1.deja.com>
I am running personal Oracle 8 and Active State perl on Stand alone pc.
I having trouble connect to oracle from perl script. I am using DBI
package. Below is the Script:
use DBI ;
$dbh=DBI->connect ( 'dbi:ODBC:beq-local' , 'scott' , 'tiger' ) ||
die " Canm not Connect $DBI::errstr\n" ;
$dbh->disconnect ;
PC and OS Spec:
Pentium 166 MHZ
Windows98
Any help would be appreciated.
Thanks
soni
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 26 Jun 1999 07:58:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: ASCII character coversion
Message-Id: <377d8626.4803410@news.skynet.be>
Steve wrote:
>I have the character P. I am redoing a program that uses ascii
>conversions was told by the original programmer that the ascii value
>should be 0x50. I get an ord value of 80. What am I missing here?
The fact that 0x50 IS 80?
Bart.
------------------------------
Date: Fri, 25 Jun 1999 23:12:39 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Backsniffing
Message-Id: <3773FED7.1A023B68@patriot.net>
> Can anyone tell me how to find out what URL a visitor to my page visited
> before coming to mine? Would I use cookies or some other method?
> Know any URL where I could find the PErl sourcecode for this?
Hey, hey!! This isn't alt.fetish!! Backsniffing...eeeewwww! How gross!
Who'd want to sniff a back? And for cookies no less! Yuck!
------------------------------
Date: 26 Jun 1999 08:24:10 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Breaking up is hard to do
Message-Id: <7l22na$14v$1@gellyfish.btinternet.com>
On Mon, 21 Jun 1999 22:02:24 -0400 Bob Walton wrote:
> Jacques Rall wrote:
>
>> Hi all,
>>
>> I have a very long string, about 1000 characters, which I need to split
>> up into 80 character lines or fields.
>
> Jacques, try something like:
>
> $in="this is a very long line..." x 100;
> while($in=~/(.{80,80})/g){
> print "$1\n"; #use push @out,$1; to save the pieces to an array
> }
>
Except if the strings length isnt an exact multiple of 80 then the
remainder will be lost - better try something like :
@out = $in =~ /(.{1,80})/g;
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 26 Jun 1999 03:40:37 GMT
From: rt_daemon@yahoo.com
Subject: Deleting lines from a file
Message-Id: <7l1i3k$mqb$1@nnrp1.deja.com>
Greetings,
How can delete some lines from a file ?
Exmaple:
something
<!--HTML-->HTML HTML HTML HTML
HTML HTML HTML HTML
<!--1-->HTML HTML HTML HTML
HTML HTML HTML HTML<BR>
<!--Something-->something something
something
How to delete the lines with HTML in it ?
Needing help,
Daemon
Webmaster
rt_daemon@yahoo.com
http://rt-daemon.virtualave.net/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 26 Jun 1999 04:23:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Deleting lines from a file
Message-Id: <37745596.119305F0@home.com>
[posted & mailed]
rt_daemon@yahoo.com wrote:
>
> How can delete some lines from a file ?
FAQ.
> How to delete the lines with HTML in it ?
perl -i -pe '$_="" if /HTML/' infile
awk '!/HTML/' infile > outfile
grep -v HTML infile > outfile
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sat, 26 Jun 1999 04:31:29 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Deleting lines from a file
Message-Id: <377454b4.6707441@news.rmi.net>
On Sat, 26 Jun 1999 03:40:37 GMT, rt_daemon@yahoo.com wrote:
>something
><!--HTML-->HTML HTML HTML HTML
>HTML HTML HTML HTML
><!--1-->HTML HTML HTML HTML
>HTML HTML HTML HTML<BR>
><!--Something-->something something
>something
>How to delete the lines with HTML in it ?
perl -ne 'print unless /HTML/' < inputfilename > outputfilename
Although if you really want to strip all the HTML _tags_ there is a
module for that.
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: 25 Jun 1999 23:13:33 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Deleting lines from a file
Message-Id: <3774617d@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, rt_daemon@yahoo.com writes:
:How can delete some lines from a file ?
Your choice:
1) Get a text editor.
2) Hire a programmer.
3) Read perlfaq5, question 2.
--tom
--
""Lurking" is one metaphor that the Omniscience has allowed us to borrow."
--Larry Wall
------------------------------
Date: Sat, 26 Jun 1999 18:46:13 +1000
From: "Neale Morison" <nmorison@ozemail.com.au>
Subject: Determining limit on size of data that a Perl CGI program can receive from a textarea form element
Message-Id: <wt0d3.1309$vP.9248@ozemail.com.au>
If this is off-topic, please excuse me. If so, I'd appreciate it if someone
could recommend a CGI group as good as this Perl group that might offer the
answer to this question.
I have put together a Perl CGI script that uses a series of HTML Forms for
web page management. It does everything I want, except for the bit where I
want to allow users to edit the contents of the web page in a textarea form
element.
It sends a large amount of data to the client browser and displays it in the
textarea field, but when I try to submit the form, I get a "Connection with
server reset" error under some circumstances.
It seems to happen if the data exceeds a certain size, which varies between
15K and 40K.
I'd love to edit files up to about 200K.
Can anyone set me on the right track? Does the limitation come from:
- The server
- Perl
- environment variables size limitations
- The HTML protocol
- The browser
- The client O/S
- Anything to do with specific characters in the textarea field, such as
quotation marks
- my karma
------------------------------
Date: Sat, 26 Jun 1999 03:15:57 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: faqs, beginner question
Message-Id: <FDwzqL.E76@presby.edu>
David Cassell <cassell@mail.cor.epa.gov> wrote:
>
>In fact, Perl has snitched good things from a slew of different
>programming languages and tools.
In other words, Perl is a "mongrel". :-)
(Not that there's anything *wrong* with that...)
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Information about newsgroups for beginners: ]
[ http://www.geocities.com/ResearchTriangle/Lab/6882/ ]
------------------------------
Date: Sat, 26 Jun 1999 08:05:35 GMT
From: blueman@?.? (blueman)
Subject: HELP-THE-GEEK-CONTEST: How can I understand the type of an unknown DBM file?
Message-Id: <377889a9.82468208@news.supernews.co.uk>
Hi All,
Yeah, yeah. I was considering myself as a Perl guru. Then, one day I
took a project where I should convert some dbm files to text files.
"Verrry Easy." I said, being a perl guru. I wrote a simple converter
in 5 min.s. Ran it. Failed. "A Perl Guru?". It seems I was fooling
myself :-).
The problem: The DBMs were created on a SUN machine. I am programming
on a Windows machine. So, probably that SUN machine has an advanced
DBM installed (Like NDBM or Berkeley), and as I don't have that DB
engine (I am using the ActivePerl distribution; so, I have SDBM.), I
am having my problems.
Now... As I can not contact the SUN machine admin. OR can not
connect to the machine itself (It's located in a far city. And, closed
for FTP, Telnet, etc.). I have to find a way to understand the type of
the DBM used for those files.
Any ideas? TIA.
blueman
bpg
------------------------------
Date: Sun, 27 Jun 1999 01:49:13 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: HELP: Can't delete ONE stinking file with Unlink!
Message-Id: <3775BB59.7424F818@ingress.com>
[posted and emailed]
Michael Carman wrote:
>
> Actually, Perl on NT is more restrictive than that. To use unlink() on NT,
> you must specify the *full* pathname to the file to be deleted. From my
> experiences, this means "x:\foo\bar\baz\blat.txt" Network paths such as
> "\\myserver\foo\bar\baz\blat.txt" do NOT work. Of course, you still won't be
> able to delete the file if you don't have the appropriate permissions. Why
> are things this way? I don't know. I find it annoying although I suppose
> (hope) there's a good reason for it.
Not true.
You just have to be certain your current working directory is what you
expected it to be if you are using relative paths.
Additionally, NT will unlink() just fine with UNC paths. Just keep in mind
that the path (hard-coded) will look more like this:
"\\\\myserver\\foo\\bar\\baz\\blat.txt"
or
"\\\\myserver\\foo/bar/baz/blat.txt"
Although, as you already pointed out, you do have to have proper
permissions, but that is the way things *should* be.
--
Ethan H. Poole **** BUSINESS ****
ehpoole@ingress.com ==Interact2Day, Inc.==
(personal) http://www.interact2day.com/
------------------------------
Date: Sat, 26 Jun 1999 00:10:41 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: How can I read a whole file in one go ?
Message-Id: <1dtzb43.1suiv331h6cd24N@roxboro0-0021.dyn.interpath.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> mist@yoyo.cc.monash.edu.au (Michael Stillwell) writes:
> :Is there any other language where the recommended way to read an
> :entire file into memory involves a shell command?
>
> Yes: bash, sh, ash, bsh, csh, tcsh, ksh, and zsh--just to name a few. :-)
> You'll have to check wish, er, tclsh, er, tcl on your own.
>
> :I find this
> :extraordinary---and more than a little inelegant.
>
> Gosh, you certainly have an, um, interesting notion of inelegant.
> Let's compare...
>
> $buff = `cat $path`;
> die "ENOKITTY: $path--bailing out" if $?;
> printf "$0: read %d bytes from $path\n", length($buff);
>
> versus
>
-snip 62 lines of not very dense C code-
undef $/;
undef $buff;
$buff = <SL> if open (SL, "<$path");
close <SL> if defined $buff;
Does a reasonable job of it, although it's not perfect.
> Now, which one did you say was more elegant? :-)
using cat except,
"
This tiny but expedient solution is neat, clean, and portable to
all systems that you've bothered to install decent tools on,
even if you are a Prisoner of Bill. For those die-hards PoBs
who've paid their billtax and refuse to use the toolbox, or who
like writing complicated code for job security, you can of
course read the file manually.
"
isn't a reasonable thing to say -- I've not paid a billtax, I think my
tools are semi-decent, and it doesn't do a thing for me.
> I think you just have a different measure of these things than I do.
> Note that, as I essentially go on to say in the cited FAQ, I see
> surpassingly scant justification for ever reading the whole file into
> memory at once in the first place. It's usually the sign of some
> overzealous neophyte going after a mosquito with a howitzer.
Thanks.
Sometimes it's what you want to do and sometimes it's not.
--
John Moreno
------------------------------
Date: Sat, 26 Jun 1999 08:38:57 GMT
From: Rick Johnson <firespring@nfx.net>
To: abigail@delanet.com
Subject: Re: Neet Perl Obfucation Program
Message-Id: <37749269.25EE78AD@nfx.net>
So where can one find an example of a GOOD license?
Rick J.
Abigail wrote:
>
> Harry P Bloomberg (hpb+@pitt.edu) wrote on MMCXVI September MCMXCIII in
> <URL:news:7kbg1t$kb9$1@usenet01.srv.cis.pitt.edu>:
> ;; I need to be able to deliver some code written in Perl and I want
> ;; to make it very difficult for unauthrorized personnel to read.
>
> chmod 000 program
>
> ;; I've dealt with some commercial packages that have been delivered with
> ;; Perl source that has been obsfucated to the point that a mere mortal
> ;; could not make sense of the code. Alas, I've been unable to find a program
> ;; that can do this, but I know they exist.
>
> You could hire a bad programmer.
>
> ;; So, could someone please point me towards a Perl obfucation program,
> ;; free or commercial?
>
> Just make a license.
>
> Abigail
> --
> sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
> f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
> f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 25 Jun 1999 23:40:08 -0400
From: Gene Dolgin <Gened@ohinter.net>
Subject: Re: Regex question (i think)
Message-Id: <37744B97.EBBD9017@ohinter.net>
i got that mail after i sent the previous one, so im lookign right now...
Tom Phoenix wrote:
> On Fri, 25 Jun 1999, Gene Dolgin wrote:
>
> > You know, after all these responses, i sitill have no clue how to do
> > it.
>
> Have you looked at Mail::Internet yet to see whether it will
> do what you need?
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 26 Jun 1999 03:11:19 GMT
From: vitanut@my-deja.com
Subject: rename dose not work
Message-Id: <7l1gch$mar$1@nnrp1.deja.com>
I am new to Perl and am having difficulty with the rename function.
Example:
rename("/usr/www/vitanut/old.txt","/usr/www/vitanut/new.txt");
My script lives in:
/usr/www/vitanut/htdocs/cgibin/
Why doesn't the above code work? My file permissions are all correct.
Any help will be greatly appreciated.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 26 Jun 1999 00:12:05 -0400
From: efflandt@xnet.com (David Efflandt)
Subject: Re: rename dose not work
Message-Id: <slrn7n8kvi.u9.efflandt@efflandt.xnet.com>
On Sat, 26 Jun 1999 03:11:19 GMT, vitanut@my-deja.com
<vitanut@my-deja.com> wrote:
>I am new to Perl and am having difficulty with the rename function.
>
>Example:
>rename("/usr/www/vitanut/old.txt","/usr/www/vitanut/new.txt");
>My script lives in:
>/usr/www/vitanut/htdocs/cgibin/
>
>Why doesn't the above code work? My file permissions are all correct.
This is not really a perl issue. Why do you assume permissions are
correct if you are new at this and do not tell us what they are?
If you set 666 permission for the file and 777 permission for the
directory it should work (if paths are correct). How much you can trim
permissions from that depends upon your webserver setup, which is subject
for another newsgroup.
Also your current directory or full system path on the webserver may be
different than your login path. That is easy enough to find out from a
simple sh script run as CGI that prints the result of pwd.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 25 Jun 1999 23:12:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: rename dose not work
Message-Id: <37746136@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Cursed to torture himself and others using Mozilla/4.0 (compatible;
MSIE 4.01; Windows 98), vitanut@my-deja.com writes In comp.lang.perl.misc,
:rename("/usr/www/vitanut/old.txt","/usr/www/vitanut/new.txt");
:My script lives in:
:/usr/www/vitanut/htdocs/cgibin/
:
:Why doesn't the above code work? My file permissions are all correct.
It has been previously suggested in this forum that one haruspicate a
whilom Windows programmer to divine meaning of this mysterious event.
Others suspect that there resides deep in the bowels of the mystical
tome known as perlvar a special variable to guide you out of darkness.
Still others allege that use of this hypothetical variable is copiously
illustrated in roughly 5,273,742 different Perl programs for your perusal.
--tom
--
"After three days without programming, life becomes meaningless."
------------------------------
Date: 26 Jun 1999 06:37:09 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: should be how to remove ^M from middle of variable?
Message-Id: <37747515$0$229@nntp1.ba.best.com>
Kazuma <kazuma@my-deja.com> wrote:
>> Okay, using vi on the output shows ^M in the middle of my variable,
>> coming from the browser. Can someone please explain what's going
>> on?
> To be sure, I would do:
> $val =~ s/\r//g; # remove ^M, the var is now 'unix like'
> $val =~ s/\n/ /g; # subsitute newline with space
If the person submitting the form is using a Mac, the above
substitution will eliminate all the newlines and butt the end of one line
up against the beginning of the next line, with no intervening space.
My (admittedly less than encyclopediac) understanding of TEXTAREA
line endings is that:
Unix boxes end lines with \n
Macs end lines with \r
DOS/Windows machines end lines with \r\n
So if you're going to do a substitution, you would probably prefer
something like:
$val =~ s/\r\n?/\n/g;
$val =~ s/\n/ /g;
to the example given above.
I'm sure there's some very good reason why CGI.pm doesn't try to
conform all these different line endings for you when decoding a form
submission, in a manner analogous to the way Perl adapts to its
environment so as to treat \n as a line ending regardless of the
platform it's running on. Still, it seems (to an amateur like me, at
least) like the sort of thing that might be worth doing in a standard
form-decoding library, just to avoid the sort of monkeyshines described
above.
If anyone would care to enlighten me on the subtler point I'm missing,
I'd appreciate it. Thanks.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Sat, 26 Jun 1999 07:47:39 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: simple question.
Message-Id: <37787fe8.3205313@news.skynet.be>
Ronald J Kimball wrote:
>That code prints out:
>
>Before
>One
>After
>
>*without* the "Two".
Ack!
Can you believe that I tested it, but mlisinterpreted the results? I
looked more at the fact that it ran at all...
This gives a new meaning to the addagio "test before you post".
Bart.
------------------------------
Date: Sat, 26 Jun 1999 05:08:12 GMT
From: kennedy_clark@my-deja.com
Subject: Socket Programming Help
Message-Id: <7l1n7n$o9m$1@nnrp1.deja.com>
I have been having problems getting the following
script to work. When I connect to it using a web
browser, the contents of the "page" is transfered,
but the connection is not cleanly shut down (TCP
uses the RESET bit instead of the FIN bit...
resulting in a "this connection was hosed" type
of message). I've tried everything. Help!
TIA,
Kennedy
kennedy_clark@my-deja.com
~~~~~~~~~~~~~~~~
#!/usr/bin/perl -w
use Socket;
use strict;
my ( $packed_client_addr, $packed_svr_socket, $svr_port_num );
socket( SVR_SOCKET, PF_INET, SOCK_STREAM, getprotobyname("tcp"))
or die "socket: $!";
setsockopt( SVR_SOCKET, SOL_SOCKET, SO_REUSEADDR, pack("l",1) );
$packed_svr_socket = pack_sockaddr_in( 8080, INADDR_ANY );
bind( SVR_SOCKET, $packed_svr_socket )
or die "Couldn't bind to port $svr_port_num :$!\n";
listen( SVR_SOCKET, SOMAXCONN ) or die "Can't listen";
$packed_client_addr = accept( CLIENT_SOCKET, SVR_SOCKET );
print CLIENT_SOCKET "<html>Test</html><body>Test</body>\n";
close CLIENT_SOCKET;
~~~~~~~~~~~~~~~~~~~~~
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 20 Jun 1999 21:42:45 +0100
From: "Ian Smith" <ianp.smith@virgin.net>
Subject: Talking to remote machines on a network
Message-Id: <7l1sgt$nq7$1@nclient5-gui.server.virgin.net>
I have the ?pleasure? of administering a system on an NT4 network, and my
problem is that I need to deliver some simple software to all of about 120
machines throughout the whole of the county of Essex, England. (Too far to
do in a day).
I have written a nice elegant (I think so!) Perl script which is driven by
the data from a simple list of machine names. Taking the machine names from
the list line by line I address them in turn, deleting old remnant
directories and installing a new directory with all its new software, copied
from the host machine.
I am stuck with NT4 batch commands inside Perl! Help! How can I do something
like the following in Perl:
"copy c:\sourcedir\*.* \\remotemachine\targetdir" - where 'remotemachine' is
the next line from the list. NT does this easily, but not reliably. I'm sure
Perl can, but can't find the 'howto' anywhere. Does anybody know how please?
------------------------------
Date: 26 Jun 1999 08:20:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Testing Perl scripts on Win 95/98/NT; and CGI too!
Message-Id: <7l22h4$14s$1@gellyfish.btinternet.com>
On Fri, 25 Jun 1999 18:31:43 -0700 The Starman wrote:
> I just wanted to apologize to Tim Greer (and anyone else who sees
> this) who mentioned someone should get ActivePerl for testing a
> script... I was under the (FAULTY) impression at the time that
> the program cost a lot of money! It does not... it is free to use.
>
Hmmm
> Now I need to find out if there's any point in switching! :-)
>
Well its built from the same core code as the source stable source
distribution - 5.00503 - and has the Perl Package Manager (PPM) that
will ease the installation of supported modules *and* maintain the
copious HTML documentation. If you are interested in such things it
also installs itself as a scripting engine for use with such things
as WSH,IE,IIS (although I cant actually see a good reason for using
it with WSH).
Theres quite a lot of point in switching from the previous Win32
Binary Distrinution - good as that was ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 26 Jun 1999 07:58:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: timing for socket connect
Message-Id: <377e86b0.4941327@news.skynet.be>
Tom Phoenix wrote:
>On the other hand, you could do as Randal has done in his twentieth Web
>Techniques column and give back a "please wait" page. (Hey! He mentioned
>me in that column! I've got to start reading these columns more
>closely....)
>
> http://www.stonehenge.com/merlyn/WebTechniques/
Nah.... Do what he does: do a search for your own name.
;-) ;-) ;-)
BTW did I say that those articles are really really great? Simple yet
non-trivial stuff.
Bart.
------------------------------
Date: Fri, 25 Jun 1999 20:37:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Unix CGI > Win/Mac
Message-Id: <Pine.GSO.4.02A.9906252029160.2676-100000@user2.teleport.com>
On Sat, 26 Jun 1999, Thomas Fischer wrote:
> My script generates source code and one of the way users can obtain
> that code is as a direct HTML feedback with the code as content of a
> textarea.
Why a textarea? Can't you simply output the data as text and
let the user save it?
> I use javascript to automatically select the textarea content and
> request the users to copy that onto their clipboard for further usage.
>
> When the code is being copied to an editor like Win32 Notepad the
> linefeeds (\n) are not recognized and are displayed as those blackbox
> characters
Sounds to me as if the browser is doing the wrong thing here. But I'd have
to read up more about browsers to be certain.
Maybe you should use the javascript to fix up the text. :-)
But it may be that, after you output the text that's right for their
platform, some other browser won't deal with it in the same way as the one
you've tried.
> My perl script knows wheather the user platform is UN*X, WIN or MAC
> therefore it should be easy... :-(
Well, you could output different stuff if you still want to. When you do
that, is the browser still doing the wrong thing?
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 26 Jun 1999 06:47:51 GMT
From: tfischer@deakin.edu.au (Thomas Fischer)
Subject: Re: Unix CGI > Win/Mac
Message-Id: <377475d9.343074955@news.deakin.edu.au>
hi,
>> My script generates source code and one of the way users can obtain
>> that code is as a direct HTML feedback with the code as content of a
>> textarea.
>
>Why a textarea? Can't you simply output the data as text and
>let the user save it?
Thats to save window space. Please trust me in that. My question
is about these damned linefeeds.
>Maybe you should use the javascript to fix up the text. :-)
As I wrote: I tried to use Perl and then I tried to use JavaScript
to fix it and it didn't work both times.
>Well, you could output different stuff if you still want to. When you do
>that, is the browser still doing the wrong thing?
YES. In an earlier document I use the JavaScript navigator.platform
object to send a Platform identification to the PERL cgi. There I
have a variable $PLATFORM which either contains the string
"WIN", "MAC" or "UNX". Depending on that I want to filter the
linefeed encoding.
You think this is right(?):
if ($PLATFORM eq "WIN") {$SOURCE =~ s/\n/\r\n/g;}
if ($PLATFORM eq "MAC") {$SOURCE =~ s/\n/\r/g;}
I wonder why this doesn't work!??!?!?!
Thomas
------------------------------
Date: Sat, 26 Jun 1999 07:58:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: validating a regexp from a CGI form
Message-Id: <377c851e.4539496@news.skynet.be>
Randal L. Schwartz wrote:
>Bart> Try eval(). Actually, try something like:
>
>Bart> $sub = eval "sub { /$regexp/ }";
>
>I wouldn't do that. What if $regexp is "/; system 'rm -rf /'; /" ?
Touchi. At first glance, I can see two ways out of this.
A) Make it "safe", by disarming the slash. Something like:
$regexp =~ s{(\\.)|/}{ $1 || "\\/" }ges;
B) Delay the compilation of the regex. Hey, I might throw in closures as
well. :-)
sub regexsub ($) {
my($regex) = @_;
return eval "sub { /\$regex/o }";
}
my $foo = regexsub('fo+') or die "Couldn't compile \$foo";
my $bar = regexsub('bar') or die "Couldn't compile \$bar";
while(<DATA>) {
$foo->() && $bar->() and print "Match in $_";
}
__DATA__
Let's test it.
I've got to have both a foo and a bar.
A foo on it's own won't do.
Neither will just a bar.
Fine, the closure works. Now see if it disarms the slash:
my $sub = regexsub('/-+/') or die "Couldn't compile regex";
for("You won't see this!","So this thing /----/ works.\n") {
print if $sub->();
}
BTW I think you'd need to disarm the new "execute Perl code in regex"
feature as well. Anybody knows yet how to use it?
Bart.
------------------------------
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 6133
**************************************