[11988] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5588 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 6 20:07:06 1999

Date: Thu, 6 May 99 17:00:20 -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           Thu, 6 May 1999     Volume: 8 Number: 5588

Today's topics:
    Re: "Text file busy" error <gellyfish@gellyfish.com>
    Re: **Free CGI Scripts!** (Tad McClellan)
        ASCII databases <pmallasch@thestarpress.com>
        Breaking Text File <tigerstr@bellatlantic.net>
    Re: Breaking Text File <design@raincloud-studios.com>
    Re: Editing a file "in-place" (Tom Tingdale)
    Re: Editing a file "in-place" (Tom Tingdale)
    Re: END block and backtick command <rick.delaney@home.com>
        Frames in Perl Script raj999@my-dejanews.com
        Frames in Perl Script raj999@my-dejanews.com
    Re: having problems getting this script to work... (Tad McClellan)
    Re: how to round off numbers? (Tad McClellan)
    Re: how to round off numbers? <gellyfish@gellyfish.com>
    Re: Increment a variable's name <tim@timbury.com>
    Re: Is there a version of CDDB written in Perl? (Alastair)
    Re: Looking for a book ... (Lee)
    Re: Making executables from .pl files? (Randal L. Schwartz)
    Re: perlfunc study - optimize input data for repeated s (Larry Rosler)
    Re: Problem with Net::Telnet and its output kinda resol <tashbrook@edisonenterprises.com>
    Re: Slice [N..end] of unnamed array? (Tad McClellan)
    Re: split, pop, and cut (Tad McClellan)
    Re: Stupid FAQ question of the (day? month? year?) (Bob Trieger)
    Re: Stupid FAQ question of the (day? month? year?) <design@raincloud-studios.com>
    Re: testing expressions in the IF statement (Tad McClellan)
        truncate() fails with "Invalid argument" on FreeBSD djhoward@uiuc.edu
    Re: truncate() fails with "Invalid argument" on FreeBSD djhoward@uiuc.edu
    Re: unos problemitas (Larry Rosler)
    Re: Which HTTP module for extracting tags? <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 6 May 1999 22:26:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "Text file busy" error
Message-Id: <7gt4ug$4t8$1@gellyfish.btinternet.com>

On Wed, 05 May 1999 12:06:29 GMT Bart Lateur wrote:
> Timothy Larson wrote:
> 
>>OK, I'm not trying to overwrite anything intentionally.  All I know is that
>>I will get one or two runs out of the script (from the command line or
>>web hits, whatever) and then the "text file busy" errors start in.  
> 
> Platform? I don't think you can get a "file busy" error on Unix.

It doesnt actually mean that literally I think.  What it means, as I
understand it is that the file from which the 'text segment' of the
program in memory cant be overwritten whilst the program is in memory.

Unfortunately I am not on a platform that exhibits this behaviour -
but I do see it on SCO at work.

I'll try it out in the morning and make another post.

Why this might be happening to the original poster I cant tell without
seeing his code.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Thu, 6 May 1999 13:12:31 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: **Free CGI Scripts!**
Message-Id: <vhisg7.1f7.ln@magna.metronet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote:
: IlIIIIIIII wrote:
: > 
: > get free CGI scripts at:
: > http://tofs.cjb.net

: One question:

: Doesn't ANYONE know the difference between CGI and Perl?


   Me me me!   I do!


   One is a word.

   One is an acronym.

   One is 3 characters long, one is 4 characters long.

   And they use different letters of the alphabet.


   They are otherwise indistinguishable  :-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 06 May 1999 17:53:38 -0600
From: "K. Paul Mallasch" <pmallasch@thestarpress.com>
Subject: ASCII databases
Message-Id: <62pY2.2694$fc1.5260267@news.netdirect.net>

What would people recommend the upper limit for a tabdelimited text file 
database? 100k? 1meg? Was wanting to do a searchable events calendar and was
wondering if it would be smart to do it with a flatfile dbase.

Thanks,
K. Paul Mallasch - Webmaster
http://www.thestarpress.com


------------------------------

Date: Thu, 6 May 1999 18:53:30 -0400
From: "Joey" <tigerstr@bellatlantic.net>
Subject: Breaking Text File
Message-Id: <7gt64q$fgb@world5.bellatlantic.net>

Just wondering, I need to break a text file and split it into sections on
keywords such as BREAK file1. Obviously, I need to create a new file with
the contents from BREAK file1 to BREAK file2. The files could get rather
large. Any suggestions for a newbie?

Thanks,

Joey




------------------------------

Date: Thu, 06 May 1999 22:51:43 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Breaking Text File
Message-Id: <32pY2.2093$iu1.1886@news.rdc1.tn.home.com>

>Just wondering, I need to break a text file and split it into sections on
>keywords such as BREAK file1. Obviously, I need to create a new file with
>the contents from BREAK file1 to BREAK file2. The files could get rather
>large. Any suggestions for a newbie?


First few questions here....
http://language.perl.com/newdocs/pod/perlfaq3.html

File specific ones here...
http://language.perl.com/newdocs/pod/perlfaq5.html

FAQ 5 is dedicated to files and formats and will most likely answer any of
your basic questions about FILE IO. If you are just starting out, you might
consider saving FAQ 1-9 to your hard drive as HTML if you have a slow
connection so they will be faster to access as you are learning. (But always
check for updates!)

CT




------------------------------

Date: Thu, 06 May 1999 22:19:43 GMT
From: tingdale@c2o.com (Tom Tingdale)
Subject: Re: Editing a file "in-place"
Message-Id: <36190807.14828281@news.ses.cio.eds.com>

Thanks Jim. 
What if I want to use this in a function only. Could I do it like this
by stuffing the file name into @ARGV???

sub change_text {
    $file = shift;
    $ARGV[0] = $file;
    while (<>) {
        s/text/newtext/;
        print;
    }
}

On 04 Oct 1998 22:09:29 -0500, Jim Woodgate <jdw@dev.tivoli.com>
wrote:

>tingdale@flash.net (Tom Tingdale) writes:
>
>
>> I have seen an example here before on how to edit a file in place, but
>> when I try it nothing happens - the file is not changed. Here is the
>> code:
>> -----------------------------------
>> #!/usr/local/bin/perl -wi
>> use strict;
>> 
>> open (FILE, "+< filename.txt") || die "Cannot open filename.txt:$!\n";
>> while (<FILE>) {
>>     s/text/newtext/;
>> }
>> ---------------------------------
>> It doesn't make any difference how I open the file, the file is not
>> changed. What I'm I doing wrong?
>
>I'm not sure about opening the file, but try the following both work:
>
>perl -i.bak -pe "s/text/newtext/" filename.txt
>
>or call
>
>$ your_script.pl filename.txt
>
>where your_script.pl is the following:
>
>#!/src/woody/bin/perl -wi.bak
>
>while (<>) {
>  s/text/newtext/;
>  print;
>}
>
>maybe a combination of the 3 will help... :)



------------------------------

Date: Thu, 06 May 1999 22:19:43 GMT
From: tingdale@c2o.com (Tom Tingdale)
Subject: Re: Editing a file "in-place"
Message-Id: <361b0ad6.15547105@news.ses.cio.eds.com>

Jim Thanks for your help. Have you ever used this method inside a sub
function and not the main? Would this work? Is there a better way?

#!/usr/local/bin/perl -wi.bak

#main
{
    # do this and do that
    change_text($filename);
}
sub change_text {
    my ($file) = shift;
    $ARGV[0] = $file;
    while (<>) {
        s/text/newtext/;
        print;
    }
}
On 04 Oct 1998 22:09:29 -0500, Jim Woodgate <jdw@dev.tivoli.com>
wrote:

