Re: Perl-Win32-Users Digest, Vol 63, Issue 12

2011-11-29 Thread Michael Zeng
 why not use File::Find ?

already written better module for you ,


On Wed, Nov 30, 2011 at 4:00 AM, 
perl-win32-users-requ...@listserv.activestate.com wrote:

 Send Perl-Win32-Users mailing list submissions to
perl-win32-users@listserv.ActiveState.com

 To subscribe or unsubscribe via the World Wide Web, visit

 http://listserv.ActiveState.com/mailman/listinfo/perl-win32-usershttp://listserv.activestate.com/mailman/listinfo/perl-win32-users
 or, via email, send a message with subject or body 'help' to
perl-win32-users-requ...@listserv.activestate.com

 You can reach the person managing the list at
perl-win32-users-ow...@listserv.activestate.com

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Perl-Win32-Users digest...


 Today's Topics:

   1. Problem with recursive routine (Barry Brevik)
   2. RE: Problem with recursive routine (Tobias Hoellrich)
   3. RE: Problem with recursive routine (Barry Brevik)


 --

 Message: 1
 Date: Mon, 28 Nov 2011 15:38:59 -0800
 From: Barry Brevik bbre...@stellarmicro.com
 Subject: Problem with recursive routine
 To: perl Win32-users perl-win32-users@listserv.activestate.com
 Message-ID:

  995C029A48947048B3280035B3B5433C010747B3@Stellar2k3-Exch.STELLARMICRO.LOCAL
 

 Content-Type: text/plain;   charset=iso-8859-1

 I'm having a problem with a recursive routine that enumerates a directory
 tree and all of its files. It works well, except when it goes down 1 level
 from the top directory, I get this message: Use of uninitialized value in
 addition (+) at test61.pl line 61.

 I've been fighting this thing for a couple of hours, and I thought that it
 was a variable scoping problem, but now I'm not so sure.

 The code:

 use strict;
 use warnings;
 use Cwd;

 # Target directory is the current directory. For consistency,
 # convert '\' into '/' and add a trailing '/' to the directory
 # path if it is missing.
 (my $targetdir = cwd()) =~ s/\\/\//g;
 unless ($targetdir =~ /\/$/) {$targetdir .= '/';}

 my $prefixFactor = 0;

 enumerateDirectory($targetdir, $prefixFactor);

 # -
 # This routine enumerates the files in the target directory
 # and traverses the directory tree downwards no matter how
 # far it goes. The routine does this by being RECURSIVE.
 #
 # While processing directories, maintain a prefix factor which
 # controls the indention of the file and directory display.
 #
 sub enumerateDirectory($$)
 {
  my ($targetdir, $prefixFactor) = @_;
  my ($filename, $filesize) = ('', 0);
  my $fileTotalSize = 0;

  if (opendir(my $currentDir, $targetdir))
  {
my $nxtfile = '';

# Enumerate each file in the current directory.
#
while (defined($nxtfile = readdir($currentDir)))
{
  # If the current file is a directory, follow this logic.
  if (-d $nxtfile)
  {
# If the directory is '.' or '..' then ignore it.
if ($nxtfile eq '.' || $nxtfile eq '..') {next;}

# If the directory name returned by readdir() is
# missing a trailing '/', add it here.
unless ($nxtfile =~ /\/$/) {$nxtfile .= '/';}

# Display the directory name then increment the prefix factor.
print \n, ' ' x $prefixFactor, $nxtfile\n;

$prefixFactor += 2;

# Call ourself with the directory name that we are following down.
enumerateDirectory($targetdir.$nxtfile, $prefixFactor);

# Upon return from the recursive call, de-increment the prefix
 factor.
$prefixFactor -= 2 if $prefixFactor  0;
  }
  else
  {
# If here, we have an ordinary file. Display it.
$fileTotalSize += (-s $nxtfile);# THIS IS LINE 61 REFERRED TO
 IN THE ERROR MSG.
print ' ' x $prefixFactor, $nxtfile, '  ', (-s $nxtfile), \n;
  }
}

# After completely enumerating each directory, be sure to
# close the directory entity.
close $currentDir;
print \n, ' ' x $prefixFactor, $fileTotalSize)\n;
  }
 }


 --

 Message: 2
 Date: Mon, 28 Nov 2011 15:46:41 -0800
 From: Tobias Hoellrich thoel...@adobe.com
 Subject: RE: Problem with recursive routine
 To: Barry Brevik bbre...@stellarmicro.com, perl Win32-users
perl-win32-users@listserv.ActiveState.com
 Message-ID:
81cb148a36e8b241a8369338aa528ac385ce852...@nambx02.corp.adobe.com
 Content-Type: text/plain; charset=us-ascii

 You are not changing the directory while traversing. Whenever you access
 $nxtfile, you'll need to access it as $targetdir/$nxtfile. So, this
 (among other things):
$fileTotalSize += (-s $nxtfile);# THIS IS LINE 61 REFERRED TO
 IN THE ERROR MSG.
 Needs to become:
$fileTotalSize += (-s $targetdir/$nxtfile);# THIS IS LINE 61
 REFERRED TO IN THE ERROR MSG.

 Cheers - Tobias

 -Original Message-
 From: 

Re: How to Extract a Date from a File

2011-11-03 Thread Michael
 Hi,

 This is usually what I do...

 -
 #!/usr/bin/perl

 my $startDate;

 while () {
 if($_ =~ 
 /StartWeekLabel.*?([\d]{4})\/([\d]{2})\/([\d]{2}).*?\/span/i) {
 $startDate =$1$2$3;
 }
 }

 print $startDate\n;
 --

 Call the script with the text file as a parameter perl myscript.pl 
 mytextfile.txt
 If you want to search multiple files just add them as well perl 
 myscript.pl mytextfile.txt mytextfile2.txt etc

 /Michael
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Pulling PERL Exectuable x86 vs x64

2011-02-22 Thread Michael Cohen
Is there a simple way to determine what flavor of PERL is running from 
within a program, specifically one that is wrapped within PERLAPP?  In 
other words, I need to determine if the PERL is 32-bit or 64-bit, to 
determine if it is running in WoW64 or not.  I realize it is easy to 
determine the flavor of the OS, but this is not that question.

Regards,
Michael Cohen___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Pulling PERL Exectuable x86 vs x64

2011-02-22 Thread Michael Cohen
Jan,

Thanks a lot!!   That did the trick.

Regards,
Michael Cohen



From:   Jan Dubois j...@activestate.com
To: Michael Cohen/Raleigh/IBM@IBMUS, 
perl-win32-users@listserv.ActiveState.com
Date:   02/22/2011 04:18 PM
Subject:RE: Pulling PERL Exectuable x86 vs x64



Load Config.pm and look at $Config{ptrsize}.  It is either 4 or 8, telling 
you that you are running 32-bit or 64-bit Perl.
 
Cheers,
-Jan
 
From: perl-win32-users-boun...@listserv.activestate.com [
mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of 
Michael Cohen
Sent: Tuesday, February 22, 2011 1:06 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Pulling PERL Exectuable x86 vs x64
 
Is there a simple way to determine what flavor of PERL is running from 
within a program, specifically one that is wrapped within PERLAPP?  In 
other words, I need to determine if the PERL is 32-bit or 64-bit, to 
determine if it is running in WoW64 or not.  I realize it is easy to 
determine the flavor of the OS, but this is not that question. 

Regards,
Michael Cohen
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Invalid type 'Q' in pack

2011-02-14 Thread Michael Cohen
I am trying to replace an old and unsupported Win32 library.  In doing so, 
I am attempting to get the following piece of code to work prior to adding 
it to my own library:

 Cut Here -
#!/usr/bin/perl -w
use strict;

use Win32;
use Win32::API;

Win32::API::Struct-typedef('MEMORYSTATUSEX', qw(
  DWORD dwLength;
  DWORD dwMemoryLoad;
  DWORD64   ullTotalPhys;
  DWORD64   ullAvailPhys;
  DWORD64   ullTotalPageFile;
  DWORD64   ullAvailPageFile;
  DWORD64   ullTotalVirtual;
  DWORD64   ullAvailVirtual;
  DWORD64   ullAvailExtendedVirtual;
));

Win32::API-Import('kernel32',
  'BOOL GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)');

# my $memoryInfo = Win32::API::Struct-new('MEMORYSTATUSEX');
tie my %memoryInfo, 'Win32::API::Struct', 'MEMORYSTATUSEX';

my $rc = GlobalMemoryStatusEx(\%memoryInfo);

printf (TotalPhys = %d\n, $memoryInfo{ullTotalPhys});

print (Finished\n);

 Cut Here -

When I try to run this program on a x86 version of ActivePerl 5.8.9 Build 
828, I get the error:
  Invalid type 'Q' in pack at C:/Perl/lib/Win32/API/Struct.pm line 230.
when it gets to line 25 (actual call of the Win32 API).

Since I need to run this bit of code on both the 32-bit and 64-bit 
Windows, how can I get this to work?

API Info:  http://msdn.microsoft.com/en-us/library/aa366589

Regards,
Michael Cohen
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Syntax::Highlight::Perl PPM problem in 5.10 repo ?

2010-04-25 Thread Michael Ellery
I need to generate some HTML for some perl code, so I thought I would 
try Syntax::Highlight::Perl.  I used ppm to install it, but I was not 
able to use the module (not found). Upon further investigation, I found 
that only a Syntax::Highlight::Perl6 package was installed. When I do a 
search, here is what I see:

C:\Documents and Settings\mikeeppm search syntax-highlight-perl

1: Syntax-Highlight-Perl
Perl 6 Syntax Highlighter
Version: 0.64
Released: 2009-06-25
Repo: ActiveState Package Repository

2: Syntax-Highlight-Perl-Improved
Highlighting of Perl Syntactical Structures
Version: 1.01
Released: 2004-05-04
Repo: ActiveState Package Repository

3: Syntax-Highlight-Perl6
Perl 6 Syntax Highlighter
Version: 0.80
Released: 2010-03-25
Repo: ActiveState Package Repository


..it's that first entry that seems to be causing me problems. Does 
anyone have advice about how to resolve this? Should I just install 
directly from CPAN?

Thanks,
Mike Ellery
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with slow startup

2010-01-19 Thread Michael Ellery
On 1/19/2010 4:17 PM, Jan Dubois wrote:
 On Mon, 18 Jan 2010, Michael Ellery wrote:

 Thanks for that patch. I've patched the file on my system and rebooted -
 now I see times shown below. Now my first startup time is only double my
 steady state time, which seems to be an improvement (previous run was
 more than 3 times the subsequent time). However, since the patch appears
 in a .pm file, shouldn't this change have an impact *every time* the
 script is executed, or is this code only loaded under certain conditions?

 I suspect that there is some OS level caching going on.  I think some of
 the type libraries installed on your machine are stored on a network drive
 and not on a local disk.

 I don't have time to work out right now if we need those file tests at all,
 but I have another idea that might speed up the code some more:  In front
 of the line that you modified with the patch insert the following line:

  local ${^WIN32_SLOPPY_STAT} = 1;

 Please let me know if this has any effect on your startup time.

 Cheers,
 -Jan



Jan,

thanks again for these mysterious patches. Yes, this had a positive 
effect - now with this patch plus the previous patch in place, my first 
vs. subsequent run times are 15s vs 10s. This is a considerable 
improvement over the 30s vs 10s that I was previously seeing.

Can you shed a little light on what this WIN32_SLOPPY_STAT does - I'm 
guessing it uses a faster set of APIs for gathering file stat info - 
perhaps at the cost of accuracy?

As for typelibrary location - all of my com objects and typelibs should 
be local (I build debug locally). The only thing I'm aware of that 
*could* be pulled from the network are the debug symbols from microsoft, 
which we store on a network share since they are rather large. This slow 
startup time is observed with release builds of our objects too (I have 
not yet tried your patches with a release build..), and those should 
have no network dependencies. Our com objects are all compiled code and 
the typelib info is built-in, so we don't ship separate typelib files (I 
don't know if that makes any difference here...)

Thanks again for your help.

-Mike
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Help with slow startup

2010-01-18 Thread Michael Ellery
I have a slow startup problem with a library I have written. The 
observed behavior is that perl scripts that use my library 
*intermittently* take 30 seconds to startup. If I run them again 
immediately thereafter, they drop back down to about 10 seconds to 
startup. If I wait for some time (several hours, perhaps, although I'm 
not sure what the trigger is), then the script will exhibit slow startup 
again for the first execution and behave normally thereafter. Rebooting 
also causes the problem to reappear.

I'm using Win32::OLE quite extensively to interact with several of our 
COM objects - and I even have some COM calls in one of by BEGIN blocks. 
All of this works fine, with the exception of this intermittent startup lag.

I have trouble reproducing the problem, so I even have trouble 
diagnosing it further (using process explorer, etc). Does anyone have 
any suggestion or advice for what might be going on and how to track it 
down?  I'm wondering if there is some caching of COM objects going on 
perhaps that could be going on?

I'm running on Windows XP 32 bit (perhaps that matters, I don't know).

I've tried running with -dprof and here's what it shows for the first 
and second runs:

FIRST RUN:
Total Elapsed Time = 37.44117 Seconds
   User+System Time = 2.947177 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
  70.8   2.087  2.079   1730   0.0012 0.0012  Win32::OLE::Dispatch
  9.03   0.266  0.421  2   0.1329 0.2103  Win32::OLE::Const::_Typelibs
  5.26   0.155  0.155744   0.0002 0.0002  Win32::OLE::Const::_Typelib
  3.19   0.094  0.714 39   0.0024 0.0183  STRIDE::Test::BEGIN
  1.56   0.046  0.759  4   0.0115 0.1899  main::BEGIN
  1.53   0.045  0.041796   0.0001 0.0001  Win32::OLE::DESTROY
  1.36   0.040  1.053   1729   0. 0.0006  Win32::OLE::AUTOLOAD
  1.09   0.032  0.032  2   0.0160 0.0160  Win32::OLE::new
  1.05   0.031  0.031  5   0.0062 0.0062  Devel::Symdump::_symdump
  1.05   0.031  0.031  4   0.0077 0.0077  Config::BEGIN
  1.05   0.031  0.045  8   0.0039 0.0057  Pod::POM::BEGIN
  0.54   0.016  0.016  1   0.0160 0.0160  Win32::OLE::Uninitialize
  0.54   0.016  0.016  1   0.0160 0.0160  Devel::Symdump::_partdump
  0.54   0.016  0.016  5   0.0032 0.0032  File::Basename::BEGIN
  0.54   0.016  0.016  6   0.0027 0.0027  Text::Wrap::BEGIN

SECOND RUN:
Total Elapsed Time = 10.91888 Seconds
   User+System Time = 2.918880 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
  75.3   2.200  2.238   1730   0.0013 0.0013  Win32::OLE::Dispatch
  10.1   0.295  0.419  2   0.1474 0.2094  Win32::OLE::Const::_Typelibs
  4.25   0.124  0.124744   0.0002 0.0002  Win32::OLE::Const::_Typelib
  2.19   0.064  0.590 39   0.0016 0.0151  STRIDE::Test::BEGIN
  1.61   0.047  0.047  5   0.0094 0.0094  Devel::Symdump::_symdump
  1.30   0.038  0.035   2536   0. 0.  Win32::OLE::Tie::FETCH
  0.55   0.016  0.016  1   0.0160 0.0159  ActivePerl::Config::override
  0.55   0.016  0.016  3   0.0053 0.0053  DynaLoader::BEGIN
  0.55   0.016  0.016  5   0.0032 0.0032  Pod::POM::View::HTML::BEGIN
  0.55   0.016  0.016  7   0.0023 0.0023  IO::Handle::BEGIN
  0.55   0.016  0.636  4   0.0040 0.1589  main::BEGIN
  0.55   0.016  0.015  8   0.0020 0.0019  Pod::POM::BEGIN
  0.55   0.016  0.027 30   0.0005 0.0009  STRIDE::Test::AddAnnotation
  0.55   0.016  0.016 42   0.0004 0.0004  Pod::POM::Node::new
  0.51   0.015  0.015414   0. 0.  Pod::POM::Node::AUTOLOAD


So, clearly it's showing the discrepancy in total time, but nothing 
stands out as far as the code that is profiled by dprof.

Any advice about other things I should try?

Thanks,
Mike Ellery
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with slow startup

2010-01-18 Thread Michael Ellery
On 1/18/2010 4:52 PM, Jan Dubois wrote:
 On Mon, 18 Jan 2010, Michael Ellery wrote:

 I have a slow startup problem with a library I have written. The
 observed behavior is that perl scripts that use my library
 *intermittently* take 30 seconds to startup. If I run them again
 immediately thereafter, they drop back down to about 10 seconds to
 startup. If I wait for some time (several hours, perhaps, although I'm
 not sure what the trigger is), then the script will exhibit slow startup
 again for the first execution and behave normally thereafter. Rebooting
 also causes the problem to reappear.

 Please try this patch to Win32::OLE::Const:

 http://code.google.com/p/libwin32/source/diff?spec=svn465r=465format=sidepath=/trunk/Win32-OLE/lib/Win32/OLE/Const.pm

 It specifically deals with some slowness in Win32::OLE::Const that
 _may_ be the problem you are seeing.

 I guess I should make a Win32::OLE CPAN release to get this change
 out to the rest of the world.  So please confirm if this solves
 your problem!

 Cheers,
 -Jan



Jan,

Thanks for that patch. I've patched the file on my system and rebooted - 
now I see times shown below. Now my first startup time is only double my 
steady state time, which seems to be an improvement (previous run was 
more than 3 times the subsequent time). However, since the patch appears 
in a .pm file, shouldn't this change have an impact *every time* the 
script is executed, or is this code only loaded under certain conditions?

Thanks,
Mike


C:\s2dprofpp tmon_FIRST.out
Total Elapsed Time = 20.19217 Seconds
   User+System Time = 2.898179 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
  75.2   2.181  2.173   1730   0.0013 0.0013  Win32::OLE::Dispatch
  8.11   0.235  0.326  2   0.1174 0.1628  Win32::OLE::Const::_Typelibs
  3.14   0.091  0.091744   0.0001 0.0001  Win32::OLE::Const::_Typelib
  2.69   0.078  0.450 23   0.0034 0.0196  STRIDE::BEGIN
  1.55   0.045  0.041796   0.0001 0.0001  Win32::OLE::DESTROY
  1.38   0.040  1.133   1729   0. 0.0007  Win32::OLE::AUTOLOAD
  1.10   0.032  0.032  2   0.0160 0.0160  Win32::OLE::new
  1.07   0.031  0.031  5   0.0062 0.0062  Devel::Symdump::_symdump
  1.07   0.031  0.541 39   0.0008 0.0139  STRIDE::Test::BEGIN
  0.55   0.016  0.016  1   0.0160 0.0160  Win32::OLE::bootstrap
  0.55   0.016  0.031  2   0.0080 0.0153  Pod::POM::parse_file
  0.55   0.016  0.016  8   0.0020 0.0020  DynaLoader::dl_load_file
  0.55   0.016  0.016  4   0.0040 0.0040  Config::BEGIN
  0.55   0.016  0.016 15   0.0011 0.0011  STRIDE::Test::MethodInfo::new
  0.55   0.016  0.016  5   0.0032 0.0032  Pod::POM::View::HTML::BEGIN

