[9851] in Perl-Users-Digest
Perl-Users Digest, Issue: 3444 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 14 10:17:26 1998
Date: Fri, 14 Aug 98 07:11:52 -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 Fri, 14 Aug 1998 Volume: 8 Number: 3444
Today's topics:
Browser Counter Code Required <jason@technolog.com>
CGI script running external program <dave@hmw.com>
Compile Perl Script <gzhel@space.ru>
Re: DBD::Oracle compile prob on Linux <smaring@gte-es.com>
Re: DBI, LD_LIBRARY_PATH, and the web hashem@my-dejanews.com
Error in Databases <coolwater@cyberdude.com>
Re: File::Find, wanted(), and parameters <jdporter@min.net>
Re: freeware documentation <jdporter@min.net>
Re: Have package use another symbol table? (Kevin Reid)
Re: Help: Installing Modules? (Mike)
Re: here's an implementation of diff in perl <ernestogf@meta4.es>
Re: here's an implementation of diff in perl <jdporter@min.net>
Re: How to append at the top of the logfile ? (Miguel Cruz)
Re: Matts counter - suddenly stopped working (I R A Aggie)
Re: Matts counter - suddenly stopped working <jdporter@min.net>
Re: Matts counter - suddenly stopped working <jdporter@min.net>
NT: redirect stdout to file (Gerhard Wrodnigg)
Re: Opening a file as "+>>file" (Phil Taylor)
Re: Opening a file as "+>>file" <jdf@pobox.com>
Re: Opening a file as "+>>file" <tchrist@mox.perl.com>
opening page in top window (Ivo Bieleveldt)
opening page in top window (Ivo Bieleveldt)
Parsing Word to ASCII <fcalabro@aisvt.bfg.com>
Perl 5.005_01 Threads and LWP (Brian L. Donnell)
Re: Perl and catching alarms <riddles@ipe.nl>
perl version <peter@richmd.demon.co.uk>
Re: perl version <flavell@mail.cern.ch>
Re: perl version <sneaker@sneex.fccj.org>
Re: Q: How to read all the file name in a directory (Ollie Cook)
Re: Read directory and not files <tchrist@mox.perl.com>
Re: Redefining routines <mortensi@idt.ntnu.no>
Re: retrieving hash name <tchrist@mox.perl.com>
Re: Setting DOS environment variables in a perl script <joanna@ecas.org>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 14 Aug 1998 12:03:18 +0100
From: "Jason Townsend" <jason@technolog.com>
Subject: Browser Counter Code Required
Message-Id: <903092775.563.0.nnrp-04.9e98ffcf@news.demon.co.uk>
Does anybody have any example code for keeping a hit counter of the type of
Browser being used to access a site, ie Number of Netscape 3.0 hits, IE 3
hits, etc.
Sorry to be a bit lazy and not write it myself but I have to get the site on
the web later today and the management have just ask for this type of hit
counter.
Thankyou,
____________________________________________________________________________
Jason Townsend Telephone: +44 1629 823611
Development Engineer Fax: +44 1629 826597
Technolog Ltd Email: jason@technolog.com
Ravenstor Rd Web: <http://www.technolog.com/>
Wirksworth
Derbyshire
DE4 4FY
United Kingdom
------------------------------
Date: Fri, 14 Aug 1998 04:31:16 -0700
From: "David W. Wong" <dave@hmw.com>
Subject: CGI script running external program
Message-Id: <6r173f$mhu$1@nntp2.ba.best.com>
I have simple Perl script (running under NT) which runs an external program
(in the same directory) as follows:
#! c:\perl\bin\perl
$output = `externalprogram.exe`;
print <<End_of_HTML;
Content-type: text/html
The Program says: $output
End_of_HTML
exit (0);
The external program prints a string to standard output.
When the above Perl script is executed from the command line, all is well:
it runs the external program and captures its output into $output, and then
prints "The Program says" followed by the contents of $output.
However, when I run the same perl script from my browser, it returns only
"The Program says". $output is empty, so it appears that the external
program was never executed.
Is there something that prevents a script, when executed by the webserver,
from executing external system programs? Is there a workaround? Permissions
issue?
Yes, I do have the script running on a webserver...Microsoft NT Peer Web
Services.
Thanks in advance,
Dave
dave@hmw.com
------------------------------
Date: Fri, 14 Aug 1998 13:08:02 +0300
From: "news.space.ru" <gzhel@space.ru>
Subject: Compile Perl Script
Message-Id: <6r0unm$9os$1@zware.space.ru>
What can I do to compile perl script? What software I can use?
Thank You, Yurin Andrew from Russia
------------------------------
Date: Fri, 14 Aug 1998 11:16:59 +0000
From: Steve Maring <smaring@gte-es.com>
Subject: Re: DBD::Oracle compile prob on Linux
Message-Id: <6r16hs$arl$1@news-1.news.gte.net>
Marti Rijken wrote:
> Steve Maring <smaring@gte-es.com> wrote:
> >
> >The Gods were kind. I finally got SCO Oracle 7.3.2.2.0 running on my
> >RedHat5.1 box successfully. Perl v5.004_04 and DBI are also OK.
> >However, when I try to make DBD::Oracle I get this:
> >
> >/usr/local/oracle7/lib/libclient.a: could not read symbols: File format
> >not recognized
>
> I have no personale experience with SCO Oracle on Linux (looking forward
> to the announced native version...). But since the Oracle library is an
> SCO library, I suppose you would need an SCO loader to link it.
> Eventually you would have to run the resulting binary under iBCS, so I
> suspect even the perl binary would have to be made with a set of SCO
> tools (cc, ld).
> --
> @..@ Marti Rijken <mrijken@prv.gelderland.nl>
> (`--') private mail: mrijken@natrix.demon.nl
> ( >__< ) URL: http://www.natrix.demon.nl/
>
Even if I could make the perl binary with SCO tools would that not screw up
everything else? Can I just make the DBD::Oracle with the SCO tools? Is
there no way around this? I thought iBCS was supposed to allow a Linux
program to use an SCO library.
-Steve Maring
smaring@gte-es.com
Tampa, FL USA
------------------------------
Date: Fri, 14 Aug 1998 07:50:59 GMT
From: hashem@my-dejanews.com
Subject: Re: DBI, LD_LIBRARY_PATH, and the web
Message-Id: <6r0q92$hnk$1@nnrp1.dejanews.com>
If your are using unix platform try suid the program to the author:
i.e. chmod 4755 or
try to set uid within the program.
Hashem
In article <35D3AE17.239832A6@erols.com>,
"Matthew O. Persico" <mpersico@erols.com> wrote:
> How about getting your administrator to set the var in the system-wide
> startup. Every account that accesses Ingress needs the LD_... anyway
> right?
>
> Garth C Sainio wrote:
> >
> > Hi,
> >
> > I'm trying to develop a script that will interface with an Ingres
> > database and display the results to a web page. All works fine as long
> > as the script is being run from an account with the LD_LIBRARY_PATH
> > environment variable set but the uid that runs cgi scripts does not have
> > this set. Thus, I get the following error "install_driver(Ingres)
> > failed: Can't load (bunch of meaningless pathnames)..." I have tried to
> > set this environement variable in the script using
> > $ENV{'LD_LIBRARY_PATH'}= but I still get the error in loading driver.
> > When I run it from the command in an environment without LD_LIBRARY_PATH
> > set the script fails, when I run the script and set the environment
> > variable as described above it fails, the only way I can get it too work
> > is too do a setenv LD_LIBRARY_PATH on the command line and then run the
> > script. The problem with setting the variable in the script seems to be
> > that the code called by the install_driver function in the DBI library
> > does not seem to get the information about the value of the environment
> > variable.
> >
> > Does anyone have any suggestions on other things to try?
> >
> > Thanks,
> >
> > Garth
>
> --
> #!/usr/bin/perl -- Matthew O. Persico
> print "Just Another Perl Neophyte\n";
> ## Simplicity is a blessing when you're
> ## supporting the program at 2AM
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 14 Aug 1998 14:42:46 +0100
From: "Kowalski" <coolwater@cyberdude.com>
Subject: Error in Databases
Message-Id: <6r1epn$27b$1@irk.zetnet.co.uk>
How do I get information out of a database (MSAccess) using perl?
thanks a lot
Will Palmer
------------------------------
Date: Fri, 14 Aug 1998 08:40:53 -0400
From: John Porter <jdporter@min.net>
Subject: Re: File::Find, wanted(), and parameters
Message-Id: <35D43055.44D3@min.net>
Thomas Frederick O'Connell wrote:
>
> what i would like to be able to do is pass wanted() the uid and gid for
> the chown function i would like to run on each encountered file.
>
> find( \&wanted( $uid, $gid ), '/' );
> sub wanted {
> my( $uid, $gid ) = @_;
> chown( $uid, $gid, $_ );
> }
This is why god gave us closures.
{
my( $uid, $gid ) = (whatever);
find( sub {
chown( $uid, $gid, $_ );
}, '/' );
}
--
John Porter
------------------------------
Date: Fri, 14 Aug 1998 09:00:19 -0400
From: John Porter <jdporter@min.net>
Subject: Re: freeware documentation
Message-Id: <35D434E3.E80@min.net>
Sabre Taylor wrote:
>
> Not to start a holy war but...
Trust your intuition.
Why do so many people (especially new posters to clpm)
insist on ignoring their intuition?
--
John Porter
------------------------------
Date: Fri, 14 Aug 1998 09:49:19 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Have package use another symbol table?
Message-Id: <1ddpc2z.p4ydxprcvh2qN@slip166-72-108-14.ny.us.ibm.net>
Sean McAfee <mcafee@gorf.rs.itd.umich.edu> wrote:
> In article <35D314B7.41C6@genome.wi.mit.edu>,
> Alex Rolfe <arolfe@genome.wi.mit.edu> wrote:
> >I would like one package (call it A) to use another package's (call this
> >one B) symbol table. The name of package B won't be known until
> >run-time. I suppose that I could use eval's everywhere, but it seems
> >that there should be some easier solution.
>
> >The goal here is that functions in A will work like they've been
> >declared in B, even though they aren't. They should use the symbol
> >table (and therefore variables) from B. A is going to be a generic
> >package. B will allow for customizations to A and will be used by
> >another program.
>
> sub copy_symbol_table {
> no strict refs; # optional if not using strict refs
> my ($package_from, $package_to) = @_;
> while (my ($symbol, $glob) = each %{"${package_from}::"}) {
> *{"${package_to}::$symbol"} = $glob;
> }
> }
>
> copy_symbol_table "B" => "A";
You don't need 'no strict' if you use the symbol table entirely:
#!perl -w
use strict;
sub copy_symbol_table {
my ($fromt, $tot) = @_;
while (my ($name, $glob) = each %{*{$::{"${fromt}::"}}{HASH}}) {
${*{$::{"${tot}::"}}{HASH}}{$name} = $glob;
}
}
$B::x = 1;
$B::x++;
copy_symbol_table "B" => "A";
$A::x++;
print $A::x;
__END__
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: 14 Aug 1998 11:40:35 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: Help: Installing Modules?
Message-Id: <6r17nj$elm$1@lark.jmu.edu>
Tom Phoenix (rootbeer@teleport.com) wrote:
> perllocal.pod (which is not to be confused with perllocale.pod) should
> have been built when perl was installed. Unfortunately, someone built your
> perl with that file in the /var/tmp directory, and it's probably not there
> anymore. You should probably (have your sysadmin) re-build perl with the
> proper location for that file. (Information on how to do that comes with
> the perl source.) Good luck!
I am my sysadmin. <g> Installing the modules did all that stuff in
/var/tmp, perl was actually installed in /usr/lib. Well thanks for the
help. I will try rebuilding.
- mike -
------------------------------
Date: Fri, 14 Aug 1998 10:51:19 +0200
From: "Ernesto Guisado" <ernestogf@meta4.es>
Subject: Re: here's an implementation of diff in perl
Message-Id: <6r0tpq$4rd$1@talia.mad.ibernet.es>
Hi,
what happens if both files are identical?
Regards,
Ernesto.
Eugene Koontz wrote in message
<35D35CCC.938C5AAF@lsi.sel.nospam.sony.com>...
>hope it's useful to someone...
>wrote it because I needed a diff to run on windows.
------------------------------
Date: Fri, 14 Aug 1998 08:57:35 -0400
From: John Porter <jdporter@min.net>
Subject: Re: here's an implementation of diff in perl
Message-Id: <35D4343F.4738@min.net>
Eugene Koontz wrote:
>
> hope it's useful to someone...
> wrote it because I needed a diff to run on windows.
Do you read this newsgroup? Mark-Jason Dominus wrote
a diff in perl already, and it uses the same algorithm
(essentially) as the unix one does.
Plus, your code has problems.
> #!/usr/local/bin/perl
No -w?
> @states = ('start','advance_file_1','advance_file_2',
qw() offends you?
Or maybe it really doesn't matter, since you don't
use @states anywhere in the program.
> $state = 'start';
> $filename1 = @ARGV[0];
> $filename2 = @ARGV[1];
How about a usage statement if the arguments are missing
or invalid?
> $i = 0;
> open FILE1, "$filename1" || die "couldn't open $filename1!";
>
> while(<FILE1>) {
> chomp;
> @filearray1[$i++] = $_;
> }
Awful. First, that should be
$filearray[$i++]
with a $ instead of a @.
This is better:
@filearray1 = (); # initialize it.
while (<FILE1>) {
chomp;
push @filearray1, $_;
}
No counters needed.
> if ($#filearray1 == -1) {
> die "couldn't open $filename1!";
> }
No! This is not an error condition!
Empty files are legal.
And if you really want to consider it an error,
change the error message; that one's wrong.
> $string1 = @filearray1[$position1];
You're making the same error over and over.
That should be $, not @.
> print STDOUT "< @filearray1[$position1]\n";
You know STDOUT is the default.
Lastly, I think you should have included the code into the
body of your message, rather than as an attachment.
Many usenet readers can't handle attachments.
--
John Porter
------------------------------
Date: 14 Aug 1998 08:49:43 GMT
From: mnc@diana.law.yale.edu (Miguel Cruz)
Subject: Re: How to append at the top of the logfile ?
Message-Id: <6r0tn7$b70$1@news.ycc.yale.edu>
Terrence S. Ma <terrence@cs.utexas.edu> wrote:
> I am pretty new to perl so I hope that I am not asking a very
> stupid question. I have a perl script to log all the web hits
> on my web page but I want to have the latest hit to be at the top
> of the logfile instead of at the bottom.
There's only one way that's going to scale particularly well to large
logfiles: Turn your monitor upside down and leave the code alone.
Otherwise you're going to have to rewrite the entire file every time you add
a line. Are you sure it's really worth the trouble? Perhaps you could attack
the problem from the other angle; for instance, write a version of "more"
that pages backwards through a file.
miguel
------------------------------
Date: Thu, 13 Aug 1998 22:50:42 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Matts counter - suddenly stopped working
Message-Id: <fl_aggie-1308982250420001@aggie.coaps.fsu.edu>
In article <Pine.GSO.4.02.9808131729550.10161-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
+ On Fri, 14 Aug 1998, Alastair Taylor wrote:
+
+ > I had a counter from MSA all working ok then suddenly it stopped
+ > showing the hits on my web page, Count.txt is being updated as is the
+ > access_log.
You do understand what counters actually show you?
+ Complain to the program's author. Hope this helps!
Matt doesn't support his programs. No help there.
James
------------------------------
Date: Fri, 14 Aug 1998 09:02:15 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Matts counter - suddenly stopped working
Message-Id: <35D43557.5EB7@min.net>
I R A Aggie wrote:
> Tom Phoenix <rootbeer@teleport.com> wrote:
> + Complain to the program's author. Hope this helps!
>
> Matt doesn't support his programs. No help there.
Nonetheless, it's the only correct course of action
(at least, of those that involve complaining).
--
John Porter
------------------------------
Date: Fri, 14 Aug 1998 09:02:59 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Matts counter - suddenly stopped working
Message-Id: <35D43583.794@min.net>
Alastair Taylor wrote:
>
> I had a counter from MSA all working ok then suddenly it stopped showing
> the hits on my web page, Count.txt is being updated as is the
> access_log.
> It got to 180 ish then stopped - this is driving me mad
We feel your pain.
MattWare == CrapWare. You got what you paid for.
--
John Porter
------------------------------
Date: Fri, 14 Aug 1998 12:48:23 GMT
From: ghw@gmx.net (Gerhard Wrodnigg)
Subject: NT: redirect stdout to file
Message-Id: <35f031ca.104868623@news.tu-graz.ac.at>
Hello!
I tried to redirect stdout to a file
eg. sample.pl >output.txt
but this doesn't work :(
How can I fix that?
-mfg-ghw-
--
In a world without walls and fences, who needs windows and gates?
------------------------------
Date: Fri, 14 Aug 1998 07:06:02 GMT
From: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: Re: Opening a file as "+>>file"
Message-Id: <35d3e1ae.2357510@news.demon.co.uk>
On 13 Aug 1998 23:06:03 -0500, Jonathan Feinberg <jdf@pobox.com>
wrote:
>Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
>http://pobox.com/~jdf/
I have read the faq, but the problem with the examples are that they
open the file with a mode of "+>" and in another article in this group
someone has stated you can't do this if you are going to change the
size of the file.
That's my problem.
------------------------------
Date: 14 Aug 1998 09:11:56 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: Re: Opening a file as "+>>file"
Message-Id: <1zqjk5zn.fsf@mailhost.panix.com>
phil@ackltd.demon.co.uk (Phil Taylor) writes:
> I have read the faq, but the problem with the examples are that they
> open the file with a mode of "+>"
I don't think you've read the FAQ very carefully. It says
specifically, and loudly, not to do that.
How come when I open the file read-write it wipes it out?
Because you're using something like this, which truncates the file and
then gives you read-write access:
open(FH, "+> /path/name"); # WRONG
Whoops. You should instead use this, which will fail if the file
doesn't exist.
open(FH, "+< /path/name"); # open for update
If this is an issue, try:
sysopen(FH, "/path/name", O_RDWR|O_CREAT, 0644);
Error checking is left as an exercise for the reader.
That's from the perlfaq5 that accompanies perl 5.004. The 5.005
perlfaq5 is greatly expanded, with many examples of open() techniques.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 14 Aug 1998 12:11:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Opening a file as "+>>file"
Message-Id: <6r19ie$9oc$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, phil@ackltd.demon.co.uk (Phil Taylor) writes:
:I have read the faq, but the problem with the examples are that they
:open the file with a mode of "+>" and in another article in this group
:someone has stated you can't do this if you are going to change the
:size of the file.
What are you talking about?
% man perlfaq5 | grep '+>'
open(FH, "+> /path/name"); # WRONG (almost always)
http://www.perl.com/perl/newdocs/pod/perlfaq5.html has what you
want, although I see it's starting to propagate to CPAN.
--tom
--
#else /* !STDSTDIO */ /* The big, slow, and stupid way */
--Larry Wall in str.c from the 4.0 perl source code
------------------------------
Date: 14 Aug 1998 07:50:19 GMT
From: obp@onlinebp.com (Ivo Bieleveldt)
Subject: opening page in top window
Message-Id: <35d3ed73.64071329@news.euronet.nl>
Hi all,
A script is being called by one frame. The script does eventually:
print "location: $url\n\n";
$url appears in the new frame, but I want it to appear in the top
window.
Does anyone know the solution to this.
Thanks a lot,
Ivo Bieleveldt
------------------------------
Date: 14 Aug 1998 07:51:22 GMT
From: obp@onlinebp.com (Ivo Bieleveldt)
Subject: opening page in top window
Message-Id: <35d3ee36.64266229@news.euronet.nl>
Hi all,
A script is being called by one frame. The script does eventually:
print "location: $url\n\n";
$url appears in the old frame, but I want it to appear in the top
window.
Does anyone know the solution to this.
Thanks a lot,
Ivo Bieleveldt
------------------------------
Date: Fri, 14 Aug 1998 08:37:01 -0400
From: Finn Calabro <fcalabro@aisvt.bfg.com>
Subject: Parsing Word to ASCII
Message-Id: <35D42F6D.14ED5465@aisvt.bfg.com>
I'm looking for a script that will convert ms Word 97 documents to
ascii. They eventually need to be in HTML, but I can get them from
ascii to html. Thanks
------------------------------
Date: Fri, 14 Aug 1998 03:05:38 -0700
From: bld@NOSPAM.bayarea.net (Brian L. Donnell)
Subject: Perl 5.005_01 Threads and LWP
Message-Id: <bld-ya02408000R1408980305380001@news.bayarea.net>
So when the documentation says that Threads are experimental in
the new version of Perl - it isn't kidding. I'm using 5.005_01
under Solaris 2.6 and have had no end of grief with threads.
no way to kill threads the cond_wait/cond_signal stuff works
unreliably at best. i thought malcolm beattie had been working
on thread integration for some time - why is it so unstable?
am i the only one who finds its current incarnation virtually useless
because it's so buggy?
Is there a list anywhere of which CPAN modules are thread safe
and which aren't - and what plans are in the works for those that
aren't? in particular LWP (from libwww 5.35) crashes and burns
(core dumps Perl) big time if run inside a thread.
Sigh. Anyone know if LWPng 0.23 alpha is thread-safe?
thanks -
brian donnell
bld@bayarea.net
------------------------------
Date: Fri, 14 Aug 1998 08:07:47 GMT
From: Mark Wormgoor <riddles@ipe.nl>
Subject: Re: Perl and catching alarms
Message-Id: <6r0r8j$ivq$1@nnrp1.dejanews.com>
In article <ExnBK0.1L8@news.boeing.com>,
ced@bcstec.ca.boeing.com (Charles DeRykus) wrote:
> In article <6qu2fo$1cc$1@nnrp1.dejanews.com>,
> Mark Wormgoor <riddles@ipe.nl> wrote:
> >Hi,
> >
> >Could somebody please tell me what's wrong in the following eval{}? I'm using
> >this in Perl 5.004 but it won't catch the alarm. The progam dies with 'Alarm
> >clock' and that's it.... The eval I used is almost exactly the one described
> >in the perlipc docs...
> >----------------------------------------------------------------------------
> >eval {
> > local $SIG{ALRM} = sub {die "Connect failed"};
> > alarm 10;
> > $remote = IO::Socket::INET->new(Proto =>"tcp",
> > PeerAddr=> "www.domain.com",
> > PeerPort=> "80");
> > alarm 0;
> > close($remote);
> >};
> >if ($@ && ($@ =~ /failed/)) {
> > print "Connect failed!\n";
> >} else
> > print "Connected succesfully!\n";
> >};
> >
>
> Looks like the local SIGALRM definition is getting lost.
> Have you tried the builtin time out, e.g.,
>
> $remote = IO::Socket::INET->new(Proto =>"tcp",
> Timeout => 10,
> ...
Actually, I did. That was the first thing I tried... But the timeout for
the connect is still 180 seconds, which is way too long for what I'm trying to
do. (BTW, I'm using Redhat 5.1 w/ perl5.004_4)
Kind regards,
Mark Wormgoor
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 14 Aug 1998 13:07:50 +0100
From: Peter Richmond <peter@richmd.demon.co.uk>
Subject: perl version
Message-Id: <35D42896.47ABBE61@richmd.demon.co.uk>
HI,
This is probably a silly question to ask in this NG..
How do find out what version of Perl is installed in the machine?
Thanks
--
Peter Richmond.
--
Home : Sunderland, United Kingdom
Web : www.richmd.demon.co.uk
Pager: 01426 281 367
------------------------------
Date: Fri, 14 Aug 1998 14:11:17 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: perl version
Message-Id: <Pine.HPP.3.95a.980814140939.1195M-100000@hpplus01.cern.ch>
On Fri, 14 Aug 1998, Peter Richmond wrote:
> How do find out what version of Perl is installed in the machine?
Even I can answer that one: "perl -v", or "perl -V" for more detail.
(If only all programs would follow this convention!).
------------------------------
Date: Fri, 14 Aug 1998 09:40:39 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: perl version
Message-Id: <35D43E57.D85D20A2@sneex.fccj.org>
Peter Richmond wrote:
>
> HI,
>
> This is probably a silly question to ask in this NG..
>
> How do find out what version of Perl is installed in the machine?
>
> Thanks
> --
> Peter Richmond.
perl -v or perl -V
While a perl script is running, try
$] for the version number
$^T the time the script started
$^X the name by which it was started
All this and more from Perl 5 Desktop Referference.
(the Pocket edition 48-pages @ $6.95)
HTH,
-Sneex- :]
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Life is a 'Do it yourself' thing...
http://webmaster.fccj.org/cgi/mail?webmaster
------------------------------
Date: Fri, 14 Aug 1998 08:41:07 GMT
From: oliver.REMOVE.cook@bigfoot.DELETE.com (Ollie Cook)
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <35d4f804.3137048@news.ukonline.co.uk>
Thanks to the two people who replied to my post. I've now successfully
completed the script.
Regards
Ollie
------------------------------
Date: 13 Aug 1998 11:31:16 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Read directory and not files
Message-Id: <6quiq4$bee$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, mjd@op.net (Mark-Jason Dominus) writes:
:No, but you can use
: @directories = grep {-d} readdir D;
:to get a list of only directories.
This works only if the directory handle named D has been opened to
'.' instead of to some path like $dir. Forgetting this is a very
common problem.
opendir(D, '.') || die "dot is inaccessible: $!";
@directories = grep {-d} readdir D;
But
opendir(D, $dir) || die "opendir $dir: $!";
@directories = grep {-d} map {"$dir/$_"} readdir D;
>From the readdir(3pl) manpage:
If you're planning to filetest the return values out of a readdir(),
you'd better prepend the directory in question. Otherwise, because
we didn't chdir() there, it would have been testing the wrong file.
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
--tom
--
It's there as a sop to former Ada programmers. :-)
--Larry Wall regarding 10_000_000 in <11556@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 14 Aug 1998 13:01:43 GMT
From: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: Redefining routines
Message-Id: <6r1cfn$rgc$1@due.unit.no>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
> Morten Simonsen <mortensi@idt.ntnu.no> wrote:
>>P.S. If use require statement everywhere, I get "redefining
>>subroutine"-warning.
> Since require only loads a particular piece of code once, this warning
> must be being caused by something else. Perhaps some two of your
> modules define a subroutine of the same name in the same package.
I eventually found the error. It was caused by a mistyping in the
require-statement, like this:
require "$cond::PATH{'DB'}misc.pm";
instead of:
require "$conf::PATH{'DB'}misc.pm";
$conf::PATH{'DB'} contained the absolute path of misc.pm.
$cond::PATH{'DB'} contained nothing.
Because misc.pm was in the same directory as the file with the
mistyped require-statement, no error was discovered at this
moment. But apparently the same module were viewed as two different
ones, and then the warning came up. I am right? This means that a
relative and a absolute reference to a file makes two different files?
Morten Simonsen
------------------------------
Date: 14 Aug 1998 12:29:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: retrieving hash name
Message-Id: <6r1ajp$9oc$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
mwilhelm@ccat.sas.upenn.edu (Mark C. Wilhelm) writes:
:Suppose one "dynamically" names a hash during the course of a script, and
:then creates a reference to the hash. Is is it possible, using the
:reference, to retrieve the _name_ of the hash as well as the key/value
:pairs? If so, how would one do this?
Why oh why would you be creating a name of a hash on the fly?
This always suggests to me that someone doesn't understand
hashes. While you could write this:
$name = "fred";
$name->{WIFE} = "wilma";
$name = "barney";
$name->{WIFE} = "betty";
Better to write:
$folks{"fred"} {WIFE} = "wilma";
$folks{"barney"}{WIFE} = "betty";
--tom
--
------------------------------
Date: Fri, 14 Aug 1998 12:26:13 GMT
From: joanna <joanna@ecas.org>
Subject: Re: Setting DOS environment variables in a perl script
Message-Id: <35D42C47.3BF2B2FF@ecas.org>
vdielman@debis.com wrote:
>
> Hi there,
>
> could anybody tell me how to set DOS environment variables in PERL?
you can try {system $file.bat;} and let the batch file write your
environment variable. I do not exactly remember how to set an
anvironment variable in dos via a batch file anymore but batch files are
properly executed when started via a Perl funcion such as system. If
$file.bat contains the following code, you'll see that command.com will
properly execute it:
echo hello > test.bat
Note that if your perl script runs in the framework of a cgi-bin Perl
script, you might face some problem if the Perl script has to reply
something to the client.
Good luck, Gilles.
------------------------------
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 3444
**************************************