>tingdale@flash.net (Tom Tingdale) writes:
>
>
>> I have seen an example here before on how to edit a file in place, but
>> when I try it nothing happens - the file is not changed. Here is the
>> code:
>> -----------------------------------
>> #!/usr/local/bin/perl -wi
>> use strict;
>> 
>> open (FILE, "+< filename.txt") || die "Cannot open filename.txt:$!\n";
>> while (<FILE>) {
>>     s/text/newtext/;
>> }
>> ---------------------------------
>> It doesn't make any difference how I open the file, the file is not
>> changed. What I'm I doing wrong?
>
>I'm not sure about opening the file, but try the following both work:
>
>perl -i.bak -pe "s/text/newtext/" filename.txt
>
>or call
>
>$ your_script.pl filename.txt
>
>where your_script.pl is the following:
>
>#!/src/woody/bin/perl -wi.bak
>
>while (<>) {
>  s/text/newtext/;
>  print;
>}
>
>maybe a combination of the 3 will help... :)



------------------------------

Date: Thu, 06 May 1999 22:58:55 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: END block and backtick command
Message-Id: <37321E51.8EB1FE7@home.com>

[posted & mailed]

Steve Linberg wrote:
> 
> In article <7gshnj$6fh$1@nnrp1.deja.com>, dave_ll_chen@my-dejanews.com wrote:
> > > perl -e 'exit 20; END { `false` }'; echo $?;
> > > echo $?
> > 0
> 
> Replace the END block with something else and watch your result
> change.

OK.  

$ perl -e 'exit 20; END{ local $?;`false` }';echo $?
20

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Thu, 06 May 1999 23:23:05 GMT
From: raj999@my-dejanews.com
Subject: Frames in Perl Script
Message-Id: <7gt88l$rrc$1@nnrp1.deja.com>

How do embed Frameset tags within perl script? Any Clue Appreciated. Thanks in
Advance.
~Raj

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 06 May 1999 23:26:03 GMT
From: raj999@my-dejanews.com
Subject: Frames in Perl Script
Message-Id: <7gt8e7$s5s$1@nnrp1.deja.com>

How do I include framsset tags within a Perl script? any clue appreciated.
Thanks in advance.
~Raj

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 6 May 1999 13:09:11 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: having problems getting this script to work...
Message-Id: <nbisg7.1f7.ln@magna.metronet.com>

Bart Lateur (bart.lateur@skynet.be) wrote:
: Larry Rosler wrote:


This part was not quoted in this followup:

Bart> Then will you test my alternative?


: >> 	{
: >> 		local $\ = "\n";
: >> 		print OUT foreach @data;
: >> 	}
: >
: >Is your computer busted?  I posted the benchmark code

: Is your brain busted? ;-) 


   I think the point was that you have everything you need
   to test your alternative yourself.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 6 May 1999 12:51:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to round off numbers?
Message-Id: <5bhsg7.nd7.ln@magna.metronet.com>

Cim (cim@online.ee) wrote:
: On 6 May 1999 16:19:07 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
: wrote:

: >Sorry which part of that FAQ or the functions it describes dont you 
: >understand ?
: >
: >What happens if you do this:
: >
: >    printf("%.0f %.0f\n",$number1,$number2);

: mhm, yea but that will print. what if I have to use those numbers in
: other functions etc. IS there a function that rounds numbers normally
: or is there not?


   Yes there is, and if you would read the FAQ that you have
   been pointed to, you would know what its name is, since
   the FAQ mentions it.


     "For rounding to a certain number of digits, <2 function names>
      is usually the easiest route."


   This newsgroup is not for reading the FAQs for you.

   Just learn to read, and then practice it.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 May 1999 22:41:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to round off numbers?
Message-Id: <7gt5r1$4tg$1@gellyfish.btinternet.com>

On Thu, 06 May 1999 12:34:29 -0700 KC wrote:
> Tom Christiansen wrote:
>> A newsgroup is not a manpage server.  man perlfunc, search for
>> sprintf.
>> 
> Isn't it? People have questions. They post questions on the ng. Other
> people answer those questions.
> 

Yes and in the case of this thread I had provided the means for the
original questioner to find the answer to his question within 29 minutes.

That is to say I gave him a reference to a canonical source of information
for this Frequently Asked Question.

> Oh...you must be one of those all-knowing geniuses that only uses the ng
> to post examples of their brilliance.