C:\s2dprofpp tmon_SECOND.out
Total Elapsed Time = 10.09317 Seconds
   User+System Time = 2.742174 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
  74.9   2.056  2.064   1730   0.0012 0.0012  Win32::OLE::Dispatch
  9.63   0.264  0.342  2   0.1319 0.1708  Win32::OLE::Const::_Typelibs
  2.84   0.078  0.078744   0.0001 0.0001  Win32::OLE::Const::_Typelib
  1.71   0.047  0.047  5   0.0094 0.0094  Devel::Symdump::_symdump
  1.68   0.046  0.419 23   0.0020 0.0182  STRIDE::BEGIN
  1.42   0.039  1.039   1729   0. 0.0006  Win32::OLE::AUTOLOAD
  1.17   0.032  0.527 39   0.0008 0.0135  STRIDE::Test::BEGIN
  1.13   0.031  0.031269   0.0001 0.0001  Win32::OLE::Tie::Store
  0.58   0.016  0.016  2   0.0080 0.0080  Win32::OLE::new
  0.58   0.016  0.016  1   0.0160 0.0159  ActivePerl::Config::override
  0.58   0.016  0.031  5   0.0032 0.0061  Storable::BEGIN
  0.58   0.016  0.032  5   0.0032 0.0064  Win32::OLE::BEGIN
  0.58   0.016  0.557  4   0.0040 0.1394  main::BEGIN
  0.58   0.016  0.016 14   0.0011 0.0011 
STRIDE::Function::_perlFromPayload
  0.58   0.016  0.016 20   0.0008 0.0008  STRIDE::TestPoint::BEGIN

C:\s2dprofpp tmon_THIRD.out
Total Elapsed Time = 10.09317 Seconds
   User+System Time = 2.775174 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
  77.0   2.137  2.129   1730   0.0012 0.0012  Win32::OLE::Dispatch
  8.94   0.248  0.326  2   0.1239 0.1628  Win32::OLE::Const::_Typelibs
  2.81   0.078  0.078744   0.0001 0.0001  Win32::OLE::Const::_Typelib
  1.73   0.048  0.403 23   0.0021 0.0175  STRIDE::BEGIN
  1.69   0.047  0.047  5   0.0094 0.0094  Devel::Symdump::_symdump
  1.69   0.047  0.511 39   0.0012 0.0131  STRIDE::Test::BEGIN
  1.12   0.031  0.031  2   0.0155 0.0155  Win32::OLE::new
  1.01   0.028  0.963  3   0.0094 0.3209  STRIDE::TestPoint::Wait
  0.58   0.016  0.016  3   0.0053 0.0053  B::BEGIN
  0.58   0.016  0.016  5   0.0032 0.0032  base::BEGIN
  0.58   0.016  0.016  4   0.0040 0.0040  Pod::POM::Nodes::BEGIN
  0.58   0.016  0.031  5   0.0032 0.0061  Storable::BEGIN
  0.58   0.016  0.016 48   0.0003 0.0003  Pod::POM::Node::Sequence::new
  0.58   0.016  0.031 10   0.0016 0.0031 
STRIDE::Function

Re: WIN32::OLE WMI Out params

2009-12-05 Thread Michael
On Fri, 04 Dec 2009 17:10:26 -0800, Michael Ellery
mi...@s2technologies.com wrote:
 Michael wrote:
 Okay - Just to sum up the whole thing.
 
 The original VBScript EOF;
 
 Option Explicit
 
 Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups,
arrNodes,
 objItem
 
 Set objWMIService =
 GetObject(winmgmts:root\HewlettPackard\OpenView\data)
 
 Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup)
 Set objGetRoot = objOV_NodeGroup.GetRoot()
 objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)
 
 WScript.Echo Child Group Count:   objChildGroups  vbCrLF
 
 For Each objItem In arrNodes
   WScript.Echo Name:   objItem.Name
 Next
 EOF
 
 Returns the following:
 
 Child Group Count: 25
 
 Name: {36716FD8-E600-46FB-90CA-1263E0C62509}
 Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25}
 Name: {3E575181-0225-4553-9722-46F841B9FA76}
 Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4}
 Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281}
 Name: OpenView_AIX
 Name: OpenView_External
 Name: OpenView_HPUX
 Name: OpenView_Linux
 Name: OpenView_NNM
 Name: OpenView_OpenVMS
 Name: OpenView_OpenVMS(itanium)
 Name: OpenView_SNMP
 Name: OpenView_Solaris
 Name: OpenView_Tru64
 Name: OpenView_Unknown
 Name: OpenView_Windows2000
 Name: OpenView_WindowsNT
 Name: OpenView_WindowsServer2003
 Name: OpenView_WindowsServer2008
 Name: OpenView_WindowsVista
 Name: OpenView_WindowsXP
 Name: Root_Special
 Name: Root_Unix
 Name: Root_Windows
 
 And the Perl-Script with the modification EOF;
 #!perl
 use strict;
 use warnings;
 use Win32::OLE qw(in with);
 use Win32::OLE::Variant;
 use Data::Dumper;
 
 my $objWMIService =
 Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or
 die
 WMI connection failed.\n;
 if (Win32::OLE- LastError() != 0) {
  print Error calling GetObject:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup);
 if (Win32::OLE- LastError() != 0) {
  print Error calling Get:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $objGetRoot = $objOV_NodeGroup-GetRoot();
 if (Win32::OLE- LastError() != 0) {
  print Error calling GetRoot:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 
 my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True);
 if (Win32::OLE- LastError() != 0) {
  print Error calling GetChildNodeGroups:  . Win32::OLE-LastError() .
 \n;
 exit 0;
 }
 print Child Group Count:  . $objChildGroups . \n;
 
 print Dumper($nodes);
 
 
 foreach my $objItem (in $nodes) {
 print 'Name: ' . $objItem-{Name} . \n;
 }
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns
 ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105:
 The server threw an exception
 ##in METHOD/PROPERTYGET GetChildNodeGroups
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 Does any of this, make any sense to you guys?
 
 /Michael
 
 
 
 so, it looks like your Dumper statement is indicating a valid object

Re: WIN32::OLE WMI Out params

2009-12-05 Thread Michael
On Sat, 05 Dec 2009 05:58:48 -0800, Michael Ellery
mi...@s2technologies.com wrote:
 Michael wrote:
 On Fri, 04 Dec 2009 17:10:26 -0800, Michael Ellery
 mi...@s2technologies.com wrote:
 Michael wrote:
 Okay - Just to sum up the whole thing.

 The original VBScript EOF;

 Option Explicit

 Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups,
 arrNodes,
 objItem

 Set objWMIService =
 GetObject(winmgmts:root\HewlettPackard\OpenView\data)

 Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup)
 Set objGetRoot = objOV_NodeGroup.GetRoot()
 objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)

 WScript.Echo Child Group Count:   objChildGroups  vbCrLF

 For Each objItem In arrNodes
   WScript.Echo Name:   objItem.Name
 Next
 EOF

 Returns the following:

 Child Group Count: 25

 Name: {36716FD8-E600-46FB-90CA-1263E0C62509}
 Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25}
 Name: {3E575181-0225-4553-9722-46F841B9FA76}
 Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4}
 Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281}
 Name: OpenView_AIX
 Name: OpenView_External
 Name: OpenView_HPUX
 Name: OpenView_Linux
 Name: OpenView_NNM
 Name: OpenView_OpenVMS
 Name: OpenView_OpenVMS(itanium)
 Name: OpenView_SNMP
 Name: OpenView_Solaris
 Name: OpenView_Tru64
 Name: OpenView_Unknown
 Name: OpenView_Windows2000
 Name: OpenView_WindowsNT
 Name: OpenView_WindowsServer2003
 Name: OpenView_WindowsServer2008
 Name: OpenView_WindowsVista
 Name: OpenView_WindowsXP
 Name: Root_Special
 Name: Root_Unix
 Name: Root_Windows

 And the Perl-Script with the modification EOF;
 #!perl
 use strict;
 use warnings;
 use Win32::OLE qw(in with);
 use Win32::OLE::Variant;
 use Data::Dumper;

 my $objWMIService =
 Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or
 die
 WMI connection failed.\n;
 if (Win32::OLE- LastError() != 0) {
print Error calling GetObject:  . Win32::OLE-LastError() . \n;
 exit 0;
 }

 my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup);
 if (Win32::OLE- LastError() != 0) {
print Error calling Get:  . Win32::OLE-LastError() . \n;
 exit 0;
 }

 my $objGetRoot = $objOV_NodeGroup-GetRoot();
 if (Win32::OLE- LastError() != 0) {
print Error calling GetRoot:  . Win32::OLE-LastError() . \n;
 exit 0;
 }

 my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF,
0);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF,
0);

 my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True);
 if (Win32::OLE- LastError() != 0) {
print Error calling GetChildNodeGroups:  . Win32::OLE-LastError()
.
 \n;
 exit 0;
 }
 print Child Group Count:  . $objChildGroups . \n;

 print Dumper($nodes);


 foreach my $objItem (in $nodes) {
 print 'Name: ' . $objItem-{Name} . \n;
 }

 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns
 ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error
 0x80010105:
 The server threw an exception
 ##in METHOD/PROPERTYGET GetChildNodeGroups

 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF,
0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF,
0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.

 Does any of this, make any sense to you guys?

 /Michael


 so, it looks

RE: WIN32::OLE WMI Out params

2009-12-04 Thread Michael
Hi Steven,

Well I tried your suggestion and I think that the Win32::OLE::Variant
module might be the solution, as I have found some other examples where WMI
[out] and variants are used.

http://www.infoqu.com/dev/perl-programming/using-perl-with-wmi-to-set-folder-level-permissions-16930-1/
http://www.perlmonks.org/?node_id=325823

However I'm in way over my head here, so unless someone could cut it out in
pieces , I don't think that 
I'll get any further.

/Michael


On Fri, 4 Dec 2009 02:12:03 -0700, Steven Manross ste...@manross.net
wrote:
 Below...
 
 -Original Message-
 From: perl-win32-users-boun...@listserv.activestate.com 
 [mailto:perl-win32-users-boun...@listserv.activestate.com] On 
 Behalf Of Michael
 Sent: Thursday, December 03, 2009 6:45 AM
 To: perl-win32-users@listserv.ActiveState.com
 Subject: RE: WIN32::OLE WMI Out params
 
  When troubleshooting OLE issues, it is best to have the 
 following code 
  after each OLE command...
  
  If (Win32::OLE- LastError() != 0) {
print error calling blah:  . Win32::OLE- LastError() . \n;
exit 0;
  }
  
  ...Or something similar, so you can see what OLE had issues 
 with (if 
  anything).  It might lead you in a direction that fixes it.
  
  Steven
 
 Added to the script, but no issues reported.
 
 /Michael
 
 Well, then my next guess is the use of the Variant module (because no
 error is thrown from OLE).
 
 Some OLE calls require to be cast of a certain type before they work.
 
 use Win32::OLE::Variant;
 
 my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); 
 
 #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of
 VT_ARRAY|VT_VARIANT
 
 #then
 my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); 
 
 Play around with this...  I'm not the greatest Variant script writer
 here, to know exactly which combination will work (if this is it) based
 on the object type as I've only run into this a few times before, but
 you can get examples from your perl install here (depending on your perl
 build version) of similar options to try and all the VT_* types:
 
 C:\Perl\html\lib\Win32\OLE\Variant.html
 
 HTH
 
 P.S. I googled OV_NodeGroup and found someone else with your same
 problem on an HP board (or so it seems).  :(
 
 Steven
 
 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: WIN32::OLE WMI Out params

2009-12-04 Thread Michael Ellery
I haven't followed your thread closely, but it seems like the relevant
bits from your first link are these:

my $objSecDescriptor = Win32::OLE::Variant- new (VT_DISPATCH|VT_BYREF);
my $retval =
$objDirectorySecSetting-GetSecurityDescriptor($objSecDescriptor);

..which seems to be filling the $objSecDescriptor with an out param.

If your out param is an array, you might need to add VT_ARRAY to the
variant flags when you create it. Does something like that work for you ?

-Mike

Michael wrote:
 Hi Steven,
 
 Well I tried your suggestion and I think that the Win32::OLE::Variant
 module might be the solution, as I have found some other examples where WMI
 [out] and variants are used.
 
 http://www.infoqu.com/dev/perl-programming/using-perl-with-wmi-to-set-folder-level-permissions-16930-1/
 http://www.perlmonks.org/?node_id=325823
 
 However I'm in way over my head here, so unless someone could cut it out in
 pieces , I don't think that 
 I'll get any further.
 
 /Michael
 
 
 On Fri, 4 Dec 2009 02:12:03 -0700, Steven Manross ste...@manross.net
 wrote:
 Below...

 -Original Message-
 From: perl-win32-users-boun...@listserv.activestate.com 
 [mailto:perl-win32-users-boun...@listserv.activestate.com] On 
 Behalf Of Michael
 Sent: Thursday, December 03, 2009 6:45 AM
 To: perl-win32-users@listserv.ActiveState.com
 Subject: RE: WIN32::OLE WMI Out params

 When troubleshooting OLE issues, it is best to have the 
 following code 
 after each OLE command...

 If (Win32::OLE- LastError() != 0) {
   print error calling blah:  . Win32::OLE- LastError() . \n;
   exit 0;
 }

 ...Or something similar, so you can see what OLE had issues 
 with (if 
 anything).  It might lead you in a direction that fixes it.

 Steven
 Added to the script, but no issues reported.

 /Michael
 Well, then my next guess is the use of the Variant module (because no
 error is thrown from OLE).

 Some OLE calls require to be cast of a certain type before they work.

 use Win32::OLE::Variant;

 my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); 

 #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of
 VT_ARRAY|VT_VARIANT

 #then
 my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); 

 Play around with this...  I'm not the greatest Variant script writer
 here, to know exactly which combination will work (if this is it) based
 on the object type as I've only run into this a few times before, but
 you can get examples from your perl install here (depending on your perl
 build version) of similar options to try and all the VT_* types:

 C:\Perl\html\lib\Win32\OLE\Variant.html

 HTH

 P.S. I googled OV_NodeGroup and found someone else with your same
 problem on an HP board (or so it seems).  :(

 Steven

 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WIN32::OLE WMI Out params

2009-12-04 Thread Michael
Okay - Just to sum up the whole thing.

The original VBScript EOF;

Option Explicit

Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes,
objItem

Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data)

Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup)
Set objGetRoot = objOV_NodeGroup.GetRoot()
objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)

WScript.Echo Child Group Count:   objChildGroups  vbCrLF

For Each objItem In arrNodes
  WScript.Echo Name:   objItem.Name
Next
EOF

Returns the following:

Child Group Count: 25

Name: {36716FD8-E600-46FB-90CA-1263E0C62509}
Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25}
Name: {3E575181-0225-4553-9722-46F841B9FA76}
Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4}
Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281}
Name: OpenView_AIX
Name: OpenView_External
Name: OpenView_HPUX
Name: OpenView_Linux
Name: OpenView_NNM
Name: OpenView_OpenVMS
Name: OpenView_OpenVMS(itanium)
Name: OpenView_SNMP
Name: OpenView_Solaris
Name: OpenView_Tru64
Name: OpenView_Unknown
Name: OpenView_Windows2000
Name: OpenView_WindowsNT
Name: OpenView_WindowsServer2003
Name: OpenView_WindowsServer2008
Name: OpenView_WindowsVista
Name: OpenView_WindowsXP
Name: Root_Special
Name: Root_Unix
Name: Root_Windows

And the Perl-Script with the modification EOF;
#!perl
use strict;
use warnings;
use Win32::OLE qw(in with);
use Win32::OLE::Variant;
use Data::Dumper;

my $objWMIService =
Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die
WMI connection failed.\n;
if (Win32::OLE- LastError() != 0) {
print Error calling GetObject:  . Win32::OLE-LastError() . \n;
exit 0;
}

my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup);
if (Win32::OLE- LastError() != 0) {
print Error calling Get:  . Win32::OLE-LastError() . \n;
exit 0;
}

my $objGetRoot = $objOV_NodeGroup-GetRoot();
if (Win32::OLE- LastError() != 0) {
print Error calling GetRoot:  . Win32::OLE-LastError() . \n;
exit 0;
}

my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0);
#my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0);
#my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF);
#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
#my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);

my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True);
if (Win32::OLE- LastError() != 0) {
print Error calling GetChildNodeGroups:  . Win32::OLE-LastError() .
\n;
exit 0;
}
print Child Group Count:  . $objChildGroups . \n;

print Dumper($nodes);


foreach my $objItem (in $nodes) {
print 'Name: ' . $objItem-{Name} . \n;
}

#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns
##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105:
The server threw an exception
##in METHOD/PROPERTYGET GetChildNodeGroups

#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

#my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
Returns
##Child Group Count: 25
##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' );
##Not a HASH reference at GetChildNodeGroups.pl line 46.

Does any of this, make any sense to you guys?

/Michael



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: WIN32::OLE WMI Out params

2009-12-04 Thread Michael Ellery
Michael wrote:
 Okay - Just to sum up the whole thing.
 
 The original VBScript EOF;
 
 Option Explicit
 
 Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes,
 objItem
 
 Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data)
 
 Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup)
 Set objGetRoot = objOV_NodeGroup.GetRoot()
 objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)
 
 WScript.Echo Child Group Count:   objChildGroups  vbCrLF
 
 For Each objItem In arrNodes
   WScript.Echo Name:   objItem.Name
 Next
 EOF
 
 Returns the following:
 
 Child Group Count: 25
 
 Name: {36716FD8-E600-46FB-90CA-1263E0C62509}
 Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25}
 Name: {3E575181-0225-4553-9722-46F841B9FA76}
 Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4}
 Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281}
 Name: OpenView_AIX
 Name: OpenView_External
 Name: OpenView_HPUX
 Name: OpenView_Linux
 Name: OpenView_NNM
 Name: OpenView_OpenVMS
 Name: OpenView_OpenVMS(itanium)
 Name: OpenView_SNMP
 Name: OpenView_Solaris
 Name: OpenView_Tru64
 Name: OpenView_Unknown
 Name: OpenView_Windows2000
 Name: OpenView_WindowsNT
 Name: OpenView_WindowsServer2003
 Name: OpenView_WindowsServer2008
 Name: OpenView_WindowsVista
 Name: OpenView_WindowsXP
 Name: Root_Special
 Name: Root_Unix
 Name: Root_Windows
 
 And the Perl-Script with the modification EOF;
 #!perl
 use strict;
 use warnings;
 use Win32::OLE qw(in with);
 use Win32::OLE::Variant;
 use Data::Dumper;
 
 my $objWMIService =
 Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die
 WMI connection failed.\n;
 if (Win32::OLE- LastError() != 0) {
   print Error calling GetObject:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup);
 if (Win32::OLE- LastError() != 0) {
   print Error calling Get:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $objGetRoot = $objOV_NodeGroup-GetRoot();
 if (Win32::OLE- LastError() != 0) {
   print Error calling GetRoot:  . Win32::OLE-LastError() . \n;
 exit 0;
 }
 
 my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF);
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 
 my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True);
 if (Win32::OLE- LastError() != 0) {
   print Error calling GetChildNodeGroups:  . Win32::OLE-LastError() .
 \n;
 exit 0;
 }
 print Child Group Count:  . $objChildGroups . \n;
 
 print Dumper($nodes);
 
 
 foreach my $objItem (in $nodes) {
 print 'Name: ' . $objItem-{Name} . \n;
 }
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns
 ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105:
 The server threw an exception
 ##in METHOD/PROPERTYGET GetChildNodeGroups
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0);
 Returns
 ##Child Group Count: 25
 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' );
 ##Not a HASH reference at GetChildNodeGroups.pl line 46.
 
 Does any of this, make any sense to you guys?
 
 /Michael
 


so, it looks like your Dumper statement is indicating a valid object in
most cases. I think the problem on your loop is that you are using the
'in' adapter

WIN32::OLE WMI Out params

2009-12-03 Thread Michael
Hi,

I'm a novice regarding Perl, and need some help converting a VBScript to a
PerlScript.

The following VBScript returns some data from HP OpenView. The
GetChildNodeGroups method returns the number of ChildGroups, 

and the [out] parameter NodeGroups returns an array which contains a list
of OV_NodeGroup.

From the documentation:

sint32 GetChildNodeGroups( 
[out] OV_NodeGroup NodeGroups[], 
[in, optional] boolean IncludeSubGroups) 

Description
Returns a list of node groups (instances of OV_NodeGroup) that are children
of this node group.

Return Value
Number of node groups (children) in the out parameter NodeGroups.

' VBScript Begin

Option Explicit

Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes,
objItem

Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data)

Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup)
Set objGetRoot = objOV_NodeGroup.GetRoot()
objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)

WScript.Echo Child Group Count:   objChildGroups  vbCrLF

For Each objItem In arrNodes
  WScript.Echo Name:   objItem.Name
Next

' VBScript End

The problem is that I can't find out how to get the array (@arrNodes) in
Perl.

# PerlScript Begin
use strict;
use warnings;
use Win32::OLE qw(in with);
use Data::Dumper;

my $objWMIService =
Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die
WMI connection failed.\n;
my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup);
my $objGetRoot = $objOV_NodeGroup-GetRoot();

my @arrNodes;

my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes, True);

print Child Group Count:  . $objChildGroups . \n;

print @arrNodes . \n;

# PerlScript End

Any help would be appreciated.

/Michael
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WIN32::OLE WMI Out params

2009-12-03 Thread Michael
 Michael   wrote:
  Hi,
  
  I'm a novice regarding Perl, and need some help converting a VBScript
  to a PerlScript. 
  
  The following VBScript returns some data from HP OpenView. The
  GetChildNodeGroups method returns the number of ChildGroups, 
  
  and the [out] parameter NodeGroups returns an array which contains a
  list of OV_NodeGroup. 
  
  From the documentation:
  
  sint32 GetChildNodeGroups(
  [out] OV_NodeGroup NodeGroups[],
  [in, optional] boolean IncludeSubGroups)
  
  Description
  Returns a list of node groups (instances of OV_NodeGroup) that are
  children of this node group. 
  
  Return Value
  Number of node groups (children) in the out parameter NodeGroups.
  
  ' VBScript Begin
  
  Option Explicit
  
  Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups,
  arrNodes, objItem 
  
  Set objWMIService =
  GetObject(winmgmts:root\HewlettPackard\OpenView\data) 
  
  Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set
  objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups =
  objGetRoot.GetChildNodeGroups(arrNodes, True)  
  
  WScript.Echo Child Group Count:   objChildGroups  vbCrLF
  
  For Each objItem In arrNodes
WScript.Echo Name:   objItem.Name
  Next
  
  ' VBScript End
  
  The problem is that I can't find out how to get the array (@arrNodes)
  in Perl. 
  
  # PerlScript Begin
  use strict;
  use warnings;
  use Win32::OLE qw(in with);
  use Data::Dumper;
  
  my $objWMIService =
  Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data)
  or die WMI connection failed.\n; my $objOV_NodeGroup =
  $objWMIService-Get(OV_NodeGroup); my $objGetRoot =
  $objOV_NodeGroup-GetRoot();  
  
  my @arrNodes;
  
  my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes,
  True); 
 
 And you were doing so well up to this point. I really don't think that
 you want to pass an empty array, interpolated into a string, as an
 output parameter. In fact, I would expect that it might even produce a
 run-time error. Does it?

Nope it does not. The problem is still that @arrNodes is empty. The
GetChildNodeGroups method does not populate the variable/array like it does
in VBScript. Therefore I've been around @arrNodes, \...@arrnodes, $nodes
etc...

 
 I don't know the answer, but from my limited Perl/OLE experience, my
 first guess would be that the function would want to return an OLE
 container object in the output parameter, and so would expect it to be a
 reference to a scalar. For example:
 
 my $nodes;
 use constant TRUE =  1;
 my $objChildGroups = $objGetRoot- GetChildNodeGroups(\$nodes, TRUE);
 
  
  print Child Group Count:  . $objChildGroups . \n;
  
  print @arrNodes . \n;
 
 If I am right, and I may well not be, this would probably need to be
 something like:
 
 for my $obj (in $nodes) {
 print Name: $obj- {Name}\n;
 }
 

Yep - but because $nodes/@arrNodes is empty this does not change much.

  
  # PerlScript End
  
  Any help would be appreciated.
 
 HTH, in lieu of somebody coming up with a more certain answer.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WIN32::OLE WMI Out params

2009-12-03 Thread Michael
 When troubleshooting OLE issues, it is best to have the following code
 after each OLE command...
 
 If (Win32::OLE- LastError() != 0) {
   print error calling blah:  . Win32::OLE- LastError() . \n;
   exit 0;
 } 
 
 ...Or something similar, so you can see what OLE had issues with (if
 anything).  It might lead you in a direction that fixes it.
 
 Steven

Added to the script, but no issues reported.

/Michael
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Can I 'yield' to the system?

2009-12-03 Thread Michael Ellery
Barry Brevik wrote:
 Re: Active Perl 5.8.8 running on Windows.
 
 Back when I was doing some Assembly language programming, there was a
 system call to yield to the Windows operating system, in other words,
 give up the rest of your time slice.
 
 Is there a way to do this with Perl? I'm writing an app that
 continuously loops waiting for something to do, and it would be good to
 give control back to the OS when idle. There is Win32::GUI::DoEvents(),
 but I am unsure if this really does the same thing.
 

how about sleep ... or usleep (provided by Time::HiRes) ?

-Mike
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Determining Vista Editions

2009-08-19 Thread Michael Cohen
To whomever knows the answer:

I have been using the Win32::GetOSVersion() function for many years in 
order to pull the Windows OS level.  However, I now have a new need to 
determine whether or not the OS is Windows Vista Home Basic (or for that 
matter, other various editions).  I do not see how to pull that 
information from GetOSVersion().  From what I can find on the web, I 
somehow need to use the GetProductInfo call from the kernel32 DLL.

I have tried the following code to try to pull the information from my 
Vista 32 Ultimate, but cannot seem to get a valid response:

 Cut here 
#!/usr/bin/perl -w

use Win32;
use Win32::API;
use strict;

my @oslevel = Win32::GetOSVersion();

my ($osMaj, $osMin, $spMaj, $spMin);

printf(OS String:   %s\n, $oslevel[0]);
printf(OS ID:   %s\n, $oslevel[4]);
printf(OS Major:%d\n, $osMaj = int($oslevel[1]));
printf(OS Minor:%d\n, $osMin = int($oslevel[2]));
printf(OS Build:%s\n, $oslevel[3]);
printf(OS SP Major: %d\n, $spMaj = int($oslevel[5]));
printf(OS SP Minor: %d\n, $spMin = int($oslevel[6]));
printf(OS SuiteMask:0x%08x\n, $oslevel[7]);
printf(OS ProductType:  %s\n, $oslevel[8]);

my $prodInfo = 0x;   # initialize with invalid value
my $prodInfoPtr = \$prodInfo;

if (($oslevel[1] == 6)  ($oslevel[2] == 0)) {
  my $GetProductInfo = new Win32::API(kernel32, GetProductInfo,
  P, I);
  my $rc = $GetProductInfo-Call($osMaj, $osMin, 
 $spMaj, $spMin, $prodInfoPtr);

  printf(\nRC = %d\n, $rc);
  printf(Product Info:0x%x\n, $prodInfo);
  printf(Product Info:0x%x\n, $$prodInfoPtr);
}

 Cut here 


The information about this call is from this link:
http://msdn.microsoft.com/en-us/library/ms724358(VS.85).aspx

Since the response from the GetProductInfo() command is put into the DW 
pointer, I have initialized the variable to 0x to ensure it is a 
double; however, the variable does not appear to be updated via the 
GetProductInfo() command (it remains 0x) and the $rc is set to 1. 
FWIW, I have also tried to pass the variable directly (i.e., not the ptr).

What am I doing wrong?  Is there a better way to get this information 
instead of using the GetProductInfo() command from the kernel32 DLL?

Any help would greatly be appreciated.

Regards,
Michael Cohen___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl-Win32-Users Digest, Vol 33, Issue 6

2009-04-19 Thread Michael Zeng
please read some documents related to  perl in Win32

use Win32 ;

On 4/20/09, perl-win32-users-requ...@listserv.activestate.com 
perl-win32-users-requ...@listserv.activestate.com wrote:

 Send Perl-Win32-Users mailing list submissions to
 perl-win32-users@listserv.ActiveState.com

 To subscribe or unsubscribe via the World Wide Web, visit
 http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
 or, via email, send a message with subject or body 'help' to
 perl-win32-users-requ...@listserv.activestate.com

 You can reach the person managing the list at
 perl-win32-users-ow...@listserv.activestate.com

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Perl-Win32-Users digest...


 Today's Topics:

1. perl to dll? (Daniel Burgaud)


 --

 Message: 1
 Date: Sun, 19 Apr 2009 21:49:37 +0800
 From: Daniel Burgaud burg...@gmail.com
 Subject: perl to dll?
 To: Perl-Win32-Users perl-win32-users@listserv.activestate.com
 Message-ID:
 a3055fd90904190649l7fa2746aub17a5daf77853...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 Hi All,

 I know there is a perl to exe, but what about a perl to dll?

 Dan
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 http://listserv.ActiveState.com/pipermail/perl-win32-users/attachments/20090419/6980567f/attachment-0001.html

 --

 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


 End of Perl-Win32-Users Digest, Vol 33, Issue 6
 ***




-- 
Yours Sincerely
Zeng Hong
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl-Win32-Users Digest, Vol 33, Issue 4

2009-04-16 Thread Michael Zeng
i think you can chomp the 'return'

chomp ( my $result = STDIN )  , which is a common practice

or you can use Term::ReadKey /  Term::ReadLine  to control the read the
keyboard input more well





On 4/17/09, perl-win32-users-requ...@listserv.activestate.com 
perl-win32-users-requ...@listserv.activestate.com wrote:

 Send Perl-Win32-Users mailing list submissions to
 perl-win32-users@listserv.ActiveState.com

 To subscribe or unsubscribe via the World Wide Web, visit
 http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
 or, via email, send a message with subject or body 'help' to
 perl-win32-users-requ...@listserv.activestate.com

 You can reach the person managing the list at
 perl-win32-users-ow...@listserv.activestate.com

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Perl-Win32-Users digest...


 Today's Topics:

1. active perl 5.8.8 build 820 inconsistent behavior with $input
   = STDIN;  (Greg Aiken)
2. RE: active perl 5.8.8 build 820 inconsistent behavior with
   $input=STDIN;  (Brian Raven)


 --

 Message: 1
 Date: Thu, 16 Apr 2009 08:25:19 -0700
 From: Greg Aiken gai...@visioninfosoft.com
 Subject: active perl 5.8.8 build 820 inconsistent behavior with $input
 =   STDIN;
 To: perl-win32-users@listserv.activestate.com
 Message-ID:
 mdaemon-f200904160825.aa2550973md5049...@visioninfosoft.com
 Content-Type: text/plain; charset=us-ascii

 I seem to be experiencing inconsistency when I invoke;



 $user_input = STDIN;



 in some programs the behavior is as expected.  at that point in the program
 I type in some input from keyboard then the moment I press the 'enter' key,
 the program flow returns back to the executing Perl program.



 other times, I get a rather unusual response.



 I type in user input from the keyboard and when I press the 'enter' key,
 instead of having program flow return back to the program, the enter key is
 instead OUTPUT TO THE DOS CONSOLE SCREEN and the cursor drops down one line
 on the console screen!  when this happens, the program flow does NOT return
 back to the program and my program just hangs there.



 any explanation for this?



 more importantly, whats the fix?









 today it just happened again.  the relevant block of code is here.



 sub main_loop {



 while (1) {



 system(cls);



 print Test tcp/ip client/server request/response from
 server x using port 80\n\n

 Press:



'H' to test HTTP request/reponse

'X' to test XML  request/reponse

'Q' to Quit



 Test which application protocol:\n;



 my $ui = STDIN;



 if  ($ui =~ /x/i) {

 my $request = assign_xml_request_from_xml_file;

 attempt_request_response($request);

 } elsif ($ui =~ /h/i) {

 my $request = assign_http_request_from_http_file;

 attempt_request_response($request);

 } elsif ($ui =~ /q/i){

 print \nProgram Terminated\n;

 close $main::socket;

 exit;

 } else {

 next;   #loop

 }



 }



 }





 the full program is here:





 use IO::Socket;

 use Strict;

 use Warnings;



 our $socket;



 open_tcp_socket;

 main_loop;







 ### sub routines
 ###



 sub open_tcp_socket {



 $main::socket = new IO::Socket::INET ( Proto  = tcp,

 PeerAddr =
 siteundertest.com,

 PeerPort = 80,

) or die Error: Cannot create tcp/ip socket
 ($!)\n;

 $main::socket-autoflush(1);

 }





 sub main_loop {

 not duplicated in email - this is found above

 }





 sub assign_xml_request_from_xml_file {

 open (IN, xml.request);

 undef $/;

 my $xml_request = IN;

 return $xml_request;

 }





 sub assign_http_request_from_http_file {

 open (IN, http.request);

 undef $/;

 my $http_request = IN;

 return $http_request;

 }





 sub attempt_request_response {

 my $response;

 $main::socket-send($_[0]);

 $main::socket-recv($response, 8192);

 system(cls);

 print Response =\n\n$response;

 sleep(10);

 }



 -- next part --
 An HTML attachment was scrubbed...
 URL:
 http://listserv.ActiveState.com/pipermail/perl-win32-users/attachments/20090416/56e65340/attachment-0001.html

 --

 Message: 2
 Date: 

Win32::Process Help Needed - Main Process Exits While Children Run

2009-03-11 Thread Michael Cohen
I have a piece of code that has been running for a number of years, until 
now.  My vendor changed the way they created a program, and that new 
program exits before its children's processes are finished.  In the past, 
the following snippette has worked fine for me:

my $progFullPath = c:\\temp\\foobar.exe;# Not the real program
my $commandLine = foobar opt1 opt2; # Again, just an example
my $ProcessObj; 
Win32::Process::Create($ProcessObj,
$progFullPath,
$commandLine,
0,
NORMAL_PRIORITY_CLASS,
.)|| die print Win32::FormatMessage( Win32::GetLastError() );
while (!($done)) {
  $done = 1 if ($ProcessObj-Wait(100)); 
  $main-update;  # TK update 
}


As noted above, the Wait(100) would work fine if the parent program does 
not exit prematurely.  However, now that that is no longer true:
a)  How do I determine all of the children processes on Windows 
(specifically XP at this point)?
b)  How do I wait until all children processes are finished?

I have been searching the web for various options for several hours, and 
just cannot come up with one at this point.  If anyone has any 
suggestions, pointers, solutions, etc., I would be most appreciative of 
your help.

Regards,
Michael Cohen___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Net::XMPP

2009-01-22 Thread Michael Ellery

Just curious if anyone out there has experience getting Net::XMPP to
work with perl 5.8.x on windows?  I did manage to get it installed (via
ppm), but I'm encountering some runtime errors that make me think more
packages are required (it seems to be complaining about
Authen::SASL::Cyrus at the moment, which I can't find in any repos). Any
advice appreciated.

-Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::OLE and script components with perl 5.10

2009-01-05 Thread Michael Ellery
I've recently upgraded to activeperl 5.10 (looks like it's build 1004)
and I've just noticed that I can no longer instantiate my script
components (which are written in PerlScript).  Specifically, the perl
interpreter process crashes.

So, wanting to eliminate my WSCs, I went back to basics and took the
canonical example in the docs
(http://docs.activestate.com/activeperl/5.10/Windows/WindowsScriptComponents.html):

?xml version=1.0?
component

registration
description=Easy
progid=Easy.WSC
version=1.00
classid={74bb1ba9-2e69-4ad6-b02c-c52f3cbe153b}
/registration

public
method name=SayHello
/method
/public

script language=PerlScript
![CDATA[
sub SayHello {
my($param) = shift @_;
return reverse($param);
}
]]
/script
/component

(NOTE - there is a error in the docs and the  for the registration open
tag has to be moved to AFTER the properties). Once I do this, register
the component and then try to run the following script:

use strict;
use warnings;
use Win32::OLE;
Win32::OLE-Option(Warn = 3);
my $r = new Win32::OLE('Easy.WSC');
print hello, world\n;

...I still get a crash. Has anyone else had luck instantiating WSCs with
Win32::OLE in perl 5.10?

Thanks,
Mike Ellery




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Adding to the perl include search path

2008-12-02 Thread Michael Ellery
Win32 users:

What's the best way to add a new path to perl's @INC search path?  Our
product installs several perl modules and I would like to make those
modules available to all perl scripts without asking users to add the
'use lib mypath' business in every script. I'm only concerned with
windows (Activestate) perl at this point, but a solution that worked
generally would be fine too.

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::TieRegistry question

2008-09-26 Thread Michael Ellery
Win32-ers,

Does anyone know off-hand what TieRegistry should do with a statment
like this:

$Registry-{'LMachine/Software/Bar'} = {'SubKey/' = { '/SomeValue' = 1 }};

..specifically, with respect to the type of the SomeValue entry?  I had
thought that it would create a DWORD value since the value assigned is
integer, but based on a quick experiment, I seem to assume wrong (it
creates a REG_SZ).  Anyone have any insight into this?  What's the
right way to create/assign REG_SZ values?

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: NET SSH2 ppm for 5.10

2008-09-25 Thread Michael Ellery
Serguei Trouchelle wrote:

 
 Try this:
 
 ppm install http://trouchelle.com/ppm10/Net-SSH2.ppd
 

yes, indeed - that seems to have worked for me.  Thanks for that...and
to Rob for offering his own private build to me.

Regards,
Mike

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


NET SSH2 ppm for 5.10

2008-09-24 Thread Michael Ellery
does anyone know of a source for a NET::SSH2 ppm for 5.10?  I managed to
get this from uwinnipeg for 5.8, but ppm is telling me it can't find it
in the 5.10 repository (now that I've upgraded).

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Embedding perl by a c++ program

2008-06-27 Thread Michael Ganz
\: %s, pcFile, SvPV(ERRSV, n_a));
#else
snprintf(_pcTmp, 1023, Perl error
\%s\: %s, pcFile, SvPV(ERRSV, n_a));
#endif
_pcReturn = new char[1024];
strcpy(_pcReturn, _pcTmp);
}
else if(_iStat)
{
SV *_pSV = NULL;
SPAGAIN;
_pSV = POPs;
SvUTF8_on(_pSV);

STRLEN _lLength = 0;
char *_pcTemp = SvPV(_pSV,
_lLength);

unsigned long _lTempLength =
strlen(_pcTemp);
_pcReturn = new char[_lTempLength +
1];

if(_pcReturn)
{
strncpy(_pcReturn, _pcTemp,
_lTempLength);
_pcReturn[_lTempLength] =
NULL;
}
PUTBACK;
}
FREETMPS;
LEAVE;
PERL_SET_CONTEXT(my_perl);
PL_perl_destruct_level = 0;
perl_destruct(my_perl);
perl_free(my_perl);
}
}
}
catch(...)
{
}
return _pcReturn;
}

/***
**/
void xs_init(pTHX)
{
//PERL_UNUSED_CONTEXT;
char *_pcFile = __FILE__;
dXSUB_SYS;
{
newXS(DynaLoader::boot_DynaLoader, boot_DynaLoader,
_pcFile);
//newXS(ap::callService, callService, _pcFile);
//newXS(ap::logToFile, logFile, _pcFile);
//newXS(ap::importXml, importXml, _pcFile);
//newXS(ap::exportXml, exportXml, _pcFile);
//newXS(ap::repository, repository, _pcFile);
newXS(ap::stream, streamToSender, _pcFile);
//newXS(ap::charset, setCharset, _pcFile);
//newXS(ap::message, message, _pcFile);
newXS(ap::actionAsXml, actionAsXml, _pcFile);
//newXS(ap::actionGetBaseParam, actionGetBaseParam,
_pcFile);
//newXS(ap::actionGetRequestParam, actionGetRequestParam,
_pcFile);
//newXS(ap::actionGetResponseParam,
actionGetResponseParam, _pcFile);
//newXS(ap::actionSetResponseParam,
actionSetResponseParam, _pcFile);

newXS(ap::sayhello, sayHello, _pcFile);
}
}

/***
**/
void dl_init(pTHX)
{
dTARG;
dSP;
SAVETMPS;
targ = sv_newmortal();
FREETMPS;
}

And the perl script:
use strict;
use warnings;

sub ap_presentation
{
   my $action_addr = shift;

   printf(Called script\n);

   printf(Address: $action_addr\n);

   my $sayhelloreturn = ap::sayhello( hello ap);
   printf(output: $sayhelloreturn\n);

   my $sayhelloagain = ap::sayhello( hello ap again);
   printf(output: $sayhelloagain\n);

   # if I call this one times all works fine on WIN
   my $xmlAction = ap::actionAsXml(\$action_addr);
   printf(\n$xmlAction\n);

   printf(Address: $action_addr\n);

   # if I call this the perl interpreter loops in ~vmem on WIN
   my $testAction = ap::actionAsXml(\$action_addr);
   printf(\n$testAction\n);

   # if I use this the cloned interpreter ends in a heap corruption
   my %callmap = ();
   
   $callmap{RESULT} = Kleiner Teststring zum Streamen;
   $callmap{ERRORCODE} = 0;
   $callmap{CONTENTTYPE} = text/html;
   $callmap{CTYPE} = test;
   $callmap{PRESENTATION} = FALSE;
   
   my $result = Kleiner Teststring zum Streamen. Teil:;
   
   for my $counter (1..10)
   {
$callmap{RESULT} = HR$result $counter\n;   
   my $errorcode = ap::stream(\$action_addr, %callmap);

printf(Streaming to sender returns value: $errorcode\n);
   }
   

   my $tmp_buf = $xmlAction;
   $tmp_buf .= \n!--Added content by perlscript--\n;
   return $tmp_buf; 
}



Kindly regards Michael

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Problem with Win32::ToolHelp module

2008-06-19 Thread Michael Ellery
apologies if this is not the right place for module specific 
questions...but here goes...

I'm running 5.8.8 and have had Win32::ToolHelp installed for some time. 
  Just recently, I started getting a failure when trying to use the 
package - specifically:

Can't load 'C/Perl/site/lib/auto/Win32/ToolHelp/TollHelp.dll for 
module Win32::ToolHelp: load_file: The specified module could not be 
found at C:/Perl/lib/DynaLoader.pm line 230

I've looked on the filesystem, and ToolHelp.dll is there in the location 
mentioned.  I've even tried ppm install --force Win32::ToolHelp to see 
if that would fix it, but it hasn't.

Any idea what might be wrong and what else I could try to fix it?

TIA,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Problem with Win32::ToolHelp module

2008-06-19 Thread Michael Ellery
Stuart Arnold wrote:
 Did you copy/paste or type the error in? There seems to be a typo:
 TollHelp.dll
 ToolHelp/TollHelp.dll  
 

typo -- sorry.  That is ToolHelp.dll.

Thanks,
Mike

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Problem with Win32::ToolHelp module

2008-06-19 Thread Michael Ellery
Michael Ellery wrote:
 apologies if this is not the right place for module specific 
 questions...but here goes...
 
 I'm running 5.8.8 and have had Win32::ToolHelp installed for some time. 
   Just recently, I started getting a failure when trying to use the 
 package - specifically:
 
 Can't load 'C/Perl/site/lib/auto/Win32/ToolHelp/TollHelp.dll for 
 module Win32::ToolHelp: load_file: The specified module could not be 
 found at C:/Perl/lib/DynaLoader.pm line 230
 
 I've looked on the filesystem, and ToolHelp.dll is there in the location 
 mentioned.  I've even tried ppm install --force Win32::ToolHelp to see 
 if that would fix it, but it hasn't.
 
 Any idea what might be wrong and what else I could try to fix it?
 

after some investigation, it appears to be a case of installation of 5.8 
on top of 5.6 without cleanly reinstalling all packages. I generally 
only do clean installs, but I was dealing with an inherited system and 
wasn't as careful as I should have been.

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


OLE Events and STDIN

2008-06-13 Thread Michael Ellery
Win32 Users,

I would like to accept OLE Events in my script - I've written working 
code that successfully receives events.  Now I want to also receive some 
console (stdin) input.  I typically use Term::Readline for this, 
although I'm happy to try something else.  The basic problem is that 
Win32:OLE MessageLoop() spins forever (or until QuitMessageLoop is 
called).  Is there any way I can do something else, like check for 
console input, when MessageLoop is running?  Or, perhaps I can do some 
kind of polling loop where I check for events, check for stdin input and 
then sleep briefly (I'm not sure if such a thing is possible).

TIA,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: OLE Events and STDIN

2008-06-13 Thread Michael Ellery
Jan Dubois wrote:

 
 You may get something working by using Term::ReadKey::ReadKey() in
 non-blocking mode interleaved with calls to Win32::OLE-SpinMessageLoop().
 

thanks for this advice -- I'm going to give Spin/ReadKey a try first. 
It has the undesirable polling loop aspect but i think it would actually 
be fine for my purposes.

 In general it would be better to provide a GUI for your input,
 using Tk, Tkx, Win32::GUI, wxPerl etc. which would avoid the problem
 altogether.
 

It's been a long time since I've tried any GUI programming in perl, but 
IIRC usually there is a point where you have to call a message loop in 
order to allow the UI to process messages.  How would that work with 
with Win32::OLE's MessageLoop()?  Obviously I can't have two message 
loops going - would the UI message loop be sufficient to deliver my COM 
events (in other words, I'd never have to call OLE's MessageLoop)?


-Mike


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::OLE -- assignment to property of type IUnknown..how?

2008-05-28 Thread Michael Ellery

I have a COM component with a property defined like this (IDL):

[propput, id(30), helpstring(property TestSuite)] HRESULT 
TestSuite([in] IUnknown *pVal);
[propget, id(30), helpstring(property TestSuite)] HRESULT 
TestSuite([out, retval] IUnknown **ppVal);

..basically it gets/sets a dual interface object that is implemented in 
a different COM component.

Using Win32::OLE, it doesn't let me do a normal property assignment -- 
i.e. this fails:

$myObj-{TestSuite} = $someOtherObj;

..however, it DOES let me do by ref assigment:

$myObj-LetProperty('TestSuite', $someOtherObj);

Can someone explain why?  I would prefer (for consistency with other 
properties) to use the SetProperty style of assignment instead of 
LetProperty - is there something I need to change in my IDL to make the 
SetProperty style work?

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Trouble installing Perl Module in cygwin

2008-05-18 Thread Michael Putch
   It doesn't like having the .cpan directory to
have directory path with spaces.  Notice how it is
looking for /cygdrive/c/Documents, which is your
path truncated at the first space, but not finding
it.
   Perhaps the gurus here have a better solution, but
what I would do is have your udk home directory
(which contains .cpan) be somewhere else.  For
example on my system my cygwin home directory
is:
  /cygwin/home/putch

HTH


Udaya K (udk) wrote:
 Hi,
 Can anyone please help in working out the following error.
 I am trying to install Perl Modules in Cygwin.
 Same error when I try to insall IO::Tty and Expect
  
 Thanks
 Udaya
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] /cygdrive/c
 $ perl -MCPAN -e shell
  
 cpan shell -- CPAN exploration and modules installation (v1.7602)
 ReadLine support enabled
 cpan install Bundle::CPAN
 CPAN: Storable loaded ok
 Going to read /cygdrive/c/Documents and Settings/udk/.cpan/Metadata
   Database was generated on Sat, 17 May 2008 03:29:47 GMT
 CPAN: Digest::MD5 loaded ok
 CPAN: Compress::Zlib loaded ok
 Checksum for /cygdrive/c/Documents and 
 Settings/udk/.cpan/sources/authors/id/A/A
 N/ANDK/Bundle-CPAN-1.857.tar.gz ok
 Scanning cache /cygdrive/c/Documents and Settings/udk/.cpan/build for sizes
 sh: /cygdrive/c/Documents: No such file or directory
 /usr/bin/tar: This does not look like a tar archive
 /usr/bin/tar: Error exit delayed from previous errors
 Uncompressed /cygdrive/c/Documents and 
 Settings/udk/.cpan/sources/authors/id/A/A
 N/ANDK/Bundle-CPAN-1.857.tar.gz successfully
 Using Tar:/usr/bin/tar xvf /cygdrive/c/Documents and 
 Settings/udk/.cpan/sources/
 authors/id/A/AN/ANDK/Bundle-CPAN-1.857.tar:
 /usr/bin/tar: /cygdrive/c/Documents: Cannot open: No such file or directory
 /usr/bin/tar: Error is not recoverable: exiting now
 Couldn't untar /cygdrive/c/Documents and 
 Settings/udk/.cpan/sources/authors/id/A
 /AN/ANDK/Bundle-CPAN-1.857.tar
  
 
 cpan
 
 
 
 
 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::Process::Create

2008-04-29 Thread Michael Ellery
Jan Dubois wrote:

 
 If you need to wait for your subprocesses, then you may want
 to use this somewhat obscure form:
 
 my $pid = system(1, $cmdline);
 # ...
 waitpid $pid, 0;
 
 (This is documented in `perldoc perlport` as a Win32 specific extension
 to system(), but not mentioned in `perldoc -f system`).
 

okay - thanks to everyone for the advice.  I never knew this 
non-blocking version of system() existed - very interesting.  Based on 
my quick tests, it looks like this version might still use the shell 
(although I can't tell).  For instance, I wasn't able to start a cmd.exe 
instance to run a  batch file using system(1, ...) in my quick tests, 
but that might have been pilot error.  I'll give Win32::GUI::Show a shot 
- that might be my best option for now.

Thanks,
Mike


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::Process::Create

2008-04-28 Thread Michael Ellery
..I use this function pretty regularly to spawn procs on windows, but 
I've often wanted to minimize the console or main window that was 
launched.  Does anyone know how to do this?  In the corresponding WIN32 
API, there is a STARTUPINFO structure that allows this, but looks like 
it's not part of the Win32::Process API.  Advice appreciated.

-Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::Process::Create

2008-04-28 Thread Michael Ellery
Sisyphus wrote:

 
 What happens if you launch the script using the wperl executable instead 
 of the perl executable ?
 

I don't even know what wperl is, although it does look like it's part of 
my current perl install (I have never heard of it before now). In any 
event, it's not an option for us since most of our stuff runs in the 
context of the perlSE.dll (ActiveScript engine).

 Have you checked the various flags constants ? From the docs:
 
 --
 EXPORTS
The following constants are exported by default:
 
CREATE_DEFAULT_ERROR_MODE
SNIP
 --
 
 I was thinking specifically of CREATE_NO_WINDOW constant (but perhaps 
 that does something else).
 

I believe this corresponds to this process creation flag (from MSDN docs):


CREATE_NO_WINDOW
0x0800

The process is a console application that is being run without a console 
window. Therefore, the console handle for the application is not set.

This flag is ignored if the application is not a console application, or 
if it is used with either CREATE_NEW_CONSOLE or DETACHED_PROCESS.


I'm really looking for something that works more generally (for console 
and non-console apps alike).  In older versions of the win32 API, I'm 
pretty sure there was a field in the STARTUPINFO that allowed the caller 
to request the app be started mimimized, but the current docs don't show 
such an option.

Perhaps my best bet it to try to call ShowWindow directly ??




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Can a Perl script be called as a COM object?

2008-04-01 Thread Michael Ellery
Howard Maher wrote:
 One of our possible vendors said that if Perl scripts can be callable COM 
 objects, then we can interface with their engine.  Does anyone know whether 
 Perl scripts can be?  The languages that they suggest are VB6, C++, and 
 .NET...   The Perl.NET project has pretty much been scrapped, correct?  
 Thanks in advance for any help you can give us. 


try a web search for Windows Script Components.  ActiveState perl 
works nicely as a scriplet engine.

--Mike Ellery


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: rsync for Win32

2008-03-10 Thread Michael Ellery
Sisyphus wrote:

 I couldn't find a Cygwin version of rsync under Cygwin's Setup.exe (though 
 it wouldn't surprise me if such a beast existred) and the 2 windows 
 executables that I've tried (rsync-wrap.exe and rsync.exe both croak on the 
 command).

I have a fairly recent install of Cygwin and it looks like there is an 
rsync:

$ which rsync
/usr/bin/rsync

..I have not used it, so I can't attest that it actually works.

--Mike

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


ppm repository for 5.10

2008-02-29 Thread Michael Ellery
Many thanks to the people at ActiveState for all the work in getting us
a release of 5.10.  I've been holding off on upgrading for the package
compatibility problem.  Is there now a complete ppm repository available
for 5.10? Are there any packages that were available in 5.8 that are no
longer available in 5.10?

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::OLE and hidden methods

2008-02-13 Thread Michael Ellery
Can Win32::OLE access methods/props marked as hidden in the IDL?  There
happens to be one property we have marked as such and I tried the naive
thing:

my $secret = $object-HiddenProperty

...and it was rejected.  Is there some way to ask Win32::OLE to ignore
the hidden attribute?

TIA,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


properties, VT types, and Win32::OLE

2008-02-04 Thread Michael Ellery
Given some object and a property:

my $obj = new Win32::OLE(SOME.class);
my $val = $obj-{SomeProperty};

...is there some way to determine the VT type of $val (or of
SomeProperty, equivalently).  I often run into strange problems where I
expect a 32 bit negative value from some property, but when I simply
print it, perl shows it as a large positive value.  It is bit equivalent
to the expected negative value, but somehow not being interpreted with
the corrected sign-ed-ness.  The first thing I would like to check is
the VT type that Win32::OLE thought it got -- then I'll see if I agree
with how Win32::OLE is converting to perl scalars based on the VT type.

Advice appreciated.

-Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: properties, VT types, and Win32::OLE

2008-02-04 Thread Michael Ellery
Jan Dubois wrote:
 On Mon, 04 Feb 2008, Michael Ellery wrote:
 Given some object and a property:

 my $obj = new Win32::OLE(SOME.class);
 my $val = $obj-{SomeProperty};

 ...is there some way to determine the VT type of $val (or of
 SomeProperty, equivalently). I often run into strange problems where I
 expect a 32 bit negative value from some property, but when I simply
 print it, perl shows it as a large positive value. It is bit
 equivalent to the expected negative value, but somehow not being
 interpreted with the corrected sign-ed-ness. The first thing I would
 like to check is the VT type that Win32::OLE thought it got -- then
 I'll see if I agree with how Win32::OLE is converting to perl scalars
 based on the VT type.
 
 I haven't tested this, but you should be able to do something like this:
 
 my $prop = Win32::OLE::Variant-new();
 $obj-Dispatch('SomeProperty', $prop);
 print V_VT(prop)=%d\n, $prop-Type);
 

