[18827] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 995 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 27 03:05:55 2001

Date: Sun, 27 May 2001 00:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <990947109-v10-i995@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 27 May 2001     Volume: 10 Number: 995

Today's topics:
    Re: ? The best Perl book ? hzi@uol.com.br
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <dball@bnb-lp.com>
        comparing two HoHoL's <webmaster@webdragon.unmunge.net>
    Re: Converting spaces to plus signs <kenphilbrick@mindspring.com>
    Re: Existing Script To Add Time <dball@bnb-lp.com>
    Re: Existing Script To Add Time (Tad McClellan)
    Re: hash array (Mark Jason Dominus)
        How to create a text file in Windows/DOS with PERL? (codeslayer)
    Re: How to create a text file in Windows/DOS with PERL? <krahnj@acm.org>
    Re: How to create a text file in Windows/DOS with PERL? (rabbits77)
    Re: How to create a text file in Windows/DOS with PERL? <pne-news-20010527@newton.digitalspace.net>
    Re: How to send mail with PostFix and Linux (reader of news)
    Re: Match Parsing Glitch <nospam@xx.com>
    Re: Match Parsing Glitch <nospam@xx.com>
    Re: Match Parsing Glitch <nospam@xx.com>
    Re: Match Parsing Glitch <nospam@xx.com>
    Re: NET::SMTP (Peter L. Berghold)
    Re: parsing perl again (Jordan Dimov)
    Re: parsing perl again (Damian Conway)
    Re: PDF Files <ron@savage.net.au>
        search keywords for text analysis tools (Guy Worthington)
        tail -f in a perl-program (Konstantinos Agouros)
    Re: tail -f in a perl-program (Mark Jason Dominus)
    Re: tail -f in a perl-program (Tramm Hudson)
    Re: Taint <dball@bnb-lp.com>
    Re: Taint (Steven Smolinski)
        typeglob (one more try) <Anonymous_Account>" <remailer@xganon.com>
    Re: typeglob (one more try) <tony_curtis32@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 27 May 2001 15:42:57 +0000
From: hzi@uol.com.br
Subject: Re: ? The best Perl book ?
Message-Id: <9eq48g$l1e9$1@ID-78052.news.dfncis.de>

In article <9an5a5$j8v$1@news.EUnet.yu>, "Dejan Bizinger" <lists@brokerpal.com> wrote:
> I would like to start learning Perl so I would like you to recommend me some
> good book.  I want to buy a book that starts explaining basics thru advanced
> programming. I have several picks like:
> Programming Perl - Larry Wall
> Learning Perl - Larry Wall
> Perl - The Complete Reference - McGraw-Hill
> Thanks in advance.
> Regards,
>                 Dejan
>                 Editor of BrokerPal Newsletter - free list of expired domain
> names, domain texts, news, auctions
>                 Subscribe: mailto:bizi-subscribe@listbot.com
> 
> 
I'm reading "Beginning Perl" (Wrox Press) and I'm quite satisfied with it, so far.
Programming Perl (the camel book) complements it, whenever I need to go deeper.
Regards,
HL




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

Date: Sat, 26 May 2001 16:22:31 -0700
From: David Ball <dball@bnb-lp.com>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <7ie0htcm064jm5v6ajemv3922odgvk0i3q@4ax.com>

On 11 May 2001 16:12:42 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>What cabal?  What authority is being claimed?
>
>[snip Che Guevara]
>
>Anno

Anno

Apparently, I'm not the only one who finds your net-nazi routine
annoying.

-- David



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

Date: 27 May 2001 01:53:47 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: comparing two HoHoL's
Message-Id: <9epmnb$peg$0@216.155.32.196>

I have two semi-complex hashes that I wish to compare 

the data I wish to extract and print is 

A.    items missing from hash1 or hash2
B.    items in hash1 that have been changed/updated in hash2

B is easy, but A is considerably more difficult. here's why: 

the hashes look like this

    $hash1{$gametype}{$coercedtitle} = 
        [$filename, $title, $size, $review, $rating];

it's simple enough to loop through them in a double-step

