[6714] in Perl-Users-Digest
Perl-Users Digest, Issue: 339 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 19:17:12 1997
Date: Mon, 21 Apr 97 16: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 Mon, 21 Apr 1997 Volume: 8 Number: 339
Today's topics:
Re: A Perl modules confusion... (Gandalf D'Grey)
Re: cgi security - how to protect data from local cgi-s (Dave Ripberger)
executing perl scripts <dflash@netcomuk.co.uk>
Re: First and Last line in a file (Joel Graber)
Re: Help with Filehandles <rra@stanford.edu>
How do I make libperl.a a shared lib? (Henry Avatar Chan)
Re: How to expand a variable in a string? (Nathan V. Patwardhan)
Last item in list is screwed <mnordenstam@imagicgames.com>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Mike Haertel)
Re: MacPerl problems (Dave Giggy)
Oraperl (Rick B Teh)
Re: Ousterhout and Tcl lost the plot with latest paper (Mark A Harrison)
Perl and Access or Oracle <mmiguel@swbell.net>
Re: PERL Editor (Dick Barker)
Re: perl mkdir produces weird permissions (Jack Applin)
Re: perl mkdir produces weird permissions (Mike Stok)
Re: perl mkdir produces weird permissions <rra@stanford.edu>
Re: perl mkdir produces weird permissions <tchrist@mox.perl.com>
Perl Telnet Web CGI HELP! <asahijc@erols.com>
Perl5 Compiler and BSD (Henry Avatar Chan)
pod2info or info pages <dorman@s3i.com.ANTI-SPAM>
Re: Prototypes and anonymous subs <pav@LAS.alfred.edu>
Regular expression question <wwenger@enron.com>
Re: Regular expression question <tchrist@mox.perl.com>
static vs. dynamic typing (was Re: Scripting vs. System (Paul Wilson)
Telnet and Web and Perl <asahijc@erols.com>
Re: Telnet and Web and Perl <eryq@enteract.com>
Re: Two-Way Sockets in Perl <psrc@corp.airmedia.com>
Re: Unix and ease of use (WAS: Who makes more ...) <vladimip@killspammers.com>
Re: Who will win? Borland or Microsoft or Programmers? mac@macsofta.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Apr 1997 22:29:46 GMT
From: grimaldo@IAEhv.nl (Gandalf D'Grey)
Subject: Re: A Perl modules confusion...
Message-Id: <5jgpoq$nd2@news.IAEhv.nl>
D. Emilio Grimaldo T. (grimaldo@panama.iaehv.nl) wrote:
: Hi,
: I am converting a 4.x package to a 5.003 version, however I
: am getting the impression that this 'module' stuff is more a
Fixed it:
1. I still think the modules thing is a bit sloppy, and teh
class/object thing I don't want even to look at, seems so
yuk and fragile. For those things I would rather stick to
a development language. I guess Python is a bit more
refined in additions to the language but aside from that I
am a PIG fan (Perl Is Great)
2. I overlooked that I can only use ONE Export statement with
everthing in it...
3. Also the 'import' thing, It was overriding the import routine
of Exporter! I misunderstood the PODs, but then I did it
BECAUSE:
I need to do something during module import which
makes use of the 'configuration' variables, the
problem is that BEGIN is oblivious of all of them
because it has not interpreted them yet... Shame.
It would be a GOOD idea to extend the Exporter module
so that it can call a user defined import routine
*after* it has done it's own internal import.
o Cheers,
Emilio
--
D. Emilio Grimaldo T.
URL: http://www.iaehv.nl/users/grimaldo/
http://www.iaehv.nl/users/grimaldo/panama.html
------------------------------
Date: Mon, 21 Apr 1997 21:29:20 GMT
From: dlrip@one.net (Dave Ripberger)
Subject: Re: cgi security - how to protect data from local cgi-server shell users?
Message-Id: <335bdacc.2049965@news.one.net>
Ron Elkayam <relkay01@fiu.edu> wrote:
> Hi,
>
> We're running a cgi form and the contents are stored on the cgi-server
> shell account. Is there a way to hide the contents of the cgi script
> itself so local shell users won't be able to simply look at the file,
> figure out where the data files are, and mess up the data?
>
> I *must* give everyone both read and execute permissions on the cgi
> script, and write permission on the actual data files. I could hide
> the data files in an unreadable directory, but again, anyone with a
> cgi-account here could still read the cgi script and find out where the
> data is...
>
> Can anything be done about this?
>
>From my experience, a binary executable can be ran from the shell with
execute-only permission, while a script must have read+execute. I
would think this would be true for cgi. So you might try writing a C
program instead of a perl script, that is if you think it could
provide the desired security. Try something real simple first to see
if my assumption is correct.
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, add ber
| to username in reply to address.
|________
------------------------------
Date: Mon, 21 Apr 1997 22:48:52 +0100
From: Demon Flash <dflash@netcomuk.co.uk>
Subject: executing perl scripts
Message-Id: <335BE0C4.4C73@netcomuk.co.uk>
This is a multi-part message in MIME format.
--------------7338F857762
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I have this perl script that will just not execute. I have flaged it
read and execute globally so that anyone can execute it, i have made
html scripts that #exec it and i have run the script on its own, it just
doesn't seem to work. I have included a copy of the script for you to
look at and if you can let me know of any problems please e-mail me at
any of the addresses at the bottom of the page.
Thanks.
--
Demon Flash, England.
Mailto:dflash@netcomuk.co.uk
Mailto:demon_flash@hotmail.com
http://www.netcomuk.co.uk/~jamesmc/dflash.htm
http://www.hpvca.com
--------------7338F857762
Content-Type: application/x-perl; name="logger.pl"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="logger.pl"
IyEvdXNyL2Jpbi9wZXJsDQoNCiRtYWlscHJvZyA9ICcvdXNyL3NiaW4vc2VuZG1haWwnOw0K
JG15X25hbWUgPSAnRGVtb24gRmxhc2gnOw0KJG15X2VtYWlsID0gJ2RmbGFzaEBuZXRjb211
ay5jby51ayc7DQokZGF0ZSA9ICcvYmluL2RhdGUnOw0KJGxvZ2ZpbGUgPSAiL3Vzci9ob21l
L2hwdmNhLmNvbS9odG1sL2xvZy9sb2dnZXIuaHRtIjsNCg0KcHJpbnQgIkNvbnRlbnQtdHlw
ZTogdGV4dC9odG1sXG5cbiI7DQoNCiZnZXRfZGF0ZTsNCg0Kb3BlbihGSUxFLCAiJGxvZ2Zp
bGUiKSB8fCBkaWUgIkkgY2FuJ3Qgb3BlbiAkbGlua3BhZ2VcbiI7DQoJQGxpbmVzID0gPEZJ
TEU+Ow0KCWNsb3NlKEZJTEUpOw0KCSRzaXplbGluZ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E1BSUwg
IlNvbWVvbmUgdmlzaXRlZCBvbmUgb2YgeW91ciBwYWdlc1xuIjsNCglwcmludCBNQUlMICJv
bjogJGRhdGVcbiI7DQoJcHJpbnQgTUFJTCAiTG9nZ2VyIGhhcyBhcHBlbmRlZCB5b3VyIGxv
ZyBmaWxlIGF0OlxuIjsNCglwcmludCBNQUlMICIkbG9nZmlsZVxuIjsNCglwcmludCBNQUlM
ICJ0aGFua3MgZm9yIHVzaW5nIG15IExvZ2dlciFcbiI7DQoJcHJpbnQgTUFJTCAiLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuIjsNCmNsb3NlKE1BSUwpOw0K
CQl9
--------------7338F857762--
------------------------------
Date: 21 Apr 1997 20:13:02 GMT
From: jgraber@daldd.sc.ti.com (Joel Graber)
Subject: Re: First and Last line in a file
Message-Id: <JGRABER.97Apr21151302@sun_7407>
ebohlman@netcom.com (Eric Bohlman) writes:
> Newsgroups: comp.lang.perl.misc
> Greg Keene (gkeene@watertown.com) wrote:
> : If I have a large text file and I want to load the first line and the last
> : line without having to load all the lines in between, what's the most
> : efficient way?
>
> : I didn't find this in the FAQ (didn't address how to look at the last line).
> : I don't think seek will work because it takes you past the last line, right?
>
> Reading the first line is easy, of course. For the last line, you'll have
> to seek to the next-to-last character in the file (assuming that you know
> that there's a newline at the end of the last line; this often turns out
> to be missing if people can manually edit the file), read it in and keep
> seeking backwards and reading a character at a time until you encounter
> another newline. You may as well build up the last line
> character-by-character as you do this.
What is the point of reading the file byte-by-byte?
Is there some penalty for accidently reading more than the last line?
Look at the perlfunc entry for seek FILEHANDLE,POSITION,WHENCE :
" The values for WHENCE are 0 to set the
file pointer to POSITION, 1 to set the it to current
plus POSITION, and 2 to set it to EOF plus offset."
So Seek ye WHENCE to the end of the file, with a negative offset that is
bigger than your last line is guaranteed to be.
Read a block or lines until you find the last line.
Actually, Eric's post isn't so bad, if you understand to use
seek(x,-blksize,2) to seek to near the end of file,
and then just substitute "block" where he has "character".
------------------------------
Date: 21 Apr 1997 12:56:22 -0700
From: Russ Allbery <rra@stanford.edu>
To: ptanner@doom.sw.stratus.com (Philip Tanner)
Subject: Re: Help with Filehandles
Message-Id: <qumlo6c40bd.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
Philip Tanner <ptanner@doom.sw.stratus.com> writes:
> I'd like to use the filehandle somehow to pass the filename to diff, but
> am having problems doing that. I've declared diff with the use Shell
> directive, but no matter how I pass the filehandle, it doesn't work.
> I'd rather not have to hardwire the filename to a variable as it could
> be either one of two names, and given the filehandle is already set to
> the correct names(s), it makes sense to use it. Does anyone know what I
> need to do to get this to work?
diff needs the filename as a string, and file handles don't know their
associated name. You'll have to keep track of the name yourself in an
additional variable (initialize it when you open the file handle).
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 21 Apr 1997 20:04:24 GMT
From: q8e192@ugrad.cs.ubc.ca (Henry Avatar Chan)
Subject: How do I make libperl.a a shared lib?
Message-Id: <5jgh88$apn$1@nnrp.cs.ubc.ca>
How do I make libperl.a a shared lib?
I'm planning to use this with the Perl5 compiler,
but I hear that this lib must be shared.
How?
I'm running FreeBSD
thx
Henry Chan
q8e192@ugrad.cs.ubc.ca
------------------------------
Date: 21 Apr 1997 21:00:53 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to expand a variable in a string?
Message-Id: <5jgki5$m8n@fridge-nf0.shore.net>
Petr Prikryl (prikryl@dcse.fee.vutbr.cz) wrote:
: I have read a string into my variable $str. The string may be something
: like this:
: "some text $variable and some text again"
$str_1 = "foo bar";
$str_2 = "here they are: ".$str_1." baz";
print $str_2,"\n";
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 21 Apr 1997 14:54:57 -0500
From: Marcus Nordenstam <mnordenstam@imagicgames.com>
Subject: Last item in list is screwed
Message-Id: <335BC611.B8B@imagicgames.com>
Why is it that when I write:
@list = ("a\n","b\n");
the expression
while( $l = <@list> )
{
print $l;
}
evaluates to:
a<CR>
b
when it ought to be:
a<CR>
b<CR>
where <CR> is a carriage return, or newline.
It seems like the last item in the list has it's newline
removed, which is silly. It means that you can't treat
each list element the same, you have to check for the last
item and special-case it.
Or is there perhaps some way to disable this "feature"??
~Marcus
------------------------------
Date: 21 Apr 1997 21:00:36 GMT
From: mike@ducky.net (Mike Haertel)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <slrn5lnl9m.la9.mike@ducky.net>
In article <335BAB74.458F@polaroid.com>, M. Prasad wrote:
>If this experience is BS, what is the truth? Why _did_
>the Lisp machines die?
The Lisp machines died mostly because Lisp running on conventional
architectures began to beat LispM performance starting in the late
1980's. The LispM market was not large enough to sustain the R&D
investment required to be performance-competitive with the workstation
RISC processors. The conventional processors could also run many
other applications that could only have been ported to the LispM's
at great cost.
LispM proponents like to brag about the advantages of their
software, but conveniently neglect that it also had some
substantial disadvantages:
* LispM's were not multi-user - they could have only
one logged-in user at a time, although they did
provide a degree of remote access.
* LispM's were not secure - the whole system, including
the operating system kernel, ran in a single giant
address space.
The LispM's also cost too much--especially for single-user machines!
The lesson: If you're going to be different, you'd better offer
some *extremely* compelling advantages, or your more conventional
competitors will have you for lunch.
------------------------------
Date: Mon, 21 Apr 1997 15:37:49 +0100
From: gig@znet.com (Dave Giggy)
Subject: Re: MacPerl problems
Message-Id: <gig-2104971537500001@capts-33.znet.com>
>
>I'm having severe problems with the latest release of MacPerl (5.1.3r2).
>Those are the problems:
>
>1. I cannot get the help function to work, even though my Internet Config
>is correctly configured as per the instructions in the README.MAC.
>Everytime I choose some item in the help listing that calls for something
>in the pod folder, MacPerl wants to launch the Internet Config app.
>
I found that I had to drag the Help file icon onto the MacPerl app to get
to see the help info. ( It is worth it )
>2. A more serious one. When I try to compile (or build or whatever) a pm
> clip..
The documentation on my MacPerl download indicated it was a 68K version
and the PowerPC version wasn't yet available.
Really though, the Perl stuff ive been doing can be done with a text file
editor ( I often just use PageSpinner 1.2.2, which is my HTML editor [a
$25 shareware item that is dandy for lots of uses on the Mac]).
I just check the syntax with macperl's checker which will probably be OK
on your machine.
All i have been using it for however, is CGI stuff so my server provides a
lot of the translation stuff.
Good luck- gig
------------------------------
Date: 21 Apr 1997 21:41:20 GMT
From: boonteh@acsu.buffalo.edu (Rick B Teh)
Subject: Oraperl
Message-Id: <5jgmu0$r6i@prometheus.acsu.buffalo.edu>
Hi...
I know both Oracal and Perl, but have no knowledge in using oraperl.
Can anyone please give me some sort of guide line for a newbie like
me? I need to at least get myself started. Thanks in advance.
-Rick
------------------------------
Date: 21 Apr 1997 22:06:44 GMT
From: mharriso@utdallas.edu (Mark A Harrison)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5jgodk$nd7$1@news.utdallas.edu>
Paul Wilson (wilson@cs.utexas.edu) wrote:
: That's understandable, too. What I'm trying to figure out is which issues
: are the most important in overcoming resistance to things like Scheme
: and Smalltalk.
I can't address smalltalk, but with regards to scheme and lisp
in general:
1. People thing lisp is weird.
2. People think lisp programmers are weirdos.
3. All attempts by lisp programmers to refute #1 seem to confirm #2.
I have to agree with Karl Lehenbauer's points regarding this... I
enjoyed lisp, but there's lots of people who just don't seem
to relate to it.
In another post, you mention that the computer language community
should be embarrased by Tcl (I can't quite remember the exact wording).
I think that an equally valid question is:
Why are so many of the popular languages created not by language
theorists but by people trying to accomplish some other task?
(I think JO raised this last point in his MIT lecture.)
Mark.
------------------------------
Date: Mon, 21 Apr 1997 15:11:07 -0500
From: Maribeth Miguel <mmiguel@swbell.net>
Subject: Perl and Access or Oracle
Message-Id: <335BC9DB.5D6A@swbell.net>
Does anyone know if Perl can access/update an Access or Oracle Database
and how(or a link to a site or book)?
Thanks
dmanning@swbnet.net
------------------------------
Date: Mon, 21 Apr 1997 21:23:45 GMT
From: dickb@eskimo.com (Dick Barker)
Subject: Re: PERL Editor
Message-Id: <19970421142345497538@dickb.ndip.eskimo.net>
Don't see what the fuss is about. Real perl programmers use cat >fname
to write their stuff. See comp.sys.unix.perl.editors.cat for more help.
:-)
Tad McClellan <tadmc@flash.net> wrote:
> Mike (mike@pentagon.abel.co.uk) wrote:
>
> : this has a lot to do with cgi cos perl is a language that is used in cgi
>
>
> Uhh. So, since I use Perl for developing Accounting software, I can
> ask about program editors in biz.comp.accounting ???
>
>
> This has *nothing* to do with CGI. Just because lots of people choose
> to use Perl to implement their CGI scripts, does not mean they are
> the same. People who use C, C++, VB, Java, JavaScript, shell, Delphi,
> Lisp, Pascal for their CGIs have no interest in what is a good editor
> for Perl.
>
> They have an interest in CGI programming issues, not language specific
> issues.
>
> There are language specific newsgroups for language specific discussion.
>
>
> So,
>
> Please try to pick your newsgroups appropriately. (still!)
>
>
>
> Perl != CGI
>
>
>
> : A. Deckers wrote in article <5j2c3k$61u@Holly.aa.net>...
> : >In comp.infosystems.www.authoring.cgi,
> : > aschenk@prospernet.com wrote:
> : >:I'm looking for a windows based perl editor. It could be as simple as
> : >:notepad with a perl syntax checker. Anybody got any ideas?
> : >
> : >Emacs?
> : >
> : >BTW, what's this question doing in comp.infosystems.www.authoring.cgi? In
> : >what way does it deal with CGI? Please try to pick your newsgroups
> : >appropriately.
>
>
> --
> Tad McClellan SGML Consulting
> Tag And Document Consulting Perl programming
> tadmc@flash.net
--
Dick Barker dickb@eskimo.com http://www.eskimo.com/~dickb/
Do you qualify to join OFDA? http://www.eskimo.com/~dickb/ofda.html
San Juan Isl Dive Charter? http://www.eskimo.com/~dickb/starfire.html
------------------------------
Date: 21 Apr 1997 20:20:01 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: perl mkdir produces weird permissions
Message-Id: <5jgi5h$34v@fcnews.fc.hp.com>
Ken Anderson wrote:
> i was trying to use the perl mkdir function and
> am winding up with weird permissions on the directory.
>
> mkdir filename,mode
>
> Camel book says that it will be made "with permissions
> set by mode (as modified by the current masks)."
>
> Well, this is rather vague and the behaviour is not
> at all obvious. eg.
>
> on a process with the umask as 022
>
> mkdir filex,777 gives d-----x--x filex
> mkdir filex,000 gives d--------- filex
> mkdir filex,333 gives dr-x--xr-x filex
> mkdir filex,111 gives d--xr-xr-x filex
> mkdir filex,755 gives d-wxr----x filex
Read the FAQ, available at http://www.perl.org/CPAN/doc/FAQs/,
and search for "mkdir". It says:
> chmod(644, $file); # WRONG -- perl -w catches this
> chmod(0644, $file); # right
If you want to specify permissions in octal, then you should
use an octal constant--with a leading 0. Try this:
mkdir "filex",0777;
-Jack Applin
------------------------------
Date: 21 Apr 1997 20:45:48 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl mkdir produces weird permissions
Message-Id: <5jgjls$8r5@news-central.tiac.net>
In article <y7xwwpwicxw.fsf@necsys.gsfc.nasa.gov>,
Ken Anderson <anderson@necsys.gsfc.nasa.gov> wrote:
>Hi again,
>
>i was trying to use the perl mkdir function and
>am winding up with weird permissions on the directory.
>
> mkdir filename,mode
>
>Camel book says that it will be made "with permissions
>set by mode (as modified by the current masks)."
>
>Well, this is rather vague and the behaviour is not
>at all obvious. eg.
>
>on a process with the umask as 022
>
>mkdir filex,777 gives d-----x--x filex
>does this make sense to anybody?
Yes, you are specifying a mode in decimal, perl does automatic octal
conversions in program text, so you can say
mkdir 'filex', 0777 or die "$0: mkdir failed ($!)\n";
or
$mode = '777';
mkdir 'filex', oct $mode or die "$0: mkdir failed ($!)\n";
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 21 Apr 1997 13:02:11 -0700
From: Russ Allbery <rra@stanford.edu>
To: Ken Anderson <anderson@necsys.gsfc.nasa.gov>, Ken Anderson <anderson@necsys.gsfc.nasa.gov>
Subject: Re: perl mkdir produces weird permissions
Message-Id: <qumhgh0401o.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
Ken Anderson <anderson@necsys.gsfc.nasa.gov> writes:
> i was trying to use the perl mkdir function and am winding up with weird
> permissions on the directory.
> mkdir filename,mode
> Camel book says that it will be made "with permissions set by mode (as
> modified by the current masks)."
> on a process with the umask as 022
> mkdir filex,777 gives d-----x--x filex
> mkdir filex,000 gives d--------- filex
> mkdir filex,333 gives dr-x--xr-x filex
> mkdir filex,111 gives d--xr-xr-x filex
> mkdir filex,755 gives d-wxr----x filex
> does this make sense to anybody?
Yup. You're passing decimal values in as the mode, and mode is
interpreted as an octal number. So you get weird behavior like that. You
need to put a leading 0 on all of those mode numbers above and then
they'll do exactly what you want.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 21 Apr 1997 21:36:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl mkdir produces weird permissions
Message-Id: <5jgmku$acv$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Ken Anderson <anderson@necsys.gsfc.nasa.gov> writes:
:i was trying to use the perl mkdir function and
:am winding up with weird permissions on the directory.
:
: mkdir filename,mode
You didn't read the FAQ entry:
Why isn't my octal data interpreted correctly?
Perl only understands octal and hex numbers as such when they occur
as literals in your program. If they are read in from somewhere and
assigned, no automatic conversion takes place. You must explicitly
use oct() or hex() if you want the values converted. oct() interprets
both hex ("0x350") numbers and octal ones ("0350" or even without
the leading "0", like "377"), while hex() only converts hexadecimal
ones, with or without a leading "0x", like "0x255", "3A", "ff", or
"deadbeef".
This problem shows up most often when people try using chmod(),
mkdir(), umask(), or sysopen(), which all want permissions in octal.
chmod(644, $file); # WRONG -- perl -w catches this
chmod(0644, $file); # right
I agree that if chmod can catch this on -w, mkdir should as well.
It doesn't seem to right now.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"That is not dead which can eternal lie
And with strange aeons, even death may die."
--H.P. Lovecraft
------------------------------
Date: Mon, 21 Apr 1997 17:58:08 +0000
From: Atsushi Amemiya <asahijc@erols.com>
Subject: Perl Telnet Web CGI HELP!
Message-Id: <335BAAB0.4355@erols.com>
I'm hoping someone could help me.
There seems to be things you can do from telnet
but not by a CGI that is executed by a
click from a user.
For example, in my perl program, there is a line
that searches htm files in my directory
and pipe the result to t.dat.
system ("find /mnt/web/guide
/abcdefg/*.htm > t.dat");
When I execute this program from telnet,
it works, meaning, it creates a file, t.dat.
But when I execute it from my web browser
by a click of a button, the line is ignored.
Can anyone tell me what's wrong with this?
Thanks in advance.
Atsushi
------------------------------
Date: 21 Apr 1997 21:22:04 GMT
From: q8e192@ugrad.cs.ubc.ca (Henry Avatar Chan)
Subject: Perl5 Compiler and BSD
Message-Id: <5jglps$bet$1@nnrp.cs.ubc.ca>
Could anyone who has successfully got the Perl5 Compiler using
dynamic libs to work on FreeBSD please email me?
I have a lot of question to ask...
thx
q8e192@ugrad.cs.ubc.ca
Henry Chan
------------------------------
Date: 21 Apr 1997 14:34:47 -0400
From: Clark Dorman <dorman@s3i.com.ANTI-SPAM>
Subject: pod2info or info pages
Message-Id: <d7mhw5ins.fsf@s3i.com>
I'm working on perl in emacs, and the easiest way to use the manual is
to use GNU info pages in emacs. However, I cannot find a pod2info.
Does one exist?
The only thing that I have been able to find is pod2texinfo. This
works without crashing, but then makeinfo does not work on the
outputs.
I was using:
pod2texinfo: http://www.perl.org/CPAN/doc/pod2x/pod2texinfo
makeinfo: GNU Makeinfo (Texinfo 3.9) 1.67
on a Sun Sparc 20, Solaris 5.4.
--
Clark Dorman "Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html -Francis Crick
------------------------------
Date: Mon, 21 Apr 1997 14:08:09 -0400
From: Steven Elliot Pav <pav@LAS.alfred.edu>
To: Markus Laker <laker@tcp.co.uk>
Subject: Re: Prototypes and anonymous subs
Message-Id: <Pine.LNX.3.95.970421135326.746A-100000@LAS.alfred.edu>
On Fri, 18 Apr 1997, Markus Laker wrote:
> 1: sub fillin (&$\$)
> 2: { my ($code, $a, $ret) = @_;
> 4: print "$$ret ", &$code($a), "\n";
> 5: $$ret = "ice cream";
> 6: }
> 7:
> 8: my $retval = 'jelly';
> 9:
> 10: fillin sub {$_[0] gt 'a';}, 'b', \$retval;
> 11: print $retval;
this might be simpler to read/maintain.
s. y. elliot pav
pav@las.alfred.edu
http://las.alfred.edu/~pav/
3000 trinity drive apt 64, los alamos, nm 87544
------------------------------
Date: Mon, 21 Apr 1997 20:43:21 GMT
From: "Bill Wenger" <wwenger@enron.com>
Subject: Regular expression question
Message-Id: <01bc4e95$5839ae00$af3cfb9b@eoghou1277.eog.enron.com>
I have data in a comma delimited file such that some of the fields
themselves contain commas. What I need to do is split the fields by the
commas but the data that has a comma embedded in it is throwing off the
split function. When the data does indeed have a comma in it, the data is
put in double quotes. Thus I have something like the following:
10,"Fred, Wilma and Pebbles","The Flintstones",100
20,"Barney, Betty and Bambam Rubble","The Flintsones",150
30,"Jerry Seinfeld","Seinfeld",200
What I would like to be able to do is to break the fields of each record
into 4 fields something like ($f1,$f2,$f3,$f4) = split/,/;
This works on the last record but not on the first two. I don't mind
stripping the extra commas out or replacing them with some other character.
Any help would be appreciated.
Thanks,
Bill Wenger
------------------------------
Date: 21 Apr 1997 21:38:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Regular expression question
Message-Id: <5jgmoh$acv$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Bill Wenger" <wwenger@enron.com> writes:
:I have data in a comma delimited file such that some of the fields
:themselves contain commas. What I need to do is split the fields by the
:commas but the data that has a comma embedded in it is throwing off the
:split function. When the data does indeed have a comma in it, the data is
:put in double quotes.
FAQqed again:
How can I split a [character] delimited string except when inside
[character]? (Comma-separated files)
Take the example case of trying to split a string that is
comma-separated into its different fields. (We'll pretend you said
comma-separated, not comma-delimited, which is different and almost
never what you mean.) You can't use `split(/,/)' because you shouldn't
split if the comma is inside quotes. For example, take a data line
like this:
SAR001,"","Cimetrix, Inc","Bob Smith","CAM",N,8,1,0,7,"Error, Core Dumped"
Due to the restriction of the quotes, this is a fairly complex
problem. Thankfully, we have Jeffrey Friedl, author of a highly
recommended book on regular expressions, to handle these for us. He
suggests (assuming your string is contained in $text):
@new = ();
push(@new, $+) while $text =~ m{
"([^\"\\]*(?:\\.[^\"\\]*)*)",? # groups the phrase inside the quotes
| ([^,]+),?
| ,
}gx;
push(@new, undef) if substr($text,-1,1) eq ',';
Alternatively, the Text::ParseWords module (part of the standard perl
distribution) lets you say:
use Text::ParseWords;
@new = quotewords(",", 0, $text);
--
Tom Christiansen tchrist@jhereg.perl.com
I dunno, I dream in Perl sometimes...
--Larry Wall in <8538@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 21 Apr 1997 17:01:47 -0500
From: wilson@cs.utexas.edu (Paul Wilson)
Subject: static vs. dynamic typing (was Re: Scripting vs. Systems)
Message-Id: <5jgo4b$dlc@roar.cs.utexas.edu>
[ Note: followups trimmed. ]
In article <r8t4td14mfc.fsf@nordica.CS.Princeton.EDU>,
Daniel Wang <danwang@nordica.CS.Princeton.EDU> wrote:
>>>>>> "Marc" == Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de> writes:
>
> Marc> Daniel Wang (danwang@dynamic.CS.Princeton.EDU) wrote about Lisp:
>
> >> This is why Lisp doesn't have a type system,
> {stuff deleted}
> Marc> What it doesn't have is _enforced_ statically decidable typing.
>
>This is my definition of a type system. I should be shot for forgetting some
>people have very different ideas of what a type system is. **Statically
>decidable** typing is what make "type systems" a win as it catches errors at
>compile time rather than at runtime.
I'm not sure what you mean here, so perhaps some clarification is in
order.
What the Lispers are talking about is optional enforced
static typing. The idea is that you can statically type important
parts of your code, for all of the usual reasons, but you can also
use dynamic typing if you find it more convenient for rapid prototyping
or if there's something you believe is correct but can't express
to the static type system. Common Lisp and Dylan let you do some
of this sort of thing.
Common Lisp allows an implementation to completely ignore type
declarations, and some implementations do at higher optimization
levels. They assume that you'll get your program debugged with
extensive checking, and then compile it for speed rather than safety.
Some implementations always put in any checking if they can't optimize
it away, so that you don't lose safety at higher optimization levels,
and instead you may lose a little speed.
(My own preference is that a language should make it explict that
type declaratiosn are always repected and checked at compile-time
or run-time, but also provide for "trust me" type declarations
where you've proved to your own satisfaction you're right. This
is important in developing tweaked code, like an object system
implemented within the language. The typing of such things
can be very hard to explain to any compiler, because the
constraints aren't local.)
Dynamic typing is sometimes more convenient and expressive (in the
sense of "being able to express a computation" to the system concisely)
in general, and static typing is intentionaly more restrictive, but more
"expressive" in a different sense---you can express more *constraints*
on computations, and have the compiler "check your work."
I'm not trying to take a stand here on whether your program should
be mostly statically typed, or mostly dynamically typed. It is
clear that polymorphic static type systems are much more expressive than
earlier, monomorphic type type systems---they let you do more things
that you could in, say C's type system, without the compiler getting
confused and rejecting your program. This lets you do many of the things
that previously required a dynamic type system. However, most or all of
the advanced polymorphic type systems are awkward for some styles of
programming (particularly OOP programming with side effects.)
W.R.T. this thread, dynamic typing is attractive to many poeple
for scripting because it is very simple to implement, very simple to
understand, and supports wildly extensible langauges based on a tiny,
clean core language. The addition of optional strong typing can
help with programming in the large. However, static polymorphic type
systems have nice advantages, too, and some of the newer type systems
seem to combine many of the best featurees of both. (I believe
there are still limitations, such as typing things like eval,
and other metaleval code, which turns out to be quite relevant
to scripting languages.)
If people want to discuss advanced type systems, I suggest we do
it elsewhere, so I've set followups to comp.lang.misc.
--
| Paul R. Wilson, Comp. Sci. Dept., U of Texas @ Austin (wilson@cs.utexas.edu)
| Papers on memory allocators, garbage collection, memory hierarchies,
| persistence and Scheme interpreters and compilers available via ftp from
| ftp.cs.utexas.edu, in pub/garbage (or http://www.cs.utexas.edu/users/wilson/)
------------------------------
Date: Mon, 21 Apr 1997 17:17:51 +0000
From: Atsushi Amemiya <asahijc@erols.com>
Subject: Telnet and Web and Perl
Message-Id: <335BA13F.791C@erols.com>
I'm hoping someone could help me.
There seems to be things you can do from telnet but not by a CGI that is executed by a
click from a user.
For example, in my perl program, there is a line that searches htm files in my directory
and pipe the result to t.dat.
system ("find /mnt/web/guide/abcdefg/*.htm > t.dat");
When I execute this program from telnet, it works, meaning, it creates a file, t.dat.
But when I execute it from my web browser by a click of a button, the line is ignored.
Can anyone tell me what's wrong with this?
Thanks in advance.
Atsushi
------------------------------
Date: Mon, 21 Apr 1997 17:14:30 -0500
From: Eryq <eryq@enteract.com>
To: Atsushi Amemiya <asahijc@erols.com>
Subject: Re: Telnet and Web and Perl
Message-Id: <335BE6C6.4FB68B95@enteract.com>
Atsushi Amemiya wrote:
> There seems to be things you can do from telnet but not by a CGI that is executed by a
> click from a user.
Yup, that's very true...
> system ("find /mnt/web/guide/abcdefg/*.htm > t.dat");
>
> When I execute this program from telnet, it works, meaning, it creates a file, t.dat.
>
> But when I execute it from my web browser by a click of a button, the line is ignored.
This is not a Perl issue; it's a CGI issue, and it's covered in
several FAQs. I suggest you start with "The Idiot's Guide to Solving Perl
CGI Problems", at:
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
Hope that helps,
--
___ _ _ _ _ ___ _ Eryq (eryq@enteract.com)
/ _ \| '_| | | |/ _ ' / Hughes STX, NASA/Goddard Space Flight Cntr.
| __/| | | |_| | |_| | http://www.enteract.com/~eryq
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Mon, 21 Apr 1997 14:59:13 -0400
From: Paul S R Chisholm <psrc@corp.airmedia.com>
Subject: Re: Two-Way Sockets in Perl
Message-Id: <335BB901.7C23@corp.airmedia.com>
John Michael Pirie wrote:
> I am setting up a simple client-server application in perl,
> and am having difficulty with sockets. I have found many examples
> of client-server applications, but have been unable to find
> any where two-way communication takes place.
I think I'm confused. Client-server applications usually involve two-way
communications.
The only difference between a client and a server is how each sets up
its half of the connection. A client connects to a server port. A server
listens to a server port, then accepts a connection. Once that's
happened, the resulting socket on either end can be read from, written
to, or both, in any order. (That's a big difference between a socket and
a pipe.)
The Blue Camel socket server example might be a little confusing, in
that it makes STDIN and STDOUT both point to the socket, then invokes a
routine that reads from STDIN and writes to STDOUT. (It's a great
approach for debugging and reuse, though, since it lets you invoke the
function with or without sockets.)
--Paul S. R. Chisholm, AirMedia, Inc. (formerly Ex Machina)
mailto:psrc@exmachina.com http://www.exmachina.com/~psrc
I'm not speaking for the company, I'm just speaking my mind
------------------------------
Date: Mon, 21 Apr 1997 12:56:18 -0700
From: Da Borg <vladimip@killspammers.com>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <335BC662.277D5EAA@killspammers.com>
[misc.jobs.misc, comp.sys*, comp.object removed from the crosspost]
Tim Behrendsen wrote:
...........
> > OK, how about a Linux kernel? *I* find it hugely useful, letting me
> > program and do just about anything I damn well please; I get TeX, I
> > get a good C++ compiler, I get vast abilities to munge text (most of
> > what I do). Others use them to run ISPs, servers, firewalls, almost
> > everything. It has full TCP/IP support, IPX, security, quotas,
> > accounting, whatever.
>
> Yes, good example. And is more evidence for my point, of course.
> Linux is far, far from the best Unix, for any price. An excellent
> product, but far from the best. (some say it's not even the best
> *free* Unix).
This is strange because accordingly to my experience, it
actually _is_ one of the best Unixes, both commercially and
free implemented. However, even all Unixoid OSes are designed
with slightly different goals in mind, so it depends what you
want to do with your OS. E.g. if you (theoretically) tried to
install Linux on a $600,000 128 CPUs Cray mainframe with liquid
cooling, where you should be running UNICOS instead, I agree
it would not do too well, but on iX86 architecture, Linux beats
most commercial alternatives hands down. I won't mention
the brands and trademarks to avoid another flame thread.
--
My real email address is: <vladimip @ uniserve dot com>
#include <disclaimer.h> | *Good pings come in small packets*
Vancouver | Ceterum censeo Microsoftam delendam esse
British Columbia | SIGSIG -- signature too long (core dumped)
------------------------------
Date: Mon, 21 Apr 1997 16:37:26 -0700
From: mac@macsofta.com
Subject: Re: Who will win? Borland or Microsoft or Programmers?
Message-Id: <335BFA36.1F87@macsofta.com>
> M A wrote:
>
> Hi,
> My company is planning to start a project. We have a big question
> about our investments. We don't know if we should use Microsoft
> compiler or Borland. Some myth we heard over the net.
>
> 1) 90% of the programmer uses Microsoft Compiler.
> That's absoutly untrue for now and future..
---90% uhh, since when. I just looked up TRST report and that says 50%
Microsoft, 30% Borland, and 20% all others...
> > 2) Borland will vanish in 2 years (NASDAQ:BORL)
> Borland's bad finicial situation was issused four years ago, somebody
> said Borland will vanish in 2 years, and 4 years passed, look what's
> happening?
That won't happen. Look at Netscape. It is still alive and running
faster then ever.
> > 3) Borland has better compiler
> Well, they have the fastest compiler for C++ (C++Builder), TOP
> RAD(Delphi) and Very Very Fogotten but a very very professional and
> powerful Visual dBase.. Actually, they have better compiler.. But
> language itself is not only compiler..(Forget I didn't metion both
> Borland and Microsoft doesn't support mulitiple-platform, yet..)
Entera or what ever from Borland will set the standard for next 10
years.
> > 4) 99% of the College in US have/use Borland Compiler.
> That's absoutly untrue, either..
Well it more like 80%.
> If you want to choose project between Borland and Microsoft, my
> suggestion is depended on what do you actually need. Actually, if you
> wnat to make DOS-GAMES, window PE and all kinds of mutiple-platform PC
> apps, choose Borland C++ 5.1 (VC++ doesn't support these platform
> anymore..) if you want RAD, choose Delphi. If you are using MS-Office
> (which is the top office suite), choose VB. If you have a bunch of
> people accustomed to MFC class library, choose VC++..
>
> And also, if you are using Linux, UNIX, X windows, SUN, and others, IBM
> visual Age is the best choice..
>
> >
> > Some one show us the way?
> >
Don't worry about the size of Microsoft. Your company need productivity
so go for Borland. After all if you have a good product it will make up
all the investment during the first 6 month. I have seen project
written in VB and VC. I know the difference it make. Don't let
Microsoft wash your brain. They are only good and Marketing and hypeing
the shit out of a product. MacOS is much superior then Win97. Se ya
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 339
*************************************