With two minor syntax fixes to the print line, this works great. Thanks!

-Mike

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::OLE and VT_INT

2008-01-09 Thread Michael Ellery
just running some quick COM code in perl and I notice this: if I call a
property or method that returns VT_I4, Win32::OLE maps that to a perl
integer in scalar context.  When I call a property or method that
returns VT_INT, however, it gets mapped to a perl string.  Is this
deliberate? Is it correct behavior? I can work around my current issue
by just doing int() around my values, but it seemed strange to me that
these two cases produced slightly different scalars.

Thanks,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::OLE and VT_INT

2008-01-09 Thread Michael Ellery
Jan Dubois wrote:
 On Wed, 09 Jan 2008, Michael Ellery wrote:
 just running some quick COM code in perl and I notice this: if I call
 a property or method that returns VT_I4, Win32::OLE maps that to a
 perl integer in scalar context. When I call a property or method that
 returns VT_INT, however, it gets mapped to a perl string. Is this
 deliberate? Is it correct behavior? I can work around my current issue
 by just doing int() around my values, but it seemed strange to me that
 these two cases produced slightly different scalars.
 
 It is a bug in Win32::OLE: it doesn't handle VT_INT (nor VT_UINT)
 explicitly and therefore tries to coerce it into VT_BSTR (using
 VariantChangeTypeEx) before turning it into a Perl scalar. At the Perl
 level this shouldn't really matter though, as strings are converted back
 to integers/numbers automatically whenever needed.
 
 I don't know why it was never handled explicitly; I just checked, and
 even the wtypes.h from VC98 lists VT_INT as a valid type for a VARIANT.
 
 I'll fix it in a future Win32::OLE release.
 
 Cheers,
 -Jan

Jan,

Thanks for the quick response.  In my case, I only noticed the behavior
because I am passing the output to another property - and that property
put wasn't expecting a string.  It went something like this:

my $foo = $oleObject-Some_VT_INT_Property;
$oleObject-{Some_VARIANT_Property} = $foo;

The VT_TYPE coming into my put_Some_VARIANT_Property was actually
VT_BSTR in this case, which I was not expecting. Simply wrapping int()
around the get call works fine, but a fix to Win32::OLE would be great.
I think I'll also update my VARIANT processing on the put.

Thanks,
Mike


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Perl, PDF password secured ???

2008-01-08 Thread Michael D Schleif
I am seeking a Perl method to create password secured PDF files from
HTML web pages.

PDF::API2 does not appear to have this functionality.

What do you think?


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl 5.10 ActiveScript engine

2008-01-03 Thread Michael Ellery
Jan Dubois wrote:
 On Thu, 20 Dec 2007, Michael Ellery wrote:
 ..I just upgraded to 5.10 (uninstalled 5.8 and installed 5.10, actually)
 and I can't seem to execute using the perl ActiveScript engine.  For
 instance, I try this simple script:

 job
 script language=PerlScript
   use strict;
   say Hello World;
 /script
 /job

 and try to run with cscript -- cscript crashes.

 In our application, we also have a custom ActiveScript host (so we can
 execute ActiveScript engines) and we can also no longer run using the
 PerlScript engine.  We get an exception thrown from the InitNew method
 on the IActiveScriptParse interface.  Is the activescript engine broken
 in this release?
 
 Yes, it looks like it is broken. :(  The same issue probably afflicts
 PerlEx and Perl for ISAPI as well.
 
 I'll see that we can get this fixed ASAP.
 
 Cheers,
 -Jan
 

Any estimate when we might see a fix for this issue?  Do you expect to
produce a new 5.10 build or just a patch to the current build?

Thanks,
Mike


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl 5.10 ActiveScript engine

2007-12-20 Thread Michael Ellery
..I just upgraded to 5.10 (uninstalled 5.8 and installed 5.10, actually)
and I can't seem to execute using the perl ActiveScript engine.  For
instance, I try this simple script:

job
script language=PerlScript
  use strict;
  say Hello World;
/script
/job

and try to run with cscript -- cscript crashes.

In our application, we also have a custom ActiveScript host (so we can
execute ActiveScript engines) and we can also no longer run using the
PerlScript engine.  We get an exception thrown from the InitNew method
on the IActiveScriptParse interface.  Is the activescript engine broken
in this release?

TIA,
Mike Ellery

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


win32::daemon Pod::Webserver ???

2007-08-30 Thread Michael D Schleif
I installed Pod::Webserver  executing podwebserver from CLI works OK;
except that it requires keeping open a Command Prompt window.

So, I thought that I could use Win32::Daemon to create and run it as a
service ;

The service installs successfully.

However, it will NOT run !?!?

use Win32::Daemon;

my $name = podWebServer;
my %Hash = (
display = $name,
name = $name,
parameters = 'C:\Perl\bin\podwebserver',
path = 'c:\perl\bin\perl.exe',
pwd = ,
user = ,
);
if( Win32::Daemon::CreateService( \%Hash ) ) {
print Successfully ADDED.\n;
} else {
warn Failed to ADD service: 
. Win32::FormatMessage( Win32::Daemon::GetLastError() )
. \n;
}


What do you think?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: win32::daemon Pod::Webserver ???

2007-08-30 Thread Michael D Schleif
* David Rigaudiere [EMAIL PROTECTED] [2007:08:30:22:47:29+0200] scribed:
 Hello Michael,
 your service is installed but it does not thing to do.
 
 You have to manage service manager events :
 
 use Win32::Daemon;
 
 Win32::Daemon::StartService();# start service as soon as  
 possible
 
 while( ($State = Win32::Daemon::State()) != SERVICE_STOPPED ) {
 if( $State == SERVICE_START_PENDING ) {
 Win32::Daemon::State( SERVICE_RUNNING );
 } elsif( $State == SERVICE_PAUSE_PENDING ) {
 Win32::Daemon::State( SERVICE_PAUSED );
 } elsif( $State == SERVICE_CONTINUE_PENDING ) {
 Win32::Daemon::State( SERVICE_RUNNING );
 } elsif( $State == SERVICE_STOP_PENDING ) {
 Win32::Daemon::State( SERVICE_STOPPED );
 } elsif( $State == SERVICE_RUNNING ) {
  # do something
 }
 
 sleep( 5 ); # little sleep for preserve resources
 }
 
 Win32::Daemon::StopService();
 
 Cheers.
 David Rigaudiere
snip /

Yes, I see what you are saying.  I was confused about the POD and
StartService, and callbacks ...

A Windows Service is a service, is a service -- no ???

Is it NOT possible to start it from Windows Service panel?

Your code example (above) makes NO reference to WHICH service; and I do
not understand from the POD how to refer to which service.

What am I missing?


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: win32::daemon Pod::Webserver ???

2007-08-30 Thread Michael D Schleif
* Bill Luebkert [EMAIL PROTECTED] [2007:08:30:10:58:09-0700] scribed:
 Michael D Schleif wrote:
  I installed Pod::Webserver  executing podwebserver from CLI works OK;
  except that it requires keeping open a Command Prompt window.
  
  So, I thought that I could use Win32::Daemon to create and run it as a
  service ;
  
  The service installs successfully.
  
  However, it will NOT run !?!?
  
  use Win32::Daemon;
  
  my $name = podWebServer;
  my %Hash = (
  display = $name,
  name = $name,
  parameters = 'C:\Perl\bin\podwebserver',
 
 You may need a .exe on the end there.

No, that is the _exact_ file name -- no extension.  It is a Perl script
that DOES run successfully from CLI.


  path = 'c:\perl\bin\perl.exe',
  pwd = ,
  user = ,
  );
  if( Win32::Daemon::CreateService( \%Hash ) ) {
  print Successfully ADDED.\n;
  } else {
  warn Failed to ADD service: 
  . Win32::FormatMessage( Win32::Daemon::GetLastError() )
  . \n;
  }
  
  
  What do you think?
 
 What's your error indication ?
 
 Does CreateService also start the service or do you need to do that too ?

It creates the service, which DOES show up in Windows Services panel.

However, it refuses to start, at least from that Services panel, nor
from the CLI (e.g., net start podWebServer) ...


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32 Shortcut?

2007-06-25 Thread Michael Higgins
I can't seem to find win32::shortcut... I'm assuming some other
ppm-available module now has this feature, but I haven't found it yet.

Anyone have a suggested solution?

Cheers,

--
   . .   .   .   .  .   .   . .. ...   .   .  .``.
   .`. .`.   .   . .`   .   .   .   .   .` .`  .   .`. .  `.
   .  `  .   .   .`..`` .```.   .   .  ..  .  ..   .   .  `.`.
   . .   .   .  `.  .   .   .`..`   `..`   .   .   .  `..`
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: control characters in perl

2007-06-19 Thread Michael Higgins
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On 
 Behalf Of jagdish eashwar
 Sent: Tuesday, June 19, 2007 8:38 AM
 To: perl-win32-users@listserv.activestate.com
 Subject: control characters in perl
 
 Hi,
 
 Do word processors insert any character for word wraps like 
 they do for new lines(\n)? If yes, what is the corresponding 
 perl control character? I need to split a multi line string 
 from a word table cell at the word wraps. 
 
 jagdish eashwar
 
 

Some of the more commonly used ASCII codes:
Chr(9) = tab
Chr(11) = manual line break (shift-enter)
Chr(12) = manual page break
Chr(13) = vbCrLf (return)
Chr(14) = column break
Chr(30) = non-breaking hyphen
Chr(31) = optional hyphen
Chr(32) = space
Chr(34) = quotation mark
Chr(160) = nonbreaking space
For more see also Chr$ under VBA Help.

USAGE EXAMPLE: Selection.TypeText text:=Chr(12)

see: www.jojo-zawawi.com/code-samples-pages/code-samples.htm 

HTH,

--
   . .   .   .   .  .   .   . .. ...   .   .  .``.
   .`. .`.   .   . .`   .   .   .   .   .` .`  .   .`. .  `.
   .  `  .   .   .`..`` .```.   .   .  ..  .  ..   .   .  `.`.
   . .   .   .  `.  .   .   .`..`   `..`   .   .   .  `..`
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Truncating decimal number

2007-06-19 Thread Michael Cohen

John,

Have you thought of using the SPRINTF function?

e.g.:
my $temp1 = 10.25233006477356;
my $temp2 = sprintf(%.6f, $temp1);
print $temp2;

  10.252330

I realize that the SPRINTF will round, but not needing and not wanting
are two different situations.  I use this function all the time, and it is
easy to implement.  If you do not want to round, than I don't know.

Regards,
Michael Cohen



   
 John Townsend   
 [EMAIL PROTECTED] 
 omTo
 Sent by:  [EMAIL PROTECTED]
 perl-win32-users- ate.com
 [EMAIL PROTECTED]  cc
 ActiveState.com   Chad Freeman [EMAIL PROTECTED]
   Subject
   Truncating decimal number   
 06/19/2007 06:50  
 PM
   
   
   
   




I'm trying to truncate a number, 10.25233006477356, to 6 decimal points.
E.g. 10.252330.


I don't need to round the number, I just want it to drop everything after
the 6th decimal point. This should be easy, but I'm drawing a blank.


Thanks ___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


inline: graycol.gifinline: pic01763.gifinline: ecblank.gif___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Compiling Perl

2007-03-21 Thread Michael Cohen

Nelson,

I have been using ActiveState's PerlApp program, which is part of their PDK
for a number of years to do exactly what you want to do.  It works well,
with good documentation.

Regards,
Michael Cohen




   
 Nelson R.
 Pardee   
 [EMAIL PROTECTED]  To
  Active State Perl   
 Sent by:  [EMAIL PROTECTED]
 perl-win32-users- ate.com
 [EMAIL PROTECTED]  cc
 ActiveState.com   
   Subject
   Compiling Perl  
 03/20/2007 05:34  
 PM
   
   
   
   




In order to avoid installing Perl on a bunch of PC's, I'd like to compiler
a couple of Perl programs. Any recommendations? I didn't see anything
recently in the archives but I might have missed it. Thanks in advance.
Nelson

 --Nelson R. Pardee, Support Analyst, Information Technology  Services--
 --Syracuse University, CST 4-191, Syracuse, NY 13244  --
 --(315) 443-1079 [EMAIL PROTECTED] --
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


print queues cups ???

2006-11-08 Thread Michael D Schleif
Anybody here have experience with cups and system v lp print queues?  I
have been asked to build a Perl solution, according to the following:

[1] A printing company has switched from SysV lp to cups.  They have a
plethora of tools they have developed to query and manage lp queues;
which do NOT work with cups.  However, their worst problem is the
tens of thousands of jobs they have queued, and the way cups
regularly polls queues, ALL queued jobs, and consumes an inordinate
amount of system resource.

[2] I have been asked to develop two (2) custom processes:
[A] A process to receive print job contents on STDIN, and build
System V lp queues, which can be managed by their existing
tools.
[B] A process to receive a print job request on STDIN, from which
this process will select the appropriate queues (as built in
[A]), and insert that print job into cups.

[3] Are there ways that cups can better manage large queues (as outlined
in [1])?

[4] What are the pluses and minuses of the approach in [2]?

[5] Where can I get more information on queue building, as outlined in
[2][A]?

[6] Is there a CLI to cups?  Where is this documented?

I am not a printing expert -- for me, it simply works.  However, I am an
accomplished programmer, especially Perl; and I need to establish the
scope of such a project, in order to quote it to my client.

What do you think?


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Logger::Simple Deep Recursion Error

2006-10-26 Thread Michael Papet
Hi,

I'm trying to use Logger::Simple in my program with an
empty log file.  When I go to nmake test I get the
following error:

Deep recursion on subroutine Logger::Simple::write
at
C:/Perl/site/lib/Logger/Simple.pm line 84
(#3)

Relevent code from that file:
  push @{$$self{HISTORY}},$error;
  carp $error\n if $$self{CARP};
  $self-write($error); # line 84
}

1. Is there something I'm missing?  
2. Can someone suggest a fix?
3. Is there a working logger in the activestate repo? 
4. Where do I report bugs? Activestate or back to author?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Net::Server::Daemonize Error

2006-10-24 Thread Michael Papet
The net-server package isn't ported well for win32.

Error:
The getpwnam function is unimplemented at
C:/Perl/site/lib/Net/Server/Daemonize.
pm line 162.

Is there a well-known workaround?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Strawberry Perl Bugs Report

2006-10-23 Thread Michael Papet
Hi,

Some feedback for the strawberry-perl project.

Platform: WinXP SP2, totally up to date.

Install went okay except for environment paths were
not set so dmake didn't work in cpan right away.

To fix dmake, I copied it into c:\OSdir\system32 along
with the folder.  Maybe you want to do that with the
installer?  I can understand why that may not be good,
but FYI.

Set paths in systemSystem
propertiesadvancedEnvironment Variables by adding
C:\strawberry-perl\dmake\bin\;C:\strawberry-perl\perl\bin;C:\strawberry-perl\mingw\bin

After a reboot, there are problems.

Somehow I got XML::Parser and IO::Tty involved and
both fail installation.

IO::Tty fails with this on the CLI
Now let's see what we can find out about your system
(logfiles of failing tests are available in the conf/
dir)...
Looking for _getpty().. not found.
Looking for getpt() not found.
Looking for grantpt().. not found.
Looking for openpty().. not found.
Looking for ptsname().. not found.
Looking for ptsname_r() not found.
Looking for sigaction() not found.
Looking for strlcpy().. not found.
Looking for ttyname().. not found.
Looking for unlockpt(). not found.
Looking for libutil.h.. not found.
Looking for pty.h.. not found.
Looking for sys/pty.h.. not found.
Looking for sys/ptyio.h not found.
Looking for sys/stropts.h.. not found.
Looking for termio.h... not found.
Looking for termios.h.. not found.
Looking for util.h. not found.

My quick and dirty attempts to find the mingw headers
was unsuccessful.  Does IO:Tty needs different build
instructions for mingw/win32?

Keep up the great work.  Let me know if you need more
info.

MP 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Strawberry Perl Bugs Report

2006-10-23 Thread Michael Papet
After some more testing, errors appear related to
Log::Log4Perl

This is the package that seems to trigger the
dependency to IO::Tty.

You can reproduce the bug by starting cpan and
entering upgrade.  Admittedly, this is not a great
idea right now, but it produces the issue on XPSP2.

Any ideas on how to address this one?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Generate RFC-2821 compliant date ???

2006-10-12 Thread Michael D Schleif
Consider this code:

use POSIX qw(strftime);
print strftime(%a, %d %b %Y %H:%M:%S %z, localtime 1160662136), \n;

On *NIX, that code produces this output:

Thu, 12 Oct 2006 09:08:56 -0500

On Windows, using ActivePerl, I get this output on several boxes:

Thu, 12 Oct 2006 09:08:56 Central Daylight Time


I want the _numeric_ TZ reference.

I am NOT married to strftime.

What am I missing?


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl-Win32-Users Digest, Vol 1, Issue 1792

2006-08-17 Thread McDermott, Michael


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, August 17, 2006 1:00 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Perl-Win32-Users Digest, Vol 1, Issue 1792

Send Perl-Win32-Users mailing list submissions to
perl-win32-users@listserv.ActiveState.com

To subscribe or unsubscribe via the World Wide Web, visit

http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Perl-Win32-Users digest...


Today's Topics:

   1. Unable to locate cgi-bin folder!!! (ukhas jean)
   2. Unable to locate cgi-bin folder!!! (ukhas jean)
   3. Unable to locate cgi-bin folder!!! (ukhas jean)
   4. Unable to locate cgi-bin folder!!! (ukhas jean)
   5. Unable to locate cgi-bin folder!!! (ukhas jean)
   6. Re: Unable to locate cgi-bin folder!!! (Ted Schuerzinger)
   7. Win32API::Net (Jim Bartlett)
   8. Re: Win32API::Net ($Bill Luebkert)
   9. Active Directory - Authentication ([EMAIL PROTECTED])


--

Message: 1
Date: Wed, 16 Aug 2006 23:37:35 -0700 (PDT)
From: ukhas jean [EMAIL PROTECTED]
Subject: Unable to locate cgi-bin folder!!!
To: Active Perl activeperl@listserv.ActiveState.com,  active perl
activeperl@listserv.activestate.com
Cc: Perl Mongers [EMAIL PROTECTED],   Perlwin
Web
perl-win32-web@listserv.ActiveState.com,  Perl Win Users
perl-win32-users@listserv.ActiveState.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

Hello All,
   
  I am unable to locate the cgi-bin folder on my machine. My cgi-scripts
are ready, but I am unable to test them.
   
  I believe it should either be in my Inetpub folder or my
Perl-installation folder.
  But it is not there.
   
  I am having Win XP. Perl 5.8.8 and IIS installed on my machine.
  Do I require to install anything else??
   
  Pardon me for this amateurish question. Any leads/suggestions would be
most welcome.
   
  Thanks and Regards,
  Jenson Samuel.


-
Get your email and more, right on the  new Yahoo.com 
-- next part --
An HTML attachment was scrubbed...
URL:
http://listserv.ActiveState.com/pipermail/perl-win32-users/attachments/2
0060816/96826f09/attachment-0003.html 

--

Message: 2
Date: Wed, 16 Aug 2006 23:37:35 -0700 (PDT)
From: ukhas jean [EMAIL PROTECTED]
Subject: Unable to locate cgi-bin folder!!!
To: Active Perl activeperl@listserv.ActiveState.com,  active perl
activeperl@listserv.ActiveState.com
Cc: Perl Mongers [EMAIL PROTECTED],   Perlwin
Web
perl-win32-web@listserv.ActiveState.com,  Perl Win Users
perl-win32-users@listserv.ActiveState.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

Hello All,
   
  I am unable to locate the cgi-bin folder on my machine. My cgi-scripts
are ready, but I am unable to test them.
   
  I believe it should either be in my Inetpub folder or my
Perl-installation folder.
  But it is not there.
   
  I am having Win XP. Perl 5.8.8 and IIS installed on my machine.
  Do I require to install anything else??
   
  Pardon me for this amateurish question. Any leads/suggestions would be
most welcome.
   
  Thanks and Regards,
  Jenson Samuel.


-
Get your email and more, right on the  new Yahoo.com 
-- next part --
An HTML attachment was scrubbed...
URL:
http://listserv.ActiveState.com/pipermail/perl-win32-users/attachments/2
0060816/96826f09/attachment-0004.html 
-- next part --
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

--

Message: 3
Date: Wed, 16 Aug 2006 23:37:35 -0700 (PDT)
From: ukhas jean [EMAIL PROTECTED]
Subject: Unable to locate cgi-bin folder!!!
To: Active Perl activeperl@listserv.ActiveState.com,  active perl
activeperl@listserv.ActiveState.com
Cc: Perl Mongers [EMAIL PROTECTED],   Perlwin
Web
perl-win32-web@listserv.ActiveState.com,  Perl Win Users
perl-win32-users@listserv.ActiveState.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

Hello All,
   
  I am unable to locate the cgi-bin folder on my machine. My cgi-scripts
are ready, but I am unable to test them.
   
  I believe it should either be in my Inetpub folder or my
Perl-installation folder.
  But it is not there.
   
  I am having Win XP. Perl 5.8.8 and IIS installed on my machine.
  Do I require to install anything else??
   
  

RE: PERL on a CD

2006-07-26 Thread Michael D. Smith

Okay,  tested just copying the Perl folder to E drive and it worked. I 
uninstalled perl and deleted the folders from my hard drive for testing 
purposes, burned perl folder onto the CD, deleted eg and html folders for 
space but it wasn't really necessary, there's plenty of room.

My CD drives are G and H but a CD could be any drive letter so now I need a 
relative path. I first  thought use a shortcut and then open the properties 
dialog box and enter what you want but Windozes won't accept a relative 
path there. I would call BillyG and tell him what I think about that but 
his number is unlisted :)

