[7909] in Perl-Users-Digest
Perl-Users Digest, Issue: 1534 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 24 23:07:20 1997
Date: Wed, 24 Dec 97 20:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 24 Dec 1997 Volume: 8 Number: 1534
Today's topics:
Re: Access Denied Problem running script on NT4 <myleslawrence@email.msn.com>
Re: Access Denied Problem running script on NT4 (Jim Michael)
Re: Bulding 5.004 for Interactive UNIX (Ton Hospel)
Re: Dynamic array names <beans@bedford.net>
Re: Extensible File Handle Objects (Ton Hospel)
External Subroutines (greg head)
Re: Help needed (Ton Hospel)
Re: Help. Checking file sizes in perl5 (Robert Haig)
Re: Help. Checking file sizes in perl5 (Mark G. Scheuern)
Re: How to pad a variable to make the output look prett (Michael Kelly)
MAPI modules for perl WIN32?? <david_x_johnson@ml.com>
Merry XMas perl monsters (Jonathan Stowe)
Re: Mini Critiques (Ton Hospel)
Re: Newbie frustration (Jim Michael)
Re: Newbie frustration (Don)
Re: Newbie frustration (Don)
Re: ORAPerl (Steve)
Re: Perl editor needed (David Grove)
Re: PERL Memory Problems <beans@bedford.net>
Re: Review of CGI/Perl book (brian d foy)
Re: Shared libraries on IRIX? <scotth@sgi.com>
Re: Sort a file and pattern match (Ton Hospel)
Re: Wacky idea: a PERL server (Ton Hospel)
Re: what is the equivalent of fflush in perl (Ton Hospel)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Dec 1997 16:05:45 -0800
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: Re: Access Denied Problem running script on NT4
Message-Id: <utZuIgME9GA.316@upnetnews02.moswest.msn.net>
You know I'm not sure. How do I determine the login ID the script is running
under. If all I have to do is provide the correct permisions, I can do that
because this is an internal intranet application.
Creede Lambard <$_=qq!fearless@NOSPAMio.com!;y/A-Z//d;print> wrote in
message <67r9km$q6n@mtinsc05.worldnet.att.net>...
>You may have hit the nail on the head. Does the login ID the script's
>running under have permission to access the server in question?
>
>To duplicate problems like this under NT you have to do your test using the
>exact conditions under which the problem occurs. Without knowing more that
>the situation that's the best advice I can give you. Good luck!
>
>--- Creede Lambard
>Minister of Irregular Expressions
>Programming Republic of Perl
>
>Myles Lawrence wrote in message <#TE5MGCE9GA.216@upnetnews03>...
>>I've got one for you. I've got a script that executes the copy command on
>an
>>NT4 server using IIS to copy a file from one pc to another. If I remotely
>>key in and execute the copy command by typing \\server\copy
>>\\machineA\fileA \\machineB\fileB, everything works fine. But If I try to
>>run this command from a script I get an access denied message because the
>>script doesn't seen to have access to the network computers. Any ideas?
>>Myles
>>myleslawrence@msn.com
>>
>>
>
>
------------------------------
Date: Thu, 25 Dec 1997 00:43:04 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Access Denied Problem running script on NT4
Message-Id: <genepoolELpzBs.E76@netcom.com>
Myles Lawrence (myleslawrence@email.msn.com) wrote:
: You know I'm not sure. How do I determine the login ID the script is running
: under. If all I have to do is provide the correct permisions, I can do that
: because this is an internal intranet application.
If your intranet server runs as a service under NT you can go into the
services area under the control panel and set the account that it runs
under. Once you know the account it is running under, add that account to
the group which has permission to access that resource. HTH.
Cheers,
Jim
------------------------------
Date: 25 Dec 1997 01:33:36 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Bulding 5.004 for Interactive UNIX
Message-Id: <67sd5g$jnj$2@newspost.lunix.private>
In article <349A1395.968244A7@anasazi.com>,
William Bloom <wbloom@anasazi.com> writes:
> William Bloom wrote:
>>
>> I am attempting to build 5.004 on Interactive 3.2. Once the build
>> begins executing miniperl on ext/DynaLoader/Makefile.PL, it core
>> dumps with a floating point exception.
>>
>> Is this a known problem? Any suggestions, work around?
>>
>> Bill
>> --------------------------------------------------------------------------
>> William Bloom <wbloom@anasazi.com>
>> (602) 906-7525
>> Anasazi, Inc. - 7500 North Dreamy Draw Drive, Suite 120, Phoenix, Az
>> 85020
>
> I discovered my own answer to my own posted question before anyone
> else responded...
>
> Turns out to be an Interactive compiler bug. The floating point
> exception was occurring in cast_uv() (in util.c). The compiler
> generates flawed code that will choke when a value of type (double) is
> typecast to (unsigned long) in case the magnitude of the resulting
> integer is too large for a (long). The error was reproducible with
> something like...
>
> miniperl -e '~0 - 1'
>
> I had to work around it by modifying cast_uv(). All is well now.
>
>
No, in fact you discovered a bug in perl. Your compilers
behaviour is completely legit.
--
Microsoft: Where do you want to go today?
Linux: Been there, done that.
------------------------------
Date: 25 Dec 97 00:53:35 GMT
From: Tom H <beans@bedford.net>
Subject: Re: Dynamic array names
Message-Id: <34a1ae8f.0@news3.paonline.com>
>
> I want to create an array named by each of the files in the <SOMEPATH>.
> the files in the array change so I need something dynamic.
>
...
This is best done with references. You could use a reference to an unnamed array
or an associative array of references to whatever. Explanation is too long to
post here and its in the documentation anyway.
-Tom
------------------------------
Date: 24 Dec 1997 22:37:07 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Extensible File Handle Objects
Message-Id: <67s2qj$fdd$2@newspost.lunix.private>
In article <67ofv4$j56$1@lyra.csx.cam.ac.uk>,
mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
> Yitzchak Gale <gale@LiveLink.Com> wrote:
>>>> Why not let <$fh> call the getline or getlines method whenever $fh is
>>>> any kind of blessed reference? ...
>>>> Is this hard to implement? Is it / was it already done?
>>
>>> See the section "Tying FileHandles" in the perltie man page.
>>
>>First of all, for those of you who missed Mike's reference, I quote
>>that man page section in its entirety:
>>
>> This isn't implemented yet. Sorry; maybe someday.
>
> That isn't what I referenced. Why would I refer to ancient
> documentation when more modern stuff is available? Current Perl has
>
> Tying FileHandles
>
> This is partially implemented now.
>
> A class implementing a tied filehandle should define the
> following methods: TIEHANDLE, at least one of PRINT, PRINTF,
> READLINE, GETC, or READ, and possibly DESTROY.
>
> which, although incomplete, does enough for what you want.
>
>
> Mike Guy
Still, the original poster seems to have a point. The <$fh> notation clearly
seems to indicate that you want to do some buffered IO, so why indeed not
let it work "automagically tied" for blessed references ? It would even
seem consistent with the IO::Handle stuff going on.
--
Microsoft: Where do you want to go today?
Linux: Been there, done that.
------------------------------
Date: Wed, 24 Dec 1997 20:48:52 GMT
From: greghead@melbpc.org.au (greg head)
Subject: External Subroutines
Message-Id: <67rosm$f0n$1@wombat.melbpc.org.au>
Rather than include all my subroutines in the one Perl program (too
large) I would like to store them as seperate files.
Ihave tried USE for this but keep running into the same problem. i.e.
the subroutine returns "did not return a true value" on return from
the called subroutine. Is this the preferred (only?) way - if so what
am I doingwrong? Thanks
------------------------------
Date: 25 Dec 1997 01:51:33 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Help needed
Message-Id: <67se75$jnj$3@newspost.lunix.private>
In article <349FC10C.BAC@min.net>,
John Porter <jdporter@min.net> writes:
> Answer: use awk.
>
> % nawk '/startstring/,/stopstring/' <infile >outfile
>
> John Porter
> jporter@logicon.com
>
How dare you answer that in a perl group !
#perl -ne 'print if /startpattern/../stoppattern/' < infile > outfile
The only slightly postive point I can find in your answer is that it
works, which is of course hardly relevant.
You are hereby blackballed from the Royal Perl Society :-)
>
> Katalin Nadassy wrote:
>>
>> Hello,
>>
>> I'm new here in this newsgroup and also new in using Perl. I would like
>> to ask you for your help in the following problem: I would like to open
>> a file search for a certain string and then from that point where the
>> string is found extract the content of the file until another string
>> found and write it to a file.
>> I know that is probably a very easy problem, but I would appreciate any
>> suggestions and help.
>>
>> Thank you very much !
>>
>> Best regards,
>>
>> Kati
--
Microsoft: Where do you want to go today?
Linux: Been there, done that.
------------------------------
Date: 25 Dec 1997 01:59:45 GMT
From: rhaig@austin.ibm.com (Robert Haig)
Subject: Re: Help. Checking file sizes in perl5
Message-Id: <67semh$1rsg$1@ausnews.austin.ibm.com>
In article <67r8v6$d24$1@morse.news.easynet.net>,
<mat.r@ukonline.co.uk> wrote:
>I am desperately trying to write a piece of code that checks a files size
>and returns the path if it exceeds a set limit.
>... <snip> ...
>The script will be running on a Unix system.
I'll probably get slapped down for this, but why reinvent the wheel?
find . -size +<limit> -print
if this is going to be in a cgi script or similar, then I could see where
you might not want to spawn another process to do this. At that point I'd
whip out find2perl on the above one-liner
--
Rob
------------------------------
Date: 24 Dec 97 20:22:16 GMT
From: mgscheue@xanadu.io.com (Mark G. Scheuern)
Subject: Re: Help. Checking file sizes in perl5
Message-Id: <mgscheue.882994936@xanadu.io.com>
mat.r@ukonline.co.uk writes:
>I am desperately trying to write a piece of code that checks a files size and returns the path if it exceeds a set limit. Most of the code is in place, I just can't seem to get the code that checks the files size to work. If anyone has a bit of code th
at does this, I would appreciate a copy of it, so I can modify it to suit my needs.
Something like this, where $myfile is your file path and $sizelimit is the
miminum size for which you want to trigger the action:
-s $myfile >= $sizelimit && print "$myfile\n";
You could use stat() instead, but if all you need is the file size this is
simpler.
Mark
------------------------------
Date: Wed, 24 Dec 1997 20:47:12 GMT
From: mkelly99@gate.net (Michael Kelly)
Subject: Re: How to pad a variable to make the output look pretty ;p
Message-Id: <34a974a1.21181916@news.gate.net>
On Wed, 24 Dec 1997 19:21:58 GMT, Xnihon@Yjapan-mail.Zcom (Nihon) wrote:
>Here's my question:
>
>How do I read how many characters are in a variable and make sure that I pad the variable with spaces at the end to make the total amount of
>characters equal 25 if the amount of characters is less than 25? Otherwise, the table in the email looks awful.
>
>I scanned thru the FAQ index, but I didn't see anything that seemed to address this problem. Of course, the FAQ is _rather_ large.... ;p
>
>Thanks for the help!
I would guess something like this would work:
(At least it did when I tried it. :) )
#!/usr/bin/perl
$variable = "This is a test";
$count = 25 - length($variable);
$variable .= ' ' x $count unless ($count < 0);
print "$variable\n";
$count = length($variable);
print "Variable line len is: $count\n";
Mike
"Genius gives birth, talent delivers."
- Jack Kerouac
------------------------------
Date: Wed, 24 Dec 1997 20:06:12 -0500
From: "David X. Johnson" <david_x_johnson@ml.com>
Subject: MAPI modules for perl WIN32??
Message-Id: <34A1B184.5F09@ml.com>
Looking for a MAPI module for perl WIN32. I'm not interested in simple
send mail -- I can use SMTP for that. For example: Would like to
export a list of mail addresses from the global list (MS Exchange) using
perl.
Does anyone know if/where such a thing exists?
------------------------------
Date: 24 Dec 1997 21:19:24 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Merry XMas perl monsters
Message-Id: <67ru8s$1cc$1@mendelevium.btinternet.com>
=head1 DESCRIPTION
Santa - a festive perl Module
=head1 USAGE
use Santa;
$my_santa = new Santa;
=head1 SEE ALSO
Elves.pm, Reindeer.pm, Xmas::Party
=cut
#
# Santa.pm
# Usage:
# use Santa;
# $my_santa = new Santa;
# ...
#
package Santa;
sub new {
my $new_santa = {};
my $Message="csim.lrep.gnal.pmoc ta enoyreve ot samX yrreM";
print "Ho, Ho, Ho\n";
print reverse(split("",$Message)),"\n";
bless $new_santa;
return $new_santa;
}
sub DESTROY {
print "See you next christmas\n";
}
return 1;
------------------------------
Date: 24 Dec 1997 20:43:48 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Mini Critiques
Message-Id: <67rs64$e1a$1@newspost.lunix.private>
In article <67mm22$5at$2@comdyn.comdyn.com.au>,
mgjv@comdyn.com.au (Martien Verbruggen) writes:
> In article <67m235$4au$1@csnews.cs.colorado.edu>,
> Tom Christiansen <tchrist@mox.perl.com> writes:
>
>> 2. Perl CGI Programming, No Experience Required
> [snip]
>> RATING: 1 out of 5 camels.
>
> Why the 1 camel? The review doesn't sound as if you found anything
> good with it. More a 0 I'd say :)
It spells the word perl correctly :-)
------------------------------
Date: Wed, 24 Dec 1997 20:59:23 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Newbie frustration
Message-Id: <genepoolELpoyz.8Kz@netcom.com>
Don (dongood@ibm.net) wrote:
: Well, thanx to this ng I now know that I can use ctrl-z as an EOF in
: win 95. Problem is when I use ctrl-z, it ignores the next command!
Post an example of the offending code.
: Can I run a unix OS(linux) on my win 95 box without removing win 95?
There is a utility which will allow you to repartition your hard file
without forcing a reformat of your DOS partition. Check the Linux
installation and getting started document at http://www.linux.org.
Cheers,
Jim
------------------------------
Date: Wed, 24 Dec 1997 21:34:04 GMT
From: dongoodwin@usa.net (Don)
Subject: Re: Newbie frustration
Message-Id: <34a57f40.12731555@news3.ibm.net>
On Wed, 24 Dec 1997 20:59:23 GMT, genepool@netcom.com (Jim Michael)
wrote:
>Don (dongood@ibm.net) wrote:
>: Well, thanx to this ng I now know that I can use ctrl-z as an EOF in
>: win 95. Problem is when I use ctrl-z, it ignores the next command!
>
>Post an example of the offending code.
<snip>
Here is the code, copied right from notepad:
@array = <STDIN>;
print (@array);
print ("hello\n");
I now notice that the first time I execute the program it works fine,
after that it skips the second line!
Thank-you,
Don
------------------------------
Date: Wed, 24 Dec 1997 21:39:53 GMT
From: dongoodwin@usa.net (Don)
Subject: Re: Newbie frustration
Message-Id: <34a680ca.13125426@news3.ibm.net>
On Wed, 24 Dec 1997 21:34:04 GMT, dongoodwin@usa.net (Don) wrote:
>On Wed, 24 Dec 1997 20:59:23 GMT, genepool@netcom.com (Jim Michael)
>wrote:
>
>>Don (dongood@ibm.net) wrote:
>>: Well, thanx to this ng I now know that I can use ctrl-z as an EOF in
>>: win 95. Problem is when I use ctrl-z, it ignores the next command!
>>
>>Post an example of the offending code.
><snip>
>
>Here is the code, copied right from notepad:
>@array = <STDIN>;
>print (@array);
>print ("hello\n");
>
>I now notice that the first time I execute the program it works fine,
>after that it skips the second line!
Actually, I should say it only skips the second line for the first
element of the array
If I enter:
Happy
Holidays
^Z
I get back:
Holidays
Hello
>
>Thank-you,
>Don
------------------------------
Date: Wed, 24 Dec 1997 22:52:55 GMT
From: syarbrou@ais.net (Steve)
Subject: Re: ORAPerl
Message-Id: <34a19198.23523242@news.ais.net>
The ORAperl interface does not work with perl 5.004. It's only
designed for Perl 4. From what I have heard, there is no further
development being done on it. Besides, DBI/DBM's are much better and
use the latest version of Perl.
Steve
On Mon, 22 Dec 1997 11:32:52 +0100, Jan Peyer
<jan.peyer@be.softlab.ch> wrote:
>Hi Everyone
>
>Does someone can tell me where i can find somethings about ORAPerl for
>Perl V. 5.004
>
>Thanks
>Jan
------------------------------
Date: Wed, 24 Dec 1997 22:24:44 GMT
From: dgrove@ntslink.net (David Grove)
Subject: Re: Perl editor needed
Message-Id: <34a18b62.22859566@news.ntslink.net>
Buy codewright. vi isn't as good as DOS Edit, which sucks. If you WANT
a real programming editor, get one: don't settle for a re-named,
scaled-down notepad with extra buttons.
On Wed, 24 Dec 1997 01:35:09 GMT, wjin@cs.uh.edu (Woody Jin) wrote:
>In article <67mgu3$cs5$3@mainsrv.main.nc.us>, scott@softbase.com wrote:
>>Perl editors under Windows ...
>
>Elvis 2.1
> 1) First, it is a vi. I can't live without it
> 2) Nice syntax coloring.
>
>available ftp://ftp.cs.pdx.edu/pub/elvis
>
>--
>Woody
------------------------------
Date: 25 Dec 97 00:42:14 GMT
From: Tom H <beans@bedford.net>
Subject: Re: PERL Memory Problems
Message-Id: <34a1abe6.0@news3.paonline.com>
Tim Nash <scover@sportscover.com> writes: > Hello,
>
> Could anyone please help me with this problem ?
>
> I use a PERL script to work its way through
> a list and assign values to each of the items so
> are sorted. I use a hash table / associatuive array
> to hold the items and value.
..
Kind of vague question. How about stripping out out the superfluous
code and reposting the snippet that's left. First check that you are
not using [] when you meant {}
-Tom
.
------------------------------
Date: Wed, 24 Dec 1997 19:36:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Review of CGI/Perl book
Message-Id: <comdog-2412971936170001@news.panix.com>
In article <882920705.230031371@dejanews.com>, craig@cgi-perl.com wrote:
> brian d foy wrote:
[why is my name in a post in which i have authored no text?]
> In article <66o7rp$7ju@tekka.wwa.com>, scribble@tekka.wwa.com (Tushar
> Samant) wrote:
>
> >It's incredible how
> >everyone is recommending this extraordinary book for the fulfilment
> >of one's web dreams. It has arrived. Every hacker born in this
> >decade will grow up with an instinctive feel for the CGI/Perl
> >cookbook, or he will be no hacker.
> Yet even though
> Randal strongly opposed this choice from the beginning, he still stated
> for the record that the book "should definitely be on your shelf for
> ready-to-run programs and inspiration for your own custom programs." His
> comment captures the intent of the book.
i was *very* surprised to see that Randal had "endorsed" this book, and
when i asked him about it later he told me that the publisher had taken
that quote out of context.
"for the record", Randal said a lot more than the publisher is willing
to admit. it's sad that a publisher would have to resort to such tactics
rather than relying on the content to stand for itself. it's even worse
that an author would need to do the same.
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: 24 Dec 1997 14:05:22 -0800
From: Scott Henry <scotth@sgi.com>
Subject: Re: Shared libraries on IRIX?
Message-Id: <yd8lnxaxuql.fsf@hoshi.engr.sgi.com>
>>>>> "A" == Alex Tang <altitude@ren.us.itd.umich.edu> writes:
A> Hi folks.
A> I've got a perl module (using perl 5.004_04) that I'm compiling on an
A> IRIX 6.3 box. it builds just fine, however, when I try to run a program
A> with the module, I get the following:
A> Can't load '/local/lib/perl5/site_perl/IP32-irix/auto/Ldapc/Ldapc.so' for
A> module Ldapc: 9986:/usr/bin/perl: rld: Fatal Error: cannot successfully
A> map soname 'libldap10.so' under any of the filenames
A> /usr/lib32/libldap10.so:/lib32/libldap10.so:/usr/libn32/libldap10.so:/libn32/libldap10.so: at /local/lib/perl5/IP32-irix/5.00404/DynaLoader.pm line 166.
A> at /local/lib/perl5/site_perl/Ldapp.pm line 207
A> BEGIN failed--compilation aborted at ./test.pl line 2.
A> But the shared library is located in /usr/lib32 (which is in the path that
A> was searched.
A> gromit% ls -al /usr/lib32/libldap10.so
A> -rwxr-xr-x 1 root sys 375804 Dec 8 17:40 /usr/lib32/libldap10.so*
A> Any ideas?
Which ABI are the files? You can't mix-n-match... the output of
`file` command on the perl binary and all the .so's must match.
Specifically:
% file /local/lib/perl5/site_perl/IP32-irix/auto/Ldapc/Ldapc.so
and
% file /usr/lib32/libldap10.so
--
Scott Henry <scotth@sgi.com> / Help! My disclaimer is missing!
IRIX MTS, / GIGO *really* means: Garbage in, Gospel Out
Silicon Graphics, Inc / http://reality.sgi.com/scotth/
------------------------------
Date: 25 Dec 1997 03:08:26 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Sort a file and pattern match
Message-Id: <67sina$m1t$1@newspost.lunix.private>
In article <eli$9712231530@qz.little-neck.ny.us>,
Eli the Bearded <#@qz.to> writes:
> In article <34a0088d.3167511@news.venus.it>, <boggiano@venus.it> wrote:
>> Hi all,
>
> Hello.
>
>> i need to reverse the order of the lines in a file,
>
> Hmmm. Sounds like a job for reverse:
>
> open (IN,"<file") or die q$ You're killing me here $;
> @lines=<IN>;
> @reversed=reverse @lines;
>
> Of course you can do it in other ways as well.
Or, as I posted the last time this question came up:
(only sensible for BIG files)
(notice that this program depends on randomly calculated seek offsets
having a meaning, and that bigger offsets are later in the file.
This makes the program in fact unportable (is there a perl on VM/CMS ? it
would fail on VM/CMS variable files). It should work on most systems though.
Maybe even on everything perl has been ported to yet ? )
--
#! /usr/bin/perl -w
# Reverse a file line by line with reasonable efficiency and memory usage
# Author: Ton Hospel (thospel@mail.dma.be)
# GNU copyleft or Perl Artistic, your choice
use strict;
use integer;
use Carp;
# We don't want to jump around in the file too much. So set some measure
# of how big the file chunks we handle in one go are
$::chunk = 1024;
for (@ARGV) {
reverse_file($_);
}
sub reverse_file {
my ($file) = @_;
my ($high, $step, $here, @lines);
local(*FILE);
open(FILE, $file) || croak "Could not open $file: $!";
eval {
$step = $::chunk;
# $here = -s FILE; # replaces next 2 lines if offset(end) == size
seek(FILE, 0, 2) || croak "Somebody is doing something weird to $file";
$here = tell(FILE);
while ($high = $here) {
do {
$here -= $step;
$step *= 2;
$here = 0 if $here < 0;
seek(FILE, $here, 0) || croak "Somebody is truncating $file";
goto edge unless $here; # I want last on a do loop !
defined(<FILE>) || croak "Somebody is truncating $file";
$here = tell(FILE);
} until ($here < $high);
edge:
@lines = ();
do {
defined($_ = <FILE>) || croak "Somebody is truncating $file";
push(@lines, $_);
} while (tell(FILE) < $high);
print reverse @lines;
$step = (2*$::chunk+$step)/4;
}
};
close FILE;
die $@ if $@;
}
--
------------------------------
Date: 25 Dec 1997 00:41:12 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: Wacky idea: a PERL server
Message-Id: <67sa38$i6m$1@newspost.lunix.private>
In article <882917977.357803@thrush.omix.com>,
Zenin <zenin@best.com> writes:
> Bill Totten <biell@udel.edu> wrote:
>: This is not really necessary, however. In any reasonable OS, perl will
>: stay in shared memory if you have enough of it. So, if perl never leaves
>: shared memory, you have the bulk of the program ready for use by anyone.
>: The first time you start it, it will still need to be loaded.
>
> Hmm, not as far as I know. The OS can load it faster because it
> can pull clean pages from memory/swap, but it still needs it's own
> memory space per invocation (to set user rights, etc) and thus
> multible copys in memory for each.
>
> If you use vfork(2) inside a program (perl needs to be compiled with
> the vfork option set to do this, but don't try it on Solaris as the
> secular/swaper can freak) and don't exec(), you'll use the same
Is this still true on recent solarisses ? I always compile my programs with
vfork, and have never seen a problem. I even did a bit of stress testing with
my vfork compiled perl, but maybe I tried the wrong stresses ?
Any suggestion of a program that tends/tended to show the problem so I can
see if I should go back to using plain fork ?
Ton
------------------------------
Date: 24 Dec 1997 22:29:46 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: what is the equivalent of fflush in perl
Message-Id: <67s2cq$fdd$1@newspost.lunix.private>
In article <67dajd$t63$1@news.bc>,
mnesbitt@nospam.rogers.wave.ca (Murray Nesbitt) writes:
> In article <34994957.61BC@frontiernet.net>,
> Vijay Veeranna <turk2@frontiernet.net> wrote:
>> I have a perl script which runs as a deamon and logs continuously
>> to a log file. The problem I am facing is the log file is
>> updated after almost 4-5 hours because of the buffering. Is there
>> any way of doing an fflush to my log file descriptor similar to
>> what we do in C language?
>
> select(LOGFILE);
> $| = 1;
>
That set's the file to autoflushing. Quite often I prefer to have perl
do the buffering and then flush when I know it's a good/important moment.
See flush.pl in your perl installation, which we inherited from old times
--
Microsoft: Where do you want to go today?
Linux: Been there, done that.
------------------------------
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 1534
**************************************