foreach my $gametype ( keys %hash1 )
{
    foreach my $coercename ( sort keys %{$hash1{$gametype}} )
    {
        my($filename, $title, $size, $review, $rating) = 
            @{$hash1{$gametype}{$coercename}};
        
        #do tests A and B here
    }
}

and then do the same for %hash2, this time just testing A.

However, I'm curious to know whether you folks know of any more 
efficient methods for comparing the two, this being a bit more complex 
than a simple array or hash comparison typically found in the pod... 

The hash contains roughly 4,050 entries at present.

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Sat, 26 May 2001 20:50:35 -0400
From: Ken Philbrick <kenphilbrick@mindspring.com>
Subject: Re: Converting spaces to plus signs
Message-Id: <3B104F5B.2F2C045D@mindspring.com>

Yes, this is a CGI question.  Sorry I didn't mention it originally.

But I was looking for a solution that didn't rely on any CGI modules,
because I thought it would be interesting to know how to do this sort of
thing for other problems as well.

Thanks for your help.

--
Ken

Ken Philbrick wrote:
> 
> I have some strings that contain spaces, but I'd like to convert all the
> spaces into plus signs.  I've tried various methods using split and
> join, but nothing has worked.  The FAQ on perl.com doesn't seem to
> mention anything about it either.  Any ideas?
> 
> --
> Ken

-- 
Ken


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

Date: Sat, 26 May 2001 16:25:18 -0700
From: David Ball <dball@bnb-lp.com>
Subject: Re: Existing Script To Add Time
Message-Id: <1pe0htkhk7th154bgso7eelkpkb603nvh0@4ax.com>

On 13 May 2001 17:57:07 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>According to Dodger <dodger@necrosoft.net>:
>> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
>> news:9dm2ur$1a5$2@mamenchi.zrz.TU-Berlin.DE...
>> > According to Dodger <dodger@necrosoft.net>:
>> > > # On the fly - Not tested, as usual.
>> >
>> > Why not?  There are two reasons for posting untested code: either it
>> > is trivial and you trust yourself to get it right, or it requires
>> > an environment you don't have and can't be expected to set up.
>> 
>> The former, in two senses.
>> 
>> a) the problem itself is trivial, and I trust myself to get it right
>> b) since its a post in comp.lang.perl.misc, it's someone else's problem, and
>> as such, I can't be bothered if I'm not getting paid. I'm being nice
>> throwing the logic out there for someone who asked. I don't need to debug
>> any potential typoes, too.
>
>If you want to describe the logic of the problem, describe it.  If
>you want to post a solution in code, test it.  And do think about it
>a little before you present it as exemplary.  Your 15-line solution
>includes a while loop that does nothing but integer division.  This
>is just thoughtless.  The whole thing can be expressed in four lines
>like this:
>
>    my ($starth, $startm, $stoph, $stopm) = map split( /:/), @ARGV;
>    my $minutes = 60 * ($stoph - $starth) + $stopm - $startm;
>    $minutes += 24 * 60 if $minutes < 0; # not specified, but plausible
>    printf "%02d:%02d\n", int $minutes / 60, $minutes % 60;
>
>Except perhaps for the map() everything is absolutely straightforward
>and, with a moment's thought, should have occurred to you as well.  A
>little diligence is required.
>
>> > Otherwise, test your code, or don't post.
>> 
>> I'm afraid I can't accept your authority as a controlling one for me. That
>> is to say, I'm not going to do what you say.
>
>Up to you.
> 
>> No offense, but I will continue to post as I do, with on-the-fly code, for
>> simple tasks such as this. If I have reason to doubt either a logic flow or
>> a bit o' Perl that's particularly weird, I will log in and test it. If it's
>
>[snip]
>
>You will be criticized.
>
>Anno

Yes, but it's by Anno the jerk so it doesn't count.



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

Date: Sat, 26 May 2001 19:10:07 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Existing Script To Add Time
Message-Id: <slrn9h0duf.2is.tadmc@tadmc26.august.net>

David Ball <dball@bnb-lp.com> wrote:


>Yes, but it's by Anno the jerk so it doesn't count.


I think most folks will recognize who is being a jerk (hint: it isn't Anno).


Anno was trying to save you from becoming widely killfiled by the
folks most likely to answer your future Perl questions.

He failed.

*plonk*


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 27 May 2001 02:31:05 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: hash array
Message-Id: <3b1066d5.e64$152@news.op.net>

In article <tlqvgtglo65v7tcro6qbqupdlehbofet07@4ax.com>,
Philip Newton  <nospam.newton@gmx.li> wrote:
>On Sat, 26 May 2001 05:10:05 GMT, Gisle Aas <gisle@ActiveState.com>
>wrote:
>
>> You can also get that number with code like this:
>> 
>>   $size = do { local $hash{x} = 1; (split "/", %hash)[1] };
>
>Unless the hash happened to be "full", 

If you had read the rest of the thread, you would have discovered that
the question was "After you erase a hash with %hash = (), how do you
tell how many buckets it had before?"

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 26 May 2001 20:40:31 -0700
From: weedmonster_99@yahoo.com (codeslayer)
Subject: How to create a text file in Windows/DOS with PERL?
Message-Id: <4b459565.0105261940.43a39676@posting.google.com>

Greetings to All:
-----------------

I am going nuerotic trying to find the answer to what seems to be a
simple question.

I would like to know what code will let me create a text file in PERL,
or, if that is NOT POSSIBLE.

I have scoured several books, tutorials, manuals, and the internet for
the answer, to no avail. Everywhere I look, there are instructions for
"open a file", "writing to a file", "die"ing when the file does not
exist, "creating cgi log files", etc ...

None of which seems to have the answer, though.  I need to know what
code sequence will allow me to create a file; no modules, functions,
cgi, etc ... just PURE RAW PERL CODE!

To illustrate:

In Unix one can use the "touch" command in a shell script to create a
file. I need to know what the equivalent is in PERL, or as I said
before, if it is IMPOSSIBLE. I am doing this in a Win32/Windows/DOS
environment.

Any help will be appreciated.

Thank you.


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

Date: Sun, 27 May 2001 05:33:48 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How to create a text file in Windows/DOS with PERL?
Message-Id: <3B1091BE.9387A86D@acm.org>

codeslayer wrote:
> 
> Greetings to All:
> -----------------
> 
> I am going nuerotic trying to find the answer to what seems to be a
> simple question.
> 
> I would like to know what code will let me create a text file in PERL,
> or, if that is NOT POSSIBLE.

I can show you how to do it in perl, I don't know anything about PERL.

#!/usr/bin/perl -w
use strict;
open FILE, '> file.txt' or die "Cannot open file.txt: $!";
print "This is a text file.\n";
__END__


> I have scoured several books, tutorials, manuals, and the internet for
> the answer, to no avail. Everywhere I look, there are instructions for
> "open a file", "writing to a file", "die"ing when the file does not
> exist, "creating cgi log files", etc ...
> 
> None of which seems to have the answer, though.  I need to know what
> code sequence will allow me to create a file; no modules, functions,
> cgi, etc ... just PURE RAW PERL CODE!
> 
> To illustrate:
> 
> In Unix one can use the "touch" command in a shell script to create a
> file. I need to know what the equivalent is in PERL, or as I said
> before, if it is IMPOSSIBLE. I am doing this in a Win32/Windows/DOS
> environment.

http://language.perl.com/ppt/src/touch/touch.abigail



John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 27 May 2001 02:14:06 -0400
From: rabbits77@my-deja.com (rabbits77)
Subject: Re: How to create a text file in Windows/DOS with PERL?
Message-Id: <rabbits77-2705010214060001@208.26.112.40>

<snip>
> To illustrate:
> 
> In Unix one can use the "touch" command in a shell script to create a
> file. I need to know what the equivalent is in PERL, or as I said
> before, if it is IMPOSSIBLE. I am doing this in a Win32/Windows/DOS
> environment.
> 
> Any help will be appreciated.
> 
> Thank you.

open(FILEHANDLE,">temp.txt") || die "cannot open file.";
#print FILEHANDLE "Hello\n";
close(FILEHANDLE);

The above will simple create an empty file. To write to the file uncomment
the second line.

-- 
In science, there is only physics; all the rest is stamp collecting.
  -Ernest Rutherford.


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

Date: Sun, 27 May 2001 08:58:01 +0200
From: Philip Newton <pne-news-20010527@newton.digitalspace.net>
Subject: Re: How to create a text file in Windows/DOS with PERL?
Message-Id: <u991ht8uus7fbef6iql6tissrdijr7b1ug@4ax.com>

On Sun, 27 May 2001 05:33:48 GMT, "John W. Krahn" <krahnj@acm.org>
wrote:

> I can show you how to do it in perl, I don't know anything about PERL.

I think you actually showed him how to do it in Perl, rather than perl,
if you're going to pick nits.

> #!/usr/bin/perl -w
> use strict;
> open FILE, '> file.txt' or die "Cannot open file.txt: $!";
> print "This is a text file.\n";
> __END__

I think you need s/print/print FILE/ there (or maybe s/print/select
FILE; print/).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sat, 26 May 2001 23:34:04 GMT
From: newsreader@mediaone.net (reader of news)
Subject: Re: How to send mail with PostFix and Linux
Message-Id: <slrn9h0f90.fff.newsreader@dragon.universe>

If postfix understands smtp
then you can use Net::SMTP
which is part of libnet on
cpan.  After you install it
you can find out how to
use it by doing
	$ man Net::SMTP


On Sat, 26 May 2001 14:47:59 -0500, Tommy Martin <tmartin1@telocity.com> wrote:
>I need to send simple emails from perl scripts on a linux box. Is there some
>simple sample code somewhere I can look at or can anyone point me in the
>right direction.
>
>Please disreguard the previous post of mine. I was not sure what mail
>program was installed on that machine.
>
>Tommy
>
>
>


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

Date: Sat, 26 May 2001 20:43:05 -0700
From: Eric <nospam@xx.com>
Subject: Re: Match Parsing Glitch
Message-Id: <3B1077C9.8ECF589F@xx.com>

Eric Bohlman wrote:
> 
> That's when you send someone an e-mail copy ("CC") of a post, but you
> don't give any indication in the e-mail copy that it was also posted.

Ahhh...to me, Bcc has always been the "stealth" mode :-)  Tnx.


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

Date: Sat, 26 May 2001 20:59:08 -0700
From: Eric <nospam@xx.com>
Subject: Re: Match Parsing Glitch
Message-Id: <3B107B8C.BF7D679C@xx.com>

Abe Timmerman wrote:

>> RE: global type errors
> 
> Descriptions of these errors can be found in perldiag.pod
>         perldoc perldiag

I finally got Perl 5.6.1 Plus installed, but the above doesn't work
on my WIN32 system.  Must be a Unix thing?
> 
> You can also let perl do the lookup for you, if you put the line
>         use diagnostics;
> near the top of your program whilst developing.

I tried this ... total "Greek" to me about initializing a filehandle.

> It looks like you need to declare the variables with my() or the "use
> vars" pragma.
> 
>         perldoc -f my
>         perldoc vars

ARRRGGGHHH ... read this but still "Greek" ;-(
> 

Things seemed to be so much easier back when I was using 4.x  :-)

Now that I have 5.6.1 installed, maybe there is a simpler way to 
accomplish the objective???

Thank you for all your continued assistance.

Eric


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

Date: Sat, 26 May 2001 21:38:12 -0700
From: Eric <nospam@xx.com>
Subject: Re: Match Parsing Glitch
Message-Id: <3B1084B4.2B4986E@xx.com>

Eric wrote:

> I tried this ... total "Greek" to me about initializing a filehandle.

OK...I did some more reading, but it appears I am already making a 
filehandle initialization???

	$filename = <STDIN>; 
	open (INFILE, "$filename")
	or die "Could not open $filename as read: $!";