Then I thought to try an autorun.ini file containing something like:
[autorun]
shellexecute=Perl\bin\perl.exe myscript.pl

That works for html files anyway and it * might * work for this but somehow 
my file associations to ini have all become notepad.exe and one action has 
disappeared completely.

If someone would please open folder options, file types tab, scroll down to 
ini and highlight, then click the advanced button, then highlight -- here 
I'm not sure, it's the one that disappeared, it's something like install 
or execute or run or... --  and click the Edit button and tell me 
what's in the Application used to perform action dialog box -- I would 
appreciate it very much.

Thanks very much for everyone's patience with my tinkering.

BTW this is not for distribution. It's a one time thing on one computer but 
important (to me) nevertheless. I tried PP, that worked, but I really don't 
want to install anything on the host computer, even in the Temp file.

ms

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: PERL on a CD: Ini Association and relative Path Woes

2006-07-26 Thread Michael D. Smith

Despite the fact the file association is not there now, the CD that I made 
yesterday still autoruns, so there must be something to this shows it to 
you when it decides it wants to nonsense. More to talk with Billy about if 
I ever get a chance.

Besides, Autorun.ini will not accept a path, relative or otherwise, either. 
The file to be opened must be in the root directory with autorun.

I need a C wrapper, say setup.exe, to open perl and it's command line 
argument. Assuming I can do a relative path in C of course. If only i knew 
how to do that. I have a beginning C book and an advanced C book. 
Apparently it's in the middle-ing C book :)


ms


At 06:34 AM 7/26/2006, you wrote:


Michael D. Smith wrote:
  Okay,  tested just copying the Perl folder to E drive and it worked.
  snip
  My CD drives are G and H but a CD could be any drive letter so now I need
  a relative path.
A no can do for shortcuts as paths are made absolute. Another problem could
be changing drive letters due to removable drives, by the way. If you've got
control over the target machines you could use mounted folders for USB stuff
in stead of drives. This is well hidden, and found in:
control panel, administrative tools, computer management, disk management,
[context menu] change drive letter and paths, [button] add, [checkbox] mount
in the following empty NTFS folder

  somehow my file associations to ini have all become notepad.exe and one
  action has disappeared completely.
Ouch this sounds bad. Have you ttried pressing the restore button in the
Folder Options tab to see if it helps? You asked if it would be possible to
check what settings Windows is using for the disappeared items like install,
the answer is that those items are generated dynamically, presumably by
shell extensions, and do not show up in Folder Options.

This one is there -- or was yesterday.

ms


  I ran into similar
trouble in trying to add new actions to folders. In my case, this Microsoft
article helped:

http://support.microsoft.com/?kbid=321186

--
With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: It works!!! PERL on a CD: Ini Association and relative Path Woes

2006-07-26 Thread Michael D. Smith

That's it!

Works perfectly now.

No distribution. I'm carrying the CD with me to one other computer then 
taking it home with me and now it doesn't install a thing on the other 
computer -- not even in a temp directory, so it would seem (to me but I'm 
no lawyer) there should be less licensing issues than otherwise.

ms



At 10:23 AM 7/26/2006, Timothy Johnson wrote:


Also note that you should be able to use a path, like so:

open=perl\bin\perl.exe myscript.pl

(with the same caveat Jan gave us yesterday that you have to make sure
you're appropriately licensed if you plan to distribute outside of your
organization)



-Original Message-
From: Timothy Johnson
Sent: Wednesday, July 26, 2006 8:21 AM
To: 'Michael D. Smith'; perl-win32-users@listserv.ActiveState.com
Subject: RE: PERL on a CD: Ini Association and relative Path Woes

I think you want the Autorun.inf file, not ini.

Check out the reference here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellc
c/platform/shell/programmersguide/shell_basics/shell_basics_extending/au
torun/autoplay_cmds.asp




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Michael D. Smith
Sent: Wednesday, July 26, 2006 5:59 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: Re: PERL on a CD: Ini Association and relative Path Woes


Despite the fact the file association is not there now, the CD that I
made
yesterday still autoruns, so there must be something to this shows it
to
you when it decides it wants to nonsense. More to talk with Billy about
if
I ever get a chance.

Besides, Autorun.ini will not accept a path, relative or otherwise,
either.
The file to be opened must be in the root directory with autorun.

snip

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: PERL on a CD

2006-07-25 Thread Michael D. Smith

Is it possible to burn PERL and a script onto a CD and execute it from 
there without installing perl on the host computer?

There would be nothing in the registry. The path to perl.exe would have to 
be included for the script to execute -- but beyond that, I'm a blank.

Any thoughts appreciated.

Actually, it would be unknown if PERL were installed on the host computer 
or not -- is there any way to check first? -- as it would definitely 
execute quicker off the hard drive than off a CD.

TIA

ms

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: PERL on a CD

2006-07-25 Thread Michael D. Smith

I installed PAR using ppm. It seemed to work. It created an executable file 
that ran.

It seems that what it's doing is putting (installing?) Perl, or at least a 
big piece of it, in a temp file. Specifically: C:\Documents and 
Settings\Administrator\Local Settings\Temp\par-Administrator\cache-1153854792

If I wasn't logged on as admin, could it write to a file in that part of 
the dir tree?

If it can do that, it looks like executing off the CD should be much the 
same thing, without installing a bunch of files on the host computer. 
Unless that executable, in addition to those files, added registry entries 
as well. Hummm...

ms





At 01:16 PM 7/25/2006, you wrote:


  par-0.942 includes the Perl Packager.  It worked well for me, although
a very short script came out to a 1.3 meg .exe file.

-Original Message-
From: Lynn, Tom
Sent: Tuesday, July 25, 2006 11:14 AM
To: 'Michael D. Smith'
Subject: RE: PERL on a CD

Why not just make your script an standalone executable program?


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
This is what I want to do:

  %hash = @array;

But it don't work :)

  Every other array element is a key and every other one is data. A loop, 
could be done, but this every other one thing could get complicated.

Must be an easy way.

ms

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
At 08:03 PM 7/16/2006, Charles K. Clarkson wrote:


Michael D. Smith wrote:

: This is what I want to do:
:
:   %hash = @array;
:
: But it don't work :)

Define it don't work.

There is nothing in the hash after execution. It's defined, but empty. I 
printed the array, it's there, just as it's supposed to be. Knowing that 
statement is supposed to work and to look elsewhere is itself a big help.

Thanks everyone.

ms





#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper 'Dumper';

my @foo = (
 foo = 1,
 bar = 2,
 baz = 'three',
);

my %foo = @foo;

print Dumper \%foo;

__END__


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

Don't tread on my bandwidth. Trim your posts.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith

Thanks again everyone. Data::Dumper was the key to the whole thing.

The array was loaded from a file. All the keys (and data) had newlines on 
the end. When I asked for a key without a newline -- it wasn't there -- and 
I just assumed the statement was a little to cute -- but not for PERL :)

ms



At 09:12 PM 7/16/2006, Eric Edwards wrote:


$Bill wrote:
When you post code, post a small complete failing snippet with any input
and output examples:
use strict;
use warnings;
use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1;
my @array = (Key1 = 'Value1', Key2 = 'Value2', Key3 = 'Value3',
   Key4 = 'Value4');
my %hash = @array;
print Data::Dumper-Dump([\%hash], [qw(\%hash)]);

__END__

Result:

$\%hash = {
   'Key1' = 'Value1',
   'Key2' = 'Value2',
   'Key3' = 'Value3',
   'Key4' = 'Value4'
};

Eric replied:
Thanks for the feed back, but that is not what Michael is trying to do.
The code snip he supplied was sufficient unto it self.
He was trying to:
%hash = @array;
Thanks,
Eric
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
At 09:45 PM 7/16/2006, you wrote:


Eric Edwards wrote:

  $Bill wrote:
  When you post code, post a small complete failing snippet with any input
  and output examples:
  use strict;
  use warnings;
  use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1;
  my @array = (Key1 = 'Value1', Key2 = 'Value2', Key3 = 'Value3',
Key4 = 'Value4');
  my %hash = @array;


  print Data::Dumper-Dump([\%hash], [qw(\%hash)]);
 
  __END__
 
  Result:
 
  $\%hash = {
'Key1' = 'Value1',
'Key2' = 'Value2',
'Key3' = 'Value3',
'Key4' = 'Value4'
  };
 
  Eric replied:
  Thanks for the feed back, but that is not what Michael is trying to do.
  The code snip he supplied was sufficient unto it self.
  He was trying to:
  %hash = @array;

Note the line above with ^^ under it.
Isn't that setting %hash to @array ?

The code snippet was hardly sufficient if it doesn't compile or
produce any output.

Show me a complete code snippet that fails.

Bill's right. I assumed that was the failing code snippet. Unfortunately 
most of my errors are not where I'm looking, so... I should've shown the 
whole thing.

ms


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Issue w Daylight Saving Time on german win2k machine

2006-03-30 Thread Michael Hirmke
Hi,

Hi out there,

[...]
According to 'perlfunc':  $isdst is true if the specified
time occurs during Daylight Saving Time, false otherwise.
So - according to my understanding - (localtime())[8]
should have retured 1.

I had the same problem here - caused by my TZ variable.
I deleted this env variable and got the correct DST.

[...]
Thanx for your help in advance

greetings from the polish border

Oliver

Bye.
Michael.
-- 
Michael Hirmke| Telefon +49 (911) 557999
Wilhelm-Spaeth-Strasse 52 | FAX +49 (911) 557664
90461 Nuernberg   | E-Mail  mailto:[EMAIL PROTECTED]
  | WWW http://www.hirmke.de/
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: old messages? ( I think we're blocking now... )

2006-03-08 Thread Michael D. Smith

At 12:30 PM 3/8/2006, Jeff Griffiths wrote:





Chris Wagner wrote:

Did anyone else also just receive a boat load of old messages from the list?
I've got about 25 and more coming.  They go back to October.  And the really
funny thing about it is they're all from threads I participated in.  I
checked out the headers and they're originating from mail.mytravelweb.net
and involve somebody [EMAIL PROTECTED]  Here's one of the headers.

...
Thanks for reporting this. Annoying, isn't it? Internally we have blocked 
this traffic but I suspect some lot of users of the list are still getting 
messages because their email addresses are in the headers of the original 
messages. If you have gotten any of these messages *from* ActiveState's 
servers since around 9PM last night, please let me know right away and 
attach the full headers to your email.


Personally, I'm filtering all email with 'hescobar' in the To or CC 
fields; this seems to do the trick. The running theory we have is that 
this is the work of a bot-net of some sort.




The baffling thing is that while the header forging seems to be relatively 
sophisticated, it is still really easy to filter these messages due to the 
fact that they all have the same word / phrase in the To / CC header.


A script gone awry perhaps?

I once (OK twice:) brought down a server by doing this  instead of this 
, so these things do happen.


ms



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


[Fwd: File::Copy and eval]

2006-01-24 Thread Michael Jung

This is perl, v5.8.4 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Binary build 810 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  1 2004 11:52:21



In this example the source file is across the internet via VPN.

Once in a while after a file has started to copy the connection
breaks.

When this happens $@ is never set and the message Error does
not get printed.

Instead the portion of foo.dbf is erased and Error is not printed

Now is the module broke or do I not understand eval and it's implications
when using modules?

You can easily simulate this by coping a large file across you
LAN and pull your network cable during the middle of the copy.

Any ideas are welcomed.

 example code +

use strict;
use warnings;
use File::Copy;

eval {
  copy(/somepath/foo.dbf, /someotherpath/work/);
};
if ($@) {
  print Error . \n;
}
print End of program . \n;

+

p.s.Interestingly under perl 5.6.1/FreeBSD Error does not get printed
but this does to STDERR

Error: could not get handle for foo.dbf
Error reading header of foo.dbf

The application bombs and End of program does not print


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


uninitialized value in numeric gt ???

2006-01-03 Thread Michael D Schleif
Happy New Year!

I just installed spamassassin 3.1.0 (2005-09-13) on a debian box.
Everything appears to be running OK, except these incessant errors:

Use of uninitialized value in numeric gt() at /usr/lib/perl/5.8/DB_File.pm 
line 271.

I have googled to no avail.  Probably, there is something simple to be
done; but, I have not found it, yet.

So, I place myself at your mercy.  ALL pointers are welcome.

What do you think?

P.S., $VERSION = 1.811 ;

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Checking for internet connection

2005-11-01 Thread Michael D. Smith


Is there a right way/best way to check for an internet connection?

Now I'm using LWP simple to retrieve a webpage, if that fails, just assuming no
connection. It's fast when it works. I like fast, but that assumption is 
not always
correct and causes the script to fail inelegantly when it isn't. I hate 
inelegant :)



Must be a better way. Any thoughts appreciated.

ms

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Back-slashes calling a batch file from perl ???

2005-10-28 Thread Michael D Schleif
* On 2005:10:27:15:07:31-0500 I, Michael D Schleif [EMAIL PROTECTED], scribed:
 I have a perl script that calls a batch file (necessary), and passes it
 two arguments.  The first argument is a directory name, and the second a
 simple label.
 
 When I used forward-slashes (/) everywhere, the perl script behaves as
 expected; but, the batch file refuses to recognize the legitimacy of the
 directory name; at least in the context of passing it to the batch file
 in a system() call, as I need to parse the exit codes.
 
 my $dir = E:/backup;
 
 Yes, I test `-d $dir' successfully.  The batch file refuses to accept
 $dir while using forward-slashes.  I am using s/// to replace (/) with
 any number of (\).  I have tried up to eight (8) back-slashes; but,
 everytime the script mis-behaves, and I have not been able to complete
 this simple task.
 
 What am I missing?
 
 What do you think?

I am sorry that I did not publish any code in the original post.  I have
run into back/forward slash issues on windows before; and I hoped that
there was a simple, code-agnostic solution.

I have reduced the Perl code to this:

#! /usr/bin/perl

require 5;
use diagnostics;
use strict;
use warnings;

my $prog = E:/usr/ov/bin/nvhotbackup.bat;
my $dir = 'E:/backup';

my $dest = timestamp();
mkdir $dir/$dest;
do_prog($prog, $dir, $dest);

exit 0;

# Run system command  return exit code
sub do_prog {
my ($prog, $dir, $dest) = @_;

# $dir =~ s!/!!g;

my $cmd = join  , $prog, $dir, $dest;
print CMD == , $cmd, \n;

# return 1;

my $null = NUL;
#   system $cmd $null 21;
system $cmd;
1;
}

# Get date  time string
sub timestamp {
@_ = localtime($_[0]
? shift
: time()
);
return sprintf %d%02d%02d%02d%02d%02d, $_[5] + 1900,$_[4] + 
1,$_[3],$_[2],$_[1],$_[0];
}

==


[A] As is, $prog fails like this:

  Invalid switch - backup\20051028070933.

Nevertheless, $dir/$dest *DOES* get created.

[B] When I do any of these in do_prog:

  $dir =~ s!/!\\!g;
  $dir =~ s!/!!g;
  $dir =~ s!/!\\!g;
  $dir =~ s!/!!g;

I do *NOT* get errors from $prog; but, $dir/$dest does *NOT* get
created.  In the real script, I am doing error checking; and the
following does *NOT* die:

mkdir $dir/$dest
or die \n\n\tERROR: Cannot create \'$dir/$dest\' : $! : $?\n\n;

Nor, does it get created ;

Without that directory, $prog *CANNOT* do what it is intended to do
(e.g., copy files into that directory.)

[C] Obviously, when I use the `return 1;', and bypass system(), then the
directory gets created, regardless of back or forward slashes.