Please dont be someone who only uses this group to post examples of their
ignorance.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Thu, 6 May 1999 18:21:31 -0400
From: "Tim" <tim@timbury.com>
Subject: Re: Increment a variable's name
Message-Id: <926029238.041.56@news.remarQ.com>


Eric The Read wrote in message ...
>Tom Pape <tom@ernieball.com> writes:
>> Is there a way I can increment a variable's name?   The form I am
>> processing can have a different number of quantity variables depending
>> on the number of items listed.  If I have $i number of items can I
>> assign values to a variable that might look like qty$i?  I need to
>> incerment the variables name by 1 each time a loop runs, for example:
>> qty1, then qty2, then qty3 ....
>
                            [snip]
>
>1) If you know you're going to index by number, then why not just use an
>   array?
>
>$qty[1] = "something";
>$qty[2] = "something else";
>
>and so on.
                            [snip]
>-=Eric

Yes, use an array.

$qty[1] = "slinky";
$qty[2] = "super slinky";
$qty[3] = "extra slinky";

Say Hi to Ernie!  (Sorry, group, couldn't resist).

Tim K.





------------------------------

Date: Thu, 06 May 1999 22:49:14 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Is there a version of CDDB written in Perl?
Message-Id: <slrn7j4alh.5f.alastair@calliope.demon.co.uk>

bobby <bobby@DIESPAMDIEbarnworth.com> wrote:
>I'm looking for a way to uniquely identify audio/data cd's and think
>CDDB may be the way to go. Is there a version of CDDB written in Perl?

What happened when you queried Altavista (or whatever) for 'cddb and perl'?

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


------------------------------

Date: Thu, 06 May 1999 17:36:06 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Looking for a book ...
Message-Id: <B357838696686D9D1@0.0.0.0>

In article <7gsfik$4f0$1@nnrp1.deja.com>,
marzoram@my-dejanews.com wrote:

>Perl is the only language I have used until now for my job, but now I need to
>learn C (for some network programming: Linux, NT). Can anybody recommend a
>book on C...

I find Johnson and Troan's Linux Application Development (Addison Wesley)
very good.

Lee





------------------------------

Date: 06 May 1999 15:09:04 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Making executables from .pl files?
Message-Id: <m1wvyl4zr3.fsf@halfdome.holdit.com>

>>>>> "Bob" == Bob Trieger <sowmaster@juicepigs.com> writes:

Bob> As the newsgroup and subject line suggest. He was refering to perl 
Bob> source code. I challenge you to show us an example of free perl software 
Bob> that did not include its code.

ActiveState's win32 port?

<quickly ducking...>

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Thu, 6 May 1999 16:40:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: perlfunc study - optimize input data for repeated searches
Message-Id: <MPG.119bc84f803b22179899e8@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <3731bba0@cs.colorado.edu> on 6 May 1999 09:56:16 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
> (This excerpt is from the perlfunc manpage, part of the standard set of
> documentation included with every valid Perl distribution--like the one on
> your own system.  See also http://language.perl.com/newdocs/pod/perlfunc/
> if your negligent system adminstrator has been remiss in his duties.)

Hoo-boy!  Now I know why the message count spiked when I was away for a 
couple of hours at a meeting.

I don't mind at all, because I have super bandwidth on a very good 
newsfeed.  But I wonder...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 6 May 1999 16:31:12 -0700
From: "Tom Ashbrook" <tashbrook@edisonenterprises.com>
Subject: Re: Problem with Net::Telnet and its output kinda resolved
Message-Id: <pCpY2.7071$ny.696115@typhoon-sf.snfc21.pbi.net>

Actually the prompt is OK for now but I understand what you mean.

I think I actually fixed the problem by working around in the code.  By
using input_log() and dump_log() I noticed that the HP servers and one or
two of the AIX servers would echo each command back.  This echo must be
discarded by the Telnet.pm.  If I look in the dump files of an HP server I
will see my command input as "uptime" and the string "uptime" echoed back.
On most of the AIX boxes there is not an echo of the command line.  This
must be the setup of the individual servers.

The work around is shown below.  I used print and getline and looked for the
actual echo of the command.  If there was an echo I grabbed the next line to
get the actual output of the command I issued.

I hate to work things like this and it should be built into the Telnet
module in my opinion.

Thanks,
Tom.

sub get_info
{

  use Net::Telnet;

  print "\n...Generating output from the @_ server...\n";

  $dino = new Net::Telnet (Host => "@_",
                           Timeout => 30,
                           Prompt => '/.*>/');

$fi = $dino->input_log("@_"."in");
$fd = $dino->dump_log("@_"."out");



  print "\n...Generating output from the @_ server...\n";

  $dino = new Net::Telnet (Host => "@_",
                           Timeout => 30,
                           Prompt => '/.*>/');

    #$fi = $dino->input_log("@_"."in");
    #$fd = $dino->dump_log("@_"."out");


  $dino->login(guest,utiluser);
  # set up the command to get the disk info
  $host_cmd = "uptime";

  ## Request status of messages.

#####Here is where I changed
  $dino->print("uptime");
  $line = $dino->getline;

####If there is an echo enabled then grab the next line
  if ($line eq "uptime\n")
  {
    $line = $dino->getline;
  }
  print $line;

  $dino->close;

 # print @lines;
}






------------------------------

Date: Thu, 6 May 1999 12:55:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Slice [N..end] of unnamed array?
Message-Id: <ohhsg7.nd7.ln@magna.metronet.com>

Sam Nelson (sam@cs.stir.ac.uk) wrote:
: If I just generated an array whose length I don't know, how do I take a slice
: containing item N onwards? 


   Your use of "unnamed array" is confusing, since that term is
   not used in Perl.

   Perl has "lists" and "anonymous arrays".

   Did you mean one of those?


   Post a little code that generates whatever data structure it
   is that you _do_ mean, and we could likely show how to
   slice and dice it.
   
 
--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 6 May 1999 12:59:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: split, pop, and cut
Message-Id: <rphsg7.3e7.ln@magna.metronet.com>

Peter Eisengrein (prsinfo@profrecovery.com) wrote:
: I am looking for a way to split not by delimiter (which is like the UNIX
: 'cut -d'), but instead by character count, like the UNIX 'cut -c'
: command. I know I can cut off the end with pop, but that isn't exactly
: right either.

: I can't find this anywhere in the man pages or on the Web. Any help you
: can offer is greatly appreciated. Thanks.


   perldoc -f unpack


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 06 May 1999 22:12:01 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Stupid FAQ question of the (day? month? year?)
Message-Id: <7gt3ba$idh$1@ash.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
jgd@alpha3.csd.uwm.edu wrote:
>
>[Well, stupid and perhaps naive question of the day / month / year /
>millenium?]
>
>
>I see that Tom C is reposting the Perl FAQ, item by item.  This is
>good.
>
>However, it begs a question.
>
>Many of you c.l.p.m folks refer others to a FAQ item by number.  ("See
>FAQ 3.1, it answers all." was a recent response.)  So, I look at FAQ 3
>(perldoc perlfaq3), and the first item _does_ "answer all".
>
>But this brings me to my point.  The items are no longer _numbered_ in
>the FAQ files.  This is fine if one is looking for the first couple of
>items, but when one is referred to FAQ 4.47, the search becomes a little
>tedious.

Just translate the FAQS into text files and then you can use any text 
reader, editor or web browser to view them. To find a specific entry 
open the file in your reader/editor/browser and do a search on the 
entry.




------------------------------

Date: Thu, 06 May 1999 22:11:18 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Stupid FAQ question of the (day? month? year?)
Message-Id: <asoY2.2081$iu1.1918@news.rdc1.tn.home.com>

>There may be some type of structure to it, but it often eludes me as it is
not
>visually aparant until you read through 6-7 questions.


Okay...so I see it's under the NAME header. Shouldn't it be at the top of the
page first thing so you don't have to scroll down to figure out where you are?
:)

CT




------------------------------

Date: Thu, 6 May 1999 12:57:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: testing expressions in the IF statement
Message-Id: <5lhsg7.nd7.ln@magna.metronet.com>

UUNET (bvargas@hntb.com) wrote:

: For example, can I use something similar to the following statement?

: if ($x < 5 and $x > 2)


   WHWYTI?

   (What Happened When You Tried It)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 May 1999 23:06:33 GMT
From: djhoward@uiuc.edu
Subject: truncate() fails with "Invalid argument" on FreeBSD
Message-Id: <7gt79p$h40$1@vixen.cso.uiuc.edu>

Testing on FreeBSD 2.2-STABLE and 3.1-STABLE ELF yields same results:
truncate: Invalid argument at ./test.pl line 18, <FH> chunk 1000.

Chunk 1000 likely because test.txt is 1000 lines.

Here's the stripped-down text script:

#!/usr/bin/perl

use Fcntl ':flock';

sysopen(FH, "test.txt", O_RDWR|O_CREAT) or
	die "Couldn't open test.txt: $!";

flock(FH, LOCK_EX) or die "flock: $!";
seek(FH, 0, 0) or die "seek: $!";

while( <FH> ) {
	chomp;
	@a = split;
	$users{$a[0]} = $a[1];
}

seek(FH, 0, 0) or die "seek: $!";
truncate(FH, 0) or die "truncate: $!";
foreach $k (sort keys %users) {
		print FH "$k $users{$k}\n";
}

flock(FH,LOCK_UN) or die "flock: $!";
close(FH) or die "close: $!";

Yes, I am using Perl5 on both systems.
Yes the OS supports truncate().
Yes, the filesystems support locking. (Local, native FreeBSD FS.)

 ... am I doing something wrong or have I found a new bug?

Thanks!

-danny

-- 
dannyman - http://www.dannyland.org/~dannyman/


------------------------------

Date: 6 May 1999 23:17:00 GMT
From: djhoward@uiuc.edu
Subject: Re: truncate() fails with "Invalid argument" on FreeBSD
Message-Id: <7gt7tc$hvu$1@vixen.cso.uiuc.edu>

Followup: changing use Fcntl ':flock'; to use Fcntl; did the trick.  Is this
correct behaviour?

Thanks,
danny

-- 
dannyman - http://www.dannyland.org/~dannyman/


------------------------------

Date: Thu, 6 May 1999 16:13:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: unos problemitas
Message-Id: <MPG.119bc1e793e46c269899e7@nntp.hpl.hp.com>

In article <7gt17r$lk7$1@nnrp1.deja.com> on Thu, 06 May 1999 21:23:11 
GMT, pricerbumanto@my-dejanews.com <pricerbumanto@my-dejanews.com> 
says...
> In article <MPG.119b8460e1baadab9899e0@nntp.hpl.hp.com>,
>   lr@hpl.hp.com (Larry Rosler) wrote:
> > Someone suggested Esperanto.  Plural 'problemoj' ???  :-)
 ... 