The script will be used to open a number of different files.  Would
taking vitamins help here?  ;-(

Eric


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

Date: Sat, 26 May 2001 23:30:10 -0700
From: Eric <nospam@xx.com>
Subject: Re: Match Parsing Glitch
Message-Id: <3B109EF2.8F0F6A20@xx.com>

Abe:

This is "partially" working now (as long as I don't use 'strict' and
ignore thee following errors AFTER I've run the script:

ERROR FOR EACH FILE RECORD READ: readline() on unopened filehandle input
at line 67

LINE 67 IS:    for ( 3..11 ) { $line = <INPUT> }

Part of the problem was some lines that had 'INPUT' (I changed these to
'INFILE' and also decided to parse two more fields and modified the 'for
( 3...x)' line to provide for the extra line for parsing.

Now with 5.6.1 (Build 626) loaded, I tried perldoc -q FAX define ...
(and defined) but nada, zip squat came up.  If I put back in 'use
strict;' then it won't run and I still get those undefined filehandle
errors.

All I know is that I'm getting the .csv file output for importing into
Excel now, and greatly appreciate all the help.  However, it would be
nice to know how to resolve the nasty errors and understand WHAT is
still wrong.

Eric

--- Retweaked Script Below ---

#!/usr/bin/perl -w
#use strict;    ###### will only work with this commented out !!!
# 
# DATA RECORD BIZZARE FILE FORMAT LINES TO PARSE (complete file contains
blank lines)
#
# EXAMPLE OF ONE RECORD FROM FILE
#
#1 #053817   1/5  329 ANYWHERE ST.               1/UN  BD 3 BA 2.5 
SP:$1,000,000
#2 SO:XYZ123.8     SA:SUZY SALES         FN:OC1S        SD:05/23/01 
LP:$9,000,000
#  ZC:95037       CS:MONTEZUMA          SF:7000/C      LR:         
TL:$0
#  CO:SCC         PG:00  HZ:00  VT:00   AG:18          KT:         
CA:$0
#  TB:0958 B6     BD:                                  MB:         
MP:$0
#  HS:0   HD:480  TR:                   LS:0 ACRES     DR:         
AF:$0
#  MS:0           PN:123-45-678         ZN:AW          FR:         
TX:$0
#  ES:0   ED:480  OW:SUPERSELLER                       CE:05/2/401 
RT:$0     TT:N
#  T1:            OC:O/MR & MRS BATMAN                 LD:05/21/01 
DOM:2
#  T2:            OP:408-842-4355                      XD:05/25/01 
OLP:$6,000,000
#11LO:BIGLISTINGOFFICEINSK CBA987.11RP:408-999-0000    SC:05/22/01 
RD:05/23/01
#12LA:LARRY LISTER         CR:3     AP:408-888-0000    IS:F        
LOE:5
# <snipped more lines of text & numbers not needed in each record>
#
$R=1;						#start number for record counter
print "Enter File Name To Parse: "; #instructions for entering file name
$filename = <STDIN>; 			#enter file name to parse
print "Enter Output File Name: "; 	#instructions to enter out file name
$datafile = <STDIN>; 			#enter output file name
open (INFILE, "$filename")
or die "Could not open $filename as read: $!"; 	#open input file

my $line;
while ( defined( $line = <INFILE> ) ) 

{
	  next unless $line =~ /^#\d{6}/;
        my( $status, $addr, $price ) =
                unpack 'x12 A1 x2 A25 x28 A10', $line;
        $price =~ tr/$,//d;
        $addr  =~ s/^\s+//g; #trailing spaces removed by unpack 'A'

        $line = <INFILE>; #This line should start with 'SO'
        die "Line 2 of record didn't start with 'SO'\n"
                unless $line =~ /^SO/;

        my( $so, $sa ) = unpack 'x3 A8 x7 A17', $line;

        $sa =~ s/^\s+//g;

####### The next line is LINE 67
        for ( 3..11 ) { $line = <INPUT> }
          $line = <INFILE> for 3..11; # skip some lines
        die "Line 11 of record didn't start with 'LO'\n"
                unless $line =~ /^LO/;

	  my( $lo ) = unpack 'x24 A8', $line;

        $line = <INFILE>; #This line should start with 'LA'
        die "Line 12 of record didn't start with 'LA'\n"
                unless $line =~ /^LA/;

        my( $la ) = unpack 'x3 A17', $line;
        $la =~ s/^\s+//g;

        writedatafile( $status, $addr, $price, $so, $sa, $lo, $la );
}

close (INFILE); #close input file

### SUBROUTINE TO PARSED DATA TO ASCII .CSV FILE
sub writedatafile
{
my ($status, $addr, $price, $so, $sa, $lo, $la ) = @_;
open (FILE ,">>$datafile"); 			#open output file for append
print FILE "$R,$status,\"$addr\",$price,$so,$sa,$lo,$la\n"; #write data
to file
$R++;							#increment record counter
close (FILE); #close output file
}
# END OF PERL SCRIPT


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

Date: Sun, 27 May 2001 01:31:31 GMT
From: peter@uboat.berghold.net (Peter L. Berghold)
Subject: Re: NET::SMTP
Message-Id: <slrn9h0m7g.slc.peter@uboat.berghold.net>

In comp.lang.perl.misc, Peter Ruester(Peter.Ruester@t-online.de) 
	Spoke Thusly about
	"NET::SMTP":
[*]Hi,
[*]
[*]I would like to send a Email with an attached file.
[*]Is it possible with the module NET::SMTP
[*]A sample is very welcome.
[*]

Check out MIME::Entity on CPAN.  And there is a sample how-to 
in the doco for that module...

HTH

-- 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
Schooner Technology Consulting           http://www.berghold.net
Unix Professional Services    Perl Perl/CGI mod_perl 


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

Date: 26 May 2001 19:41:40 -0700
From: jdimov@cis.clarion.edu (Jordan Dimov)
Subject: Re: parsing perl again
Message-Id: <7447a59a.0105261841.32747f1f@posting.google.com>

Can the rest of us get to know some more about this alternative life form?  

damian@cs.monash.edu.au (Damian Conway) wrote in message news:<9emoh0$4u9$1@towncrier.cc.monash.edu.au>...

> Curiously, I have a talk at TPC5 that is relevant to this increasingly
> silly thread:
> 
> 	http://conferences.oreillynet.com/cs/os2001/view/e_sess/1512
> 
> You have been warned.
> 
> Damian


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

Date: 27 May 2001 04:02:52 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: parsing perl again
Message-Id: <9epu9c$m62$1@towncrier.cc.monash.edu.au>

jdimov@cis.clarion.edu (Jordan Dimov) writes:

> Can the rest of us get to know some more about this alternative life form?  

After the conference...don't want to give the game away beforehand. ;-)

Damian


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

Date: Sun, 27 May 2001 11:55:49 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: PDF Files
Message-Id: <kiYP6.970$Yr1.42463@ozemail.com.au>

1: http://www.ra.informatik.uni-stuttgart.de/~gosho/pdftohtml/

2: http://www.foolabs.com/xpdf/

--
Cheers
Ron  Savage
ron@savage.net.au
http://savage.net.au/index.html





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

Date: 26 May 2001 22:31:05 -0700
From: guyw@multiline.com.au (Guy Worthington)
Subject: search keywords for text analysis tools
Message-Id: <33f78556.0105262131.4bcbac67@posting.google.com>

I need my hand held when using "search.cpan.org".  I would like to build
a sorted list of all the words, and the lines (or pages) they occur on,
from a TeX file source (I think of it as a raw concordance table).  Could I
prevail on some of you to give me keyword searches to help me find a tool
that constructs a concordance table.


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

Date: 27 May 2001 00:43:51 +0200
From: elwood@news.agouros.de (Konstantinos Agouros)
Subject: tail -f in a perl-program
Message-Id: <elwood.990916899@news.agouros.de>

Hi,

I want to read line-like with <DESCRIPTOR> from logfiles. Currently I do
something like 'open(DESK,"tail -f /var/log/messages|")' to stay life on the
logfile. Is this the most efficient way to do this? Since I don't want to
loose the <> using select (the system call) might not be the best idea or is
there something I am missing completely?

Konstantin
-- 
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres


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

Date: Sun, 27 May 2001 02:33:43 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: tail -f in a perl-program
Message-Id: <3b106777.e72$90@news.op.net>

In article <elwood.990916899@news.agouros.de>,
Konstantinos Agouros <elwood@news.agouros.de> wrote:
>I want to read line-like with <DESCRIPTOR> from logfiles. Currently I do
>something like 'open(DESK,"tail -f /var/log/messages|")' to stay life on the
>logfile. Is this the most efficient way to do this? Since I don't want to
>loose the <> using select (the system call) might not be the best idea or is
>there something I am missing completely?

I use:

        #!/usr/bin/perl
        
        use Symbol;
        
        unless (@ARGV) {
          die "Usage: $0 files...\n";
        }
        
        foreach $file (@ARGV) {
          my $fh = gensym;
          (my $tag = $file) =~ s:.*/::;
          if (open $fh, $file) {
            $fh{$file} = [1, $fh, $tag];
            seek $fh, 0, 2;		# Seek to end
          } else {
            warn "Couldn't open file `$file': $!; ignoring\n";
          }
        }
        
        @files = keys %fh;
        
        for (;;) {
          my $goodfiles = 0;
          foreach $file (@files) {
            my $lines = 0;
            my ($good, $fh, $tag) = @{$fh{$file}};
            seek $fh, 0, 1 unless $good;
            while (defined ($line = <$fh>)) {
              $lines++;
              print "$tag: $line" ;
            }
            $goodfiles += $fh{$file}[0] = ($lines > 0);
          }
          sleep 5 unless $goodfiles;
        }
        
        
I have no idea about the efficiency.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 27 May 2001 04:43:46 GMT
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: tail -f in a perl-program
Message-Id: <9eq0m2$7eu$1@sloth.swcp.com>

[ Posted and cc'd to cited author ]

Mark Jason Dominus <mjd@plover.com> wrote:
>Konstantinos Agouros <elwood@news.agouros.de> wrote:
>> ... open(DESK,"tail -f /var/log/messages|") ...
>
>I use:
[snip the code example]

Is there something wrong with the answer given by

	perldoc -q 'tail -f'

Other than that your example does support multiple files and
shows how to use gensym rather than File::Handle.

> I have no idea about the efficiency.

Does efficiency really matter if the code does a "sleep 5" in a loop?

Tramm
-- 
  o   hudson@swcp.com                  hudson@turbolabs.com   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.323.38.81   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.986.60.75   \ \/\_\  
  0                                                            U \_  | 


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

Date: Sat, 26 May 2001 16:26:02 -0700
From: David Ball <dball@bnb-lp.com>
Subject: Re: Taint
Message-Id: <vre0htcldf697l9o0j6keb3ch1o467tu5s@4ax.com>

On 13 May 2001 20:27:17 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>According to Dodger <dodger@necrosoft.net>:
>
>> Do not ever flame me again.
>
>Why not?
>
>Anno

Anno, you're such a jerk.



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

Date: Sun, 27 May 2001 03:46:41 GMT
From: steven.smolinski@sympatico.ca (Steven Smolinski)
Subject: Re: Taint
Message-Id: <slrn9h13sm.i7.steven.smolinski@ragnar.stevens.gulch>

David Ball <dball@bnb-lp.com> wrote:

> Anno, you're such a jerk.

I hope you realize how many killfiles you're getting into with this sort
of thing.

This newsgroup will probably be a terrible resource for you for some
time.

Steve
-- 
Steven Smolinski => http://www.steven.cx/


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

Date: Sat, 26 May 2001 21:55:37 -0500
From: "Public <Anonymous_Account>" <remailer@xganon.com>
Subject: typeglob (one more try)
Message-Id: <ffafc236c26d7757ac04a93eaec0fde7@anon.xg.nu>

Why does the following work OK but then stop working if we
simply reverse the order of the two print statements?

*a = [1..5];
print 



---
This message did not originate from the Sender address above.
It was posted with the use of anonymizing software at 
http://anon.xg.nu
---




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

Date: 26 May 2001 23:02:38 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: typeglob (one more try)
Message-Id: <87n17zo2w1.fsf@limey.hpcc.uh.edu>

>> On Sat, 26 May 2001 21:55:37 -0500,
>> "Public <Anonymous_Account>" <remailer@xganon.com> said:

> Why does the following work OK but then stop working if
> we simply reverse the order of the two print statements?

> *a = [1..5];
> print

There's only *1* print statement.  Also you do not define
what you mean by "work OK" and "stop working".  Contrary
to popular belief, noone here is psychic, you have to
include:

 o the ACTUAL code involved
 o what behaviour you expected (show input, output, warnings etc)
 o what behaviour you actually got (show input, output, warnings etc)

If you do that, we can get somewhere...

hth
t
-- 
Just reach into these holes.  I use a carrot.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 995
**************************************


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