[D] This is supposed to be run as Scheduled Task/cron; so, the $null
issue is to eliminate unnecessary noise.  Whether or not I use that
in this test code does *NOT* seem to affect the results.

[E] $prog itself is copyrighted.  If necessary, I will try and reduce
that, and publish it as well.  It is doing basic batch file stuff,
setting variables and copying files.  Normally, I would convert its
code, and incorporate that into Perl; but, my client is concerned
about future upgrades of the large program, whence $prog comes,
breaking functionality -- the old customizations broken by other
software upgrades problem ;  My Perl program is to be a wrapper to
allow automated, unattended use of this proprietary program.


What do you think?


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Back-slashes calling a batch file from perl ???

2005-10-28 Thread Michael D Schleif
* $Bill Luebkert [EMAIL PROTECTED] [2005:10:28:07:21:26-0700] scribed:
 I ran it like this and it seems OK, but I don't have the same conditions:

There's the rub ;

 use diagnostics;
 use strict;
 use warnings;
 
 my $prog = E:/usr/ov/bin/nvhotbackup.bat;
 my $dir = 'E:/backup';
 
 if (not -d $dir) {
   mkdir $dir or die mkdir $dir: $! ($^E);
 }

I have cut-pasted your exact code.  Please, recognize that my real code
does use tests of this nature.

Also, please, notice the anomaly I tried to describe in my last post,
regarding whether or not this directory actually gets created (see
below.)

 my $dest = timestamp ();
 if (not -d $dir/$dest) {
   mkdir $dir/$dest or die mkdir $dir/$dest: $! ($^E);
 }
 
 do_prog ($prog, $dir, $dest);
 
 exit 0;
 
 # Run system command  return exit code
 
 sub do_prog {
   my ($prog, $dir, $dest) = @_;
 
 $dir =~ s!/!\\!g; # this one you definitely need
 $prog =~ s!/!\\!g;# this may be optional

This is _not_ required, since MS Windows 2003 Server _does_ follow
forward slashes in cmd shell.

 my $cmd = qq{$prog $dir $dest};
 print CMD == , $cmd, \n;
 
 # my $null = NUL;
 # system $cmd $null 21;
 
 system $cmd;  # seems OK

Again, I get the same results that I have always had at this point.
Your code has not affected my results ;

 # my @res = `$cmd`;   # also tried this OK
 #print res='@res'\n;

The reason that this is *not* an option is, I need to use the exit codes
from the call to batch file.

 }
 
 # Get date  time string
 
 sub timestamp {
   @_ = localtime ($_[0] ? shift : time);
 return sprintf %d%02d%02d%02d%02d%02d, $_[5]+1900, $_[4]+1, $_[3], $_[2],
   $_[1], $_[0];
 
 }
 
 __END__
 
  
  [A] As is, $prog fails like this:
  
Invalid switch - backup\20051028070933.
  
  Nevertheless, $dir/$dest *DOES* get created.
 
 That's because you do a mkdir in the script ??
snip /

Please, understand: Whenever I use back-slashes -- however many, however
quoted do far -- this directory does *NOT* get created!  Nor does the
Perl code die at the mkdir test ?!?!

Here are my two (2) basic problems:

[A] The called batch file will not accept a file path with
forward-slashes; and

[B] When I pass the directory string _with_ back-slashes, the mkdir :
- does *NOT* create a directory;
- does *NOT* die nor croak any warning;
- function is passed and do_prog() *IS* called;
Of course, since the batch file concatenates $dir and $dest into a
directory path, into which it tries to copy many files, the batch
file *ALWAYS* fails, because there is *NO* directory into which
those files can be copied.

Yes, I know that this is confusing; and I am quite befuddled ;

Here is information on my development workstation:
System Information:
OS NameMS Windows XP Professional
Version5.1.2600 SP 1 Build 2600

C:\perl -v

This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)

Copyright 1987-2005, Larry Wall

Binary build 813 [148120] provided by ActiveState
http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  6 2005 13:36:37


What do you think?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Back-slashes calling a batch file from perl ???

2005-10-28 Thread Michael D Schleif
* $Bill Luebkert [EMAIL PROTECTED] [2005:10:28:16:54:19-0700] scribed:
 Michael D Schleif wrote:
  * $Bill Luebkert [EMAIL PROTECTED] [2005:10:28:07:21:26-0700] scribed:
snip /

  I have cut-pasted your exact code.  Please, recognize that my real code
  does use tests of this nature.

Please, take careful note of the above statement.

 If your mkdir is failing in the Perl script, could there be a permissions
 problem ?  You're using /'s instead of \'s like the above right ?

As you know, this is a very complex problem.

[A] When my Perl code _always_ uses forward-slashes, then the Perl mkdir
*DOES* work; but, the BAT cannot use the directory path argument
passed to it.

[B] So, _ALL_ I change is the forward-to-back slashes, and _ONLY_ for
the directory path argument.  Then, the Perl mkdir does *NOTHING*,
and the Perl mkdir does *NOT* croak nor die.  On top of that, the
code continues on into the BAT code, whereupon the BAT cannot do its
job, because its job is to copy files into the dir that was to be
created by the Perl mkdir -- follow the sequence in the sample code.

Yes, this is bizarre behavior.  Yes, this should be a simple case of
swapping slashes.  Unfortunately, this is _not_ that simple ;

  Also, please, notice the anomaly I tried to describe in my last post,
  regarding whether or not this directory actually gets created (see
  below.)
snip /

  system $cmd;   # seems OK
  
  Again, I get the same results that I have always had at this point.
  Your code has not affected my results ;
  
  # my @res = `$cmd`;# also tried this OK
  #print res='@res'\n;
  
  The reason that this is *not* an option is, I need to use the exit codes
  from the call to batch file.
 
 You still can get the return code from `` calls:
 
 $CHILD_ERROR
 $?  The status returned by the last pipe close, backtick (``) command,
 successful call to wait() or waitpid(), or from the system()
 operator. This is just the 16-bit status word returned by the 
 wait()
 system call (or else is made up to look like it). Thus, the exit
 value of the subprocess is really ($?  8), and $?  127 
 gives
 which signal, if any, the process died from, and $?  128 
 reports
 whether there was a core dump. (Mnemonic: similar to sh and ksh.)

O, I see -- somehow, I thought that I had gone this route before, and
this was not the case.

I will have to test this, rather than system().  The true test must wait
until Monday, when I have access to the systems on which this must run.

  Please, understand: Whenever I use back-slashes -- however many, however
  quoted do far -- this directory does *NOT* get created!  Nor does the
  Perl code die at the mkdir test ?!?!
 
 Then don't use back slashes.  I created the dir without them - look at
 the mkdir's above.

Creating the directory with forward-slashes is *NOT* the problem.  Why
is this so hard for me to explain?

The problem is, the BAT will not accept the first argument (%1) as a
directory path when I use forward slashes.  So, I am forced to change
the back-slashes *ONLY* for this argument; and when I do that, then the
previous mkdir does *NOT* happen.

What part of this do you not understand?  How can I make this clearer
for you?

  Here are my two (2) basic problems:
  
  [A] The called batch file will not accept a file path with
  forward-slashes; and
 
 So reverse them just before the system call.

That is _exactly_ what I am doing.  Don't you see that in the sample
code?

  [B] When I pass the directory string _with_ back-slashes, the mkdir :
 
 I thought the dir was already made before passing the args to the bat file ?
 
  - does *NOT* create a directory;
 
 The mkdir (in the Perl code) should have already created the dir and it
 works fine with slashes, so use them there.

Again, this *IS* the crux of the problem!

 I'm not following you - be more explicit on where the mkdir is - Perl or bat ?

Do you see the mkdir in the Perl sample code I have published?

That is the one and only mkdir -- period.

  - does *NOT* die nor croak any warning;
  - function is passed and do_prog() *IS* called;

Did you really read what I wrote there?  Literally, that is what I mean.
No, it does not make sense; but, that *IS* what happens.

  Of course, since the batch file concatenates $dir and $dest into a
  directory path, into which it tries to copy many files, the batch
  file *ALWAYS* fails, because there is *NO* directory into which
  those files can be copied.
 
 If that's true, you should first concentrate on getting the mkdir in
 the Perl script to work so it's there - before you deal with the bat file.
snip /

I am not allowed to modify the BAT code.  What it does is take two (2)
arguments; and, after some other processing, the BAT code concatenates
the two arguments, like this:

%1\%2

Whereupon, it copies a bunch of files to that path

Re: Back-slashes calling a batch file from perl ???

2005-10-28 Thread Michael D Schleif
* $Bill Luebkert [EMAIL PROTECTED] [2005:10:28:19:49:55-0700] scribed:
snip /

 The fact that you used the same code means nothing since 1) we seem to be
 talking apples and oranges and 2) your bat file is different.
snip /

 Then you don't have a problem - use the forward slashes to do the mkdir.
snip /

 NO You just said it worked with forward slashes - so use forward slashes.
 Switch the slashes *AFTER* you do the mkdir.
snip /

 Yes - it is or you're not splaining yourself very well.
snip /

 Beats me, but you're not.
snip /

 You're not getting it.  Use forward slashes *ONLY* for the Perl script
 mkdir and then switch to back slashes.
snip /

 You're doing a terrible job and I'm trying to be clearer than you are.
snip /

 Yes, but you said it fails.  It should work cause you said it works
 with back slashes.  You're doing a terrible job of explaining your
 slashes.
snip /

 And you said it works if ytou use slashes - so use them.
snip /

 No - you haven't explained anything where I can understand it.  You keep
 contradicting yourself (at least that's what I'm reading).
snip /

 Looks simple enough to me and works for me.
snip /

 What you're not getting across is where the problem is.
 
 You said the mkdir works with forward slashes and the bat file works
 with back slashes.  So use forward on the mkdir and back on the bat call.
 It's that simple.  Now where does it fail under those circumstances ?


One more way to explain this:

[A] Using Code #1, the Perl mkdir successfully creates $dir/$dest, and
goes on to call $prog.  $prog fails, because it will not accept $dir as
a valid directory while using forward-slashes (/).  At one trial, the
stderr returned was this:

Invalid switch - backup\20051028070933.

[B] Using Code #2, the Perl mkdir does *NOT* create $dir/$dest; nor does
it croak, nor does it die !?!?  Nevertheless, the Perl code goes into
$prog; but, the BAT code cannot copy files into %1\%2, because that
directory does *NOT* exist, because the Perl code somehow did *NOT*
mkdir it !?!?


I know that this is bizarre behavior.  I cannot explain it -- hence, my
series of incomprehensible posts ;

Is this explication any clearer?


###  Code #1 : BEGIN  

#! /usr/bin/perl
use diagnostics;
use strict;
use warnings;

my $prog = E:/usr/ov/bin/nvhotbackup.bat;
my $dir = 'E:/backup';

if (not -d $dir) {
mkdir $dir or die mkdir $dir: $! ($^E);
}
my $dest = timestamp ();
if (not -d $dir/$dest) {
mkdir $dir/$dest or die mkdir $dir/$dest: $! ($^E);
}
do_prog ($prog, $dir, $dest);

exit 0;

sub do_prog {
my ($prog, $dir, $dest) = @_;
###  Substitution line omitted  ###
my $cmd = qq{$prog $dir $dest};
print CMD == , $cmd, \n;
system $cmd;# seems OK
}

sub timestamp {
@_ = localtime ($_[0] ? shift : time);
return sprintf %d%02d%02d%02d%02d%02d,
$_[5]+1900, $_[4]+1,
$_[3], $_[2], $_[1], $_[0];
}
__END__

###  Code #1 : END  


###  Code #2 : BEGIN  

#! /usr/bin/perl
use diagnostics;
use strict;
use warnings;

my $prog = E:/usr/ov/bin/nvhotbackup.bat;
my $dir = 'E:/backup';

if (not -d $dir) {
mkdir $dir or die mkdir $dir: $! ($^E);
}
my $dest = timestamp ();
if (not -d $dir/$dest) {
mkdir $dir/$dest or die mkdir $dir/$dest: $! ($^E);
}
do_prog ($prog, $dir, $dest);

exit 0;

sub do_prog {
my ($prog, $dir, $dest) = @_;
$dir =~ s!/!\\!g;   # this one you definitely need
my $cmd = qq{$prog $dir $dest};
print CMD == , $cmd, \n;
system $cmd;# seems OK
}

sub timestamp {
@_ = localtime ($_[0] ? shift : time);
return sprintf %d%02d%02d%02d%02d%02d,
$_[5]+1900, $_[4]+1,
$_[3], $_[2], $_[1], $_[0];
}
__END__

###  Code #2 : END  


-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Back-slashes calling a batch file from perl ???

2005-10-27 Thread Michael D Schleif
I have a perl script that calls a batch file (necessary), and passes it
two arguments.  The first argument is a directory name, and the second a
simple label.

When I used forward-slashes (/) everywhere, the perl script behaves as
expected; but, the batch file refuses to recognize the legitimacy of the
directory name; at least in the context of passing it to the batch file
in a system() call, as I need to parse the exit codes.

my $dir = E:/backup;

