[18414] in Perl-Users-Digest
Perl-Users Digest, Issue: 582 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 28 14:26:49 2001
Date: Wed, 28 Mar 2001 11:26:29 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985807588-v10-i582@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 28 Mar 2001 Volume: 10 Number: 582
Today's topics:
Re: service pack information <Jonathan.L.Ericson@jpl.nasa.gov>
Re: service pack information <hillr@ugs.com>
Simple replacement for IPC::Run run() function (Michael Friendly)
Re: stat() or 'real' filesize of a file in an iso-files <gtoomey@usa.net>
Re: stat() or 'real' filesize of a file in an iso-files <bart.lateur@skynet.be>
Re: stat() or 'real' filesize of a file in an iso-files <pilsl_@goldfisch.at>
Re: stat() or 'real' filesize of a file in an iso-files <bernie@fantasyfarm.com>
Re: Using Sunfreeware's perl in place of Sun's perl <och@nym.alias.net>
Re: Using Sunfreeware's perl in place of Sun's perl <och@nym.alias.net>
Re: Using Sunfreeware's perl in place of Sun's perl <"ken"@$nospam$wellconnected.com>
Re: Using Sunfreeware's perl in place of Sun's perl <tony.walton@uk.sun.com>
Re: Using Sunfreeware's perl in place of Sun's perl (Stuart Krivis)
Re: Using Sunfreeware's perl in place of Sun's perl (Casper H.S. Dik - Network Security Engineer)
Re: Wierd new response to old CGI script nobull@mail.com
Re: Writing a script to install Perl modules automatica (Rodney)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Mar 2001 02:29:46 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: service pack information
Message-Id: <86g0fymxr9.fsf@jon_ericson.jpl.nasa.gov>
"Scaramouche" <e.quesada@verizon.net> writes:
> is there any way of extracting service pack version information on a win32
> system through perl. it's meant to be used within a script and written onto
> a file, thus the os 'winver' command is useless to me.
Have you tried using search.cpan.org to find a module to help you out?
I imagine that Windows has an API call for this. You are more likely
to get reasonable answers if you ask a Windows forum.
Factious answer:
#!perl -w
use strict;
print "What is your service pack version?\n";
system "winver";
my $spv = <STDIN>;
Jon
------------------------------
Date: Wed, 28 Mar 2001 06:06:47 -0800
From: Ron Hill <hillr@ugs.com>
Subject: Re: service pack information
Message-Id: <3AC1EFF7.3F9F2635@ugs.com>
Scaramouche wrote:
>
> is there any way of extracting service pack version information on a win32
> system through perl. it's meant to be used within a script and written onto
> a file, thus the os 'winver' command is useless to me.
you might want to take a look at the Win32 module
my @osversion = Win32::GetOSVersion();
this will give you what you need
------------------------------
Date: Wed, 28 Mar 2001 15:18:17 +0000 (UTC)
From: friendly@hotspur.psych.yorku.ca (Michael Friendly)
Subject: Simple replacement for IPC::Run run() function
Message-Id: <99svbp$8da$1@sunburst.ccs.yorku.ca>
I am unable to install IPC::Run on my 5.004 perl system, and need to
find a simple replacement for the run() function, which is used in another
module, in the form
run \$program, \$input, \$output;
I can do this with a piped-open, but I'm not sure how to handle
the fact that the name of the output variable is passed by reference.
Here's what I tried. Can someone help?
#! /usr/local/bin/perl
sub run {
my ($program, $input, $output) = @_;
open(RUN, "$$program $$input|");
while ($in = <RUN>) {
$lines .= $in;
}
print $lines;
$$output = $lines;
}
$program = "ls";
$input = '*.pl';
run \$program, \$input, \$output;
print "Got:\n$$output";
exit;
--
Michael Friendly Email: friendly@yorku.ca (NeXTmail OK)
Psychology Dept
York University Voice: 416 736-5115 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
------------------------------
Date: Wed, 28 Mar 2001 12:40:30 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <%Zbw6.4684$45.24172@newsfeeds.bigpond.com>
The corollary to this is that if you have a fast algorithm, it is only an
approximation
or a 'heuristic'.
The time to find an exact solution would at least rise exponentially,
depending on the number of songs.
gtoomey
------------
>
> `NP' means nodeterministic polynomial. It means that it has not been
> determined whether or not a polynomial solution for the problem can
> ever be found. Most NP problems are placed in that class because it
> is thought unlikely they will ever be solved in polynomial time. These
> are classified NP because it's not proven they are non-polynomial nor
> that the are polynomial. A given solution can often be found to be
> either correct or incorrect in polynomial time.
>
> A special subclass of NP is NP-Complete, which is a fairly large
> class of problems which are thought to be nonpolynomial by many
> experts, but which all can be transposed from one NP-Complete
> problem to another in polynomial time. All of these can have a
> protential solution found to be correct or incorrect in polynomial
> time, once the solution has actually been found (which cannot, as
> yet, be done in polynomial time). If someone ever finds a way to
> solve an NP-Complete problem in polynomial time, then all of NP
> complete moves to class P.
>
> All this being said, there are many suboptimal approximation
> routines for many NP problems which can be run in polynomial
> time. The Traveling Salesman Problem, the Towers of Hanoi,
> and other NP-Complete problems are the subjects of much research.
> One interesting NP-Complete problem which was found in the past
> year or two to be NP-Complete is how to test whether a given
> Minesweeper game state is logically consistent internally. Maybe
> this will be the path which leads someone to cracking the
> NP-Complete enigma. ;-)
>
> If all of this is not understood, you may want to read a good
> book on the complexity of algorithms, such as
>
> _Computers and Intractability:_
> _A Guide to the Theory of NP-Completeness_
>
> Michael R. Garey, David S. Johnson
> Format: Textbook Paperback, 338pp.
> ISBN: 0716710455
> Publisher: W. H. Freeman Company
> Pub. Date: November 1990
>
> or some of the other ones that bn.com gave me after a search on
> `NP-Complete', `complexity', or `algorithm'. Some of them even
> offer approximation algorithms for NP-Complete and NP-Hard
> problems.
>
> Chris
>
> --
> Christopher E. Stith
> You must not lose faith in humanity. Humanity is an ocean;
> if a few drops of the ocean are dirty, the ocean does not
> become dirty. -- Mohandas K. Gandhi
>
------------------------------
Date: Wed, 28 Mar 2001 02:46:02 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <8oj2ct8fqer306pue2558ni0me3fl27qsu@4ax.com>
peter pilsl wrote:
>I am scanning 100.000 files and create subsets for burning on cdrom. To
>fill each cdrom as most as possible, I need to know for each file and
>directory how much space it will finally take on the destination-
>filesystem (joliet-iso9660), including its space in the filesystems
>header.
>
>The size-value delivered by stat() is a very bad estimation of course. I
>also tried the product blocks*blksize, but this delivers a unreal value
>and in fact I dont know what blksize and blocks really mean.
You're going the wrong way. You don't want to know what space a file
takes on the filesystem, but what it *would* take on a CD-ROM. That
means that you need to use the blocksize of a CD-ROM, to round values
up. I *think* the block size on a CD is 2k, or 2048 bytes.
So add 2047 to the file size, divide by 2048, take int() of the
quotient, and multiply by 2048 again. That should be the space taken by
the file contents on a CD.
As for the entry in the directory... unless you have files of just a few
k, I'd simply ignore that. Just take a forfait value, say, 10 or 20k, or
a fixed value per file if a lot of them fit on a CD.
--
Bart.
------------------------------
Date: Wed, 28 Mar 2001 12:11:16 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <MPG.152bd72f3a97cf149897c9@news.inode.at>
In article <tc2gmhgps1vp89@corp.supernews.com>, mischief@velma.motion.net
says...
>
> `NP' means nodeterministic polynomial. It means that it has not been
<skip>
> One interesting NP-Complete problem which was found in the past
> year or two to be NP-Complete is how to test whether a given
> Minesweeper game state is logically consistent internally. Maybe
> this will be the path which leads someone to cracking the
> NP-Complete enigma. ;-)
>
To test, if a given state of minesweeper is logically consistant ?
You mean: I dont see the mines, I just see the exposed fields and the
numbers on it and userset flags and need to check if all this seems to be
logically all together ?
horio ! I'll get famous ;)
Thanx for explaining NP to me. Due I studied mathematics, I've heard of
things things ;), but I didnt know the name NP.
> If all of this is not understood, you may want to read a good
> book on the complexity of algorithms, such as
>
> _Computers and Intractability:_
> _A Guide to the Theory of NP-Completeness_
>
> Michael R. Garey, David S. Johnson
> Format: Textbook Paperback, 338pp.
> ISBN: 0716710455
> Publisher: W. H. Freeman Company
> Pub. Date: November 1990
>
Is this minesweeper-problem in it ? I really got interested, cause I
played with an autosolving-feature for minesweeper years ago ;)
peter
--
pilsl@
goldfisch.at
------------------------------
Date: Wed, 28 Mar 2001 08:32:31 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <flp3ct8o29gd9cbsqf1ovpovfimch8009h@news.supernews.net>
peter pilsl <pilsl_@goldfisch.at> wrote:
} In article <slrn9c1jik.alk.abigail@tsathoggua.rlyeh.net>, abigail@foad.org
} says...
} > peter pilsl (pilsl_@goldfisch.at) wrote on MMDCCLXV September MCMXCIII in
} > <URL:news:MPG.152ade4bcdf1ed719897c1@news.inode.at>:
} > //
} > // I am scanning 100.000 files and create subsets for burning on cdrom. To
} > // fill each cdrom as most as possible, I need to know for each file and
} >
} > That's the 0-1 knapsack problem. Which is NP-complete. You really do
} > not want to calculate the optimal way to write your CDs, unless you can
} > afford to wait far past the heat-death of the universe.
} >
}
} I am interested what NP means.
"NP" means that the problem can be solved in polynomial time by a
nondeterministic finite-state-machine. The NP-complete problems are a
subset of the NP-class problems --- there is no proof that any NP-complete
problems are actually 'NP'. It is only the case that the best known
solutions to any of them happens to be NP... AND -- they are equivalent.
That is, if someone could find a Polynomial-time solution to any of the
NP-complete problems, that algorithm could be used for a P-solution to
every problem in the class.
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: 28 Mar 2001 03:04:39 -0000
From: Och <och@nym.alias.net>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <20010328030439.11453.qmail@nym.alias.net>
> Ken:
>
> Hi - I didn't have any trouble removing perl5 completely from my
> Solaris 8 system.
>
> The CDE errors you posted in removing perl man pages are not in any
> manner related to perl - your system or CDE is simply screwed up.
Bingo!
Something corrupted a half dozen, widely separated, lines in
/var/sadm/install.
For instance, it contained
/usr.dt/appconfig/icnns/C/Fpexit.s.bm
instead of
/usr/dt/appconfig/icons/C/Fpexit.s.bm
pkgrm successfully removed the three perl packages bundled
with Solaris after I fixed the erroneous lines in
/var/sadm/install.
Tip - whenever you use pkgrm it completely reads /var/sadm/install
from top to bottom. It stops when it finds any corruption, even with
files belonging to other packages.
_______________________________________________________________________
Och finger och@nym.alias.net for public key
------------------------------
Date: 28 Mar 2001 04:40:43 -0000
From: Och <och@nym.alias.net>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <20010328044043.14654.qmail@nym.alias.net>
> Russ:
>
> h2ph doesn't like absolute path names. Did you, by any chance, try
> following the instructions in the INN installation manual, which say to
> do:
>
> # cd /usr/include
> # h2ph * sys/*
>
> Those instructions are in the section on controlchan, so you may have
> missed them.
That caused the following set of new errors to appear:
_______________________________________________________________________
Warning: Use of "defined" without parens is ambiguous at /usr/perl5/site_perl/5.
005/i86pc-solaris/_h2ph_pre.ph line 2.
Can't use subscript on subroutine entry at /usr/perl5/site_perl/5.005/i86pc-sola
ris/_h2ph_pre.ph line 2, near "} }"
(Did you mean $ or @ instead of &?)
syntax error at /usr/perl5/site_perl/5.005/i86pc-solaris/_h2ph_pre.ph line 4, ne
ar "unless"
BEGIN failed--compilation aborted at /usr/local/news/bin/mailpost line 15.
_______________________________________________________________________
Apparently perl doesn't like the following line that h2ph adds to
/usr/perl5/site_perl/5.005/i86pc-solaris/_h2ph_pre.ph:
unless (defined &) { sub () { "" } }
But, after you comment it out, everything seems to work.
Problem solved, thanks. ;-)
_______________________________________________________________________
Och finger och@nym.alias.net for public key
------------------------------
Date: Tue, 27 Mar 2001 23:10:12 -0800
From: Kenneth Simpson <"ken"@$nospam$wellconnected.com>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <q7gw6.811$Uv.523144@newsrump.sjc.telocity.net>
Hi - this should work without any modifications to any code
anywhere under Solaris 8.
If it doesn't, then either your environment or system is screwed up.
-- Ken
Och wrote:
>
> > Russ:
> >
> > h2ph doesn't like absolute path names. Did you, by any chance, try
> > following the instructions in the INN installation manual, which say to
> > do:
> >
> > # cd /usr/include
> > # h2ph * sys/*
> >
> > Those instructions are in the section on controlchan, so you may have
> > missed them.
>
> That caused the following set of new errors to appear:
>
> _______________________________________________________________________
>
> Warning: Use of "defined" without parens is ambiguous at /usr/perl5/site_perl/5.
> 005/i86pc-solaris/_h2ph_pre.ph line 2.
> Can't use subscript on subroutine entry at /usr/perl5/site_perl/5.005/i86pc-sola
> ris/_h2ph_pre.ph line 2, near "} }"
> (Did you mean $ or @ instead of &?)
> syntax error at /usr/perl5/site_perl/5.005/i86pc-solaris/_h2ph_pre.ph line 4, ne
> ar "unless"
> BEGIN failed--compilation aborted at /usr/local/news/bin/mailpost line 15.
> _______________________________________________________________________
>
> Apparently perl doesn't like the following line that h2ph adds to
> /usr/perl5/site_perl/5.005/i86pc-solaris/_h2ph_pre.ph:
>
> unless (defined &) { sub () { "" } }
>
> But, after you comment it out, everything seems to work.
>
> Problem solved, thanks. ;-)
>
> _______________________________________________________________________
>
> Och finger och@nym.alias.net for public key
--
========================================================================
Ken Simpson Well Connected Computing, Inc.
Email: ken@wellconnected.com 1001 Bridgeway, Suite 630
Voice: +1.415.332.5018 Sausalito, CA 94965
FAX: +1.415.332.9197 USA, Earth
========================================================================
Printed using 100% recycled electrons.
------------------------------
Date: Wed, 28 Mar 2001 10:11:40 +0100
From: Tony Walton <tony.walton@uk.sun.com>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <3AC1AACC.520A4F72@uk.sun.com>
Och wrote:
>
> I put the missing froups back in the header for you.
>
> > not:
> >
> > actually, it seems more like a "you can't even read" problem.
>
> That doesn't even make sense slaphead, when everyone clearly sees
> that my problem lies with newbies who keep posting unsolicited
> opinions.
>
> > try: ``find /usr/perl5 -name '*.ph' -print'' if they are not there
> > _that_ is the problem.
>
>
> $ find /usr/perl5 -name '*.ph' -print
> /usr/perl5/site_perl/5.005/i86pc-solaris/_h2ph_pre.ph
> /usr/perl5/site_perl/5.005/i86pc-solaris/usr/include/syslog.ph
> /usr/perl5/site_perl/5.005/i86pc-solaris/syslog.ph
>
> Do you have any more worthless advice to offer up Einstein?
Could you two both please grow up and leave out the schoolboy
namecalling, in comp.unix.solaris at least?
Thank you very much.
fu set to alt.dev.null
--
Tony Walton
------------------------------
Date: 28 Mar 2001 06:58:38 -0500
From: jd@mongo.krivis.com (Stuart Krivis)
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <slrn9c3kgt.2qo.jd@poof.apk.net>
On 27 Mar 2001 13:29:10 -0800, Russ Allbery <rra@stanford.edu> wrote:
>In news.software.nntp, Och <och@nym.alias.net> writes:
>
>Those instructions are in the section on controlchan, so you may have
>missed them.
>
This isn't an answer, but Sun does not recommend removing their version
of Perl. Unfortunately, their version was compiled using their Forte C
compiler, and people have reported problems when adding things compiled
with gcc.
The solution is to add your own Perl somewhere like /usr/local/bin and
work forward from there.
Sun claims that some of their admin tools and scripts depend upon their
version of Perl and that simply replacing it will cause problems. True?
I have no idea.
--
Stuart Krivis
------------------------------
Date: 28 Mar 2001 12:53:50 GMT
From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer)
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <99smsu$pqf$1@new-usenet.uk.sun.com>
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
jd@mongo.krivis.com (Stuart Krivis) writes:
>This isn't an answer, but Sun does not recommend removing their version
>of Perl. Unfortunately, their version was compiled using their Forte C
>compiler, and people have reported problems when adding things compiled
>with gcc.
That doesn't matter; multiple version of perl can live together.
Unfortunately, as with many freeware programs, configuration for some
things is done at compile time. (If you ship a binary only release, you
know better than to configure using #ifdef FEATURE)
In perl's case, only few features are determined in that way, but the
Config.pm contents from which all modules are build is hardcoded.
I don't think we have yet figured out a way to make Config.pm behave
nicely for both compiles and how to distinguish between the two
compilers at load time.
>Sun claims that some of their admin tools and scripts depend upon their
>version of Perl and that simply replacing it will cause problems. True?
>I have no idea.
Tehre are two dependencies: one on Sun/Solaris modules which may
or may not be in mainstream perl and the path name:
/bin/kstat: executable /usr/perl5/bin/perl script
You can safely remove /usr/bin perl, but I suggest you do not remove
the perl packages.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: 28 Mar 2001 17:53:41 +0100
From: nobull@mail.com
Subject: Re: Wierd new response to old CGI script
Message-Id: <u9n1a56dii.fsf@wcl-l.bham.ac.uk>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>> "Janet" == Janet Ruhl <ruhl@realrates.com> writes:
>
> Janet> Many thanks for your extremely helpful advice! I replaced the calls to
> Janet> cgilib.pl in my old scripts with "use CGI qw(:cgi-lib);" scripts and
> Janet> everything still works.
>
> Janet> I just don't want to think about how many sales or rate contributions I
> Janet> might have missed over the past months because visitors had the scripts blow
> Janet> off on them.
>
> May we quote you on that? From time to time, people say "I'll write
> my own", and we scream back "No, please use CGI.pm". Yours is a very
> practical example of what happens when people "write their own".
Except, of course, it is a false example. If I understand the
situation correctly this is an old script. The original author did
not "write his own" he used what was the standard library at the time.
So this shows that even if you do the right thing that things may
still go wrong, but at least they'll be easier to fix than if you'd
gone off on your own.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 28 Mar 2001 05:50:25 GMT
From: rbroom@homeNOS_pam.com (Rodney)
Subject: Re: Writing a script to install Perl modules automatically
Message-Id: <BYew6.76304$Xt3.10463226@news1.rdc1.az.home.com>
In article <comdog-B5115B.10254425032001@news.panix.com>, brian d foy <comdog@panix.com> wrote:
>what does your Makefile.PL file look like now? have you read
>the docs for ExtUtils::MakeMaker?
Brian has it right with MakeMaker. Try something like this:
% mkdir lib
# Now put your package in that directory
% cat Makefile.PL
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'Titan::Tracker',
'VERSION_FROM' => 'lib/Your/Package.pm', # finds $VERSION
);
% perl Makefile.PL
% make
# Now have a look at what you've got. To see what make will do:
% make -n install
---
Rodney
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 582
**************************************