List Info

Thread: RE: Not every PC is in a named domain




RE: Not every PC is in a named domain
user name
2007-09-19 17:10:21
On Mon, 17 Sep 2007, Jerry D. Hedden wrote:
> Jan Dubois wrote:
> > That is weird, why does the test fail then. 
Doesn't Win32:omainNam
e()
> > on that machine return "MSHOME"?  When I
run it on an XP (SP2) machine
> > that is not part of the domain, I get the
workgroup name:
> >
> >     C:>perl -MWin32 -e "print Win32:omainNam
e"
> >     WORKGROUP
> 
> It prints out nothing on my PC.  So it appears to be
returning an empty
> string.

It looks like we cannot determine the workgroup name if the
"Workstation"
service isn't running.  I therefore removed the Win32:omainNam
e()
test from t/Names.t (patch below is against by local depot
for the
CPAN version, but should otherwise be identical to the
bleadperl one).

Cheers,
-Jan

--- users/jand/Win32/t/Names.t.~1~      Wed Sep 19 15:06:39
2007
+++ users/jand/Win32/t/Names.t  Wed Sep 19 15:06:39 2007
 -7,17
+7,10 
 }
 use Win32;

-my $tests = 14;
-$tests += 2 if Win32::IsWinNT();
+plan tests => 14;

-plan tests => $tests;
-
-# test Win32:omainNam
e()
-if (Win32::IsWinNT()) {
-    my $domain = eval { Win32:omainNam
e() };
-    is( $, '', "Win32:omainNam
e()" );
-    like( $domain, '/^[a-zA-Z0-9!#$%^&()_'{}.~-]+$/',
"  - checking returned domain" );
-}
+# don't test Win32:omainNam
e(), it only works on Windows NT and later,
+# and it may not return anything if the
"Workstation" service is not running.

 # test Win32::GetArchName()
 my $archname = eval { Win32::GetArchName() };
End of Patch.


RE: Not every PC is in a named domain
user name
2007-09-20 02:50:23
Jan Dubois wrote:
> On Mon, 17 Sep 2007, Jerry D. Hedden wrote:
>> Jan Dubois wrote:
>>> That is weird, why does the test fail then. 
Doesn't
>>> Win32:omainNam
e() on that machine return "MSHOME"?  When I run
it
>>> on an XP (SP2) machine that is not part of the
domain, I get the
>>> workgroup name: 
>>> 
>>>     C:>perl -MWin32 -e "print
Win32:omainNam
e"
>>>     WORKGROUP
>> 
>> It prints out nothing on my PC.  So it appears to
be returning an
>> empty string.
> 
> It looks like we cannot determine the workgroup name if
the
> "Workstation" 
> service isn't running.  I therefore removed the
Win32:omainNam
e()
> test from t/Names.t (patch below is against by local
depot for the
> CPAN version, but should otherwise be identical to the
bleadperl one).

Couldn't we call Win32:omainNam
e() and then check the value of $^E
afterwards? If it is 2138 (The Workstation service has not
been started)
then skip the tests, otherwise test the returned $domain?

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )