[16200] in Perl-Users-Digest
Perl-Users Digest, Issue: 3612 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 20:19:40 2000
Date: Mon, 10 Jul 2000 17:19:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963274758-v9-i3612@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 10 Jul 2000 Volume: 9 Number: 3612
Today's topics:
Re: Welcome to.... <billy@erc.msstate.edu>
Re: Welcome to.... (Abigail)
Re: Welcome to.... <Magic@mattnet.freeserve.co.uk>
Re: Welcome to.... <Magic@mattnet.freeserve.co.uk>
What does for() return? <kistler@gmx.net>
Re: What does for() return? (Tad McClellan)
Re: What does for() return? (Villy Kruse)
what does lpxxxxx mean? <rico28NOriSPAM@bellatlantic.net.invalid>
Re: what does lpxxxxx mean? <bwalton@rochester.rr.com>
Re: what does lpxxxxx mean? <care227@attglobal.net>
what is %ENV scope <alexyz777@my-deja.com>
Re: what is %ENV scope <bwalton@rochester.rr.com>
Re: what is %ENV scope <alexyz777@my-deja.com>
Where do one start???? <jopierre@mweb.co.za>
Re: Where do one start???? <care227@attglobal.net>
Which one is better? $_[0] or shift? <abuse@localhost>
Re: Which one is better? $_[0] or shift? (Neil Kandalgaonkar)
Re: Which one is better? $_[0] or shift? (Abigail)
Re: Which one is better? $_[0] or shift? <iltzu@sci.invalid>
Re: Which one is better? $_[0] or shift? (Tad McClellan)
Re: Which one is better? $_[0] or shift? (Reini Urban)
Which Win32 OS am I running? <craigc@natinst.com>
Re: Which Win32 OS am I running? <randy@theoryx5.uwinnipeg.ca>
Re: Which Win32 OS am I running? <mjcarman@home.com>
Who is using my NT shared resources? <foo@bar.va>
Re: Who is using my NT shared resources? <carvdawg@patriot.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 3 Jul 2000 14:25:42 -0500
From: "Billy Chambless" <billy@erc.msstate.edu>
Subject: Re: Welcome to....
Message-Id: <8jqp8s$ptk$1@nntp.msstate.edu>
Bart Lateur <bart.lateur@skynet.be> wrote in message
news:3961555e.3984698@news.skynet.be...
> Billy Chambless wrote:
> >I would offer some help, but my solution to running a Web server on a PC
> >involves installing Linux.
> Mine would be to get DynamicPerl from <www.dynamicstate.com>, which
> installs both a Perl 5.6 and an Apache webserver.
FWIW, your solution has some obvious advantages over mine. :)
------------------------------
Date: 03 Jul 2000 18:37:01 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Welcome to....
Message-Id: <slrn8m26e3.59a.abigail@alexandra.delanet.com>
Magic (Magic@mattnet.freeserve.co.uk) wrote on MMCDXCVII September
MCMXCIII in <URL:news:en0vlsct0vuuvdvc06sabj6h030j0ij97u@4ax.com>:
==
== Am I? Just use your fucking brain for a minute ok. I've come here with
== a question that I *thought* would have a simple answer. I know JACK
== SHIT about Perl and wanted to learn. What a fucking waist of time that
== was, with arseholes like you around I can see why Newsgroups get a bad
== reputation. Instead of pointing me in the right direction I get given
== a script that will erase huge chunks of god knows what from the web
== server.
So, you want to learn, and when someone points out the flaws in your
code, you start crying? Not much of a student, are you?
== > Perl is actually much _safer_ than any other programming language,
== > due to its "taint checking", which no other language has.
==
== I'd say the opposite. Due to the way Perl looks like encrypted trash
== when you look at the program and seems to have no meaningful name to
== the commands, it is far easier to make a mistake that will result in
== damage being done. What the fuck is "+rm +rw r w r r r w w |?" when
== it's at home? Why don't they just call the bloody caommand "Delete"
== and save us all a headache???
== use the command "open" to erase things????
"rm" has been part of the standard Unix toolkit for about 3 decades,
and has never, ever be a part of Perl.
== WHat kind of dumb fuck enables you to
== use the command "open" to erase things????
Well, Larry of course. Magic open is useful.
== > There is no such thing as a simple problem if it has anything
== > to do with "Security" and "CGI".
==
== Really? Of it wasn't for the "open" command being stupid enough to
== allow you erase everything then there wouldn't be a security issue
== there at all.
Really? The snippet you provided below in VB happily serves /etc/passwd
to the user. Ooops!
== ' Open the file for ReadOnly access
== FileHandle = Open (Path$+File$,ReadOnly)
So, what happens if you cannot open the file? For some weird reason,
as indicated below, it looks VB allows you to open non-existing files,
but what if the file exists, but you don't have permission to open it?
Note that the above can be written in Perl as:
open FileHandle, "<", "$Path$File";
and there's no magic about the filename.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: Tue, 04 Jul 2000 10:38:04 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: Re: Welcome to....
Message-Id: <g1c3mso2ktukpup637cm7hpkftq32k7kqm@4ax.com>
On Mon, 03 Jul 2000 09:36:59 -0400, Drew Simonis
<care227@attglobal.net> wrote:
> "Magic." wrote:
> >
> >
> > So you can't see this post then, right? I guess that means you'll
> > never see the apology either. Oh well, that's life!
> >
>
> For someone who claims to have been using USENET for some time, you
> should already know what a *plonk* is. To borrow a phrase from Jeff
> Pinyan, you are shun-worthy.
That depends on how effective his KF is. Adding a "." after my name
and into my Email address may have nade the post visible....
Subtle, but often enough...
Magic ==|:o)
--
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk
------------------------------
Date: Tue, 04 Jul 2000 10:47:27 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: Re: Welcome to....
Message-Id: <i6c3ms8i5cj1bcvf742th6e30d3uaicmn8@4ax.com>
On 03 Jul 2000 18:37:01 EDT, abigail@delanet.com (Abigail) wrote:
> Magic (Magic@mattnet.freeserve.co.uk) wrote on MMCDXCVII September
> MCMXCIII in <URL:news:en0vlsct0vuuvdvc06sabj6h030j0ij97u@4ax.com>:
> So, you want to learn, and when someone points out the flaws in your
> code, you start crying? Not much of a student, are you?
I have already apologised for thqt, but I will do so again. I am
sorry, I over-reacted. Please accept my apology.
> "rm" has been part of the standard Unix toolkit for about 3 decades,
> and has never, ever be a part of Perl.
I've never touched *nix, and had no idea what this "pipe" thing was.
All I saw was a simple "Open" command that allowed people to kill
parts of my data off with odd characters.
> Really? The snippet you provided below in VB happily serves
/etc/passwd
> to the user. Ooops!
No it doesn't! The path was set to the HTML directory and VB does not
allow ".." in the path unless it is at the beginning, ie
"../../../pwd" would be valid but "/usr/home/../../../../pwd" is not.
You also cannot trigger commands that way, you need a different
command called "Shell" to do that.
> == ' Open the file for ReadOnly access
> == FileHandle = Open (Path$+File$,ReadOnly)
>
> So, what happens if you cannot open the file? For some weird reason,
> as indicated below, it looks VB allows you to open non-existing
files,
> but what if the file exists, but you don't have permission to open
it?
It would still trigger "EOF" - that is always triggered when a file
cannot be opened or contains no data. If you want more information on
why you simply examine default variable "ERR" which would contain an
error code, or ERR$ which would contain the string (in this case
"Unable to open file : 403 Forbidden").
> Note that the above can be written in Perl as:
> open FileHandle, "<", "$Path$File";
> and there's no magic about the filename.
But would this allow a filename such as "/use/home/../../../../pwd" ?
Magic ==|:o)
--
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk
------------------------------
Date: Mon, 10 Jul 2000 13:30:40 +0200
From: "Per Kistler" <kistler@gmx.net>
Subject: What does for() return?
Message-Id: <newscache$2b9hxf$jo$1@cache.cyberlink.ch>
Hi All
One can do perl -e "print $_ for ( 1 .. 5 );"
which prints: 12345.
or: perl -e "$a .= $_ and print qq(:$a:) for ( 1 .. 5 );"
which prints: :1::12::123::1234::12345:
for() seems to call the statements before for() for each loop.
Where is this behaviour of for() officially explained?
Thanks, Per.
------------------------------
Date: Mon, 10 Jul 2000 08:08:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: What does for() return?
Message-Id: <slrn8mjf5j.tf8.tadmc@magna.metronet.com>
On Mon, 10 Jul 2000 13:30:40 +0200, Per Kistler <kistler@gmx.net> wrote:
>One can do perl -e "print $_ for ( 1 .. 5 );"
>or: perl -e "$a .= $_ and print qq(:$a:) for ( 1 .. 5 );"
>for() seems to call the statements before for() for each loop.
>
>Where is this behaviour of for() officially explained?
Perl's syntax is described in:
perldoc perlsyn
The section "Simple statements" describes "statement modifiers",
like those above.
You may also want to see the first couple of paragraphs in
the "Foreach Loops" section as well.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Jul 2000 13:50:51 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: What does for() return?
Message-Id: <slrn8mjl5p.15i.vek@pharmnl.ohout.pharmapartners.nl>
On Mon, 10 Jul 2000 13:30:40 +0200, Per Kistler <kistler@gmx.net> wrote:
>Hi All
>
>One can do perl -e "print $_ for ( 1 .. 5 );"
>which prints: 12345.
>or: perl -e "$a .= $_ and print qq(:$a:) for ( 1 .. 5 );"
>which prints: :1::12::123::1234::12345:
>for() seems to call the statements before for() for each loop.
>
>Where is this behaviour of for() officially explained?
>
>Thanks, Per.
>
>
>
perldoc perlsyn
search for "Simple statement" and check the stuff about SINGLE
modifier.
This is different from the compund for ( ... ) { ... } statement.
BTW: tried this on perl-5.004 and it didn't work. Appearently this
is a 5.005 enhancement.
Villy
------------------------------
Date: Sat, 08 Jul 2000 14:22:39 -0700
From: Kevin Johnson <rico28NOriSPAM@bellatlantic.net.invalid>
Subject: what does lpxxxxx mean?
Message-Id: <210046ed.5e9d3bff@usw-ex0108-062.remarq.com>
I am writing a script using the Win32:: Service module. I
get an error that says:
Usage:Win32::Service::GetStatus(lpHostName, lpServiceName,
status) at recycle.pl line 17, <STDIN> line 2.
What does the lp mean? Thanks
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Sat, 08 Jul 2000 23:05:07 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: what does lpxxxxx mean?
Message-Id: <3967B3E8.BC47504@rochester.rr.com>
Kevin Johnson wrote:
>
> I am writing a script using the Win32:: Service module. I
> get an error that says:
>
> Usage:Win32::Service::GetStatus(lpHostName, lpServiceName,
> status) at recycle.pl line 17, <STDIN> line 2.
>
> What does the lp mean? Thanks
...
That is an example of "Hungarian notation" which encodes the type of a
variable into a few letters at the beginning of a variable name. It is
popular in C/C++ because of the myriads of data types which can be
present. The "l" usually stands for "long" or maybe "local" and the "p"
stands for "pointer". So it is a "long pointer" or a "local pointer".
But since it is only a convention, a programmer could use it for
whatever he or she wanted. Or not use it.
See Charles Simonyi and Martin Heller, "The Hungarian Revolution", BYTE,
Aug. 1991 (vol. 16, no. 8).
--
Bob Walton
------------------------------
Date: Sat, 08 Jul 2000 23:26:38 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: what does lpxxxxx mean?
Message-Id: <3967F0EE.F7704967@attglobal.net>
Bob Walton wrote:
>
> Kevin Johnson wrote:
> >
> > I am writing a script using the Win32:: Service module. I
> > get an error that says:
> >
> > Usage:Win32::Service::GetStatus(lpHostName, lpServiceName,
> > status) at recycle.pl line 17, <STDIN> line 2.
> >
> > What does the lp mean? Thanks
> ...
> That is an example of "Hungarian notation" which encodes the type of a
> variable into a few letters at the beginning of a variable name.
I was thinking line printer.
------------------------------
Date: Tue, 04 Jul 2000 12:37:51 GMT
From: AlexYZ <alexyz777@my-deja.com>
Subject: what is %ENV scope
Message-Id: <8jslqu$alr$1@nnrp1.deja.com>
In Camel book I read that %ENV is global. But if I set
$ENV{SOMETHING} in package 'main', it is not visible in
a module called from 'main'.
Is my notion of 'global' at all right?
Should I use $main::SOMETHING in the module instead?
Thanks a lot for help
Alex
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 04 Jul 2000 17:59:37 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: what is %ENV scope
Message-Id: <39622652.22CC6F40@rochester.rr.com>
AlexYZ wrote:
>
> In Camel book I read that %ENV is global. But if I set
> $ENV{SOMETHING} in package 'main', it is not visible in
> a module called from 'main'.
> Is my notion of 'global' at all right?
>
> Should I use $main::SOMETHING in the module instead?
...
> Alex
...
Not sure what you are trying to get at. The following code produces two
copies of the environment variables, both including "qq":
package XX;
sub a{
for(sort keys %main::ENV){
print "$_=$main::ENV{$_}\n";
}
}
sub b{
for(sort keys %ENV){
print "$_=$ENV{$_}\n";
}
}
1;
package main;
print "hi there\n";
$ENV{qq}='QQ';
&XX::a;
&XX::b;
Do you mean something different from this when you say "module"?
--
Bob Walton
------------------------------
Date: Thu, 06 Jul 2000 11:57:29 GMT
From: AlexYZ <alexyz777@my-deja.com>
Subject: Re: what is %ENV scope
Message-Id: <8k1s75$r5l$1@nnrp1.deja.com>
Thanks for reply. What I was doing was to pass a path to config
from main to module:
in main
use Mymodule;
$ENV{STR} = "str"; #1
...
and in Mymodule.pm
package Module;
print $ENV{STR}; #2
...
The $ENV{STR} was uninitialised in line #2,
until I put line #1 in BEGIN{} *before* 'use Mymodule'
Now it works.
Alex
In article <39622652.22CC6F40@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
> Not sure what you are trying to get at. The following code produces
two
> copies of the environment variables, both including "qq":
>
> package XX;
> sub a{
> for(sort keys %main::ENV){
> print "$_=$main::ENV{$_}\n";
> }
> }
> sub b{
> for(sort keys %ENV){
> print "$_=$ENV{$_}\n";
> }
> }
> 1;
> package main;
> print "hi there\n";
> $ENV{qq}='QQ';
> &XX::a;
> &XX::b;
>
> Do you mean something different from this when you say "module"?
> --
> Bob Walton
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 9 Jul 2000 18:44:59 +0200
From: "Jo-Pierre Lerm" <jopierre@mweb.co.za>
Subject: Where do one start????
Message-Id: <3968ac12.0@news1.mweb.co.za>
I would like to know what software do i need to start.
Where can I find it....downloadable?
------------------------------
Date: Sun, 09 Jul 2000 14:53:10 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Where do one start????
Message-Id: <3968CA16.70F5FEC6@attglobal.net>
Jo-Pierre Lerm wrote:
>
> I would like to know what software do i need to start.
> Where can I find it....downloadable?
Assuming that you speak of perl, you need to visit
http://www.perl.com
------------------------------
Date: Sun, 9 Jul 2000 12:36:58 +0800
From: "multiplexor" <abuse@localhost>
Subject: Which one is better? $_[0] or shift?
Message-Id: <8k8v2o$s9024@imsp212.netvigator.com>
I saw two ways of passing parameter to a subroutine and I would like to know
which one is better.
# Method 1
sub temp {
my $text = shift;
}
# Method 2
sub temp {
my $text = $_[0];
}
Thanks.
------------------------------
Date: Sun, 09 Jul 2000 04:49:13 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Which one is better? $_[0] or shift?
Message-Id: <8k8vrn$d7g$1@localhost.localdomain>
In article <8k8v2o$s9024@imsp212.netvigator.com>,
multiplexor <abuse@localhost> wrote:
>I saw two ways of passing parameter to a subroutine and I would like to know
>which one is better.
They all have advantages and disadvantages.
I usually do:
my ($var) = @_;
Even for subs that take just one argument, because it's less of a pain
to fix it later:
my ($var, $oops_i_needed_another) = @_;
Of course, for more than four args you start to want to have multiple lines
again. But if you have a sub which requires that many args you may have
tried to do too much with one subroutine.
>
># Method 1
>sub temp {
> my $text = shift;
>}
shift gets tedious after two or more arguments. Sometimes it
is good for idioms like
my $arg = shift if (condition);
># Method 2
>sub temp {
> my $text = $_[0];
>}
This is almost never right. Much more confusing than ($var) = @_. Harder
to maintain. The only time I use $_[0] is to bypass the whole assignment
process.
sub currency {
sprintf ('%.2f', $_[0]);
}
print "$" . currency(4) . "\n"; # $4.00
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: 09 Jul 2000 01:43:29 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Which one is better? $_[0] or shift?
Message-Id: <slrn8mg59j.t4j.abigail@alexandra.delanet.com>
multiplexor (abuse@localhost) wrote on MMDIV September MCMXCIII in
<URL:news:8k8v2o$s9024@imsp212.netvigator.com>:
)) I saw two ways of passing parameter to a subroutine and I would like to know
)) which one is better.
Define "better". If you mean speed wise, then you should first consider
that if such micro-optimization is important to you, you shouldn't use
Perl in the first place. And after that, you use Benchmark and find out.
If you mean "what wins at Perl golf", then obviously, it's a tie.
But maybe you mean something else. Please clarify "better" (no pun intended).
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 9 Jul 2000 13:36:44 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Which one is better? $_[0] or shift?
Message-Id: <963149049.16408@itz.pp.sci.fi>
In article <8k8vrn$d7g$1@localhost.localdomain>, Neil Kandalgaonkar wrote:
>I usually do:
> my ($var) = @_;
>
>shift gets tedious after two or more arguments. Sometimes it
>is good for idioms like
> my $arg = shift if (condition);
A useful idiom for optional arguments is:
my $optional = @_ ? shift : 'default';
In OO methods I often shift off the instance ref and then get the
actual parameters with list assignment. This has the advantage of
making calls like $self->SUPER::foo(@_) nice and simple.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Sun, 9 Jul 2000 11:47:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Which one is better? $_[0] or shift?
Message-Id: <slrn8mh7kr.rnq.tadmc@magna.metronet.com>
On Sun, 09 Jul 2000 04:49:13 GMT, Neil Kandalgaonkar <neil@brevity.org> wrote:
>In article <8k8v2o$s9024@imsp212.netvigator.com>,
>multiplexor <abuse@localhost> wrote:
>>I saw two ways of passing parameter to a subroutine and I would like to know
>>which one is better.
>The only time I use $_[0] is to bypass the whole assignment
^^^^^^^^^
>process.
>
> sub currency {
> sprintf ('%.2f', $_[0]);
> }
Another time would be when you _want_ "pass by reference" semantics:
-------------------------
#!/usr/bin/perl -w
use strict;
$_ = 'foo bar';
init_cap($_);
print "$_\n";
sub init_cap {
$_[0] =~ s/(.)/\U$1/
}
-------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 09 Jul 2000 16:46:51 GMT
From: rurban@sbox.tu-graz.ac.at (Reini Urban)
Subject: Re: Which one is better? $_[0] or shift?
Message-Id: <3968ab7f.104315317@news>
multiplexor wrote:
>I saw two ways of passing parameter to a subroutine and I would like to know
>which one is better.
> my $text = shift;
> my $text = $_[0];
they are different. the first has a destructive side-effect on @_
the latter not. The first is argument position invariant, the latter
not. (so you can easily add an extra argument lateron at the front or in
the middle).
you cannot compare apple with fish.
"best" is probably my ($arg1, $arg2, ...) = @_; according the usual
assumptions about goodness in programming.
--
Reini
------------------------------
Date: Thu, 6 Jul 2000 10:34:56 -0500
From: "Craig Conway" <craigc@natinst.com>
Subject: Which Win32 OS am I running?
Message-Id: <sm99qd9jgas121@corp.supernews.com>
I need to determine whether my Perl script is running on Win95, Win98,
WinNT. The built in variable $^O only returns MSWin32 which doesn't tell me
enough.
I want to take advantage of the WinNT feature where you can just type the
name of the Perl script at the command prompt instead of having to type
"perl myscript.pl". This allows both the Perl executable and the script
itself to be in the path and not necessarily in the current directory.
My current solution (which is quite ugly) is this:
$OS = "XX";
system("ver > ostype.txt");
open (TF, "ostype.txt");
foreach (<TF>) {
if (/Windows NT/i) {$OS = "NT";}
elsif (/Windows 95/i) {$OS = "95";}
elsif (/Windows 98/i) {$OS = "98";}
}
close (TF);
There has to be a better solution than calling the MS-DOS "ver" command,
piping it to a file, and then reading that file. Does anyone have any
suggestions?
Thanks.
------------------------------
Date: 6 Jul 2000 17:04:21 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Which Win32 OS am I running?
Message-Id: <8k2e6l$t8b$1@canopus.cc.umanitoba.ca>
In comp.lang.perl.misc, Craig Conway <craigc@natinst.com> wrote:
> I need to determine whether my Perl script is running on Win95, Win98,
> WinNT. The built in variable $^O only returns MSWin32 which doesn't tell me
> enough.
[ ... ]
I'm not sure when they were introduced, but on recent Win32 perls
the core functions Win32::IsWin95 and Win32::IsWinNT are
available. They can be used as, for example,
print "You appear to be on Win95/98\n" if Win32::IsWin95;
print "You appear to be on WinNT" if Win32::IsWinNT;
best regards,
randy kobes
------------------------------
Date: Fri, 07 Jul 2000 07:59:35 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Which Win32 OS am I running?
Message-Id: <3965D437.61A82E78@home.com>
Craig Conway wrote:
>
> I need to determine whether my Perl script is running on Win95, Win98,
> WinNT. The built in variable $^O only returns MSWin32 which doesn't
> tell me enough.
> [...]
> My current solution (which is quite ugly) is this:
>
> $OS = "XX";
> system("ver > ostype.txt");
> open (TF, "ostype.txt");
> foreach (<TF>) {
> if (/Windows NT/i) {$OS = "NT";}
> elsif (/Windows 95/i) {$OS = "95";}
> elsif (/Windows 98/i) {$OS = "98";}
> }
> close (TF);
>
> There has to be a better solution than calling the MS-DOS "ver"
> command, piping it to a file, and then reading that file. Does
> anyone have any suggestions?
>
Well, there's certainly no need to make that file. You can capture the
output of the system call using backticks:
$os_ver = `ver`;
if ($os_ver =~ /Windows NT/) {
# [...]
That's only a little ugly, and only if you object to system calls.
Otherwise, the Win32 module should be helpful as another poster
recommended. Its GetOSVersion() function may be useful to you as well.
-mjc
------------------------------
Date: Fri, 07 Jul 2000 09:25:34 +0200
From: Marco Natoni <foo@bar.va>
Subject: Who is using my NT shared resources?
Message-Id: <396585ED.88A7FB56@bar.va>
Hi,
Is there a way to obtain a list of users connected to a given network
shared resource in Windows NT with Perl? It seems that the
Win32::NetResource module does not cover my needs...
TYA!
Best regards,
Marco
------------------------------
Date: Sat, 08 Jul 2000 07:35:11 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Who is using my NT shared resources?
Message-Id: <396711EF.7DFFBCCE@patriot.net>
The Win32::Lanman module allows you to do this. You can get it using PPM
from
http://jenda.mccann.cz/perl.
However, Win32::Lanman, as of today, has not been updated to be compatible
with
Perl 5.6. I have contacted the author and he is working on it.
Marco Natoni wrote:
> Hi,
>
> Is there a way to obtain a list of users connected to a given network
> shared resource in Windows NT with Perl? It seems that the
> Win32::NetResource module does not cover my needs...
>
> TYA!
>
> Best regards,
> Marco
------------------------------
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 V9 Issue 3612
**************************************