>                 The "-oj" at the end of "problemoj" is pornounced like
> the "oy" in English "boy"  BTW, not loke the "og" in "Roger"...  (Zamenhof
> got it from the plural ending for second declension Greek nouns in the
> nominative, I think, not that it matters).

'pornounced' sounds inappropriate (but interesting -- leer:-).  But now 
it makes sense to me -- like the Greek plural "hoi polloi" (the people, 
literally).  It might have made more sense to English speakers to spell 
the plural 'problemoi', but French speakers might have had a problem 
with pronunciation.  German speakers might be at home with 'problemoj', 
but even to them it might look weird.  It's impossible to please 
everyone with one language, which takes us ...

Back to Perl.  :-)
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 6 May 1999 22:44:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Which HTTP module for extracting tags?
Message-Id: <7gt5vu$4tk$1@gellyfish.btinternet.com>

On Thu, 06 May 1999 21:20:14 GMT Charles R. Thompson wrote:
> I'm looking on CPAN and seeing a bit too much. Which HTTP module will allow me
> the quickest way to extract text between specific HTML tags with the least
> amount of overhead? I also need it to handle tags across newlines.
> 
> Say if I wanted to jerk just the title out of a page or get an array of all
> the a href links. That kind of simple flexibility.
> 

Look at the HTML::* modules available from CPAN.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 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 5588
**************************************

home help back first fref pref prev next nref lref last post