Yes, I test `-d $dir' successfully.  The batch file refuses to accept
$dir while using forward-slashes.  I am using s/// to replace (/) with
any number of (\).  I have tried up to eight (8) back-slashes; but,
everytime the script mis-behaves, and I have not been able to complete
this simple task.

What am I missing?

What do you think?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Help: Query All Network Drives - Available or Not

2005-09-28 Thread Michael Cohen

I have a problem trying to query all network drives that are currently used by my machine.  If I perform a simple net use command, I get the following response:

New connections will be remembered.

StatusLocal   Remote  Network
---
Unavailable L:\\rtpgsa.raleigh.ibm.com\rtpgsa
Microsoft Windows Network
Unavailable M:\\rtpgsa.raleigh.ibm.com\homes
Microsoft Windows Network
Unavailable P:\\MICOHEN3-AFS\projects  Microsoft Windows Network
Unavailable R:\\MICOHEN3-AFS\rootMicrosoft Windows Network
Unavailable T:\\MICOHEN3-AFS\nt Microsoft Windows Network
Unavailable U:\\MICOHEN3-AFS\userMicrosoft Windows Network
Unavailable V:\\MICOHEN3-AFS\vlibMicrosoft Windows Network
Disconnected X:\\squeaker\f$   Microsoft Windows Network
Disconnected Y:\\squeaker\c$   Microsoft Windows Network
OK  Z:\\micohen2.raleigh.ibm.com\g$
Microsoft Windows Network
The command completed successfully.


However, if I use either the Win32::AdminMisc::GetDrives or Win32::FileOp::Mapped commands to query the network drives, I only get responses indicating the two drives, X and Y, which in net use are disconnected, and Z, which is OK.

How do I get a list of ALL network drives, Available, Unavailable, and Disconnected, without actually using the net use command?

Thank you for your assistance!

Regards,
Michael Cohen
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


cron for windows ???

2005-08-24 Thread Michael D Schleif
We have a script that runs as expected from CLI.  Basically, it parses
logfiles, and prepends to another logfile one line of summary.  Very
basic, very simple stuff.

We want it to run once per day at a specified time.  It runs on a
Windows Server 2003 box.  Windows Scheduler is very flaky on this box --
sometimes it runs the script, sometimes not.  When it does run the
script, it runs as expected.

I have googled for cron implementations for windows, and I found these:
- cronw http://sourceforge.net/projects/cronw
- cron  http://www.kalab.com/freeware/cron/cron.htm

Clearly, these are two completely different implementations, one Perl
and the other compiled.  Both fail to successfully run our script,
apparently failing for same reasons.

Unfortunately, I do not understand why the code succeeds from CLI and
fails from these cron's.  Here is the first point of breakage in the
code:

-f $out_file
or die \n\tERROR: *NOT* a file: \'$out_file\'\n\n;

I have simplified this, with same failure:

-f $out_file and die;

Earlier code defines:

my $out_dir = P:/Backup;
my $out_file = Tape_Slot.log;
$out_file = $out_dir . '/' .  $out_file;

Yes, I am aware of issues with forward  backward slashes; and issues
with single  double quotes.  No, I have NOT found any combination of
these characters that allow cron to successfully execute this code.
Also, remember, the existing code runs exactly as expected from CLI.

I will gladly publish more code, and try suggestions, if requested.  At
this point, I am trying to present the succinct case, and plead for your
kind assistance.

What do you think?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: cron for windows ???

2005-08-24 Thread Michael D Schleif
* On 2005:08:24:10:50:34-0500 I, Michael D Schleif [EMAIL PROTECTED], scribed:
snip /

 Here is the first point of breakage in the code:
 
 -f $out_file
 or die \n\tERROR: *NOT* a file: \'$out_file\'\n\n;
 
 I have simplified this, with same failure:
 
 -f $out_file and die;
snip /

Err ... umm ... actually:

-f $out_file or die;

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Error 1053 starting Win32::Daemon service

2005-08-09 Thread Michael Meltzer
try installing the service with complete requirements like

perl dirmon.pl -install -d dir to monitor -l file path where to log

Michael


[EMAIL PROTECTED] wrote:

 My apologies if this ends up posted multiple times, but I
 suspect the first attempt failed...

 I’ve been having a battle getting a simple perl script to
 start as a Win32 service (using Win32::Daemon) on XP. In
 frustration I’ve reverted to the DIRMON script from David
 Roth’s website, which is touted as the example, and I’m
 having exactly the same problems with that. Methinks the
 problem is with me, and a lack of something in the Win32
 knowledge department (my background is primarily VMS 
 Unix) – hopefully someone can point me in the right
 direction.

 I have no problems installing the DIRMON script via a
 simple

perl DIRMON.pl –install

 I’ve done this without any account or other parameters,
 but from looking at the installed service, it seems to add
 sensible defaults. If I now try and start this through the
 SCM, it immediately returns with

 Could not start the directory monitoring service on the
 local computer
 Error 1053: The service did not respond to the start or
 control request in a timely fashion

 Thinking that this could be a privilege issue with running
 outside an account context, I’ve tried to start this with
 an account and password

perl DIRMON.pl –install –user xxx –pass xxx

 I actually set up an account called xxx with the same
 password, so this is literally what was entered. This
 returns with;

 Failed to add the Directory Monitoring Service.
 Error: The account name is invalid or does not exist, or
 the password is invalid for the account name specified

 I’ve then tried installing this as a system service, then
 manually adding the account and password to the logon
 details in the services console, and starting this again.
 This still returns with the 1053 error above.

 I have found the SCM events logged for the startup
 failures, and these are all of the form

 Timeout (3 milliseconds) waiting for the Directory
 Monitoring Service service to connect.

 This implies that the SCM waited for 30 seconds for
 something to happen, but in all cases I have seen the
 failure was reported immediately the start request was
 made

 What am I missing??? How do you debug problems at the
 service level?

 Thanks for any help or pointers

 Andrew
 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

--
+-- Michael Meltzer -+-+
|   AED-SICAD Aktiengesellschaft |   EMail : [EMAIL PROTECTED]  |
|   Lilienthal-Str. 7|   Phone : +49-89-45026-108  |
|   85579 Neubiberg  |   Fax   : +49-89-45026-113  |
++-+




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


second try - Win32::ChangeNotify

2005-08-05 Thread Michael Meltzer
This message I posted yesterday but got now answer except some out of office 
replies.
Maybe my Question was not clear.
My Question is:
why does the script not fire if it runs as service ?



With this module I monitor changes in a directory:

mailprot(Monitoring started);   

$WatchSubTree = 1;  
$Events = 'FILE_NAME';  

Win32::ChangeNotify::FindFirst($monitor, $MonDir, $WatchSubTree,
FILE_NOTIFY_CHANGE_FILE_NAME
  );

 while ($monitor-FindNext()) {
$monitor-Wait( INFINITE );
#sleep(300);
$Inhalt = ;   
if (! opendir (BKDIR, $MonDir)) {   
  mailprot(can't opendir $MonDir:\n   $!\n);
}
while (defined ($fname = readdir(BKDIR))) {
   next if $fname =~ /^\.$/;   
   next if $fname =~ /^\.\.$/;
   next if $fname =~ /@ReadMe\.htm/i;
   next if $fname =~ /^Bitte Version und Sprache/i;
   $Inhalt = ${Inhalt}\n$fname;  
}   
close BKDIR;
mailprot(Aenderungen im Briefkasten:\n$Inhalt);
 }

END{ mailprot(Monitoring stopped); } 
exit 0;


I compiled the program with perl2exe to an exe file.

If I start the  program from comand line all works fine.
If it runs as service I get the start message (see first line in script) but no
message if something changes in the monitored directory.

The service was created as described in Dave Roth's  Book
'Win32 Perl Scripting', Page  274  in the following way:

instsrv.exe Monitor  C:\WIN_NT\system32/srvany.exe

Modifying the registry was not as described in the book. I had to create 
the Parameters key.
Should the key not be there already ?
That's what I now have in the registry:
'Monitor' has the keys Enum, Parameters, Security
Parameters has the String Values: Application   REG_SZ  Path to my exe file
  AppParameters REG_SZ
  (Default) REG_SZ  (Value not set)

If I start or stop the service I get the start or stop message by mail
but if I create or delete a file in the monitored directory I get no 
message.

Why ?

Environment: Win2000 (upgrade from NT) SP4
ActiveState perl 5.6.1.623
Win32::ChangeNotify 1.02

Michael

-- 
Michael Meltzer  AED-SICAD AGLilienthal-Str. 7  D-85579 Neubiberg
Tel.:+49 89 45026 108Fax: +49 89 45026 113
[EMAIL PROTECTED]
http://www.aed-sicad.de/

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: second try - Win32::ChangeNotify

2005-08-05 Thread Michael Meltzer
Thank you for your reply.
I tryed Win32::Daemon but i don't know how to pause Wait( Infinite ) ?

Michael

Ñåðãåé ×åðíèåíêî wrote:

 hello, Michael,

 Friday, August 05, 2005, 1:07:42 PM, You wrote:

 MM If I start or stop the service I get the start or stop message by mail
 MM but if I create or delete a file in the monitored directory I get no
 MM message.

 MM Why ?

 MM Environment: Win2000 (upgrade from NT) SP4
 MM ActiveState perl 5.6.1.623
 MM Win32::ChangeNotify 1.02

 I think it's not Win32::ChangeNotify issue. most likely service
 not properly installed. And on Roth's site (roth.net) there is
 module Win32::Daemon which can be used to install service
 properly. hope this help You.

 MM Michael

 --
 Ñ óâàæåíèåì,
  Ñåðãåé   mailto:[EMAIL PROTECTED]

 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

--
+-- Michael Meltzer -+-+
|   AED-SICAD Aktiengesellschaft |   EMail : [EMAIL PROTECTED]  |
|   Lilienthal-Str. 7|   Phone : +49-89-45026-108  |
|   85579 Neubiberg  |   Fax   : +49-89-45026-113  |
++-+




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: second try - Win32::ChangeNotify

2005-08-05 Thread Michael Meltzer
solved my problem ! found perl script dirmon.pl at dave roth's site.
Thanks again for your advice and to mention dave roth's site.

Michael


Ñåðãåé ×åðíèåíêî wrote:

 hello, Michael,

 Friday, August 05, 2005, 1:07:42 PM, You wrote:

 MM If I start or stop the service I get the start or stop message by mail
 MM but if I create or delete a file in the monitored directory I get no
 MM message.

 MM Why ?

 MM Environment: Win2000 (upgrade from NT) SP4
 MM ActiveState perl 5.6.1.623
 MM Win32::ChangeNotify 1.02

 I think it's not Win32::ChangeNotify issue. most likely service
 not properly installed. And on Roth's site (roth.net) there is
 module Win32::Daemon which can be used to install service
 properly. hope this help You.

 MM Michael

 --
 Ñ óâàæåíèåì,
  Ñåðãåé   mailto:[EMAIL PROTECTED]

 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

--
+-- Michael Meltzer -+-+
|   AED-SICAD Aktiengesellschaft |   EMail : [EMAIL PROTECTED]  |
|   Lilienthal-Str. 7|   Phone : +49-89-45026-108  |
|   85579 Neubiberg  |   Fax   : +49-89-45026-113  |
++-+




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::ChangeNotify

2005-08-04 Thread Michael Meltzer

With this module I monitor  changes in a directory:

mailprot(Monitoring gestartet);   

$WatchSubTree = 1;  
$Events = 'FILE_NAME';  


Win32::ChangeNotify::FindFirst($monitor, $MonDir, $WatchSubTree,
   FILE_NOTIFY_CHANGE_FILE_NAME
 );

while ($monitor-FindNext()) {
   $monitor-Wait( INFINITE );
#sleep(300);
   $Inhalt = ;   
   if (! opendir (BKDIR, $MonDir)) {   
 mailprot(can't opendir $MonDir:\n   $!\n);

   }
   while (defined ($fname = readdir(BKDIR))) {
  next if $fname =~ /^\.$/;   
  next if $fname =~ /^\.\.$/;

  next if $fname =~ /@ReadMe\.htm/i;
  next if $fname =~ /^Bitte Version und Sprache/i;
  $Inhalt = ${Inhalt}\n$fname;  
   }   
   close BKDIR;

   mailprot(Aenderungen im Briefkasten:\n$Inhalt);
}

END{ mailprot(Monitoring gestoppt); } 
exit 0;



I compiled the program whith perl2exe to an exe file.

If I start the  program from comand line all works fine but if it runs 
as service I get no
message if something changes in the monitored directory but i get the 
start message

(see first line in script)

The service was created as described in Dave Roth's  Book
'Win32 Perl Scripting', Page  274  in the following way:

instsrv.exe monitor  C:\WIN_NT\system32/srvany.exe

Modifying the registry was not as described in the book. I had to create 
the Parameters key.

Should the key not be there already ?
That's what I now have in the registry:
'Monitor' has the keys Enum, Parameters, Security
Parameters has the String Values ApplicationREG_SZ  Path to my 
exe file

  AppParameters REG_SZ
  (Default)   
REG_SZ  (Value not set)

If I start or stop the service I get the start or stop message by mail
but if I create or delete a file in the monitored directory I get no 
message.

Why ?

Details: Win2000 (upgrade from NT) SP4
ActiveState perl 5.6.1.623
Win32::ChangeNotify 1.02

Michael

--
Michael Meltzer  AED-SICAD AGLilienthal-Str. 7  D-85579 Neubiberg
   Tel.:+49 89 45026 108Fax: +49 89 45026 113
[EMAIL PROTECTED]
http://www.aed-sicad.de/

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Split function in Perl

2005-07-26 Thread Michael Louie Loria
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Thanks for all the replies.

I'm tesing the Text::ParseWords

I'm new in Perl and I'm a little bit confused with the PATTERNS
option but I'm learning it.

Is this code good for checking valid date in the format -MM-DD?
or do you have any other suggestions

sub isvaliddate {
~  my $input = shift;
~  if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[-
/.](0[1-9]|[12][0-9]|3[01])$!) {
~# At this point, $1 holds the year, $2 the month and $3 the day
of the date entered
~if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) {
~  return 0; # 31st of a month with 30 days
~} elsif ($3 = 30 and $2 == 2) {
~  return 0; # February 30th or 31st
~} elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100
 0 or $1 % 400 == 0))) {
~  return 0; # February 29th outside a leap year
~} else {
~  return 1; # Valid date
~}
~  } else {
~return 0; # Not a date
~  }
}

The link for that code is
http://www.regular-expressions.info/dates.html coz you might not
understand the code

Thanks,

Michael Louie Loria
-BEGIN PGP SIGNATURE-
Comment: Public Key: https://www.biglumber.com/x/web?qs=0x4A256EC8
Comment: Public Key: http://www.lorztech.com/GPG.txt
Comment: Yahoo ID: michaellouieloria

iQEVAwUBQua0F7XBHi2y3jwfAQoUaAf/dkEy1hqp6dG/tBONFj7EPU7/XP+YqBgL
YRXEo64R8CP3yMkUJXTQrKSEUWVeitgF2lim1BRzR1VfvTDLFJn1kh02n7tVgw1z
/F9n2y0O9pKbqkCm6BE7zzLiZpfPMS+weycbwUvp6dVUVjOLZ073b2LhAcvfq4UU
bTMqRLicxIPFTq9U1HPXCq3rrq3PK/u1CLSNfu/7GXoQ64eXSb+TrPdnNTgGLwEh
A9KtGrKgGrOkFyhA8dPNypR1aaRVszWTHTUSjRxivXlfjJOmtY1/iIEAN8pVLOUc
9z35ht6O4o3CIBGUOtDF34r8Y2MYTs9mFSJ/7lcBOYtnZN02dUYHSQ==
=3GPb
-END PGP SIGNATURE-

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Split function in Perl

2005-07-26 Thread Michael Louie Loria
$Bill Luebkert wrote:
 Michael Louie Loria wrote:
 
 
I'm tesing the Text::ParseWords

I'm new in Perl and I'm a little bit confused with the PATTERNS
option but I'm learning it.

Is this code good for checking valid date in the format -MM-DD?
or do you have any other suggestions
 
 
 What's with the ~'s starting each line ?
 
 
sub isvaliddate {
~  my $input = shift;
~  if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[-
/.](0[1-9]|[12][0-9]|3[01])$!) {
~# At this point, $1 holds the year, $2 the month and $3 the day
of the date entered
~if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) {
~  return 0; # 31st of a month with 30 days
~} elsif ($3 = 30 and $2 == 2) {
~  return 0; # February 30th or 31st
~} elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100
 0 or $1 % 400 == 0))) {
~  return 0; # February 29th outside a leap year
~} else {
~  return 1; # Valid date
~}
~  } else {
~return 0; # Not a date
~  }
}

The link for that code is
http://www.regular-expressions.info/dates.html coz you might not
understand the code
 
 
 # test a few examples:
 
 foreach ('2005-02-30', '2005-04-31', '2005-13-30', '2005-02-35', '2005-02-00',
   '2005-01-30',) {
 
   my $bool = isvaliddate ($_);# your code
   printf $_ is%s valid\n, $bool ? '' : ' not';
 
   $bool = is_valid_date ($_); # alternative code
   printf $_ is%s valid\n, $bool ? '' : ' not';
 }
 exit;
 
 # Reformatted it and changed  to != and it seems ok to me :
 
 sub isvaliddate {
   my $input = shift;
 
 # you could just use substr's and length() here instead of a RE
 # for hopefully a little more speed :
 
 # return 0 if length $input != 10 or substr ($input, 4, 1) ne '-'
 #   or substr ($input, 7, 1) ne '-';
 # my $year = substr $input, 0, 4;
 # my $month = substr $input, 5, 2;
 # my $day = substr $input, 8, 2;
 # then replace $1, $2 and $3 with $year, $month and $day
 
 if ($input !~
   m#^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$#) {
   return 0; # Not a date
 }
 
 # $1 = year, $2 = month $3 = day of month
 
 if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) {
   return 0;   # 31st of a month with 30 days
 } elsif ($3 = 30 and $2 == 2) {
   return 0;   # February 30th or 31st
 } elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and
   ($1 % 100 != 0 or $1 % 400 == 0))) {#  0 was wrong for != 0
   return 0;   # February 29th outside a leap year
 }
 return 1; # Valid date
 
 }
 
 This should work as well (maybe better) - letting the system do most of the
 grunt work but is much slower than yours :
 
 sub is_valid_date {
   my $datestr = shift;
   require Time::Local;
 
 my @d = (0, 0, 12, (split /-/, $datestr)[2, 1, 0]);
 $d[4]--; $d[5] -= 1900;
 eval Time::Local::timegm ([EMAIL PROTECTED]);   # see if it converts to 
 epoch ok
 return $@ ? 0 : 1;# return 0 if error else 1
 
 }
 
 __END__
 
 


Sorry for the ~ character. My MUA added it. I have tested the code 
and is really good but I had to change a line of code

elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100  0 
or $1 % 400 == 0)))

to

elsif ($2 == 2 and $3 == 29 and ($1 % 4 != 0 and ($1 % 100 == 0 or 
$1 % 400 != 0)))

coz I had errors with the former. I think the culprit was the NOT [
not ($1 % 4 == 0 and ($1 % 100  0 or $1 % 400 == 0)  ].

Thanks again

Michael Louie Loria


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

signature.asc
Description: 3412282408-signature.asc
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Split function in Perl

2005-07-25 Thread Michael Louie Loria
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hello,

I have a problem with the split function.


string
- - -
one two three four five six seven

should be split to
- - -
one
two three
four five
six
seven


string
- - -
one two three four five six seven

should be split to
- - -
one
two
three
four
five
six
seven


the difference is the string enclosed withis considered as 1
string even with spaces.

Thanks,

Michael Louie Loria
-BEGIN PGP SIGNATURE-
Comment: Public Key: https://www.biglumber.com/x/web?qs=0x4A256EC8
Comment: Public Key: http://www.lorztech.com/GPG.txt
Comment: Yahoo ID: michaellouieloria

iQEVAwUBQuZ7drXBHi2y3jwfAQqL6QgAiROSQrYOyuoITOPNsSxdtYT4VLDeEy6u
LFGQlEcdX2b4nkcPkmNcOEbt6qlnWHjnhQwODEH34+BjIpgAb/7yrIxmlQRPnmnj
/4O4x0YnFa71Gl7jUwythyv3gDeBo12x6GA+SZU/sdNL0IbDGu1qe0aXxEL7dt0I
kveNDhglPqihuWmAG6cqb0CatkV9na9Fg/whsfHbwIGPY4fYCSPi7GzXT+M/K0Mi
yGslp31ibW4ZVWtDm+v6g8dV4RFiKfSSpk8c65S7i384vU0RdhdPMu6Qww2U4PYa
yKdLLZ49XTG7AbMHiF/r6VUMf8rUJ0vE0I83uH1hAGI+x40K2tqiag==
=icS0
-END PGP SIGNATURE-




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Change in goto behavior

2005-07-14 Thread Michael Erskine
On Thursday 14 July 2005 03:26, Hugh Loebner wrote:
 My previous message was attached to the wrong posting.

 I doubt very much whether there is any occasion where gotos are most
 appropriate.   Please provide an example.

TMTOWTDI :)

-- 
Do nothing unless you must, and when you must act -- hesitate.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Change in goto behavior

2005-07-13 Thread Michael Erskine
On Wednesday 13 July 2005 13:30, Hugh Loebner wrote:
 Why on earth are you using a goto statement? They are pernicious.

On the contrary, a goto is often most appropriate in expressing clear program 
flow.

Regards,
Michael Erskine

-- 
Kinkler's First Law:
 Responsibility always exceeds authority.

Kinkler's Second Law:
 All the easy problems have been solved.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


drag'n'drop onto desktop icon ???

2005-05-23 Thread Michael D Schleif
I have a perl program that successfully processes a set of text files.
So far, the UI is to pass the incoming text file to the program on the
command line.

Users want an icon on their desktops, and they want to drag the text
file onto this icon, in order to process the file.

I have not been able to figure out how to do this.

What do you think?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


CSV: help optimize ???

2005-05-23 Thread Michael D Schleif
I have an ongoing stream of CSV files of varying lengths (some quite
long), and of various CSV formats.  I am using Text::CSV_XS to parse the
records; which works except in that case where the incoming file
surrounds each RECORD with double-quotes.

I find this to be aberrant behaviour.  How can I tell Text::CSV_XS to
ignore double-quotes around records?

I have the following code that normalizes each line prior to parsing
with Text::CSV_XS:

if (
 /^/
   /$/
 tr/// == 2
){
s!(^|$)!!g;
}

Obviously, in the majority of cases this should be a no-op, since
double-quotes surround fields, NOT records.

How can I optimize this sub-routine for minimal processing overhead in
those cases where it does not apply?

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--


signature.asc
Description: Digital signature
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: sort question

2004-12-16 Thread Michael Meltzer
$Bill Luebkert wrote:

 Michael Meltzer wrote:

  The following strings I have in an array:
 
  xyz
  abcd
  ZABC
 
  if I do @sorted = sort(@unsorted) I get
 
  ZABC
  abcd
  xyz
 
  I would like to sort this strings alphabetical ignoring capitalisation but 
  whithout changing the output format.
  I want to get this:
 
  abcd
  xyz
  ZABC
 
  How can I do this ?

 Taken directly from sort func on perlfumc man page :

 # now case-insensitively
 @articles = sort {uc($a) cmp uc($b)} @files;

Sorry, I didn't reckon with this example in the man page. I looked in my perl 
books and didn't find
it (needless to say ;)
Thanks to all who answered !

Michael



 --
   ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
  (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
   / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
 -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

--
+-- Michael Meltzer -+-+
|   AED-SICAD Aktiengesellschaft |   EMail : [EMAIL PROTECTED]  |
|   Lilienthal-Str. 7|   Phone : +49-89-45026-108  |
|   85579 Neubiberg  |   Fax   : +49-89-45026-113  |
++-+



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


  1   2   3   4   >