[11834] in Perl-Users-Digest
Perl-Users Digest, Issue: 5434 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 21:07:25 1999
Date: Tue, 20 Apr 99 18:00:17 -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 Tue, 20 Apr 1999 Volume: 8 Number: 5434
Today's topics:
Re: can't glob in Linux <jbusco@my-dejanews.com>
Re: Checksums from hell (Mike Wescott)
ERROR: Read on closed filehandle <_GEN_0> (help!) <tterrel@enron.com>
I need solid information <danba@apexinteractive.com>
Re: ifeither--How about some feedback? (David H. Adler)
Re: ifeither--How about some feedback? <uri@sysarch.com>
Re: ifeither--How about some feedback? (David H. Adler)
Re: ifeither--How about some feedback? (Larry Rosler)
Re: Is it REALLY impossible to install Perl on Windoze? <cassell@mail.cor.epa.gov>
Re: Perl vs. OTHER scripting languages ? When/Why to us <Marcin.Kasperski@softax.com.pl>
Re: Perl vs. OTHER scripting languages ? When/Why to us (Thorfinn)
Permissions for Directory trevod@hotmail.com
Re: Problem with writing to file. scraig@my-dejanews.com
Re: search msoffice documents (Alastair)
Re: to match pattern ended with 4 digits <cassell@mail.cor.epa.gov>
Re: Unix files in MacPerl (Ook!)
Re: Wanna post, need programmer help <wyzelli@yahoo.com>
Re: Wanted: opinions on bytecode-compiling modules unde <cassell@mail.cor.epa.gov>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Apr 1999 23:16:57 GMT
From: John Busco <jbusco@my-dejanews.com>
To: ronald.fischer@icn.siemens.de
Subject: Re: can't glob in Linux
Message-Id: <7fj1t6$ll2$1@nnrp1.dejanews.com>
Some more information for anyone interested in the problem described below,
which is to do a "chdir, glob, print filenames" under RedHat Linux 5.0
1) I found that the simple script works under the bash shell, but doesn't
work under tcsh!
2) I updated the perl and bash packages on my RedHat 5.0 distribution, but
the problem remains. I didn't see any update for the tcsh package.
3) Just in case I made a typo or some newbie perl mistake, I executed the
script directly from the Learning Perl examples file
ftp://ftp.ora.com/published/oreilly/nutshell/learning_perl2/examples.tar.gz
file ex_12-1. The example didn't work under tcsh and my Linux installation,
either!
4) The example works under Solaris 2.5 and (ugh) Win95.
At the moment I can get around the problem by using readdir instead of glob.
But, I'm sure curious as to why such a seemingly basic function doesn't work
under seemingly mature versions of Perl and Linux.
Thanks for any help,
John
In article <7fecpo$e79$1@nnrp1.dejanews.com>,
jbusco@my-dejanews.com wrote:
> Hi,
>
> I'm a newbie to perl and linux, but enthusiastically learning.
> I'm going through the Llama book "Learning Perl". There is a
> really simple exercise to change to a directory and list the
> files in that directory through globbing. It doesn't work on
> my RedHat 5.0 system!
>
> Here's the script:
>
> #!/usr/bin/perl -w
>
> print "Where to? ";
> chomp($newdir = <STDIN>);
> chdir($newdir) || die "Cannot chdir to $newdir: $!";
> foreach (<*>) {
> print "$_\n";
> }
>
> And here's the output:
>
> $ perl -w answer.pl
> Where to? /bin
> shell-init: could not get current directory: getwd: cannot access parent
> directories
> [followed by a listing of all the files in my HOME directory, not /bin!]
>
> Can anyone explain to me why this simple code doesn't work? Does it have
> anything to do with perl relying on csh, but Linux's csh is really a link
> to tcsh?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 20 Apr 1999 19:34:44 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: Checksums from hell
Message-Id: <x4hfqarhm3.fsf@cygnus.ColumbiaSC.NCR.COM>
In article <7fh9gq$vj5$1@nnrp1.dejanews.com> aaronsca@hotmail.com writes:
> So it's like this: I want to be able to generate checksums just like
> the BSD "sum" program. I tried the unpack("%32C*", <>) way just like
> in the camel book. This works fine until you try to checksum
> hundreds of files that are hundreds of megs. It takes forever. So,
> I tried going the sysread method, but for some reason I just can't
> get it right. Some of the checksums are ok, but others are wrong,
> and it is really frustrating.
I suggest looking at the implementation of sum by Theo Van Dinter in
the Perl Power Tools collection:
http://language.perl.com/ppt/src/sum/index.html
which performance (in the sysv sum code) can be improved by using
unpack:
*** sum.theo.old Tue Apr 20 18:08:37 1999
--- sum.theo Tue Apr 20 18:49:59 1999
***************
*** 63,71 ****
my($buflen) = 4096; # buffer is "4k", you can up it if you want...
while($num = sysread $fh, $buf, $buflen) {
! for($len = ($len+$num), $i = 0; $i<$num; $i++) {
! $crc += ord(substr $buf, $i, 1); # total bytes
! }
}
# crc = s (total of bytes)
--- 63,70 ----
my($buflen) = 4096; # buffer is "4k", you can up it if you want...
while($num = sysread $fh, $buf, $buflen) {
! $len += $num;
! $crc += unpack("%32C*", $buf);
}
# crc = s (total of bytes)
Moreover, the camel has it wrong. Page 237 should be
undef $/;
$checksum = unpack("%32C*",<>) % 65535;
And this is still not quite correct. This is compatible with the GNU
version of sum. But for other versions (like Solaris 7 and other
SysVr4 derived sum's)
undef $/;
$checksum = unpack("%32C*",<>);
$checksum = ($checksum & 0xffff) + int($checksum/0x10000);
$checksum = ($checksum & 0xffff) + int($checksum/0x10000);
is correct. The difference being in cases where the 32-bit sum is a
multiple of 65535. The former will print 0, the later 65535.
--
-Mike Wescott
mike.wescott@ColumbiaSC.NCR.COM
------------------------------
Date: Tue, 20 Apr 1999 23:48:14 GMT
From: "Tracy" <tterrel@enron.com>
Subject: ERROR: Read on closed filehandle <_GEN_0> (help!)
Message-Id: <01be8b88$420cf0b0$db9fa8c0@tterrel>
I am a new PERL programmer (:-) and could use some help with an error...
I am in a while loop wherein I repeatedly glob a variable to fill an array
with matching files... however, no files are matching (even though I am
SURE there is a match to be made) and I get this error (from perl -w):
Read on closed filehandle <_GEN_0> at \\xxxxx.xxxx.com\sharename\fh.pl line
43.
Here is the actual code:
MAIN: while ($keepgoing) {
# build array full of files that are ready to be processed
@readyfiles = glob($filemask);
#loop at resulting array to perform actions on each filename
found
foreach (@readyfiles) {
handle_file ($_);
}
# sleep for awhile before looking again for new files
sleep($sleepsec);
}
In this case, $filemask is = "\\xxxxx.xxxx.com\sharename\ABC*.txt", and it
is line 43 of the program!
Thanks in advance for any assistance....
Tracy
------------------------------
Date: Tue, 20 Apr 1999 18:35:05 -0500
From: Dan Barrett <danba@apexinteractive.com>
Subject: I need solid information
Message-Id: <371D0F28.B3D1E645@apexinteractive.com>
Anyone--that can post some solid references for programming/using/etc.
sockets and ports (tcp sockets are the critical item here). The Camel
book is little help, the Panther book is ..ok, and I've got another
network applications programming book.. all of which just don't have
enough information to teach one how to communicate across servers. I've
got a program by Sun Microsystems that acts as a www browser proxy,
which has been the most help so far.
However, I still can't get a program to talk to another program on a
different server. Pointers and reference is what I'm asking for, ..not
hold-your-hand-pee-in-the-toilet shtuf, but sadly, _anything_ would
help.
You can also reach me at danba@apexinteractive.com.
-Ask the right questions.. get the right answers.
------------------------------
Date: 20 Apr 1999 19:05:39 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: ifeither--How about some feedback?
Message-Id: <slrn7hq221.b9b.dha@panix.com>
On Sun, 18 Apr 1999 22:42:57 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> $_ % 2 == 0 and print "$_ is even\n" foreach 0..10;
A) does foreach work there? I'm getting errors.
and
B) Alternately (as it were...):
foreach (0..10) {$_ % 2 or print "$_ is even\n"};
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Perhaps it IS a good day to Die! I say we ship it!
- a selection from "If Klingons developed software"
------------------------------
Date: 20 Apr 1999 19:25:43 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ifeither--How about some feedback?
Message-Id: <x7d80yeux4.fsf@home.sysarch.com>
>>>>> "DHA" == David H Adler <dha@panix.com> writes:
DHA> On Sun, 18 Apr 1999 22:42:57 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>> $_ % 2 == 0 and print "$_ is even\n" foreach 0..10;
DHA> A) does foreach work there? I'm getting errors.
perl >= 5.005.
i am surprised you don't know that, dave!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 20 Apr 1999 19:37:30 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: ifeither--How about some feedback?
Message-Id: <slrn7hq3tm.kl0.dha@panix.com>
On 20 Apr 1999 19:25:43 -0400, Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "DHA" == David H Adler <dha@panix.com> writes:
>
> DHA> On Sun, 18 Apr 1999 22:42:57 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> >> $_ % 2 == 0 and print "$_ is even\n" foreach 0..10;
>
> DHA> A) does foreach work there? I'm getting errors.
>
>perl >= 5.005.
>
>i am surprised you don't know that, dave!
Oops. I'm surprised too. I must be tired... (also better check what
the latest perl they have installed here is...).
Hm.
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"You can lead a bigot to water, but if you don't tie him up, you can't
make him drown." - The Psychodots
------------------------------
Date: Tue, 20 Apr 1999 16:40:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ifeither--How about some feedback?
Message-Id: <MPG.1186b045edde7a09898f3@nntp.hpl.hp.com>
In article <slrn7hq221.b9b.dha@panix.com> on 20 Apr 1999 19:05:39 -0400,
David H. Adler <dha@panix.com> says...
> On Sun, 18 Apr 1999 22:42:57 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>
> > $_ % 2 == 0 and print "$_ is even\n" foreach 0..10;
>
> A) does foreach work there? I'm getting errors.
New in perl5.005. Time to upgrade.
> and
>
> B) Alternately (as it were...):
>
> foreach (0..10) {$_ % 2 or print "$_ is even\n"};
^ why?
Sure. But I hate punctuation () {} and such. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 20 Apr 1999 16:35:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Is it REALLY impossible to install Perl on Windoze???
Message-Id: <371D0F47.A894AAC@mail.cor.epa.gov>
mjw@bahnhof.se wrote:
>
> I am getting really mad.
I can understand why. This isn't the first time you've asked for
help on this subject.
> More times than I want to remember I tried to install Perl
> under Win95, on three different machines:
> 1. My humble, hopelessly obsolete Pentium 133 MHz
> 2. Compaq Armada 233 MHz notebook in my office
> 3. A Dell desktop PC in my office.
>
> I used various builds of Perl. I tried many times to
> carry out every installation. I tried every conceivable
> measures, deactivated antivirus programs (WHY, ON EARTH,
> IS IT NECESSARY???), switched off the lights in my room,
> prayed to God and so on.
Did you remember to sacrifice a python on a pile of java
beans? Sorry, you're probably not in a laughing mood
right now.
The anti-virus deal is sometimes needed (not for me, I'll
mention) because the install can tmaper with the Registry
if you let it do the file association, and some virus
checkers will flip out at that point.. or a few others.
Or so I have been told.
> NOTHING. NULL. ZERO SUCCESS.
>
> The ActiveState installation program freezes always
> when "preparing HTML documentation", at 95%, leaving
> the installation unfinished (I believe that 60 min
> waiting for the program to continue - was enough...).
Wow. Have you tried installing *without* the HTML
docs? You can always unzip the file from ActiveState
and get the HTML stuff manually, then point your
browser at the index.html file yourself.
The only idea I have is that something on your machine
is doing something interesting with your html. Now
I haven't seen this problem with MS Internet Exploder
or with Nyetscape. So I have no idea what it could be.
But if the install works when you run without the HTML
part, you'll have narrowed it down a lot.
Another alternative: if you skip the Registry
tampering (the file association part), does it install
properly? If so, something has the .pl extension
locked up and won't release it properly when the
install tries to change it.
> Ok. I bought a book "Perl 5 Complete" from Mc Graw-Hill,
> a respectable publishing house. I inserted the attached
> CD-ROM into my computer and started installation -
> perhaps not the latest build, but presumably "stable".
Errm, around here you might want to be careful how you
use the word 'respectable'. Some publishers which seem
to do just fine on fiction and paperbacks fail
miserably when it comes to turning out a well-
constructed book as free of horrendous errors as possible.
In fact, I recommend going to
http://language.perl.com/critiques/index.html
to see some reliable reviews of good..to..lousy
Perl books. I don't think 'Perl 5 Complete' is
reviewed, but if it is, it is *not* in the
categories:terrific, fine, or even decent.
> The installation program showed to be a worthless piece
> of crap, completely broken, unusable. Probably nobody
> ever tested it.
Sorry to hear that.
> Is there anything I can do before I start hating Perl
> and send millions of anti-Perl spam messages on the whole
> net?
It's okay to hate Perl. Many Python and Java programmers
do. Each to his own. But please, no spam. There is
enough bandwidth-waste as it is. Like this tediously
long reply. :-)
> What the hell can go wrong in an installation program
> that does little more than copying files and writing
> some info in the registry?
You ought to ask ActiveState. But they're not 'the
Perl community'. They're a for-profit company who
makes one of the better versions of Perl for Win32.
Many members of the Perl community would rather chew
their own leg off than have anything to do with WinTel.
[And they know who they are!]
> Is it really impossible for the Perl community to prepare
> a package for MANUAL installation, with all files neatly
> packed, together with the directory tree, in a ZIP archive
> or similar, ready to copy "as is"?
You can probably do that with the ActiveState distribution
if you want to. That's basically what their install
routine does.
Or you can do the manual install, if you have a C
compiler. There are at least two Perl installs like
that, one of which is the Cygwin32 setup. The latest
issue of The Perl Journal has an article on
installing from scratch using these.
Good luck,
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Mon, 19 Apr 1999 18:07:25 +0200
From: Marcin Kasperski <Marcin.Kasperski@softax.com.pl>
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <371B54BD.4EB9BC62@softax.com.pl>
>
> My manager is definately a C SHELL fan, doesn't know PERL and doesn't
> really have the time to learn it. In point of fact, he's a C SHELL expert.
>
> He recently decided that we WILL do our scripts in C-SHELL & AWK/NAWK,
> but is now willing to modify his position if I can come up with
> compelling arguments to do otherwise.
>
> Suggestions, people ?
>
Answer strongly depends of the tasks your scripts are to perform.
I use perl as script language for scripts used while C++ development.
Among the scripts are the scripts which check different project policies
(like 'each header contains precompile guards', 'each file contains
copyright information', ...), generate some code from another code (like
translating some simply enough SQL into C structs), help while
compilation (like generating option files on VMS).
For me the main perl advantages are:
- it is fully cross-platform, works perfectly on Windows NT, all Unixes
I saw and OpenVMS
- it has fast and easy to use regexp engine, which is very useful in
creating development procedures
- it has great bunch of useful modules (CPAN).
If script you use are just "set some environment variables and run
something" you can stick with any shell language...
-- Marcin Kasperski Marcin.Kasperski<at>softax.com.pl
-- marckasp<at>friko6.onet.pl
-- Moje pogl1dy s1 moimi pogl1dami, nikogo poza mn1 nie reprezentuj1.
-- (My opinions are just my opinions.)
------------------------------
Date: 15 Apr 1999 06:37:02 GMT
From: thorfinn@netizen.com.au (Thorfinn)
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <slrn7hb248.p47.thorfinn@netizen.com.au>
In comp.lang.perl.moderated, on Wed, 14 Apr 1999 10:55:40 -0400
Michael Genovese <mikeg@slpmbo.ed.ray.com> wrote:
> I'm not saying PERL should be used for ALL scripts.
I'd be tempted to say that. :) I've yet to write a shell script that
doesn't tend to grow in complexity to the point where it stops being
useful, and I need to rewrite it in perl. If I'd just written it in
perl in the first place, then I wouldn't need to port it.
> But I do think that any script of any size and/or complexity is
> probably better off in PERL than in C-SHELL and/or AWK/NAWK.
I seem to recall there being a FAQ on just this subject...
In any case, there's a few arguments to be dug out of 'perldoc perlfaq1'.
Also, well, for anything significant in size, perl is faster than any
shell scripts.
After all, done properly (ie, avoid using system() and ``), perl only
loads one executable, the perl interpreter, then proceeds to run and
do its stuff.
Perl's utility is also somewhat less... constrained, than gawk, or csh
and similar. It's also *much* more portable.
There's more, but I'm not going to ramble on.
Later,
Thorfinn
--
<a href = "http://www.netizen.com.au/"> thorfinn@netizen.com.au </a>
The moving cursor writes, and having written, blinks on.
-- BSD fortune file
------------------------------
Date: Tue, 20 Apr 1999 23:23:57 GMT
From: trevod@hotmail.com
Subject: Permissions for Directory
Message-Id: <7fj2aa$m1u$1@nnrp1.dejanews.com>
I use WS FTP LE and I am having trouble setting the permissions for my
directories. I can chmod the files in the directories but I can't chmod the
directories. Can someone please help!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 23:03:50 GMT
From: scraig@my-dejanews.com
Subject: Re: Problem with writing to file.
Message-Id: <7fj14k$l1o$1@nnrp1.dejanews.com>
In article <7fhabo$1e9$1@nnrp1.dejanews.com>,
agniora@usa.net wrote:
> why doesnt this script here work?
>
> open OUTFILE, ">upal.txt";
> print OUTFILE "HI";
> printf OUTFILE ("Hello %5.0f %5.0f\n",9375,93257392);
>
> it creates a file called upal.txt but theres nothing in the file.
I suspect that you are writing to a file, and then reading from the same
file during the execution of your script.
Perl buffers its output, so buffer needs to be flushed before such a small
amount of text is written to the file.
Closing the file handle, or terminating the script, implicitly closing the
file handle, will flush the buffer for you. There are also other ways to
flush a still open file handle. I remember seeing a FAQ about it. It is also
possible to turn off the output buffering.
HTH
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 23:28:58 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: search msoffice documents
Message-Id: <slrn7hq6vd.68.alastair@calliope.demon.co.uk>
ombiasan@hotmail.com <ombiasan@hotmail.com> wrote:
>
>
>hello everybody,
>
>i need to know if there are any possibilities to search msoffice documents
>(95/97) for a certain content (e.g. string)
Well, I'm not speaking from experience. I'd just treat the 'msoffice' files as
normal and read them as binary (see 'binmode'). Maybe as fixed blocks ('read'
perhaps). Look to match your 'string' using a regular expression ('perldoc
perlre').
Hope that helps.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Tue, 20 Apr 1999 17:07:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: to match pattern ended with 4 digits
Message-Id: <371D16D8.8C4DDD48@mail.cor.epa.gov>
Xiaoyan Ma wrote:
>
> I have a Perl subsidiary file which looks like this:
>
> 02AAAB 1
> 01 2
> 02DDDE 25
> 04 26
> 03BBBC 27
> 02RREE 30
> ....
Based on what you say below, I'll assume those are tabs in your
file...
> and when the main program calls this file it converts the left colum
> into the right colum:
It uses the left column as the key for your hash %rtypes.
> sub init_type {
> open (RECORDTYPES, "rtypes");
You aren't checking the return on your open(). That's taking a
chance you don't need to.
open (RECORDTYPES, "rtypes") or die "couldn't open,
$!\n";
Given this, I wonder. Are you using -w on your shebang line?
You don't appear to be using 'use strict'. Both of these will help
your future programming efforts.
> while ($name = <RECORDTYPES>) {
> $rtypes(substr($name,0,6)} = substr($name,7,2);
> }
Since you're using tabs, you could be using split() here if you
wanted to.
> close (RECORDTYPES);
close RECORDTYPES or warn "problem closing: $!\n";
> I have been trying to add one new type of record that is "02" followed
> by any combination of 4 digits and convert it into say "33". I have
> tried "02\d\d\d\d", "02\d{4}" and "02[0-9]{4}", neither one worked.
All three of these should have worked.
Perhaps if you show your code for these, it might help.
Were you trying to stick a regular expression into your substr()
function? I can't tell what went wrong without some code.
I presume you mean something like:
$name =~ s/^02\d\d\d\d/33/;
or
$name =~ s/^02\d{4}/33/;
or
$name =~ s/^02[0-9]{4}/33/;
All three can work.
> Then I retyped the subsidiary file, setting tabstop to 12, and changed
> the last line into:
> $rtypes(substr($name,0,10)}=substr($name,11,2);
> or ($name,0,6)
> ($name,7,2)
>
> But it still did not work. Should "02\d\d\d\d" be counted as 6 or 10.
6 or 10 characters? 6. As above.
> What is wrong? I would really appreciated if anyone can give me some
> tips.
We can't tell what is wrong when you don't show us the code which
*fails*. But perhaps this will get you going.
Read up on regular expressions in the perlre manpage [type `perldoc
perlre' at the command line] and on the operators m// and s/// in
the perlop manpage.
HTH,
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Tue, 20 Apr 1999 16:29:07 -0700
From: ookookook@yahoo.com (Ook!)
Subject: Re: Unix files in MacPerl
Message-Id: <ookookook-2004991629100001@ip186.r6.d.pdx.nwlink.com>
In article <371fee20.1930448@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:
:::graphics wrote:
:::
:::>I regularly swap Perl scripts between Mac and Linux/Unix and would like
:::>to know if there's a simple way of getting MacPerl 5.2.0r4 to read text
:::>files with Unix-style line endings, \n as opposed to the Mac's \r ?
:::
:::As TomC so elabortately wrote: "\n" and "\r" are not physical
:::representations of line endings. They are "logical" representations.
:::You could say that "\n" is the line end, and "\r" is "the other one".
Barf! His next piece of decent technical writing will be his first.
:::
:::>It's getting tedious using BBEdit to change them each time. I could
:::>write a utility to do it for me but it would be nice not to have to
:::>worry about it...
:::
:::Urm... I think you NEED to worry about it. Sorry.
:::
:::You could have a simple script that can change any line endings to your
:::native line endings, for reasonably short text files (I think most
:::scripts would qualify ;-). It doesn't even hurt if line endings already
:::WERE converted. Caveat: untested.
:::
::: undef $/;
::: while($file = shift) {
::: open(FILE,"+<$file") or die "Can't open file $file: $!";
::: $_ = <FILE>; # whole file
::: s/\015\012|\015|\012/\n/g; # any "standard" sequence
::: seek FILE,0,0;
::: truncate FILE,0;
::: print FILE;
::: }
:::
::: Bart.
This is an off-topic solution, wash out my mouth with soap and Windows,
but you can simply Tell BBEdit to use the line ending property of choice
on a particular file.
Pop open the Object Dictionary with Script Editor for syntax...
The solution is absofreakinglutely trivial with AppleScript, which you can
call from MacPerl if you really feel the need to add one meg of overhead-
this very subject was discussed in alt.comp.lang.applescript not but a
fornight hence.
What was that FAQ sub-topic? When is it better to use something else than Perl?
--
I feel sorry for people who don't drink. When they wake up in the
morning, that's as good as they're going to feel all day.
~ Frank Sinatra
------------------------------
Date: Wed, 21 Apr 1999 09:10:21 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Wanna post, need programmer help
Message-Id: <Ef8T2.2$OA2.3591@vic.nntp.telstra.net>
And this ridiculous followup doesn't waste just as much (actually more)
bandwidth and NG server space? ;-)
Followed by this one which makes me as bad as you now... heh
Where is the book of rules on NG posting syntax?
In your head?
Wyzelli
Tad McClellan wrote in message ...
>Wyzelli (wyzelli@yahoo.com) wrote:
>
>: You got too much time on your hands Abigail!!
>
>
> You've got too much quoted text in your followup Wyzelli!
>
> (over 50 quoted lines and *1* new line!!)
>
> Please don't waste our shared bandwidth with bytes that
> are unneeded.
>
>
> You also have the answer (followup) before the question.
>
> Question then answer is the normal flow, this isn't Jeopardy.
>
> Please add your followup comments _after_ the quoted text
> that you want to comment about.
>
>
>
>: lol
>
>
> Me to, BTW :-)
>
>
>: Wyzelli
>: Abigail wrote in message <7fh2dg$j97$1@client2.news.psi.net>...
>: >jeanb (jean_barry@my-dejanews.com) wrote on MMLVII September MCMXCIII in
>: ><URL:news:7fg92b$4eo$1@nnrp1.dejanews.com>:
>: >\\
>: >\\ Can someone tell me what's going on.
>: >
>: >Well, Tammy-Lee and Johnny got married; forced by their parents because
>: >Tammy-Lee is pregnant. Fred, Johnny's little brother ran away from home,
>: >and has been missing for nine days now, missing the wedding. Elmer,
>: >Tammy-Lee's nephew acted as a stand-in ring bearer. The wedding features
>: >17 female relatives and friends, and 2 males ones with tears.
>
>
>
>--
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Tue, 20 Apr 1999 16:01:41 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Wanted: opinions on bytecode-compiling modules under 5.005
Message-Id: <371D0755.A6714DA1@mail.cor.epa.gov>
eryq@zeegee.com wrote:
>
> How mature is the Bytecode compiler under 5.005 when used with
> modules; e.g., compiling Foo.pm to Foo.pmc for fast-loading?
> Is the compilation fast? Is the bytecode reliable? Does "use Foo"
> do the right thing and prefer a newer Foo.pmc to an older Foo.pm?
>
> We have tons of Perl modules on my current project, and it takes
> forever for our command-line scripts to start up. I've been
> waiting years (literally) for Perl to support bytecode compilation
> of modules the way -- for example -- languages like Emacs Lisp
> and SWI Prolog support it.
>
> Has anyone delved deep enough into this to have practical experience
> with the pitfalls?
I can't answer your direct question, but from what I have read I'm not
sure you would see a speed-up where you expect.
But let me say soemthing about your indirect question. If you're
loading tons of modules and causing your Perl programs to take a
long time to get around to their business, there are some things
you could try (in the order I would assess them myself):
(1) the `use autouse' pragma (new as of 5.004)
(2) breaking those `use' calls up into separate `require' and
`import' components
(3) the SelfLoader module
(4) the AutoLoader module
HTH,
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
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 5434
**************************************