[9896] in Perl-Users-Digest
Perl-Users Digest, Issue: 3489 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 20 09:07:21 1998
Date: Thu, 20 Aug 98 06:00:54 -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, 20 Aug 1998 Volume: 8 Number: 3489
Today's topics:
? require ? <fp@DynamicNet.net>
Re: ? require ? (Maurice Aubrey)
[Q] deprecated use of split (what? why?) <fis@mpi-sb.mpg.de>
ActivePerl install module AdminMisc <joel.brueziere@urbanet.ch>
bio.perl.org: New Bioperl Homepage <sac@alberich.Stanford.EDU>
Re: Call another perl script? (Steve Linberg)
Re: changing parents environment huntersean@hotmail.com
Comparison operator (Ekeho Oh)
Re: Dumb Windows Question (Steve Linberg)
Re: Dumb Windows Question <conmara@tcon.net>
Re: help: regular-expression /w multi-lines (Dermot McKay)
HELP: split <versace@gianni.com>
Re: HELP: split <jdf@pobox.com>
Re: How do I execute perl from html program <dan@fearsome.net>
Is there a manner to get around the problem of POSIX on <kvangompel@imagic.be>
Re: Last_modified (help with configureing date output) (Steve Linberg)
Re: LWP fails to fetch more than 4000 urls. <jdf@pobox.com>
Re: Netscape response to Perl using Front Page extensio <jdf@pobox.com>
Re: Netscape response to Perl using Front Page extensio (Steve Linberg)
Re: NEWBIE Question: Perl Script in Unix vs. NT <tom@imagic.be>
Re: Open a text file (Michael J Gebis)
Re: open on FIFO doesn4t return -Why? simon@whitestar99.demon.co.uk
Perl 5.004_04 and Tk 800.010 (Hermann Schichl)
Perl for win32:more help needed serraqi@my-dejanews.com
Re: Perl for win32:more help needed (Steve Linberg)
Problem with <=> and BigInt/BigFloat (Sean Slattery)
Re: Problem with <=> and BigInt/BigFloat <jdf@pobox.com>
Rounding & floating point problems (WLo7128808)
Re: setting environment variables huntersean@hotmail.com
solaris2.6 problems with h2ph && types.ph timh@pasport.press.net
Re: such a thing as a "perl user"? (Steve Linberg)
Re: The @INC path (Michael Murphy)
Re: Utility for news article fetching selected by keywo (Steve Linberg)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Aug 1998 06:04:46 -0400
From: "Peter Perchansky, Microsoft FrontPage MVP" <fp@DynamicNet.net>
Subject: ? require ?
Message-Id: <6rgsg6$5pf$1@usenet42.supernews.com>
Greetings:
When executing test1.pl (see below) we receive an error message stating
"common.pl" did not return a true value at line 3". What are we doing
wrong?
test1.pl
#!/usr/bin/perl
use strict;
require 'common.pl';
SomeTest ();
exit;
common.pl
#!/usr/bin/perl
use strict;
sub SomeTest
{
print "in some test";
}
--
===========================================================
Peter M. Perchansky, Internet Specialist & Microsoft FrontPage MVP
Dynamic Net, Inc.
Providing Dynamic Databases, Design, & Electronic Commerce Solutions
FrontPage Web Hosting at http://frontpagehosting.net/
FrontPage Support http://www.msfrontpage.net/
FrontPage 98 Training CD at http://www.gosoft.com/fp98/pmpcs/
------------------------------
Date: Thu, 20 Aug 1998 10:22:00 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: ? require ?
Message-Id: <slrn6tnu69.6bt.maurice@localhost.localdomain>
On Thu, 20 Aug 1998 06:04:46 -0400, Peter Perchansky, Microsoft FrontPage MVP
<fp@DynamicNet.net> wrote:
>When executing test1.pl (see below) we receive an error message stating
>"common.pl" did not return a true value at line 3". What are we doing
>wrong?
>
>test1.pl
>#!/usr/bin/perl
>use strict;
>require 'common.pl';
>
>SomeTest ();
>exit;
>
>common.pl
>#!/usr/bin/perl
>use strict;
>
>sub SomeTest
>{
> print "in some test";
>}
1;
Your module needs to return a true value. Please read the docs
next time. I'm certain this is documented.
--
Maurice Aubrey <maurice@hevanet.com>
There are three principal ways to lose money: wine, women, and
engineers. While the first two are more pleasant, the third is
by far the more certain.
- Baron Rothschild, ca. 1800
------------------------------
Date: 20 Aug 1998 13:40:36 +0200
From: Matthias Fischmann <fis@mpi-sb.mpg.de>
Subject: [Q] deprecated use of split (what? why?)
Message-Id: <y9izpcz7uff.fsf@mpii02700.mpi-sb.mpg.de>
Hi all,
The following code should (and actually does) print out a line count
of the text stored in $s:
> my $s = "foo\nbar\n";
> print (scalar (split '\n', $s));
My problem is the following warning:
> Use of implicit split to @_ is deprecated at ./gna line 4.
If I get perl right, it tries to assign the return value of split to
something and gets confused that I did not make this `something'
explicit. Is there a way to tell it that I want to use split purely
functionally?
(Ok, this one above works, but I like code that makes my compilers as
happy as it makes me. Also, I like getting behind things...)
Any ideas? (I am sure there are... :)
Thanks and yours,
Matthias
--
Max-Planck-Institut f|r Informatik | Deutsches Forschungszentrum f|r KI
fis@mpi-sb.mpg.de | fischman@dfki.de
http://www.mpi-sb.mpg.de/~fis |
------------------------------
Date: Thu, 20 Aug 1998 14:05:19 +0200
From: "Joel Brueziere" <joel.brueziere@urbanet.ch>
Subject: ActivePerl install module AdminMisc
Message-Id: <6rh3bn$ii6$1@news.interpoint.ch>
I have no problem for install Tk packages,
but i can't install AdminMisc !
I use activeperl 502 with ppm.pl
the search AdminMisc tel me ok on
Packages available from http://www.ActiveState.com/packages
But on install:
PPM> install Win32::AdminMisc
Install package 'Win32::AdminMisc?' (y/N): y
Error installing package 'Win32::AdminMisc': Could not locate a PPD file for
package Win32::AdminMisc
Idem for package VPM
Have you some help
Thanks
Joel Brueziere ++33 681 426 145
http://www.decollage.org/joelbr/
La WebCam du lac Leman
joel.brueziere@urbanet.ch
------------------------------
Date: Thu, 20 Aug 1998 03:41:29 -0700
From: "Steve A. Chervitz" <sac@alberich.Stanford.EDU>
Subject: bio.perl.org: New Bioperl Homepage
Message-Id: <Pine.OSF.3.91.980820033636.20963B-100000@alberich.Stanford.EDU>
*********************************************
* Announcing the new Bioperl homepage *
* http://bio.perl.org/ *
*********************************************
Bioperl is an association of developers of public
domain Perl tools for computational molecular biology.
The bio.perl.org website provides an online resource
for modules, scripts, and web links for developers of
Perl-based software for life science research.
Interested parties are invited to visit the site and
contribute code and/or comments to the project. Three
mailing lists are available for announcements, general
discussion, and technical discussion. Instructions for how
to join the lists are available at the above site.
Steve Chervitz
Bioperl Coordinator
sac@genome.stanford.edu
**********************************************
------------------------------
Date: Thu, 20 Aug 1998 08:30:21 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Call another perl script?
Message-Id: <linberg-2008980830210001@projdirc.literacy.upenn.edu>
In article <35DBA665.3145@gianni.com>, 8\(F&@ <versace@gianni.com> wrote:
> Hi all,
>
> I have writen 3 perl cgi scripts for different functions, say a.pl, b.pl
> and c.pl. Now, I would like to write another perl script to dispatch to
> a.pl, b.pl or c.pl depends on the function passed in. E.g
>
> if ($function eq "a") {
> call a.pl
> } elsif ($function eq "b") {
> call b.pl
> } elsif ($function eq "c") {
> call c.pl
> }
>
> How to do that? Many Thanks!
Backticks. You're welcome.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 20 Aug 1998 09:28:50 GMT
From: huntersean@hotmail.com
Subject: Re: changing parents environment
Message-Id: <6rgq8h$qrc$1@nnrp1.dejanews.com>
In article
<Pine.GSO.3.96L.980819155525.20620C-100000@unixs-eval.cis.pitt.edu>, "Paul
W. Hanbury, Jr." <pwhst+@pitt.edu> wrote:
>
>
> Is it possible (in a unix environment) to change the value of a
> variable in the shell.
>
No
> It seems kinda dopey to source a file that says
>
> if ( myscript >/dev/null ) then ## runs myscript for return value
> ## myscript is a perl script and I don't like running it twice
> setenv MYVAR "`myscript`" ## sets MYVAR to output of myscript
> else
> unset MYVAR ## but unsets MYVAR if appropriate
> endif
>
Yup.
> So, what I want to know is, "Can I set an environment variable and send it
> back to the shell from within my perl script??"
>
No. If you need to do this, your design is messed up somewhere. Either
change whatever depends on MYVAR, or change "myscript" so that you can always
just say "setenv MYVAR `myscript`". If neither of these is possible,
consider changing the shell stuff to perl. Either way, running the script
twice is a sign that your design sucks.
Sean H
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 20 Aug 1998 12:45:23 GMT
From: eoh@thunder.temple.edu (Ekeho Oh)
Subject: Comparison operator
Message-Id: <6rh5p3$e3j$1@cronkite.ocis.temple.edu>
Hi Folks,
I am a newbie of Perl.
I've got strange result. I compare $abc with 10 using == or ne. The
result wrong. I tried "10" also. Same result.
But lt, <, gt work fine.
i.e.
if ($abc == 10)
{
printf xxx
}
======================
My platform is Hp-UX 10.20 and Perl 5.
TIA
Ekeho
eoh@ford.com
------------------------------
Date: Thu, 20 Aug 1998 08:28:27 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Dumb Windows Question
Message-Id: <linberg-2008980828270001@projdirc.literacy.upenn.edu>
In article <35DB3816.68EDEEAB@unlinfo.unl.edu>, Robert Losee
<rlosee@unlinfo.unl.edu> wrote:
> I've associated the .pl extensions with perl.exe by going to "My
> Computer" --> "View" --> "File Options" --> "File Types" --> "New Type"
> --> putting .pl in the associated extension --> making a new Open action
> that then runs the perl.exe.
>
> I guess it all works OK but I can't tell because the window it executes
> in closes immediately. How do I keep it open after the execution?
You're asking a Windows question in a Perl group? This is one of those
situations where the correct course of action would be for us to redirect
you to a Windows group, since your question really has nothing to do with
Perl. However, since you mentioned Perl and you're not sure it's working,
I'll fess up: open a command window and run it from there rather than
double-clicking the script. It will stay open after the script
terminates.
Please choose your groups carefully. Thanks!
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 20 Aug 1998 14:54:34 GMT
From: Ken McNamara <conmara@tcon.net>
Subject: Re: Dumb Windows Question
Message-Id: <35DC1C97.602B9423@tcon.net>
Robert -
My choice would be to open a DOS window and run the program. There's
probably methods for opening windows and outputing to them - but no sense
complicating things at first.
KenMc
Robert Losee wrote:
> Maybe I'm dumb, or maybe Windows. I'm hoping you can tell me.
>
> I've associated the .pl extensions with perl.exe by going to "My
> Computer" --> "View" --> "File Options" --> "File Types" --> "New Type"
> --> putting .pl in the associated extension --> making a new Open action
> that then runs the perl.exe.
>
> I guess it all works OK but I can't tell because the window it executes
> in closes immediately. How do I keep it open after the execution? In
> OS/2 I would have right clicked the perl.exe and in one minute have
> associated the files and kept the window open. I can't figure out how
> it's done in Windows. Is there some option I can put in the action line?
> Thanks for you help.
>
> Bob Losee
------------------------------
Date: Thu, 20 Aug 1998 09:37:07 GMT
From: MCKAYD@aplbt1.agw.bt.co.uk (Dermot McKay)
Subject: Re: help: regular-expression /w multi-lines
Message-Id: <6rgr34$a8c$1@pheidippides.axion.bt.co.uk>
In article <6rgge5$rri$1@netnews.csie.NCTU.edu.tw>, dennis@info4.csie.nctu.edu.tw (GEMINI) wrote:
>I have a string with multiple lines like follows:
>
>line1
>line2
>=========
>1. first
>2. second
>3. third
>=========
>line3
>line4
>
>
>now I'd like to extract the lines between the "=========" lines,
>and then split it into a list by the newline character:
>
>$_= the lines shown above
>($mylines)=/={5,}.*\n(.*)\n={5,}/m;
>@list=split(/\n/,$mylines);
>
you could use
$_= "line1
line2
=========
1. first
2. second
3. third
=========
line3";
($mylines)=/={9,}\n([\w\W\n]+)\n={9,}/m;
@list=split(/\n/,$mylines);
or ($mylines)=/={9,}\n(.*)\n={9,}/s;
to achieve this.
OK Dermot
------------------------------
Date: Thu, 20 Aug 1998 18:35:43 +0800
From: 8\(F&@ <versace@gianni.com>
Subject: HELP: split
Message-Id: <35DBFBFF.2E8E@gianni.com>
Hi all,
very simple question:
$_ = "AAA BBB CCC,DDD EEE FFF,"John, William",GGG III JJJ";
how to split so that
$array[0] = "AAA BBB CCC";
$array[1] = "DDD EEE FFF";
$array[2] = "John, William";
$array[3] = "GGG III JJJ";
obviously split /,/ would get
$array[0] = "AAA BBB CCC";
$array[1] = "DDD EEE FFF";
$array[2] = "\"John";
$array[3] = " William\"";
Many Thanks!
------------------------------
Date: 20 Aug 1998 08:48:30 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: 8\(F&@ <versace@gianni.com>
Subject: Re: HELP: split
Message-Id: <lnojn4r5.fsf@mailhost.panix.com>
8\(F&@ <versace@gianni.com> writes:
> $_ = "AAA BBB CCC,DDD EEE FFF,"John, William",GGG III JJJ";
You want the Text::CSV module, available at the CPAN.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Thu, 20 Aug 1998 11:00:19 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: Re: How do I execute perl from html program
Message-Id: <903607362.26349.0.nnrp-08.c2deb1c5@news.demon.co.uk>
Martien Verbruggen wrote in message <6rg31c$mas$2@nswpull.telstra.net>...
>In article <35D9E1CE.A51FE7E8@viper.net>,
> Todd Smith <tbsmith@viper.net> writes:
>> where you want the script's output, put
>>
>> <!--exec cmd="script.pl" -->
>>
>>
>> guys- just answer the question!
>
>No. Answer questions when they have something to do with perl. If the
>question really has nothing to do with perl, the poster should be
>gently pointed in the right direction. Failure to do so will result in
>more and more off-topic questions.
>
>Would you answer a question about the home-growing of bananas, if
>asked on this group?
Thats exactly the point - if I knew the answer then yes, I would. I would
also of course mention that his question was about CGI and therefore any
questions of his in future on CGI should be directed to
comp.infosystems.www.authoring.cgi but not to include the answer if you know
it is petty and infantile.
The distinction between Perl and CGI is very narrow for newbies, and some
are bound to post to the wrong ng. Stop being so petty about it and answer
their damned question if you are able, or at least, as many people have
said, don't say anything at all.
Dan Adams
dan@fearsome.net
------------------------------
Date: Thu, 20 Aug 1998 11:26:16 +0100
From: Kris Van Gompel <kvangompel@imagic.be>
Subject: Is there a manner to get around the problem of POSIX on NT?
Message-Id: <35DBF9C8.8E8B4BA5@imagic.be>
Hi,
Like Tom Adriaenssens, I have the same problem. But I really need a
manner to create non-blocking sockets.
Please is there any way to get around this problem without changing of
OS... It has to run on NT
Thanks in advance
Kris
Here his message
I have a problem with ActivePerl 502 (on Win98) and POSIX.
I try to create a socket (which success) and then set it non-blocking.
The fcntl call fails, because "Your vendor has not defined POSIX macro
F_SETFL"...
I declared
use POSIX;
and
use POSIX qw(:fcntl_h);
even tried
use Fcntl;
but alas, nothing works.
What am i doing wrong?
Below is the (offending) code...
Tom.
Code:
----------------------------------------------------------------------------
--
use IO::Socket;
use IO::Select;
use POSIX qw(:fcntl_h);
#use Fcntl;
[snip]
$oMaster = new IO::Socket::INET( LocalHost =>
'tadriaenssen.imagic.be',
LocalPort => 5000,
Proto => 'tcp',
Listen => 5,
Reuse => 1 );
$oMaster or die "master creation failed";
fcntl( $oMaster, F_SETFL, O_NONBLOCK );
$oSelector = new IO::Select( $oMaster );
$oSelector or die "selector creation failed";
print " done.";
[snip]
Running this gives:
----------------------------------------------------------------------------
--
D:\!!Work\CS>perl s2.pl
Booting server... Your vendor has not defined POSIX macro F_SETFL, used
at
s2.pl line 153
------------------------------
Date: Thu, 20 Aug 1998 08:23:28 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Last_modified (help with configureing date output)
Message-Id: <linberg-2008980823290001@projdirc.literacy.upenn.edu>
In article <35DB5932.4928DF11@ix.netcom.com>, Jeff Litwiller
<jeffinfl@ix.netcom.com> wrote:
> The first one outputs Wednesday, August 19 1998 02:16 PM and the second one
> outputs Wed Aug 19 18:53:58 1998. I just like to control what part of the date
> I want displayed and how. Abreviated or written out. Now I understand that
> #config and #echo are webserver process and they have nothing to do with Perl,
> but I use them as SSI call to get what I want. I would just like include this
> option in one of my scripts. but If I do not want the time and just the date
> output for files last modification, is there a way?
>
> Is there a way to find out when the file was last viewed? So I could say my
> last visitor was here 10 minutes ago? like atime but I am not sure how to use
> it. Yes I am fairly new at this but am glad for any help in learning.
If your server is configured to allow server side includes, you can use
#exec cmd="/path/to/script.pl" to execute a script in-line. I'd say
forget about #config and #echo if you want a high degree of control,
although date output can be formatted pretty precisely with them (check
the apache server docs, or go to www.apache.org and poke around).
You can do it in Perl at a slight performance penalty by just using the
stat command to get whatever information you want about the file and
render it with straight Perl however you choose; just print and the output
will be directed to the web page.
In terms of when the file was last viewed, this is harder. The best way
would be to parse the server log, but this can be a slow and
resource-draining process. You can use an SSI script to read the mod date
of an empty file like "last-viewed.txt", and then "touch" it with another
script to "stamp" the current time on it... but you can't be sure that
someone viewing the page isn't seeing a cached version, for example - you
have the same problem "hit counters" have.
Reading up on your server docs will serve you immensely. Good luck!
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 20 Aug 1998 08:10:10 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: fergus@twig.demon.co.uk (Fergus McMenemie)
Subject: Re: LWP fails to fetch more than 4000 urls.
Message-Id: <u337n6j1.fsf@mailhost.panix.com>
fergus@twig.demon.co.uk (Fergus McMenemie) writes:
> However we regularly see that the script fails to fetch any
> more than about 3964 pages.
Well, what are you *doing* with those pages that you've retrieved?
Are you storing them in a variables? Are the pages quite large? Can
you reproduce the problem with a brief but complete program?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 20 Aug 1998 08:38:07 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Fish" <fish@civl.port.ac.uk>
Subject: Re: Netscape response to Perl using Front Page extensions
Message-Id: <r9ybn58g.fsf@mailhost.panix.com>
"Fish" <fish@civl.port.ac.uk> writes:
> Submitting a form to a Perl script on an NT machine running Front Page
> extensions and (I think) IIS 4.0 results in the browser asking the client if
> he wants to save the results to file, popping up a Windows Save dialog box,
> rather than printing the form results to the browser direct. This doesn't
> happen using IE3 or IE4, but seems to happen with Netscape 3.01 or
> Communicator. Any ideas?
I'd guess that your script isn't spitting out the correct headers, and
that the MS browsers are configured to accept junky output. This
isn't related to Perl, so followups are set accordingly.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Thu, 20 Aug 1998 08:48:55 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Netscape response to Perl using Front Page extensions
Message-Id: <linberg-2008980848560001@projdirc.literacy.upenn.edu>
In article <6r9e8r$f7626@tech.port.ac.uk>, "Fish" <fish@civl.port.ac.uk> wrote:
> Submitting a form to a Perl script on an NT machine running Front Page
> extensions and (I think) IIS 4.0 results in the browser asking the client if
> he wants to save the results to file, popping up a Windows Save dialog box,
> rather than printing the form results to the browser direct. This doesn't
> happen using IE3 or IE4, but seems to happen with Netscape 3.01 or
> Communicator. Any ideas?
Wacky. Anyway, this is a server configuration problem - your server
shouldn't be handing your Perl script over to the browser. Your browser
shouldn't even know there's a script running. Dig into your server docs
and make sure it knows what to do with that Perl script you're talking
about.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 20 Aug 1998 13:35:02 +0200
From: "Tom Adriaenssen" <tom@imagic.be>
Subject: Re: NEWBIE Question: Perl Script in Unix vs. NT
Message-Id: <6rh1lf$4pk$1@xenon.inbe.net>
Mr. Mirthful wrote in message +ADw-35db481f.198124758+AEA-uphs1+AD4-...
+AD4-Hi,
+AD4-
+AD4-i have the following Perl Script, which is used to keep track of
+AD4-results from a survey. it works when running it from an NT based web
+AD4-server, and now i need to have it running from Unix. The problem is
+AD4-that when it is run, it returns an +ACI-internal server error+ACI-. On the
+AD4-Unix box, other Perl programs are running fine, so it is not a
+AD4-configuration problem. i assume there must be something in the code
+AD4-that is correct for NT but not Unix. Any help would be greatly
+AD4-appreciated.
+AD4-
+AD4-Thanks.
+AD4-
Don't know what editor you are using, but we've expierenced the same
problems.
You'll have to check in what format your script is: MSDOS (CRLF at end of
each line) or Unix (LF at end of each line), because it seems to matter.
Running MSDOS saved scripts on Unix fails, but if we save em into Unix
format, they work great.
Get a descent editor (i recommand TextPad) that can do the conversion for
you, or a utility to do the conversion.
tom.
------------------------------
Date: 20 Aug 1998 07:23:05 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Open a text file
Message-Id: <6rgisp$gdu@mozo.cc.purdue.edu>
"Michael C. Blair" <blairs@jps.net> writes:
}I would like some suggestions on where to find an example of opening a text
}file and reading the data into a HTML Table. Thanks
Learning Perl, Second Edition (the Llama Book):
ISBN 1-56592-284-0 (English)
Get ordering info by typing "man perlbook"
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Thu, 20 Aug 1998 11:08:33 GMT
From: simon@whitestar99.demon.co.uk
Subject: Re: open on FIFO doesn4t return -Why?
Message-Id: <6rh03h$vrl$1@nnrp1.dejanews.com>
In article <6qeqnq$7pq$1@rznews.rrze.uni-erlangen.de>,
ws97-868@wsrz1.wiso.uni-erlangen.de wrote:
> Hello.
>
> I have a problem that I want to solve by two perl porcesses communiating
> via a FIFO.
>
> The neame of the fifos I have written in the array @masterfifos.
> So I address one of the fifos with $masterfifos[0]="/tmp/FIFO0"
>
> When I do a
> open (IN,"$masterfifo[0]") || die "$!";
> print "SUCCESSFUL" if $DEBUG;
>
> perl doesn4t complain,but doesn4t print "SUCCESSFUL",i.e doesn4t return
> from the open although the FIFO exists.
>
> Whats my or perl4s problem?
>
> Thank you for your answer.
> Bye.
>
>
I was having trouble with FIFOs which didn't seem to want to block on a
select () after the first time I sent data through them. They opened fine but
then only blocked once until data appeared then they refused to block. I then
decided that Perl's open() must open with the O_NONBLCK flag by default hence
the lack of blocking when I used select(). I then tried using sysopen() and
just specifying O_RDONLY and things worked fine. The important thing to note
is that when you try to open a FIFO (in blocking mode) for reading if there
is nothing which has it open for for writing then it will block until
something opens it for writing. It almost looks like your open() is
defaulting to opening the FIFO in blocking mode.
Simon
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 20 Aug 1998 10:44:17 GMT
From: herman@radon.mat.univie.ac.at (Hermann Schichl)
Subject: Perl 5.004_04 and Tk 800.010
Message-Id: <6rgum1$32ps$1@www.univie.ac.at>
Hi!
I have a question directed to the perl & Tk
specialists among you. Unfortunately, I am
not able to post this question to
comp.lang.perl.tk
since our site does not get this newsgroup.
I am writing a special Entry-widget which
accepts arithmetic expressions and I want
to force the user to enter correctly formed
expressions. Therefore, I want to make sure
that the focus must not leave the Entry if
the expression is malformed.
In principle my idea was as follows:
Lets say the $e contains a reference to the
Entry.
bind the <FocusOut> event to a syntax checking
function (essentially an eval) and if the expression
is malformed, ring the bell and perform
$e->focus
which forces the focus back to the Entry. This works
very well.
However, if I want to pop up a messageBox containing
the error message something strange (for me at least)
happens: If you use the window manager to move the
main window (which does not accept the input focus
while the messageBox is active) and afterwards press
the OK button of the messageBox, another <FocusOut> event
is triggered and the messageBox reappers and so on in an
endless loop (the only possibility to break the loop is
to kill the application).
I do not understand the reason for this, since I thought
that a <FocusOut> event is only triggered internally
(Tk::focus man page) by perlTk, and after $e->focus the
focus should be back at the Entry, and without possibility
to communicate with the main-window, it should be impossible
to trigger another <FocusOut> event.
If anybody has an idea what is going on and how to solve the
problem, please tell me.
If anybody in the comp.lang.perl.tk group knows an answer,
please send it by E-mail to
hschichl@esi.ac.at
since I cannot read that group
Thanks for your help
Hermann
------------------------------
Date: Thu, 20 Aug 1998 10:42:29 GMT
From: serraqi@my-dejanews.com
Subject: Perl for win32:more help needed
Message-Id: <6rguil$unp$1@nnrp1.dejanews.com>
couple of questions: 1. is there a program out there that can convert another
language's source code to perl? 2. is there a source code in perl for a
compiler for perl?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 20 Aug 1998 08:54:22 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl for win32:more help needed
Message-Id: <linberg-2008980854220001@projdirc.literacy.upenn.edu>
In article <6rguil$unp$1@nnrp1.dejanews.com>, serraqi@my-dejanews.com wrote:
> couple of questions: 1. is there a program out there that can convert another
> language's source code to perl? 2. is there a source code in perl for a
> compiler for perl?
1. Maybe. Which language? The chances of converting anything to GOOD
Perl are slim.
2. Not that I have ever heard of. There is source code in C for a
compiler for Perl. Your Perl version would need to generate
machine-specific binary code. Write one, and you'll be a hero! :)
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 17 Aug 98 18:50:49 GMT
From: jslttery@cs.cmu.edu (Sean Slattery)
Subject: Problem with <=> and BigInt/BigFloat
Message-Id: <jslttery.903379849@GS148>
I'm having trouble using sort and the overloaded <=> operator for BigFloat.
If you try the code below - sort will complain about non-numeric values being
returned by the subroutine. In fact, it seems that <=> on BigFloats
returns something that looks a lot like a BigInt, and is definitly not one
of the three integers -1, 0, 1.
Two questions:
1. Shouldn't all implementations of <=> always return -1, 0, 1?
2. If so, isn't the following code fragment from Math::BigInt fundementally
wrong (in that it returns a BigInt):
use overload
<snip>
'<=>' => sub {new Math::BigInt
$_[2]? bcmp($_[1],${$_[0]}) : bcmp(${$_[0]},$_[1])},
(The same can be seen in the Math::BigFloat package).
Yes? No? Depends?
S.
Code fragment:
use Math::BigFloat;
$f1 = Math::BigFloat->new("+264778822323083708517675150460936161362663868530828028675369912812186677226307536908362937497908733544119308410008295153247736466208628169476392585048363179562235615187389721611224173609785041104043216741387910892457405169195308062489934948525891695294774067397206949220990295432658128057122833535930435502617002015727730946355936422505626511858402906376588358835527240277836236491964571466550780784508455199270055551081835883552724027783623649196457146655078078450845519927005555108
16521273548591493153088076672595178643980250153585980979132155938985601253032821179290637361103657059131495978850885603470653217364169140588495415785431498451736567378284595281652947972094196038616359547319538813024694733784556850325397457328474689303081106861635954731953881302469473378455685032539745732847468930308110698943700658458732955145685E-697");
$f2 = Math::BigFloat->new("+177369144741458309393849052127623329944280240074754051696439911478015331741425224002139327934341881583736313597843779160080921322130968521540136390323739624244927714999608133100214846884873674213096852154013639032373962424492771499960813310021484688487367470804778150071646571882722342768812180085288000915232048053683150248028311572844676678528111952332493507043482538534201533155393715857127538340412403616566296082081943659403349590735122322652053640637825173066436536327549694896
707434215696117883016761935015364063782517306643653632754969489670743421569611788301676193501393931013059379035211520833376876989789587031886910676300464403214570643937352460257210795456744818389905634602943801337500388760117007566895873632317444243682993414662318731620291446367924457192019347476251203809062468781466877428646191720230900940001399E192019347476251203809062468781466877428646191720230900940001399E-710");
@array = ($f1, $f2);
$compare = ($f1 <=> $f2);
print "$compare\n";
@array2 = sort { $a <=> $b } @array;
------------------------------
Date: 20 Aug 1998 08:47:22 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: jslttery@cs.cmu.edu (Sean Slattery)
Subject: Re: Problem with <=> and BigInt/BigFloat
Message-Id: <ogtfn4t1.fsf@mailhost.panix.com>
jslttery@cs.cmu.edu (Sean Slattery) writes:
> I'm having trouble using sort and the overloaded <=> operator for
> BigFloat.
You can show that bug much more concisely:
$a = new Math::BigInt '1000';
$b = new Math::BigInt '10';
print $a <=> $b;
I reported it to perlbug some weeks ago, and M.J.T. Guy sent me a
patch that same day (!).
--- ./t/lib/bigintpm.t.orig Fri Jul 24 18:21:03 1998
+++ ./t/lib/bigintpm.t Fri Jul 24 17:32:00 1998
@@ -10,7 +10,7 @@
$test = 0;
$| = 1;
-print "1..246\n";
+print "1..247\n";
while (<DATA>) {
chop;
if (s/^&//) {
@@ -116,6 +116,7 @@
+124:+123:+1
-123:-124:+1
-124:-123:-1
++100:+5:+1
&badd
abc:abc:NaN
abc:+0:NaN
--- ./lib/Math/BigInt.pm.orig Fri Jul 24 18:25:22 1998
+++ ./lib/Math/BigInt.pm Fri Jul 24 18:10:07 1998
@@ -82,8 +82,8 @@
# Negate input value.
sub bneg { #(num_str) return num_str
local($_) = &bnorm(@_);
- vec($_,0,8) ^= ord('+') ^ ord('-') unless $_ eq '+0';
- s/^H/N/;
+ return $_ if $_ eq '+0' or $_ eq 'NaN';
+ vec($_,0,8) ^= ord('+') ^ ord('-');
$_;
}
@@ -106,7 +106,7 @@
} elsif ($y eq 'NaN') {
undef;
} else {
- &cmp($x,$y);
+ &cmp($x,$y) <=> 0;
}
}
@@ -393,7 +393,7 @@
=head1 Autocreating constants
After C<use Math::BigInt ':constant'> all the integer decimal constants
-in the given scope are converted to C<Math::BigInt>. This convertion
+in the given scope are converted to C<Math::BigInt>. This conversion
happens at compile time.
In particular
End of patch
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 20 Aug 1998 10:48:16 GMT
From: wlo7128808@aol.com (WLo7128808)
Subject: Rounding & floating point problems
Message-Id: <1998082010481600.GAA08601@ladder01.news.aol.com>
I've written a simple rounding function, which seems to be working (at least
for me). I actually stole and modified someone's code from the math/stats
archive at the perl site. It's nothing complicated, but funnily enough I don't
understand how it works! OK! Here's my round function (from memory):
## Assuming we want 2 decimal places (for cents)
## Example call: print &round(36.715);
sub round {
$val = i_[0];
$ival = 100*$val;
$ival = int(ival) + 0.501;
return $ival/100;
}
The funny thing is the magic number 0.501. In theory it should be 0.5 (which is
what the original code has), but I've found it doesn't work with some numbers -
such as 36.715. I can't explain it, it seems to have something to do with the
way Perl does floating point arithmetic.
Also, try this:
$a=36.715;
$b=sprintf("%.2f", $a);
print $b; # gives 36.72
$a=50*.7343; # result should be 36.715
$b=sprintf("%.2f", $a);
print $b; # gives 36.71 - I thought it was 36.72????
I'd assume 36.715 were assigned to $b in both cases? (I've tested this with
Perl 5 on Win95 and AIX, it does happen on both).
Any idea???
William
------------------------------
Date: Thu, 20 Aug 1998 09:31:32 GMT
From: huntersean@hotmail.com
Subject: Re: setting environment variables
Message-Id: <6rgqdk$r5i$1@nnrp1.dejanews.com>
In article <6rfmir$1eri$1@ausnews.austin.ibm.com>,
"Nitin Gupta" <niting@raleigh.ibm.com> wrote:
> How can I set an env variable dynamically from within PERL? I have a script
> which sometimes needs to access the proxy server so I need to set the
> 'http_proxy' env. variable for the session the script is running under.
>
> Any pointers are appreciated.
>
> -Nitin
>
%ENV contains the current environment, but remember, settings in this hash
will not persist when your script exits.
Sean Hunter
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 20 Aug 1998 09:22:44 GMT
From: timh@pasport.press.net
Subject: solaris2.6 problems with h2ph && types.ph
Message-Id: <6rgpt2$qml$1@nnrp1.dejanews.com>
perl 5.004_04
In /usr/include/sys/types.h line #381:
#define P_MYPID ((pid_t)0)
Using h2ph translates this to types.ph line #84
eval 'sub P_MYPID () {(( &pid_t)0);}' unless defined(&P_MYPID);
A number of scripts that I've run produce the following error:
Number found where operator expected at (eval 19) line 1, near ")0"
(Missing operator before 0?)
Q. Is the error in the original types.h file or is h2ph doing something it
shouldn't?
Tim Hartley
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 20 Aug 1998 08:46:34 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: such a thing as a "perl user"?
Message-Id: <linberg-2008980846340001@projdirc.literacy.upenn.edu>
In article <35DBE09E.EEE976B2@west.net>, John Callender <jbc@west.net> wrote:
> I've been growing vaguely depressed at the Perl Conference this year,
> which is kind of odd, given how I'm also having a great time, just like
> last year. As I've been thinking about where the depression is coming
> from, I think I have an inkling:
>
> I'm never going to be like you guys.
I recall having the same feeling at a job I had about ten years ago
(yikes) where there was one senior engineer who was just phenomenal. We
were a bunch of self-trained, five-year hackers with great aptitude and
machine-level skills, but this guy was one of the rare kinds of
university-trained programmers who knew all the street-level stuff too.
He could do things I couldn't even begin to comprehend. His office was
clean and orderly, he was calm and soft-spoken and humble, with all the
Knuth books (and others) that he had actually read neat on his shelf...
and I realized one day that I would never be like him. Confessing this to
my boss one day, he said "Maybe you should get some counseling!" I
laughed.
I've been thinking about how Perl has spoiled me a bit - I've been
programming for about 20 years and worked in 8-bit assembly languages
before moving up to C, so my entire orientation is worrying about memory
and speed and architecture, and Perl removes you so far from the nuts and
bolts that all of that is irrelevant. Its ease of use is both a blessing
and a curse - so easy to work with, but so abusable to people who know
little-to-nothing about programming. And the last time I had to go back
and do some C, after all this Perl, I had to take a deep breath and
concentrate again.
This group is littered with "Michael Jordans," as you put it; people I
know I will never be as good as. Not because I couldn't if I put in the
time, but because Perl isn't as central to my life. I've been writing
Perl for about three years now, and I consider myself an intermediate
Perl'er. Every day I learn something new here, and I'm not terribly
worried about the pace of my progress. Perl is a lot of fun and
completely unlike any other language I've written in. You can really be
artistic and elegant with Perl. Has anybody ever written poetry in C?
My main worry about the overall state of Perl is that because it's so
efficient and simple, and machines are so fast, that it's easy for newbies
to write sloppy code and not realize that it's sloppy. There's no need to
optimize when the performance of even lousy code is so high. This leads
directly (I believe) to buggy bloatware that is prevalent everywhere -
tools built with tools built with tools built with tools, with many layers
of inefficiency... I think a good Perl hacker should have a very slow
machine with limited RAM and disk space for writing and testing scripts.
There's an awful lot of very bad code out there, and every time I look
back at code I wrote even six months ago I wrinkle my nose and go "ewwww."
Well, I'm rambling... no, you and I will never be Tom Christiansen and
Abigail (or Randal or Tom Phoenix or ... you all know who you are, there
are too damn many to count!). But we can read the groups and help newbies
now and then and learn from people who know more than us, and just keep
climbing!
Happy Perl'ing. Wish I could have afforded the conference. :)
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 20 Aug 1998 06:35:45 -0500
From: mike_murphy-ppk@nortel.com (Michael Murphy)
Subject: Re: The @INC path
Message-Id: <mike_murphy-ppk-2008980635450001@nppkm606.us.nortel.com>
In article <35DB3561.5FED16FE@ab.bluecross.ca>, knguyen@ab.bluecross.ca wrote:
> Hello all,
>
> After installing Perl5, DBD-Oracle-0.46, DBI-0.88, I ran a test:
> $ perl bind.pl # simple lookup program
First step, update DBD to 0.51 and DBI to 0.93. They can be found on
CPAN. When I looked last some of the directories weren't up-to-date so
you may have to look around. This is a must do. I had some minor
problems with 0.88 that went away in 0.93.
> 1. Could someone pls tell me how could the extra "04" possibly got to
> the @INC
> path? This will help me to determine whether I should reinstall or patch
> the
> some files.
I don't know the answer to this one.
> 2. My 2nd question is how do I change @INC path? I looked into
> Oraperl.pm
> DBI.pm and didnt see obvious clue.
$INC[@INC] = '/new/path/goes/here';
HTH,
Mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Mike Murphy ~ Nortel ~
~ my opinions are my own ~ Raleigh, North Carolina ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 20 Aug 1998 08:50:44 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Utility for news article fetching selected by keywords ?
Message-Id: <linberg-2008980850440001@projdirc.literacy.upenn.edu>
In article <rd7m04c9us.fsf@epiphore.francenet.fr>, Gildas Perrot
<perrot@francenet.fr> wrote:
> Hi everybody,
>
> Is there any tool to fetch in certain newsgroups, articles
> selected by keywords ?
> Thanks in advance for your help. Gildas.
How about News::NNTP? Go to www.perl.com and check the CPAN archives.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3489
**************************************