[11479] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5079 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 7 08:07:33 1999

Date: Sun, 7 Mar 99 05:00:45 -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           Sun, 7 Mar 1999     Volume: 8 Number: 5079

Today's topics:
    Re: append 3 huge log files barryc@spots.ab.ca
        FAQ 2.10: Where should I post source code?   <perlfaq-suggestions@perl.com>
        FAQ 2.9: What are the Perl newsgroups on USENET?  Where <perlfaq-suggestions@perl.com>
        Faster way to read lines from a file (was Re: Sorting t (Fuzzy Warm Moogles)
    Re: file extension .pl <bcornwell@mail.peds.lsumc.edu>
    Re: File Question (Newbie) <dgris@moiraine.dimensional.com>
        Germans Find Pentium III Flaw - Your privacy - Expires  (Boycott Swintel)
    Re: Help-Perl has stopped on my IIS server! (Steve Grantz)
        How to do Spell Check <kcchan@csis.hku.hk>
    Re: input from file or from buffer <dgris@moiraine.dimensional.com>
        Newbie can't use fetchrow_hashref with DBI - HELP! (Jamie)
    Re: Perl & OS/2: problems with makefile.pl & makemaker (Erik Huelsmann)
    Re: Verifying URL's with perl. <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 7 Mar 1999 07:18:26 GMT
From: barryc@spots.ab.ca
Subject: Re: append 3 huge log files
Message-Id: <7bt982$jsh$2@iceman.tac.net>

vnguyen2891@my-dejanews.com wrote:
~Hello guys,

~I got 3 huge log files which I want to append them all into one file ( put 3
~files into 1 file). Do you have any suggestion to do it? Please give me
~detailed suggestion.

~Thanks in advance
~Van Nguyen

man join

You're most welcome,
Barry


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

Date: 7 Mar 1999 03:42:10 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 2.10: Where should I post source code?  
Message-Id: <36e25802@csnews>

(This excerpt from perlfaq2 - Obtaining and Learning about Perl 
    ($Revision: 1.30 $, $Date: 1998/12/29 19:43:32 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq2.html
if your negligent system adminstrator has been remiss in his duties.)

  Where should I post source code?

    You should post source code to whichever group is most
    appropriate, but feel free to cross-post to comp.lang.perl.misc.
    If you want to cross-post to alt.sources, please make sure it
    follows their posting standards, including setting the Followup-
    To header line to NOT include alt.sources; see their FAQ
    (http://www.faqs.org/faqs/alt-sources-intro/) for details.

    If you're just looking for software, first use Alta Vista, Deja
    News, and search CPAN. This is faster and more productive than
    just posting a request.

-- 
	    Finally, which rhymes with enough --
	    Though, through, plough, or dough, or cough?


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

Date: 7 Mar 1999 01:12:02 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 2.9: What are the Perl newsgroups on USENET?  Where do I post questions?  
Message-Id: <36e234d2@csnews>

(This excerpt from perlfaq2 - Obtaining and Learning about Perl 
    ($Revision: 1.30 $, $Date: 1998/12/29 19:43:32 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq2.html
if your negligent system adminstrator has been remiss in his duties.)

  What are the Perl newsgroups on USENET?  Where do I post questions?

    The now defunct comp.lang.perl newsgroup has been superseded by
    the following groups:

        comp.lang.perl.announce             Moderated announcement group
        comp.lang.perl.misc                 Very busy group about Perl in general
        comp.lang.perl.moderated            Moderated discussion group
        comp.lang.perl.modules              Use and development of Perl modules
        comp.lang.perl.tk                   Using Tk (and X) from Perl

        comp.infosystems.www.authoring.cgi  Writing CGI scripts for the Web.

    There is also USENET gateway to the mailing list used by the
    crack Perl development team (perl5-porters) at
    news://news.perl.com/perl.porters-gw/ .

-- 
The reductionist approach has its place, as does the holistic approach.
Render therefore unto Unix the things which are Unix's, and unto Perl
the things that are Perl's.  :-)  Larry Wall in <1994Nov10.185030.16615@netlabs.com>


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

Date: Sun, 07 Mar 1999 07:07:09 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Faster way to read lines from a file (was Re: Sorting trouble. Almost solved. Final touch needed.)
Message-Id: <36e318eb.326191328@news.oz.net>

On Sat, 06 Mar 1999 23:18:44 GMT, @l@ <aqumsieh@matrox.com> wrote:

>In article <tGED2.14$5R.2106@dummy.bahnhof.se>,
>  "Par Svensson" <par@removethis.bahnhof.se> wrote:
>
>> while (<INFILE>) {
>> $wholefile .= $_;
>>   }
>>
>> @unsorteddata = split (/\n/, $wholefile);
>
>The four lines above can be substituted by the much faster:
>
>	@unsorteddata = <INFILE>;

Faster?  Not by a long shot.  Anyone remember the Python thread awhile
back, where a Python snippet slurped in file lines faster than Perl?
<> has to copy stuff twice.  split() has optimized this slowdown away.

Below are some benchmarks.  Note the huge difference between 'Array'
(your solution + chomp) and 'Split' (Par's solution without the costly
line-by-line buildup of $wholefile):

Benchmark: timing 100 iterations of Aqum, Array, Par, RE, Split...
      Aqum: 16 wallclock secs (16.09 usr +  0.00 sys = 16.09 CPU)
     Array: 17 wallclock secs (17.74 usr +  0.00 sys = 17.74 CPU)
       Par: 17 wallclock secs (16.04 usr +  0.00 sys = 16.04 CPU)
        RE: 12 wallclock secs (12.74 usr +  0.00 sys = 12.74 CPU)
     Split: 10 wallclock secs (10.22 usr +  0.00 sys = 10.22 CPU)

#!/usr/bin/perl -w

use Benchmark;

$file = 'words';  # /usr/dict/words

timethese 100, {
    Array => sub {
        open FH, $file;
        chomp(my @array = <FH>);
        close FH;
    },
    Aqum  => sub {
        open FH, $file;
        my @aqum = <FH>;
        close FH;
    },
    Split => sub {
        open FH, $file;
        local $/;
        my @split = split /\n/, <FH>;
        close FH;
    },
    Par   => sub {
        open FH, $file;
        my $file = '';
        $file .= $_ while <FH>;
        my @par = split /\n/, $file;
        close FH;
    },
    RE    => sub {
        open FH, $file;
        local $/;
        my @re = <FH> =~ /(.*)\n/g;
        close FH;
    },
};

BTW, I'm not claiming any of the above are equivalent to each other.
They aren't.


-- 
perl -e '1 while print "I want a moogle stuffy!\n"'


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

Date: Sun, 7 Mar 1999 06:32:53 -0600
From: "Brent Cornwell, Pediatrics Computer Administrator" <bcornwell@mail.peds.lsumc.edu>
Subject: Re: file extension .pl
Message-Id: <7bts0e$lu4$1@fox.comm.net>

what i find works the best is to create a NotePad shortcut in my SendTo
folder, to send the file to NotePad for a simple "rightclick, Send To,
NotePad"

Win95's SendTo folder is under the Windows folder
WinNT's sendto folder is under the user's profile folder

Brent Cornwell, Computer Support Administrator
Pediatrics Department, LSU Medical


deltabob wrote in message <36e2072d.8429686@news.telis.org>...
> I have a file with a .PL extension. Can
>anyone tell what I need to read this file? I am
>using win95B.
>                                  Thanks for any help
>                                   deltabob




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

Date: 07 Mar 1999 03:09:42 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: File Question (Newbie)
Message-Id: <m31zj11uhl.fsf@moiraine.dimensional.com>

rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:

> I can conceive of using parentheses and braces backwards )like this }or
> like this{(.  But how the heck does one use quotes backwards?

'like this`

HTH :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Sun, 28 Feb 1999 19:46:10 GMT
From: swintel@badchips.com (Boycott Swintel)
Subject: Germans Find Pentium III Flaw - Your privacy - Expires 2/28/99
Message-Id: <36da9c39.304681@news.earthlink.net>

	Pentium III chip with the individual serial number that can
track your web surfing and buying habits can now have the ID number
turned on and off by software.  Following some links I found the
www.fightdivx.com website and noticed that they have a Intel Boycott
page with links, quotes and info on why you should boycott the
invasion of privacy Pentium III chips. Just like everyone suspected,
the ID number can be taken without a customers knowledge. Just like
cellular phone fraud, once someone has your unique ID number, they
could pose as you on the internet.  Do not be fooled by reports that
this problem is fixed because Intel disabled this feature by software
on their up coming chips.  Information is power. They want to know
your surfing and buying habits. That is what this is all about. Here
is the link to the page with the boycott info and links. 

http://www.fightdivx.com/intelboycott.htm

Also you will find a Boycott Intel screen saver and banner on their
page above. Spread it around.




Take the Pentium III Boycott Survey
http://mail.infotrieve.com/isurvey/index.cfm?vendorid=6045&formid=F0006045





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

Date: Sun, 07 Mar 1999 11:11:45 GMT
From: sgrantz@visi.com (Steve Grantz)
Subject: Re: Help-Perl has stopped on my IIS server!
Message-Id: <R9tE2.110$to3.8442@ptah.visi.com>

Neil Barker (neil@cqit.qld.edu.au) wrote:
: I upgraded to the latest perl from activestate and suddenly nothing works.
: When I run a perl script it says "The specified module could not be found."
: 
: Can anyone help?  I no longer have the old perl.

You may wish to check the IIS configuration and see what it has listed
as the exectuable to run for .pl extensions. It may still be pointing to
the old version, or there may be multiple listings for .pl . 


Hope this helps,
SG

-- 
More of Steve Grantz's Blather at               2 * McQ != McQ
http://www.visi.com/~sgrantz         		0.5 * McQ == McQ


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

Date: Sun, 7 Mar 1999 20:18:03 +0800
From: Rollo Chan Ka Chun <kcchan@csis.hku.hk>
Subject: How to do Spell Check
Message-Id: <Pine.GSO.4.03.9903072017360.23088-100000@eagle.csis.hku.hk>

Dear all,

	How to do spell check in PERL?

Regards,

Rollo 



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

Date: 07 Mar 1999 03:14:55 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: input from file or from buffer
Message-Id: <m3ww0tzjvk.fsf@moiraine.dimensional.com>

bart.lateur@skynet.be (Bart Lateur) writes:

> I have a little problem: I need to be able to call a sub with a file, or
> a buffer (I think an array of preread lines).

<snip>

> My guts tell me that a "tied filehandle" could help, but I've never used
> anything even remotely like it before, and I don't know how to apply it.

Bingo, this is the sort of problem that tie() is perfect for.  I
posted an article earlier this week that implemented a simple tied
filehandle class, check Deja News for it (the subject was something
like Tie::File::URL, it was changed from an earlier subject line).

> The explanation in perltie looks intimidating. The phrase " This is
> partially implemented now" doesn't promise much good.

I've yet to run into problems with tied filehandles (that doesn't
mean that they don't exist, but I haven't had any trouble :-).

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Sun, 07 Mar 1999 11:49:53 GMT
From: Jamie@worldweb.demon.co.uk (Jamie)
Subject: Newbie can't use fetchrow_hashref with DBI - HELP!
Message-Id: <36e265ef.9031597@news.demon.co.uk>

Hi,

I hope someone can help me! I'm new to Perl, this being my first
attempt at writing
anything in the language. I'm using the TK module for a frontend and
using DBI with the
Oracle module to access data. The example is simply to allow data
entry for a SQL statement
which is then prepared and executed and the results displayed in a
listbox. My first
version of this code used Win32::ODBC and it worked. However, I'd
prefer to use the DBI modules
and native drivers to access the database if I can.

My problem is that when running this script, I get an error:

Can't locate object method "fetchrow_hashref" via package "DBI::db" at
line
52.

Now the books I'm using as reference all talk about 'fetchrow_hashref'
so
I'm sure it exists - question is, why can't I use it ?!

My installation is from the PRK, with updates to DBI and the Oracle
module
from CPAN.

Any help would be gratefully received.

Thanks,

Jamie Badman.


# Create frontend, allowing user to enter SQL, then by pressing the
'execute' button the
# SQL will be processed and the results displayed row by row on a
scrolling list box.
#

# Use the windows library, the ODBC libary
use Tk;
use DBI;

$ENV{ORACLE_HOME} = "d:\orant";
$Message = "Query results";

$top = MainWindow->new();
$frame = $top->Frame()->pack();
$frame->Label(-textvariable => \$Message)->pack();

$text_in_frame = $top->Text(-wrap=>"word", -state=>"normal")->pack();
#$text_in_frame->configure(-state=>"normal");

$text_in_frame->insert("end", "select * from snr_ship");

# Create 'Execute' button
$GoButton = $top->Button(-text=>"Execute",
-command=>\&ProcessQuery)->pack();

$ScrollingBox = $top->ScrlListbox()->pack(-expand=>"yes",
-fill=>"both");

# create link to Oracle database
$dbHandle = DBI->connect("dbi:Oracle:", "master", "knife");

# Setting this means we don't have to check every DBI call
$dbHandle->{RaiseError} = 1;

# Call it anyway (normally from button) just to test it's working
ProcessQuery();

MainLoop;

#Close the connection
$dbHandle->disconnect;

# Define subroutines
sub ProcessQuery{
	# Clear the old data out of the result window
	$ScrollingBox->delete(0,"end");

	$SQL = $text_in_frame->get("1.0", "end");

	$stHandle = $dbHandle->prepare("$SQL");

	if ($stHandle) {
		$stHandle->execute; #($first, $last);

		while($dbHandle->fetchrow_hashref){
			undef %RowData;
			undef $FetchedData;

			# Store the retrieved data into an associative
array
       		%RowData = $dbHandle->DataHash();

			foreach $key ( keys %RowData ){
				# Build up the string
				$value = $RowData{$key};
				$FetchedData = "$FetchedData$value ";
			}
			$ScrollingBox->insert("end", "$FetchedData");
		}
	} else {
		print("Error preparing SQL\n");
	}
}



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

Date: 7 Mar 1999 11:47:34 GMT
From: erikh@nospam.com (Erik Huelsmann)
Subject: Re: Perl & OS/2: problems with makefile.pl & makemaker
Message-Id: <wzgSQd1pdrdd-pn2-5ubSppRnN3Qw@localhost>

[cc-mailed]

On Sat, 6 Mar 1999 19:35:31, ilya@math.ohio-state.edu (Ilya 
Zakharevich) wrote:

> Oh, you got a floating point exception!  You should have started with
Hmm, yes; I guess indeed I should have started with it.

> this!  Where you ever running Doom/2 on this machine, or something
> like this?  You need to remove GAMESRVR.DLL from PM_ED_HOOK (or
No, there is nothing like GAMESRVR.DLL on my system. I also deleted 
COMETDLL.DLL (which did hook in PM_ED_HOOK). All other stuff such as 
taskbar, OS/2 Peer and watchcat uninstalled last night, but no, it did
not solve the problem.

I discovered this though: when I boot to command-line the problem does
not show and Makefile.pl completes without a crash (though complaining
my paths are incorrect - which is more than I could say before). 

> It (or something else very similar which "hooks" into "system calls"
> the program makes) is resetting FP flags on
> initialization/screen-writes.
Is there a way to fix this? I mean in the program itself? I don't seem
to be able to find the problem! What I do not get is that most of the 
programs I wrote myself do not suffer from this behaviour. Most of 
them are not longer than 100 lines, but they take up to 10 minutes to 
complete: more than enough to show this problem I would say [but they 
don't].
 
Any idea what other programs could interfere with perl? [or is it EMX 
it interferes with?]

bye, Erik

--
ICQ# 23883733 | Want to link your Psion to OS/2? Check out
http://www.oprit.rug.nl/hulsmann/PSI.html
Using Sibyl for OS/2 RAD development (http://www.ndrh.de/~speed/)
[Don't mail posts, I will see them here just fine]



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

Date: Sun, 7 Mar 1999 10:30:40 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Verifying URL's with perl.
Message-Id: <ebohlmanF87zv5.7yo@netcom.com>

chames@my-dejanews.com wrote:
: In article <7bpk52$f0m$1@nnrp1.dejanews.com>,
:   sidney_roberts@my-dejanews.com wrote:
: >   I have a list of url's and I need to check three things.  First, did I get
: > a response back from the server.  Second, was the file found or not?  Third
: > (and this is important), was the response that I got back binary or text
: > data?

: I'd use the following:

:   use LWP::UserAgent;  my $ua = LWP::UserAgent->new;  $ua -> timeout(10); 
: #in seconds  $ua -> max_size(1);  # this should be max size in kB of document
: (text,img, whatever) - but it doesn't work correctly :-(

:   my $req = HTTP::Request->new('HEAD',"$url");


:     if ($res->is_success) {   # because not only 200 is ok
:         #print "ok $i - ".$res->code." \n";
:     }
:     else {
:         #print "Error: " . $res->status_line . "\n";
:     }

This can result in false alarms because some servers can be configured to 
refuse HEAD requests.  Therefore, if the HEAD request fails it's a good 
idea to try a GET request before giving up.



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

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 5079
**************************************

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