Re: PAR failure

2014-11-15 Thread John
Hi Rob

Thanks for responding

On 15/11/2014 2:21 AM, sisyph...@optusnet.com.au wrote:
> -Original Message- From: John
> Sent: Thursday, November 13, 2014 1:25 PM
> To: pw32-users
> Subject: PAR failure
>
>> Attempt to reload Config.pm aborted.
>
> I've not struck this error before.
> If you google that error message you'll get a few hits. Do any of them
> help you at all ?
>
> Is your Config.pm normally loadable ? For example, do the following work
> without error:
>
> perl -MConfig -e 1
> perl -MConfig -e "use Config;"
>
> Both of those commands should produce no output at all.

Which is exactly what I got.

I was able to build a 'Hello.par' file which executed successfully with 
'parl.exe', it only crashed when trying to make it executable. I have 
googled it, and like you, didn't find much.

I have decided to shelve the issue until I have more time, it wasn't 
critical, and have uninstalled PAR. It is time I upgraded with a fresh 
installation anyway.

>
> To reach a broader range of perl programmers I suggest you post to (eg)
> perlmonks.
>
> Cheers,
> Rob
>
>
John

-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


PAR failure

2014-11-12 Thread John
Hi

Recently updated a bunch of modules via PPM for my current version of 
ActiveState Perl on Win XP:
---
Thu 12:04> perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32- 
x86-multi-thread (with 1 registered patch, see perl -V for more detail)

Copyright 1987-2011, Larry Wall

Binary build 1402 [295342] provided by ActiveState 
http://www.ActiveState.com
Built Oct  7 2011 15:49:44

With PAR:
-
Thu 12:20> perl -MPAR -e "print \"\$PAR::VERSION = $PAR::VERSION\n\""
$PAR::VERSION = 1.005

I get this:
---
Thu 12:16> pp -o hello.exe -e "print \"hello world\n\""
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Attempt to reload Config.pm aborted.
Compilation failed in require at C:/bin/Perl/Perl514/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at C:/bin/Perl/Perl514/lib/Errno.pm 
line 8.
Compilation failed in require at C:/bin/Perl/Perl514/lib/File/Temp.pm 
line 148.
BEGIN failed--compilation aborted at 
C:/bin/Perl/Perl514/lib/File/Temp.pm line 148.
Compilation failed in require at C:/bin/Perl/Perl514/lib/Archive/Zip.pm 
line 14.
BEGIN failed--compilation aborted at 
C:/bin/Perl/Perl514/lib/Archive/Zip.pm line 14.
Compilation failed in require at -e line 228.
C:\bin\Perl\Perl514\site\bin/pp: Failed to extract a parl from 
'PAR::StrippedPARL::Static' to file 'C:\DOCUME~1\John\LOC
ALS~1\Temp\parlsmIWHrx.exe' at 
C:/bin/Perl/Perl514/site/lib/PAR/Packer.pm line 1158,  line 1.

These point to:
---
Errno.pm line 8. ==> use Config;
File/Temp.pm line 148. ==> use Errno;
Archive/Zip.pm line 14. ==> use File::Temp  ();

File write dates (dd/mm/):
--
09/03/2014  12:45   3,371  Config.pm
07/10/2011  15:47   5,787  Errno.pm

Config.pm appears to have been re-written earlier this year, probably 
not relevant. I suspect this issue might have something to do with the 
"gcc environment" but don't really know where/what to look for.

Any assistance would be appreciated.
"Clueless" John



-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


why does perl critic not like @_

2014-08-18 Thread John
Hi

I have just started using perl critic to analyse my code.

I have often used @_ as a temporary array like this:
[code]
# count internals
@_ = $h_wk->selectrow_array("SELECT COUNT(*) FROM v_internals");
my $count_all_internals = shift @_;

@_ = $h_wk->selectrow_array("SELECT COUNT(*) FROM 
v_completed_internals");
my $count_completed_internals = shift @_;

@_ = $h_wk->selectrow_array("SELECT COUNT(*) FROM v_internals "
."  WHERE asset NOT IN 
v_completed_internals");
my $count_outstanding_internals = shift @_;

@_ = $h_wk->selectrow_array("SELECT COUNT(*) FROM v_internals_in_work");
my $count_internals_in_work = shift @_;

@_ = $h_wk->selectrow_array("SELECT COUNT(*) FROM wkintnls "
."  WHERE asset NOT IN v_internals_in_work "
."AND asset NOT IN 
v_completed_internals");
my $count_internals_not_in_work = shift @_;
[/code]

Critic complains with 'Always unpack @_ first', why?
What is so wrong with this usage?

Could someone please enlighten me.

John

-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


Fwd: Re: Q: looking for some AutoIT functionality in Perl

2014-05-31 Thread John
Resending in case it might be useful, sorry it bounced last time.


 Original Message 
Subject: Re: Q: looking for some AutoIT functionality in Perl
Date: Tue, 13 May 2014 13:43:06 +1000
From: John McMahon 
Reply-To: j...@jspect.fastmail.com.au
To: perl-win32-users@listserv.ActiveState.com

Hi Daniel

Look at Win32-GUITest. This can do many of the things AutoIT can do
although I am not sufficiently familiar with it or AutoIT to advise
definitely  whether it will do the task you want.

John


On 10/05/2014 9:27 PM, Daniel Burgaud wrote:
> Hi
>
> If you are familiar with AutoIT, here are some questions I would like to
> ask regarding Perl:
>
> Does Perl have any functions, modules that allows me to
>
> #1. do PixelGetColor (x,y) and PixelSearch(x1,y1,,x2,y2,color) similar
> to AutoIT?
> Ability to get pixel and search for the pixel within a given area on the
> current displayed screen.
>
> #2. do ToolTip(text) similar to AutoIT?
> ability to print/display text/numbers on the current visible desktop
>
> #3. do ImageSearch DLL calls
> to perform image comparison between a saved PNG file and the displayed
> screen
>
> Basically I would like to write some apps, that interacts with what is
> displayed on the active screen to include screen on a game.
>
> I am more comfortable/adept programming in perl and prefer to do the app
> in Perl.
>
> thanks!
> Dan
>
>
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

-- 
Regards
John McMahon
 j...@jspect.fastmail.com.au
 04 2933 4203



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


help dbd-anydata / dbi-dbd-sqlengine issue

2013-05-18 Thread John
Hi

Several years ago I dabbled with DBD::AnyData to read and merge a 
variety of csv data files. Recently I updated my DBI module to version 
1.625 (and yesterday to 1.627). Since updating DBI my program has failed 
with an error message similar to that below (I have included a test 
script below that produces the error message).

I would like advise on how to raise this with the appropriate 
developers/maintainers.

Have I included enough info here for the developer/maintainer to track 
the problem? If not, what else should I include?

I have provided my current perl version info below, I also have an older 
perl installation (v5.10) on my computer with DBI v1.616 and 
DBI-DBD-SqlEngine v0.03 that do not fail as reported here.

Thanks
John

#[perl version]###
I am currently using ActiveState ActivePerl V5.14.
12:26>perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for 
MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more 
detail)

The DBI-DBD-SqlEngine module concerned is version 0.06.

#[err msg]#
DBD::AnyData::db do failed:
Execution ERROR: Can't call method "complete_table_name" on an undefined 
value at
C:/bin/Perl/Perl514/site/lib/DBI/DBD/SqlEngine.pm line 1503.
  called from tst_mkAP.pl at 10.

  at C:/bin/Perl/Perl514/site/lib/DBI/DBD/SqlEngine.pm line 1239
  [for Statement "CREATE TABLE AP_mem (
  date_indexINTEGER,
  amountVARCHAR(15),
  acc1  VARCHAR(8),
  acc2  VARCHAR(8),
  description   VARCHAR(30),
  voucher   VARCHAR(5),
  costctr   VARCHAR(5),
  date  VARCHAR(12)
   )"] at tst_mkAP.pl line 10.
#[\err msg]#

#[test script]#
#! perl -w
use strict;
use warnings;
use DBI;

# define transient storage table
sub mk_APmem {
my $dbh = shift @_;

$dbh->do(
   qq{CREATE TABLE AP_mem (
  date_indexINTEGER,
  amountVARCHAR(15),
  acc1  VARCHAR(8),
  acc2  VARCHAR(8),
  description   VARCHAR(30),
  voucher   VARCHAR(5),
  costctr   VARCHAR(5),
  date  VARCHAR(12)
   )}
);

my $insert   = qq{
   INSERT INTO AP_mem
   (date_index,  amount,  acc1, acc2, description,   voucher, 
costctr, date) VALUES
   ( ?,   ?, ?,?,   ?, ?, 
?,?)
};
# and return insert statement
return $insert;
}

my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):');

my $flags = {
col_names   => 'Date,Description,AccNum,Debit,Credit'
};

my $file = "C:\\Documents and Settings\\John\\My 
Documents\\dnload\\10457109_20130514.dat";

#my ($file, $flags, $dbh) = @_;

# define data source
# $dbh->func('CRU_in', 'CSV', $file, $flags, 'ad_catalog');
$dbh->func('CRU_in', 'Pipe', $file, $flags, 'ad_catalog');

# define transient storage table and return insert SQL Statement
my $putAP = mk_APmem($dbh);

print "$putAP\n";

#[\test script]#

-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


Re: active directory cookbook

2012-06-19 Thread John Mason Jr
On 6/18/2012 2:50 PM, Gomes, Rich wrote:
> This may be a long shot but worth a try.
> The author of Active Directory Cookbook used to have perl scripts for the 
> examples given in the book (mainly VBScript) on his website:
> http://rallenhome.com/books/adcookbook2
>
> That's been down for a while and there are no updated links for it and no 
> email links for the author either. I used to reference the scripts quite a 
> bit but never downloaded all of them for future reference.
>
> I am hoping someone here did or may know of a location where I could find 
> them?
>
>
> Thanks!
>
> Rich

You might try oreily website they normally host the sample/example code

http://examples.oreilly.com/9780596521110/

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


Spreadsheet-WriteExcel write formula

2011-11-08 Thread John
Hi

I am generating an Excel s/sht with above module and inserting formula 
to provide calculated results on the s/sht - code snippets below.

In the *types* case below the calculated results are displayed on 
opening the s/sht, but in the *branch* case the initial on opening 
results are not displayed (shows 0 (zero)). They do display after 
editing the cell (press F2 then Enter).

What I want to have happen is for the *branch* results to also be 
displayed on initial opening. Does anyone have any ideas on what is 
happening and what I can try to get my desired result?

NOTE: the *write_formula* method is just a change I made to try and get 
it working.

[code]
# types tallies
$col = 18;  # type column
$cell1 = xl_rowcol_to_cell($ttop,$col); # column range start
$cell2 = xl_rowcol_to_cell($tbottom,$col);  # column range end
$cnt = 0;
for (@list) {
   $row = $ftop + $cnt;
   $formula = "=COUNTIF($cell1:$cell2,MID(".
  xl_rowcol_to_cell($row,$col + 1) .",2,1))";
   $proj_sht->write($row,$col,$formula,$fmtNmbrCenter);
   $cnt++
}
[\code]
Produces cell formula like:
=COUNTIF(S2:S136,MID(T139,2,1))

[code]
# branch tallies
$col = 3;   # branch column
$cell1 = xl_rowcol_to_cell($ttop,$col); # column range start
$cell2 = xl_rowcol_to_cell($tbottom,$col);  # column range end
$cnt = 0;
for (@branches) {
   $row = $ftop + $cnt;
   $formula = "=COUNTIF($cell1:$cell2,".
  xl_rowcol_to_cell($row,$col - 1) .")";
   $proj_sht->write_formula($row,$col,$formula,$fmtNmbrCenter);
   $cnt++
}
[\code]
Produces cell formula like:
=COUNTIF(D2:D136,C139)



-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


Re: Win32::OLE

2011-06-29 Thread John Harrington
Hi Leo,

Yes, it turns out the security setting is the issue.  On machines where this
didn't work, the security settings were different than on the machines where
it did work.  Thank you very much for your help with this puzzling issue.
 It is very much appreciated.

For any other users who may find this thread on Google, it was necessary to
modify the Access security settings to get automation to run.

To do that in Access 2007:

1. Open Access.
2. Click the "Office button" (the circle in the extreme upper right).
3. Select the "Access Options..." button.
4. On the "Access Options" dialog, click "Trust Center".
5. Click "Trust Center Settings...".
6. On the "Trust Center" dialog, click "Macro Settings".
7. Select "Enable all macros" (last option).


Best regards,
John

On Wed, Jun 29, 2011 at 11:06 AM, Leo Susanto  wrote:

> Try this:
> http://stackoverflow.com/questions/837754/call-routine-in-access-module-from-net
>
> On Wed, Jun 29, 2011 at 10:19 AM, John Harrington 
> wrote:
> > Hi Leo,
> > Thanks for this.
> > I tried this script on one of the machines that wasn't working yesterday
> and
> > received only this error:
> >  Last OLE32 error: Win32::OLE(0.1709) error 0x800a9d9f in
> > METHOD/PROPERTYGET "Run"
> > Any suggestions?
> > So far I've tried automation on four separate machines:
> > All with Access 2007 12.0.6535.5005  SP2 MSO 12.0.6554.5001
> > OS   bits  Perl version  Works?
> > XP   32 5.10.1 yes
> > XP   32 5.12.4 no
> > W7   64 5.12.4 yes
> > W7?  64?5.10.1no
> > I believe OS, bits, Perl version, and Access version can be ruled out as
> the
> > explanation.
> > Thank you again,
> > John
> >
> > On Tue, Jun 28, 2011 at 5:35 PM, Leo Susanto 
> wrote:
> >>
> >> Thank, so Access 2007 is installed in all of the machine
> >>
> >> Could you please run this and see if there is any error?
> >>
> >> use strict;
> >> use warnings;
> >> use Win32::OLE;
> >> my $oAccess;
> >> eval {$oAccess = Win32::OLE->GetActiveObject("Access.Application")};
> >> if ($@) {
> >>die "Access.Application is not installed\n";
> >> }
> >> unless (defined $oAccess) {
> >>unless ($oAccess = Win32::OLE->new("Access.Application", sub
> >> {$_[0]->Quit;})) {
> >>die "Can not start Access.Application\n";
> >>}
> >> }
> >>
> >>
> $oAccess->OpenCurrentDatabase("C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb");
> >> print "Last OLE32 error: ". Win32::OLE->LastError() if
> >> (Win32::OLE->LastError());
> >> $oAccess->Run("AutomationTest");
> >> print "Last OLE32 error: ". Win32::OLE->LastError() if
> >> (Win32::OLE->LastError());
> >>
> >> On Tue, Jun 28, 2011 at 4:36 PM, John Harrington 
> >> wrote:
> >> > I have a very simple script using Win32::OLE that works perfectly on
> my
> >> > machine but not on other people's machines and I can't figure out why.
> >> > The script is as follows:
> >> >
> >> > use strict;
> >> > use warnings;
> >> > use Win32::OLE;
> >> > my $oAccess;
> >> > $oAccess = Win32::OLE->new('Access.Application') or die "Unable to
> start
> >> > Access";
> >> >
> >> >
> $oAccess->OpenCurrentDatabase("C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb");
> >> > $oAccess->Run("AutomationTest")
> >> >
> >> > When I run it on my machine, it successfully runs a Public Function
> >> > called
> >> > AutomationTest in my database.  This function writes two files to the
> >> > cwd, a
> >> > text file and a simple Excel spreadsheet.
> >> > When I run this script on other people's machines, the script executes
> >> > (same
> >> > OS, same version of ActiveState Perl (5.10.1), same database, same
> >> > permissions) but the files are not written, which suggests the
> >> > automation is
> >> > not working.  No errors are generated.  The script runs, but there are
> >> > no
> >> > files produced.
> >> > Again, it works on my machine, not on theirs, with apparently the very
> >> > same
> >> > conditions.  I even tried sharing my Perl folder so another user could
> >> > be
> >> > assured he was running the same version of the module and Perl.
> >> > I am at my wit's end.  Any help would be appreciated.
> >> > Can you think of any reason such a simple application of the
> Win32::OLE
> >> > module would work on one machine and not on another?
> >> >
> >> > Thanks,
> >> > John
> >> >
> >> >
> >> >
> >> >
> >> > ___
> >> > 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


Win32::OLE

2011-06-28 Thread John Harrington
I have a very simple script using Win32::OLE that works perfectly on my
machine but not on other people's machines and I can't figure out why.

The script is as follows:

use strict;
use warnings;
use Win32::OLE;
my $oAccess;

$oAccess = Win32::OLE->new('Access.Application') or die "Unable to start
Access";
$oAccess->OpenCurrentDatabase("C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb");
$oAccess->Run("AutomationTest")


When I run it on my machine, it successfully runs a Public Function called
AutomationTest in my database.  This function writes two files to the cwd, a
text file and a simple Excel spreadsheet.

When I run this script on other people's machines, the script executes (same
OS, same version of ActiveState Perl (5.10.1), same database, same
permissions) but the files are not written, which suggests the automation is
not working.  No errors are generated.  The script runs, but there are no
files produced.

Again, it works on my machine, not on theirs, with apparently the very same
conditions.  I even tried sharing my Perl folder so another user could be
assured he was running the same version of the module and Perl.

I am at my wit's end.  Any help would be appreciated.

Can you think of any reason such a simple application of the Win32::OLE
module would work on one machine and not on another?


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


Question about calling my own Access VBA function using Win32::OLE

2011-06-09 Thread John Harrington
This question has to do with automating Access.  I simply want to run my own
function in Access and pass it parameters.

Let's say I have written a public function called foo() in a module in my
Access database.  Foo() takes a couple of arguments, param1 and param2, the
first a string, the second an int.  I want to write a Perl script that runs
this function in my Access database and passes it values for these
parameters.  What would that look like?

It's not clear to me from reading the Win32::OLE documentation at CPAN how
to do this.  If this is not possible with Win32::OLE, can you tell me how I
might accomplish this?

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


Re: experiencing Out of memory errors

2011-01-27 Thread John Deighan
I'd forgotten about Strawberry Perl (came across it about a year ago, but never 
got around to trying 
it). One question, though: I'm thinking there's not much point to using a 
64-bit version of mod_perl 
unless I'm using it with a 64-bit version of Apache. Where can I get a 64-bit 
version of Apache that 
will with with the mod_perl below?

On 1/27/2011 6:57 AM, Michiel Beijen wrote:
> Hi John,
>
> ... etc.
>
> If you would want to switch to StrawberryPerl 5.12.x 64-bit, you can use
> this pre-compiled mod_perl:
> http://strawberryperl.com/package/kmx/mod_perl/
>
> --
> Mike
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: experiencing Out of memory errors

2011-01-26 Thread John Deighan


On 1/26/2011 11:22 AM, Brian Raven wrote:
> -Original Message-
> From: perl-win32-users-boun...@listserv.activestate.com
> [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
> John Deighan
> Sent: 26 January 2011 15:18
> To: perl-win32-users@listserv.ActiveState.com; us...@httpd.apache.org;
> modp...@perl.apache.org
> Subject: experiencing Out of memory errors
>
>> We have an Apache/mod_perl application running under Windows Server2003
 >> ...etc.
>> help us.
>
> Unless it is fairly easy to create a 64 bit setup, it might be worth
> expending some effort in checking whether your belief that you don't
> have a memory leak is sustainable. This may help.
>
> http://modperlbook.org/html/14-2-6-Memory-Leakage.html

Thanks for the help, Brian. I'll check it out.

That does remind me, however, that we've tried to analyze how much memory some 
of our larger data 
structures take up. We'd previously done that using a function in the 
Devel::Size library named 
total_size. You pass it the reference to a data structure, like an array or 
hash, and it tells you 
how many total bytes it uses, including traversing all references it contains, 
recursively.

However, in an effort to reduce the memory we use (and at the same time speed 
up response time), 
we've started using thread-shared memory for cached data. Since we're on 
Windows, Apache starts a 
single process with multiple threads (technically, it's 2 processes, but the 
first just shuttles the 
request to the 2nd, which uses one of the threads to handle it). Using 
thread-shared data structures 
means that when one of the threads (i.e. "Perl interpreters") has data to 
cache, other threads can 
find and use that data since it's stored in a area accessible to all threads.

Unfortunately, the Devel::Size functions don't work correctly with 
thread-shared memory and the 
total_size function returns erroneous information (specifically, no matter how 
large the data 
structure is, it reports the same, rather small size. Perhaps it's unable to 
follow references at 
all, but I really don't know what the problem is).

Does anyone know of an alternative way to determine the amount of memory used 
by a Perl data structure?

use Devel::Size qw(total_size);
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


experiencing Out of memory errors

2011-01-26 Thread John Deighan
We have an Apache/mod_perl application running under Windows Server 2003
that periodically experiences
"Out of memory" errors (they appear in the Apache error logs) which
forces Apache to restart. Our application does, in fact, use a lot of
memory, and we believe that this is not due to a bug or memory leak.
What we would like is to run this application in a 64 bit environment, thus
allowing us to use more than the 2 GB memory that the Apache process ('httpd')
is limited to (the "Out of memory" errors always occur as the memory usage
of the httpd process approaches this 2 GB limit).

We know that we will need to run a 64 bit version of Windows on 64 bit
hardware to accomplish this. Furthermore, we know that ActiveState has a
binary Perl install of a 64 bit Perl. However, we're not aware of either a
64 bit Apache (though recently I found the blackdot site -
http://www.blackdot.be/ - that provides a Windows compatible binary build
of 64 bit apache, though I know very little about it) or a 64 bit mod_perl.
However, we're also not sure if either of these are needed to escape the
2 GB memory limitation. E.g., can 64 bit Perl be used with a 32 bit
Apache and/or mod_perl?

Any help with accomplishing what we need would be greatly appreciated,
including the possibility of hiring someone on a contract basis to
help us.



OS: Microsoft Windows Server 2003
Perl: v 5.8.9 ActiveState build 826
Apache 2.2.11
mod_perl 2 (not sure of the exact version, but very recent)
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl/tk on win-xp tablet (panasonic toughbook)

2010-06-11 Thread John
Hi

I recently made my first perl/tk app (previously used win32::gui) for 
use on my toughbook. This works fine when using an ordinary mouse and 
keyboard however, when using the stylus, I cannot pull up the virtual 
keyboard.

Is there a way to get this to get this to work in perl/tk/tkx?

This problem does not exist in win32::gui.

John

-- 
Regards
John McMahon
   li...@jspect.fastmail.fm


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


SOAP::Lite missing in 5.10.1?

2009-11-09 Thread John Deighan
I have installed ActivePerl 5.10.1. When I try to install SOAP::Lite using ppm 
(I start up ppm-shell and enter 
"install SOAP-Lite", it fails with the message:

install failed: Can't find any package that provides Apache:: for 
SOAP-Lite

I have no idea what the part about "Apache::" means - this is not an Apache 
related module. So, I tried 
running the GUI version of ppm which should list all available modules, and I 
don't see SOAP::Lite anywhere.

BTW, we not only have the ActiveState repository enabled, but also the bribes, 
trouchelle and winnipeg 
repositories.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Problems with DBD-ODBC 1.17

2008-11-10 Thread John Deighan
This past weekend, we updated software on a production server, and in 
the process unintentionally updated the DBD-ODBC library from version 
1.15 to version 1.17. That change caused our site to fail and we had to 
roll back to version 1.15. Here are 2 specific problems we found - both 
may have been intentional because they do make some sense, but you might 
want to watch out for them.

1. When using placeholders, you can no longer specify the type 
SQL_VARCHAR if you're inserting a string into a column of type text - 
you have to use SQL_LONGVARCHAR.

2. When using placeholders, you can no longer insert strings like 
'2008-11-08 11:23:49' into columns of type smalldatetime - you have to 
leave off the minutes: '2008-11-08 11:23' - in this case we specify the 
type SQL_VARCHAR (I tried using SQL_DATETIME and got an error message 
about an unsupported option). It makes some sense, since smalldatetime 
(unlike datetime) only has minute resolution. But, the SQL Server 
documentation specifically says that seconds can be specified and tells 
you how they will be rounded. But, this error is coming from the DBD 
driver, I assume. I haven't checked if SQL Server used via e.g. Query 
Analyzer will allow you to insert with seconds in the string.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


problem with FIRSTKEY in tied hash implementation

2008-09-30 Thread John Deighan
We needed to have hashes where values could be found in the hash, even 
if a key was used that had a different case than the original key used 
to put the value into the hash. So, I investigated tied hashes in Perl, 
and soon developed a library to do just that, which seemed to work fine, 
until recently, when I found that sometimes my hash objects acted as 
though they were empty, when clearly they were not. In fact, I ran into 
this strange situation:

# --- $hTied exists and is a tied hash

foreach my $key (keys(%$hTied)) {
print("$key = $hTied->{$key}\n");
}

# --- the above prints nothing, as if the hash %$hTied has no keys, but

my $h2 = $hTied->{prod1};
foreach my $key (keys(%$hTied)) {
print("$key = $hTied->{$key}\n");
}

# --- the above prints out several keys and values
# --- i.e. it looks like $hTied is empty, but $hTied->{prod1}exists and 
contains data

I eventually tracked the problem down to the fact that my tied hash 
contained an entry with an undef key. Normal hashes in Perl not only 
allow that, but work perfectly. The entry with the undef key can be 
retrieved like any other key:

my $h = {
a => 1,
undef , 2,
c => 3,
};

foreach my $key (keys(%$h)) {
print("'$key' => '$h->{$key}'\n");
}

prints out:

'' => '2'
'c' => '3'
'a' => '1'

(but note that I couldn't say  undef => 2 because the magic of => would 
cause it to treat undef as the string 'undef'. Also, my printing routine 
doesn't distinguish between keys that are undef and keys that are the 
empty string, but I could remedy that by making the foreach loop a bit 
more complex by checking to see if $key is defined or not)

So, understanding the problem, I figured that I'd go into my library and 
simply fix the problem. So, I looked at my FIRSTKEY function. What it is 
supposed to do is to retrieve the first key, and the first value and 
return the first key in scalar context, or the pair first key and first 
value if in list context. If there are no keys in the hash, it's 
supposed to return undef in scalar context, but the empty list if in 
array context. Well, we've got a serious logical problem if the first 
key in the hash is undef - since returning undef in scalar context is 
how we're supposed to indicate that there are no keys.

Also, I should mention that I found 2 other Perl libraries that are 
supposed to do the same thing, i.e. have case insensitive retrieval of 
values from a hash while retaining the original case of the keys. These 
are Tie::CPHash and Hash::Case::Preserve. I found that both of these 
libraries also have the same problem with undef keys.

The solution I'm going to use in my library is to convert undef keys to 
the empty string - probably on insert, but it would also work to return 
the empty string for undef keys found in the FIRSTKEY and NEXTKEY 
functions.

It's a bit annoying that with tied hashes, it seems to be impossible to 
emulate the behavior of real Perl hashes with respect to undef keys. If 
anyone knows of a way around this problem that would allow tied hashes 
to work just like true Perl hashes, except that lookups would be 
case-insensitive. Also, if anyone knows of a library implemented in C 
code, which would be much faster than any of the libraries mentioned, 
that did this, I'd appreciate knowing about it. A google search didn't 
turn up any such library.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl download a winzip file from URL

2008-09-10 Thread John Mason Jr
How about <http://search.cpan.org/dist/libwww-perl/bin/lwp-download>

John


David M. Funk wrote:
>
> Hello List,
>
> I have a perl script that connects to a website using LWP and pulls 
> down a csv & pdf file from the URL. Both of these a basically ascii 
> text files. This has been working fine for quite some time now. Just 
> recently the files are winzip files “.zip”. So when I try to d/l them 
> I get a hex file with the HTTP headers included.
>
> How do I remove the headers or is there a better way to d/l a binary file?
>
> Code snippet……
>
> use HTTP::Cookies;
>
> use IO::Socket::SSL;
>
> $ua = LWP::UserAgent->new;
>
> $ua->agent("" . $ua->agent);
>
> $ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt",autosave 
> => 1));
>
> &mesg("-\n\n");
>
> &mesg("Calling $url..\n");
>
> $response = $ua->get("$url");
>
> @result = split(/\n/,$response->as_string());
>
> foreach $line (@result) {
>
> if ($line =~ /nowrap/ && $line =~ /\-csv\.zip\?/) {
>
> print "$line\n";
>
> $line =~ /\\/;
>
> $url1=$1;
>
> $url1 =~ /ime\/(.*)\?/;
>
> $csvfile=$1;
>
> &mesg("-\n");
>
> &mesg("Filename->$csvfile<-\nURL->$baseurl/$url1<-\n");
>
> }
>
> if ($line =~ /nowrap/ && $line =~ /\-pdf\.zip\?/) {
>
> $line =~ /\\/;
>
> $url2=$1;
>
> $url2 =~ /ime\/(.*)\?/;
>
> $pdffile=$1;
>
> &mesg("-\n");
>
> &mesg("Filename->$pdffile<-\nURL->$baseurl/$url2<-\n");
>
> }
>
> }
>
> if ($url1 eq "" || $csvfile eq "" || $url2 eq "" || $pdffile eq "") {
>
> &mesg("Something went wrong.\n");
>
> &mesg("URL1 ->$url1<-\nCSVFILE ->$csvfile<-\nURL2 ->$url2<-\nPDFFILE 
> ->$pdffile<-\n");
>
> &mesg("-\n");
>
> &write_html;
>
> &mesg("emailing the error notification to 
> $group.");
>
> &send_email("UPS File Errors","Possibly the wrong 
> URL?\nURL->$url<-\nSee attached.\n",$group,$LOGDIR,"html.log");
>
> &mesg("Complete..\n");
>
> &mesg("\n## Finished $tdate ##\n");
>
> &write_log if $#LOG >=0;
>
> exit;
>
> }
>
> &mesg("-\n");
>
> &mesg("Calling $baseurl/$url1..\n");
>
> &mesg("Getting File $csvfile..\n");
>
> $response1 = $ua->get("$baseurl/$url1");
>
> $file1=$response1->as_string();
>
> &mesg("Writing $csvfile to local disk..");
>
> open (CSVFIL, ">$basedir/$csvfile") || warn &mesg("Can't open 
> $basedir/$csvfile: $!\n");
>
> print CSVFIL "$file1\n";
>
> close(CSVFIL);
>
> &mesg("Complete..\n");
>
> &write_log if $#LOG >=0;
>
> $file1="";
>
> &mesg("Calling $baseurl/$url2..\n");
>
> &mesg("Getting File $pdffile..\n");
>
> $response2 = $ua->get("$baseurl/$url2");
>
> $file2 = split(/\n/,$response2->as_string());
>
> &mesg("Writing $pdffile to local disk..");
>
> open (PDFFIL, ">$basedir/$pdffile") || &mesg("Can't open 
> $basedir/$pdffile: $!\n");
>
> print PDFFIL "$file2\n";
>
> close(PDFFIL);
>
> &mesg("Complete..\n");
>
> $file2=””;
>
> my($stop) = time();
>
> $responsetime = $stop - $start;
>
> &write_log if $#LOG >=0;
>
> }
>
> TIA,
>
> David M. Funk
> President/CEO
>
> Tivoli Certified Enterprise Consultant
> /Specializing in Network and Systems Management Solutions/
>
> Trinity Solutions
> 604 Cassandra Dr.
> Cranberry Twp., PA 16066
>
> Phone: 724-316-0721
> Fax: 724-772-7889
> email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> www: http://www.trinityITsolutions.com
>
> 
>
> ___
> 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


alias problems

2008-08-11 Thread John Deighan
I'm trying to create a global variable in my main script, then when I 
load a Perl module, in it, I want to create an alias to that global in 
the loaded Perl module. But, when I call a function in that module, the 
variable is empty (though I know that the global in my script isn't 
empty). I wanted to use Data::Alias, as suggested in the book "Perl Best 
Practices", but I'm working in the Windows world and it doesn't seem to 
be available via ppm for ActiveState perl. So, I'm using a library named 
simply "Alias", which comes with ActivePerl. Anyway, here's the code:

# 
---

# SamplePerlScript.pl

package main;

use strict;
use warnings;

our $StudentID;

use SamplePerlModule;

MAIN: {
$StudentID = 801;
test();
} # MAIN()

# 
---

# SamplePerlModule.pm

package SamplePerlModule;

use strict;
use warnings;

use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(test);

use Lexical::Alias;
$Lexical::Alias::SWAP = 1;

alias my $StudentID => $main::StudentID;

sub test {

my $id = $StudentID || 'none';
print("in test(): StudentID = $id\n");
} # test()

1;
# 
---

OUTPUT:

in test(): StudentID = none


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


missing ppm libraries

2008-03-04 Thread John Deighan
Several Perl libraries have gone missing from ActiveState's 5.8 PPM 
repository, and our software depends on them. Does anyone know why 
these libraries are no longer available there? They were there just 2 
weeks ago. The libraies are:

Date-Calc
String-Trigram
Devel-Size
DBD-ODBC

Also, DBI, but since it comes with the ActiveState Perl distribution, 
that just means we can't update it until a new version of ActivePerl 
is released. I'm particularly concerned about DBD-ODBC.

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


Re: vague error message

2008-01-04 Thread John Mason Jr
Chris Rodriguez wrote:
> Hi everybody,
> I've been getting an error message I don't know what to do about:
> Perl has caused an error in PERL58.DLL.  Perl will now close.
> If you continue to experience problems, try restarting your computer.
> 
> It doesn't appear within the DOS window (I believe it's called, from 
> which I enter the command to run a program.)  A separate window appears 
> for the message.  Well, restarting didn't help.  This always happens at 
> the same point of one particular program.  That’s a "master" script I 
> have which runs a slew of other scripts over and over.  I goes through 
> once just fine, but on the second time through, when it gets to a 
> particular script... thud.  And there's nothing wrong with that 
> particular "sub" script.  It runs just fine by itself (and on the first 
> time through).
> Does anyone know what's going on?
> Thank you,
> Chris
> 


Is it possible to create a sample script that is as small as possible 
and exhibits the behavior you observed?


John

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


Re: Net::Ftp to MVS losing last byte?

2007-10-23 Thread John Mason Jr
Mike Malony wrote:
> We're trying to upgrade from 5.6 to 5.8.  Activestate Windows (of
> course)  When using NET::FTP to move files to the mainframe, some files
> are losing the last byte on every record.  Otherwise the parms are the same
>  
> ASCII,
> LRECL=80, # mainframe speak for these records are exactly 80 bytes long
> WRAP, #
>  
> The records are variable length on windows, result in fixed length on MVS.
>  
> I'm working to build a sample script simple enough to recreate the issue.
>  
> Is there a config file for Net::Ftp that might be changing?  Anything
> else that I should look at?
>  
> Thanks,
> Mike
> 

Are you transferring the files as binary or ASCII?

Have turned on logging?

If nothing in the code changed, and you have both 5.6 and 5.8 versions
available try capturing the transfer in wireshark .

John

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


Re: In need of efficient JPEG / GIF module

2007-09-26 Thread John Mason Jr
Daniel Burgaud wrote:
> Hi,
> 
> Charts dynamically generated by perl script.
> 
> Dan
> 
> 
> On 9/25/07, *Bill Luebkert* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> Daniel Burgaud wrote:
> > Hi,
> >
> >
> > The one I use the jpeg module dumps too large pictures, its totally
> > useless for online use.
> >
> > I need efficient JPEG/GIF module for use on a web application. Any
> > better jpeg/gif
> > modules out there?
> 
> Totally cryptic man.  What specifically are you trying to do with
> images ?
> 


How about a small sample of code that illustrates the problem you are
having, and are you sure it's the module(s) that you are using that are
the cause of slowness?


John

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


RE: control M's

2007-06-25 Thread John Townsend
For Windows, I'm fond of the text editor Ultra Edit. It is not expensive
and I've been using it for years.
 
(For Mac heads, I suggest BBEdit--I'd use it on Windows if they made a
Win version)



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Chris Rodriguez
Sent: Monday, June 25, 2007 1:41 PM
To: [EMAIL PROTECTED]
Subject: control M's


Hi everyone,
I wrote a cgi script in PERL which won't execute.  I'm told it's because
I have control M's at the end of each line, and that this happens when
editing programs in Windows (which I do, with Notepad).  I found a free
program on the web
(http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which
claims to remove them.  I ran it and uploaded the new program, but it
still doesn't work.  It may be that there's another problem with the
script, then again, maybe the control M's are still there.  I'd like to
rule out the latter.  Can anyone advise me on dealing with this?  How
can I remove them?  How can I tell if they're there or not?  How can I
type up a script so that they never appear in the first place, etc.?

Thank you,
Chris




Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now
  (it's updated for today's economy) at Yahoo!
Games.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Changing space to escaped space

2007-06-19 Thread John Townsend
I'm trying to change a space to an escaped space.

I've tried something like this:

$string = ".\\agmptestapp.exe -i .\\performance_in\\3Pages3Squares.pdf
-o .\\performance_out\\ -1 -dic never -t ps3 -s irs -ppd AdobePDF 8.0
-timer > timer.txt";
$string =~ s, ,\ ,g;
print "string after\n$string\n";

However it does not appear to work.

Can someone suggest a reg ex that works? Or perhaps there is a better
way to approach the problem?

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


Truncating decimal number

2007-06-19 Thread John Townsend
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


ppm4 Error - install failed - file conflict

2007-06-10 Thread John
Hi

Installing activeperl 5.8.8.820 on a new system and encountered this 
error and upgrade failed.


Installing package failed

ERROR: File conflict for 'C:/bin/Perl/Perl58/html/site/lib/DBD/File.html'.
 The package DBD-File has already installed a file that package DBI
 wants to install.


DBD-File was installed with DBD-AnyData. I encountered this same error 
earlier when I installed DBI first so I removed DBI and attempted to 
install it after AnyData.

PPM4 doesn't seem to support a 'forced' directive (or haven't found it 
yet). Can anyone solution?


-- 
Regards
John McMahon
   [EMAIL PROTECTED]

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


Re: What is not initialised here?

2007-05-29 Thread John
[EMAIL PROTECTED] wrote:
> $_ = shift @data until /Amount/;   # start of transactions
> 
>> and get this warning:
> 
> Use of uninitialized value in pattern match (m//) at CMS2AP.pl line 138.
> 
> One way to avoid the warning is to check for that first uninit'ed $_
Thank you Andy
I had been thinking my statement above was equiv to

do {$_ = shift @data;} until ($_ =~ /Amount);

when it is really equiv to

until ($_ =~ /Amount/) {$_ = shift @data;}

and couldn't see the wood for the trees so to speak.

John


> #!perl -w
> use strict;
> my @data = qw(hi ho hee ha Amount hoo hooh);
> print "t: ", $_ = shift @data, "\n" until  ($_ and /Amount/);   # 
> start of transactions
> # $_ = shift @data until  ($_ and /Amount/);   # start of transactions
> 
> But if you've got a bunch of noise in there before 'Amount' you're wasting 
> a lot of assigns, I think.  Similarly, you'll run for quite a ways if 
> there *isn't* an "Amount" in there ;->
> 
> I tried to use the '...' flip-flop:
> [the flip-flop '..' operator] can test the right operand and
>become false on the same evaluation it became true (as in awk), but 
> it still returns true once.  If you
>don't want it to test the right operand till the next evaluation, 
> as in sed, just use three dots ("...")
>instead of two.  In all other regards, "..." behaves just like ".." 
> does.
> 
> but couldn't get it to help here. I'd think you'd want to do this on the 
> front end, though.  Don't put it into @data in the first place
> while (<>) {
>  next if 1 .. /Amount/;
>  chomp;
>  push @data, $_;
> ...
> 
> or something.
> 
> a
> 
> Andy Bach
> Systems Mangler
> Internet: [EMAIL PROTECTED]
> VOICE: (608) 261-5738  FAX 264-5932
> 
> The competent programmer is fully aware of the strictly limited size of
> his own skull; therefore he approaches the programming task in full
> humility, and among other things he avoids clever tricks like the
> plague. -- Edsger Dijkstra
> 


-- 
Regards
John McMahon
   [EMAIL PROTECTED]

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


What is not initialised here?

2007-05-26 Thread John
I use this to churn through unwanted data:

$_ = shift @data until /Amount/;   # start of transactions

and get this warning:

Use of uninitialized value in pattern match (m//) at CMS2AP.pl line 138.

The message is only reported once. The statement becomes true on line 45
of my current test data.

Could someone please explain to me what is not initialised.

-- 
Regards
John McMahon
   [EMAIL PROTECTED]


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


How do I know where my Perl script is running?

2007-05-15 Thread John Townsend
Here's my situation:

My script is executed by a larger system, from some abitrary directory.
How can I tell from which directory my Perl script was executed?

I guess I'm looking for something like pwd from UNIX.


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


Re: File copy across drives?

2007-05-10 Thread John Deighan
FYI, in my experience with Windows, "No such file 
or directory", or "Permission denied" don't necessarily mean what they say.

At 08:57 AM 5/10/2007, Dennis Daupert wrote:
>Hello list,
>
>The copy command is failing, error says:
>
>Copy failed: No such file or directory at D:\Perl\get_files\get_files.pl
>line 178,  line 9
>
># = = = =  get_files.pl = = = = =
>line 177: if ( -e $from ) {
>line 178:  copy("$from","$to") or die "Copy failed: $!";
>line 179:  $count++;
>line 180:  } else {
>line 181:print "NOT FOUND: $from\n";
>line 182:  }
>
>My theory is get_files.pl is having a problem copying across windows
>drives.
>The sys admin who reported this error said the files she's trying to copy
>to
>the D drive are "on the H drive using Vertias clustering on SAN"
>
>So I have these questions:
>Am I barking up the right tree, or do I need to bark up another?
>How do I solve this, if the problem IS copying across drives?
>If the file test operator (-e) sees the files, why doesn't copy?
>
>
>best,
>
>  /dennis
>
>
>Phone: 317.298.6049
>
>Methods for predicting the future:
>1) read horoscopes, tea leaves, tarot cards, or crystal balls . . .
>collectively known as "nutty methods;"
>2) put well-researched facts into sophisticated computer . . .
>commonly referred to as "a complete waste of time."
>
>— Scott AAdams
>
>
>
>
>This is a PRIVATE message. If you are not the intended recipient, please
>delete without copying and kindly advise us by e-mail of the mistake in
>delivery. NOTE: Regardless of content, this e-mail shall not operate to
>bind CSC to any order or other contract unless pursuant to explicit written
>agreement or government initiative expressly permitting the use of e-mail
>for such purpose.
>
>___ 
>Perl-Win32-Users mailing list 
>Perl-Win32-Users@listserv.ActiveState.com To 
>unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>Scanned for Spam and Viruses.
>PCG Information Technology Services.

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


testing subscription - please ignore

2007-04-16 Thread John

-- 
Regards
John McMahon
   [EMAIL PROTECTED]

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


Getting file name from a path

2007-04-13 Thread John Townsend
Often I need to extract the file name from a path. Typically I do
something like following. Any better ways I could do this?


#path test
$current_file = "c:/somedir/test.ps";
@split_path = split("/",$current_file);
$current_file = @split_path[-1];
print $current_file;


However, I'm pretty sure I could extract the file name using a regular
expression. How might I do this? Any suggestions welcome.

Thanks
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: how to round a floating-point value to an integer value

2007-03-17 Thread John Deighan
I think the safest way to round is to add 0.5, then use the 
POSIX::floor function. The Perl docs warn against using int() for 
just about anything (I don't have the exact quote handy):

use strict;
use POSIX qw(floor);

MAIN: {
foreach my $x (
0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
  1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5,
  0.499, 0.51,
  1.499, 1.51,
  2.499, 2.51,
  ) {
my $y = round($x);
print("$x => $y\n");
}
} # MAIN()

# 

sub round { my($x) = @_;

return floor($x + 0.5);
} # round()


OUTPUT:

0 => 0
0.1 => 0
0.2 => 0
0.3 => 0
0.4 => 0
0.5 => 1
0.6 => 1
0.7 => 1
0.8 => 1
0.9 => 1
1 => 1
1.5 => 2
2.5 => 3
3.5 => 4
4.5 => 5
5.5 => 6
6.5 => 7
7.5 => 8
8.5 => 9
9.5 => 10
10.5 => 11
0.499 => 0
0.51 => 1
1.499 => 1
1.51 => 2
2.499 => 2
2.51 => 3

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


perl as a windows service

2007-03-11 Thread John Norris
Hi,

in the FAQs at
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/Windows/ActivePerl-
Winfaq4.html#How_do_I_run_a_Perl_script_as there are a lines on running on
with W2K/XP. Does anyone have more step by step instructions on this. I have
looked at the help of the MMC and can find nothing with regard to Perl.
Is the entry refering to the PerlSrv program in the developers kit?

Regards,

John Norris


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


Re: Reading quickly from the end of a file

2007-02-08 Thread John Mason Jr
John Townsend wrote:
> I'm looking for a way to read the end of a file quickly. I have scripts
> that generate PostScript files (basically really large text files). I'd
> like to verify that each PostScript file ends with "%EOF". Rather than
> read the entire text file into memeory then parsing each line, I'd like
> to read from the bottom the file and search for the "%EOF" string.
> 
> The PostScript file I generate can be hundreds of megs, so I'm looking
> for a fast solution. I've read about the/// seek/ function, but I'm not
> sure it is what I'm looking for.
> 
> Any suggestions are appreciated.
> 

Try

File::ReadBackwards

JOhn

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


Reading quickly from the end of a file

2007-02-08 Thread John Townsend
I'm looking for a way to read the end of a file quickly. I have scripts
that generate PostScript files (basically really large text files). I'd
like to verify that each PostScript file ends with "%EOF". Rather than
read the entire text file into memeory then parsing each line, I'd like
to read from the bottom the file and search for the "%EOF" string.

The PostScript file I generate can be hundreds of megs, so I'm looking
for a fast solution. I've read about the seek function, but I'm not sure
it is what I'm looking for. 

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


Re: DLL Exsiting or not in the windows registry..??

2007-01-03 Thread John Mason Jr
raj esh wrote:
> Hi Gurus,
>  
> New year greeting to all.
>  
> I required help on windows registry topic. I need to find particular dll
> has an entry in the windows registry or not..?? example:- autoit.dll is
> existing in windows directory or not.??
>  
> Can any one suggest me any module to search the registry..?? Reference
> documentation would also help me..!!
>  
> you suggestions are valuable,
> Hoping for the best.
>  
> Thanks and Regards,
> Rajesh.
>  



Go here <http://www.roth.net/books/handbook/>

Download example code look for regfind.pl


John


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


Re: FW: lazy, lazy, lazy

2006-12-12 Thread John Mason Jr
A non perl solution but depending on the time to develop a solution
might be worth the cost

<http://www.tethyssolutions.com/automation-software.htm>


John

Eisengrein, Peter wrote:
> Dan had emailed me directly asking how he might go about doing a packet 
> capture, to which I replied directly. I thought it might be useful to others 
> on the list, so I'm sharing the wonder that is Wireshark (was Ethereal).
> 
> -Pete
> 
> -Original Message-
> From: Eisengrein, Peter 
> Sent: Tuesday, December 12, 2006 7:40 AM
> To: 'Dan Jablonsky'
> Subject: RE: lazy, lazy, lazy
> 
> 
> Download a copy of Wireshark www.wireshark.org -- it is an open source 
> sniffer. Run that on the same machine as the client app and you can capture 
> all data from that pc. You can also filter the capture or the results, which 
> will make it easier to see data between you and the server, assuming you know 
> the IP of the server. Wireshark is fairly intuitive after you've used it a 
> couple times and it allows you to drill down into each packet, seeing all the 
> headers and the raw data itself.
> 
> -Pete
> 
> 
> 
>> -Original Message-
>> From: Dan Jablonsky [mailto:[EMAIL PROTECTED]
>> Sent: Monday, December 11, 2006 5:41 PM
>> To: Eisengrein, Peter
>> Subject: RE: lazy, lazy, lazy
>>
>>
>> Thanks Peter,
>> I am preparing for the worst ... is there a place you
>> can point where I could find more details on 
>>
>>> perform various tasks with the client, 
>>> see what binary data is sent/received
>> i'm not sure I know where to start ...
>> Thanks a bunch,
>> Dan
>>
>> --- "Eisengrein, Peter" <[EMAIL PROTECTED]>
>> wrote:
>>
>>>> Now I'm left with a few maneuvers that use a
>>>> client-server app, it is possible to automate
>>> those in
>>>> any way. Unfortunatelly I don't have any access to
>>> any
>>>> internals of those applications, only permissions
>>> on
>>>> the file system, network and all ... 
>>>> I would like to try only for the fun of it, if
>>> anybody
>>>> has any ideas, please let me know,
>>>> Thanks,
>>>> Dan
>>>>
>>> Without knowing anything about the apps, I'm
>>> guessing best-bet would be to find out what command
>>> line args it will accept and then use system(). Or,
>>> if it doesn't do anything from command line, run the
>>> actual client and snoop the communication to find
>>> out what port(s) and protocol(s) it uses. And, if
>>> you're lucky it will communicate in clear text.
>>> Otherwise, you would have to perform various tasks
>>> with the client, see what binary data is
>>> sent/received, and experiment by sending data using
>>> IO::Socket. If you have to do the latter, do it on a
>>> development server if at all possible.
>>>
>>> Good luck.
>>>
>>
>>
>>  
>> __
>> __
>> Do you Yahoo!?
>> Everyone is raving about the all-new Yahoo! Mail beta.
>> http://new.mail.yahoo.com
>>
> ___
> 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: Crypt::SSLeay not found by Makefile.PL on Windows

2006-12-06 Thread John Deighan
This probably doesn't answer your question, but we use Crypt::SSLeay, 
which we get from the winnipeg reporitory at 
http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58. 
Installed via ppm, of course. It downloads 2 DLL files, which need to 
be put somewhere in the system path. That makes it unnecessary to 
install OpenSSL - I assume that when you install (and maybe compile?) 
OpenSSL, it creates those same DLL's.

At 11:32 AM 12/6/2006, Jim Keenan wrote:
>I am writing an application in which a user will make a call to a 
>server using the https protocol.  The user will have Perl's LWP 
>module installed, but LWP also requires OpenSSL and Crypt::SSLeay to 
>work.  I have gotten all this set up and working on Linux but am 
>having problems setting this up on my Windows test box.
>
>I am assuming that the user will have ActivePerl installed and has 
>the technical competence to install OpenSSL for Windows as well as a 
>ppm for Crypt::SSLeay.  As is well documented, ActiveState cannot 
>ship a ppm of Crypt::SSLeay, but such a ppm is available from Randy 
>Kobes' repository.  I have installed ActivePerl on the test box 
>(which I've done many times before) as well as OpenSSL.  And I think 
>I have correctly installed Crypt::SSLeay.
>
> C:\Client> perldoc -l Crypt::SSLeay
>
> C:\Perl\site\lib\Crypt\SSLeay.pm
>
>... which is the expected location for non-core modules.
>
>However, when I go to build the application -- which is bundled as a 
>normal, CPAN-style tarball -- I get the following:
>
> C:\Client> perl Makefile.PL
>
> Warning: prerequisite Crypt::SSLeay 0 not found.
>
> Writing Makefile for Perl::APIClient
>
>perl Makefile.PL fails to find Crypt::SSLeay, even though it's 
>installed in the correct location, and even though the script can 
>successfully locate other non-core Perl modules installed in 
>C:\Perl\site\lib\.  make runs without error, but, not surprisingly, 
>make test fails at the point where an https call is first attempted.
>
>Can anyone suggest what I'm missing?  Thank you very much.
>
>Jim Keenan
>
>___
>Perl-Win32-Users mailing list
>Perl-Win32-Users@listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
>Scanned for Spam and Viruses.
>PCG Information Technology Services.

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


Re: readdir problem

2006-11-29 Thread John Deighan
At 10:18 AM 11/29/2006, Dan Jablonsky wrote:
>Hi all,
>I am trying to read only files in a directory; I need
>to jump over the dot files and any subdirectories.
>Seems like a simple thing, however with
>
>opendir(DIR, $dir) || die "can't opendir $dir: $!";
>foreach my $file (readdir DIR)
>{
> next if (/^\./); # skip over dot files
> print "file name is: $file\n";
>}
>
>I get . and .. and all subdirectories.
>
>with
>
>opendir(DIR, $dir) || die "can't opendir $dir: $!";
>foreach my $file (readdir DIR)
>{
> next if -d $file); # skip over directories
> print "file name is: $file\n";
>}
>
>I skip the dot files but I still get the
>subdirectories. Any idea how do I get only the plain
>files?

Problem with case 1, I think, is that "next if (/^\./);" compares to 
$_, not $file. Should be:

 foreach my $file (readdir(DIR)) {
 next if ($file =~ /^\./);
 }

Problem with case 2, I think, is that you need to provide a full path 
name to -d:

 foreach my $file (readdir(DIR)) {
 next if (-d "$dir\\$file");
 }

Keep in mind that I'm using \ as a separator, which should be / for Unix/Linux.
Also, -d $file might work if you know that the current directory is 
$dir, but it seems
safer to me to just give a full path name.

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


Re: FW: Newbie: email from perl script

2006-11-03 Thread John Mason Jr
Turn on debug, or use wireshark  to capture 
the conversation with the server


  $smtp = Net::SMTP->new('mailhost',
Hello => 'my.mail.domain'
Timeout => 30,
Debug   => 1,
   );


khozaima shakir wrote:
> ofcourse, i replaced the internet address to valid address :)
> 
> 
> 
> 
> 
> From: [EMAIL PROTECTED]
> To: perl-win32-users@listserv.activestate.com
> Subject: Newbie: email from perl script
> Date: Fri, 3 Nov 2006 15:43:06 -0500
> 
> Hi All,
> I am a newbie to perl. Have installed active state and installed
> libnet module.
> 
> Am trying to learn how to send email from perl script and get
> follwing error :
> 
> Can't call method "mail" on an undefined value at myfirst.pl line
> 152,  line 1.
> 
> the script ( off the aspn: ):
> 
> use Net::SMTP;
> 
> use Net::SMTP;
> $smtp = Net::SMTP->new('here.com'); #
> connect to an SMTP server
> $smtp->mail( '[EMAIL PROTECTED]' ); # use the
> sender's address here
> $smtp->to('[EMAIL PROTECTED]'); # recipient's
> address
> $smtp->data(); # Start the mail # Send the
> header.
> $smtp->datasend("To: [EMAIL PROTECTED]");
> $smtp->datasend("From: [EMAIL PROTECTED]");
> $smtp->datasend("\n"); # Send the body.
> $smtp->datasend("Hello, World!\n");
> $smtp->dataend(); # Finish sending the mail
> $smtp->quit; # Close the SMTP connection
> 
> i can't figure out what is undefined and why is it expecting
> something from stdin.
> 
> Thanks
> khozaima
> 
> 
> Try the next generation of search with Windows LiveT Search today!
> Try it now!  
> 
> 
> 
> Try the next generation of search with Windows LiveT Search today! Try 
> it! 
> 
> 
> 
> 
> ___
> 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: what?!?

2006-10-17 Thread John Deighan
At 01:52 PM 10/17/2006, $Bill Luebkert wrote:
>John Deighan wrote:
>
> > Trust me - all code has bugs in it.
>
>That's not true.  If you slap a million lines together, then you
>have a better chance, but a good programmer in a proper environment
>doesn't write buggy code (or at least removes the bugs before going
>into production).  You'd never get a job in a financial/aerospace/medical
>field with that attitude.

You can't have it both ways. Either a good programmer never writes 
code with bugs in it, or he does, and the issue is how many bugs and 
how long does it take to "remove the bugs before going into production".

> >  The issue is how easy/hard it is
> > to create bugs, and how hard it is to find them.
>
>Creating bugs means making mistakes.  Some languages help to remedy
>the problem by being highly typed, structured, OO, etc - which also
>makes them take much longer to write, but harder to write bugs in.
>Perl isn't written that way - it's quick and dirty - you have to do
>the work yourself to keep from being buggy and you benefit by being
>up and running much faster.

Some languages make it much harder to write buggy code. In my 
experience, at least, the better languages both make it harder to 
write buggy code AND produce shorter and simpler code. It's much more 
a matter of good language design than it is adding a bunch of 
features to the language.

BTW, I hope noone is taking my comments as being Anti-Perl. It's 
actually a very well designed language. I've been using it in a 
commercial environment for over 10 years now, and in fact, it was me 
who chose it in the first place. I can think of ways to improve it, 
but I think most of them are being addressed in Perl 6.

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


Re: what?!?

2006-10-17 Thread John Deighan
At 11:35 AM 10/17/2006, $Bill Luebkert wrote:
>John Deighan wrote:
> >
> > The problem comes when you have a function that computes an index,
> > it's buggy and returns a negative number.
>
>The point is to debug your code properly.  You can't expect buggy code
>to work properly anywhere.  This is just one spot where a bug in your
>code could cause you to go a while longer before realizing it, but
>that's still no excuse for the bug being there in the first place.
>It's the bug that's causing the problem, not the feature.

Trust me - all code has bugs in it. The issue is how easy/hard it is 
to create bugs, and how hard it is to find them.

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


RE: what?!?

2006-10-17 Thread John Deighan
At 09:37 AM 10/17/2006, George Gallen wrote:
>Referencing the last element of an array (-1) without having to get
>the # of elements first, is VERY useful. Using other negative positions
>might not have as many uses, but when you find one, You'll be glad
>it's there.

The problem comes when you have a function that computes an index, 
it's buggy and returns a negative number. Using that index returns 
incorrect data instead of an undefined value, which makes it much 
harder to detect that bug. Besides, what's so hard about 
saying  [EMAIL PROTECTED]  as opposed to  $array[-1]  ?

>As for bounds checking, that always (well almost always) needs to be
>done by the routine for two reasons. the first is that you don't want
>the system to throw out warnings and/or error messages while the program
>is running (it scares the user), and secondly, you never know what the
>user will enter as a reference number for an array position.

You can trap errors and warnings. We usually inform the user that 
something went wrong, but send a detailed error message via an e-mail 
to ourselves. I think that most users would rather be told that 
something went wrong than to get incorrect data. Incorrect data that 
is taken as correct data can lead to very bad things.

Lack of automatic bounds checking (at least in cases where the 
boundaries are fixed, so this doesn't really relate to Perl) is 
responsible for all the "buffer overflow" security holes we find 
outselves having to deal with.

I totally agree that all data entered by users needs to be thoroughly 
checked, but that's a different issue than whether we programmers 
should have to implement bounds checking for every time we index into an array.

>As they say, no program is fool proof, because fools can be so ingenious,
>but the more boundry checking you have with inputs and such, then you
>it gives you more of chance to tell the user what a fool they are
>
>George
>
> > it's in the docs. Also, I checked, and if you index past the
> > beginning of an array with a negative number, you get undef, which is
> > at least consistent with what happens when you index past the far end
> > of an array.
> >
>
>
>Scanned for Spam and Viruses.
>PCG Information Technology Services.

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


RE: what?!?

2006-10-17 Thread John Deighan
At 05:54 PM 10/16/2006, Barry Brevik wrote:
> >Now, there's a great feature. If you index before the beginning of an
> >array, it neither gives you a runtime error nor returns undef. What a
>
>If you are expecting the array index to begin at 0, then do some 
>bounds checking on your "complicated function" so that it does not 
>return out of scope arguments to your Perl functions.

Yeah, my mistake on this one. I'm not convinced that I like this 
feature (negative indexes indexing from the end of the array), but 
it's in the docs. Also, I checked, and if you index past the 
beginning of an array with a negative number, you get undef, which is 
at least consistent with what happens when you index past the far end 
of an array.

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


what?!?

2006-10-16 Thread John Deighan
my @data = (1, 2, 3);
my $index = -1;
my $val = $data[$index];
print("val = '$val'\n");


Output:
val = '3'

Now, there's a great feature. If you index before the beginning of an 
array, it neither gives you a runtime error nor returns undef. What a 
great way to end up with a program that produces incorrect data with 
a long night of debugging ahead of you trying to track that one down 
(imagine that $index is computed via a complicated function in a 
totally separate part of the code).

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


ppm files on a CD

2006-08-30 Thread John Deighan
We normally install Perl and all the libraries we need by using ppm 
over the Internet. However, we now have a need for an installation 
mechanism that doesn't require access to the Internet. I'm pretty 
sure that (if I knew what I was doing), I could download the files 
that ppm normally accesses over the Internet, put them on a local 
drive or CD, then install from that using the ppm application. 
Unfortunately, I don't know the procedure for doing that. Can someone 
point me the right way? E.g. giving me a URL where I can read about 
how to do that would be sufficient.

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


RE: perl error

2006-07-24 Thread John Deighan


At 12:05 AM 7/24/2006, Chris Wagner wrote:
It's better to not use strict or
use no strict vars.  undef is a perfectly
legitimate variable value.
Bad advice - you should always "use strict".
More importantly, the problem is not "use strict", but
"use warnings". In this case, I assume that it's being picked
up from the '-w' on the shebang line (i.e. '#!/usr/bin/perl
-w'). The fact that your data is coming from a database also has
nothing to do with the problem. I do all my programming under Windows
(not so much by choice), so I never use a shebang line, but you can try
the following to see what I mean (if you need to have a shebang line,
remove the -w first):
my @values = ('1', undef, '2');
print(@values, "\n");
use strict;
my @values = ('1', undef, '2');
print(@values, "\n");
use strict;
use warnings;
my @values = ('1', undef, '2');
print(@values, "\n");
use strict;
use warnings;
no warnings 'uninitialized';
my @values = ('1', undef, '2');
print(@values, "\n");
You'll find that only the third one - with the "use warnings"
but not "no warnings 'uninitialized'", causes the warning
"Use of uninitialized value...". Note that you can selectively
turn off certain warnings, as in the fourth version. That's what I'd
recommend, though you'll probably find yourself turning off several
different warnings before you get the best setup.
The best source for what the possible warnings are, and how to turn
individual ones off, is the perldiag man page. If you're using ActivePerl
for Windows, open a browser, and in it, open the file
c:\Perl\html\index.html (modify the path according to where you installed
Perl). Then, find 'perldiag' in the menu on the left. It lists all
warning messages, and the identifier to use with "no warnings"
to turn it off.
Perhaps someone who uses Linux/Unix can post how to get to this page,
perhaps something like "man perldiag" or "man perl
perldiag"?
At 07:53 PM 7/23/2006 -0500,
Eric Edwards wrote:
>Eric Edwards replied:
>Charles,
>That was the problem.  In my table there is one field that is
blank a lot of
>the time and it showed as 'undef' when I ran the 'Dumper'.
>So, I added a default value to that field and the warning did not
come up.


--
REMEMBER THE WORLD TRADE
CENTER ---=< WTC 911
>=--
"...ne cede malis"
0100
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe:

http://listserv.ActiveState.com/mailman/mysubs

Scanned for Spam and Viruses.
PCG Information Technology Services.

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


Net-ssh-W32Perl

2006-06-09 Thread John Serink
Hi All:

Got a small problem I can't figure out here. All I want to do is log
into the SSH server, grabe the banner test and exit. The banner text
contains some HW status I'm trying to capture.
Script is below:
use strict;
use warnings;

use Net::SSH::W32Perl;

my $host = '220.255.171.11';
my $user = "";
my $pw = 'sdflkjsld';
my $ssh = new Net::SSH::W32Perl($host, protocol => 2, debug=>1,
interactive=>1);

my @frank =$ssh->login($user, $pw);
print(@frank);
print("\n");

Here is what the console looks like:
F:\perl\practice\ssh>perl ssh1.pl
johnathlonxpm: Reading configuration data "C:\Documents and
Settings\jserink\My Documents"/.ssh/conf
ig
johnathlonxpm: Reading configuration data /etc/ssh_config
johnathlonxpm: Connecting to 220.255.171.11, port 22.
johnathlonxpm: Socket created, turning on blocking...
johnathlonxpm: Remote version string: SSH-2.0-OpenSSH_3.8.1p1
Debian-8.sarge.4

johnathlonxpm: Remote protocol version 2.0, remote software version
OpenSSH_3.8.1p1 Debian-8.sarge.4

johnathlonxpm: Net::SSH::Perl Version 1.30, protocol version 2.0.
johnathlonxpm: No compat match: OpenSSH_3.8.1p1 Debian-8.sarge.4.
johnathlonxpm: Connection established.
johnathlonxpm: Sent key-exchange init (KEXINIT), wait response.
johnathlonxpm: Algorithms, c->s: 3des-cbc hmac-sha1 none
johnathlonxpm: Algorithms, s->c: 3des-cbc hmac-sha1 none
johnathlonxpm: Entering Diffie-Hellman Group 1 key exchange.
johnathlonxpm: Sent DH public key, waiting for reply.
johnathlonxpm: Received host key, type 'ssh-dss'.
The authenticity of host '220.255.171.11' can't be established.
Key fingerprint is we:er:rt:ty:rt:yu:io:s;sjsdj;jsd;fljsdlj.
Are you sure you want to continue connecting (yes/no)? [yes] yes
johnathlonxpm: Permanently added '220.255.171.11' to the list of known
hosts.
mkdir "C:\: Invalid argument at
F:/perl/site/lib/Net/SSH/Perl/Util/Hosts.pm line 51

Any idea how to get around this error? Its trying to make a directory to
store the connection info...I have Admin rights on the machine.

Ideas?

Cheers,
John

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


RE: Win32::SerialPort problem

2006-06-01 Thread John Serink
I'm running 5.8.8-817 and it appears to be included in this one.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of David Ressler
> Sent: Thursday, June 01, 2006 9:28 AM
> To: Perl List
> Subject: Win32::SerialPort problem
> 
> 
> I'm trying to use Win32:SerialPort on an XP system. 
> Apparently the standard Windows Perl installation doesn't 
> contain it, so I downloaded and installed it. THAT seems to 
> require Win32:API which I didn't find either. I tried to 
> download it from CPAN but I got an error trying to unpack it, 
> so I copied what appeared to be the correct files from 
> another computer. However, when I try to execute a script 
> that contains "use  Win32::SerialPort;" at line 12 I get the error:
> 
> Can't locate loadable object for module Win32::API in @INC 
> (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at 
> C:/Perl/lib/Win32API/CommPort.pm line 5 Compilation failed in 
> require at C:/Perl/lib/Win32API/CommPort.pm line 5. BEGIN 
> failed--compilation aborted at 
> C:/Perl/lib/Win32API/CommPort.pm line 5. Compilation failed 
> in require at C:/Perl/lib/Win32/SerialPort.pm line 4. BEGIN 
> failed--compilation aborted at 
> C:/Perl/lib/Win32/SerialPort.pm line 4. Compilation failed in 
> require at C:\Inetpub\wwwroot\pos\cgi-bin\ComPortSetup.pl
> line 12.
> BEGIN failed--compilation aborted at 
> C:\Inetpub\wwwroot\pos\cgi-bin\ComPortSetup
> 
> Line 5 of CommPort.pm is "use Win32::API", and the line in 
> Win32\API.pm that seems to be failing is "bootstrap Win32::API;"
> 
> The script works fine on the other computer mentioned above.
> 
> I suspect there may be some error in the sloppy way I tried 
> to install this. Can anyone shed some light or suggest what to do?
> 
> Thanks,
> Dave
> 
> 
> ___
> 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: Network Timeouts

2006-05-12 Thread John Serink
You're only option is to spawn threads and detach them. Have them write
their results to a shared hash or something and define your own
timeout...if you don't see the result from that thread ID in X seconds,
declare it timed out and forget about it. When it actually does timeout
is will error and then die peacefully. Make sure your script is written
NOT to die on not connecting.

Perl does not support tcp connect timeouts in Win32.

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ng, Bill
> Sent: Friday, May 12, 2006 11:27 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Network Timeouts
> 
> 
> Dilemma,
> 
>   I have many scripts that have to hit every machine in 
> my domain .. about 2400.  I can't use Net::Ping to test the 
> alive status of the boxes because our internal DNS system is 
> a real PITA to clean up and using as-is will leave me with 
> bad results.
> 
>   For now, I'm doing a write test:  if (open (WRITETEST,
> ">c:\write.test")) { &doSomething(); } ... but the timeout on 
> such a test, if the machine its trying to reach is not 
> available, is just too long.
> 
>   Anyone have a way of me testing the connectivity to a 
> computer on the network that allows me to either configure 
> the timeout or has one between 1 and 2 seconds?
> 
> Bill in Brooklyn
> 
> ___
> 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: Problem with regex

2006-05-12 Thread John Deighan

At 09:47 AM 5/12/2006, Yekhande, Seema \(MLITS\) wrote:

Holger,

Actually $ is a special character in string in perl. So, if the $ is 
there in the input,

you will have to always write it with the leading escape character.

So, make your input will be like this,
my $data = "Hello, i am a litte String.$ Please format me.$$$ I am the end
of the String.$$ And i am the last!";

It will solve your problem.


$ is only special in strings with double quote marks ( " ) around 
them. I think you meant to say:


my $data = "Hello, i am a little String.\$ Please format me.\$\$\$ I 
am the end of the String.\$\$ And i am the last!";


That works, but, you can also use:

my $data = 'Hello, i am a little String.$ Please format me.$$$ I am 
the end of the String.$$ And i am the last!';


(Note the type of quote mark used)

If you were to print out the original string data like this:

my $data = "Hello, i am a litte String.$ Please format me.$$$ I am 
the end of the String.$$ And i am the last!";

print("$data\n");

you would get this:

Hello, i am a litte String. format me. I am the end of the 
String.1896 And i am the last!


i.e., the original string did not have any '$' characters in it at all.

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


Re: Problem with regex

2006-05-12 Thread John Deighan
The code below worked for me, after using single 
quotes around the original string to prevent any 
interpolation (it's always a good practice to 
print out the original string to verify that it's 
what you thought it was), and, of course, $Data is not the same as $data.


At 08:38 AM 5/12/2006, Holger Wöhle wrote:

Hello,
under Windows with ActiveState Perl i have a strange problem with a regex:
Assuming the following String:

my $Data = "Hello, i am a litte String.$ Please format me.$$$ I am the end
of the String.$$ And i am the last!"

The regex should replace $ with the string , $$ with  and $$$ with
 (please don't think about the why)

If tried to use the following:
$data =~ s/\$\$\$//gm; #should catch every occurrence of $$$
$data =~ s/\$\$//gm; #should catch $$
$data =~ s/\$//gm; #the rest

So data should look after the first regex:
Hello, i am a litte String.$Please format me.I am the end of the
String.$$And i am the last!
And after the second:
Hello, i am a litte String.$Please format me.I am the end of the
String.And i am the last!
And the last:
Hello, i am a litte String.Please format me.I am the end of the
String.And i am the last!

But all regexes i tried (the one above are only one try) failed! When i
print out the string it looks like:

Hello, i am a litte String. Please format me. I am the end of the
String.3398 And i am the last!

Where the number after String. differs between every run.

Can someone help me ?

With regars
Holger

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


Scanned for Spam and Viruses.
PCG Information Technology Services.



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


Re: Easy One

2006-05-03 Thread John Deighan

At 11:07 AM 5/3/2006, David Kaufman wrote:

Hi Chris,

Chris Wagner <[EMAIL PROTECTED]> wrote:
> At 01:28 AM 5/3/2006 -0400, David Kaufman wrote:
>> my ($b, $c) = ($1, $2) if $a =~ /^(\D+)(\d+)/;
>
> U can't combine a my and an if.  Perl will go schizo.

Sure "U" can :-) I use this type of construct all the time, even 
with strict mode and warnings on.  What you mean by "perl will go schizo"?


What *will* happen is that, if $a doesn't match the regex, $b and $c 
will be undefined.  But I use this in cases, like the original 
poster's, where the regex is expected to always match.  In such 
cases an error has already occurred so any subsequent "Use of 
uninitialized value" warnings will warn me that the string contained 
something it was never supposed to contain.


That's what you would think. I.e., in the simple statement:

my $val =  if ;

you would think that if  were false, that certainly $val would 
end up undefined. Alas, that is not the case. There is absolutely no 
guarantee about the value of $val after this statement is executed 
when  is false. In my opinion, this is a genuine Perl bug - 
however, not everyone would agree with me. Check out the code below. 
Note that I use both 'strict' and 'warnings'. The function f() takes 
a character and returns its ordinal value. However, it uses the hash 
$h as a cache, so that when you call f(), it first checks to see if 
it has previously encountered the character you passed it, in which 
case it returns the value that it previously saved there. (Never mind 
that the ord() function is so fast that caching the ordinal value of 
a character to save processing time doesn't really make sense here). 
The point is that the first time f() is called, it computes ord('x'), 
which is 120, and stores that in $h. But, the next time f() is 
called, this time with a different value 'y', when the line marked 
'HERE' is executed, the condition $h->{$ch} fails, but $val, instead 
of being undefined, has the value it had during the previous call to 
f(), i.e. 120. So, it returns that. Trust me, it took me a long time 
to find this problem in a much more complex piece of code. Bottom 
line is, never combine 'my' with a trailing 'if'.


use strict;
use warnings;

our $h = {};

print("f(x) = ", f('x'), "\n");
print("f(y) = ", f('y'), "\n");

sub f {

my $ch = shift;
my $val = $h->{$ch} if $h->{$ch};   # HERE
if ($val) {
return $val;
}
else {
$val = ord($ch);
$h->{$ch} = $val;
return $val;
}
} # f()

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


RE: Easy One

2006-05-01 Thread John Serink
REGEX!

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ng, Bill
> Sent: Tuesday, May 02, 2006 3:55 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Easy One
> 
> 
> Real simple,
> 
>   I have a string, "$a" for arguments sake, that contains 
> a single word.  The word will always have exactly 8 
> characters in it, most likely something like "ABCD1234".  I 
> need to split this up into two strings ($b & $c), the first 
> string needs to contain all the characters before the first 
> number in the word ("ABCD" in this example), the second 
> string needs everything after, and including, the first 
> number in the word "1234" in this example.
> 
>   Now, substr() would be a walk in the park, except for 
> the fact that I can't guarantee the first number will always 
> be in the fifth position ... it might come in any position 
> between 3 and 7.  How would YOU go about doing this?  
> Inquiring minds want to know.
> 
> Bill in Brooklyn
> 
> ___
> 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


Missing PerlIsEx.dll

2006-04-25 Thread John Deighan
Twice now, I've installed the latest ActivePerl (from 
perl-win32-users@listserv.ActiveState.com), and both times, after the 
installation my Perl/bin folder does not contain PerlIsEx.dll (that's 
a lowercase 'L' followed by an uppercase 'i' as the 4th and 5th 
letters). Any ideas?


I'm running Microsoft Windows 2000 Server, version 5.0.2195 Service 
Pack 4 Build 2195


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


RE: Opening an Excel workbook with links to other data sources

2006-04-20 Thread Jarvis, John


[Sorry for the top post, only got a few seconds to get this in...]

For what it's worth, the Excel 2003 VBA Help offers this clue to the
'UpdateLinks':

UpdateLinks Property
Returns or sets an XlUpdateLink constant indicating a workbook's setting for
updating embedded OLE links. 
Read/write.

XlUpdateLinks can be one of these XlUpdateLinks constants. 
xlUpdateLinksAlways Embedded OLE links are always updated for the specified
workbook. 
xlUpdateLinksNever Embedded OLE links are never updated for the specified
workbook. 
xlUpdateLinksUserSetting Embedded OLE links are updated according to the
user's settings for the specified workbook. 

expression.UpdateLinks
expressionRequired. An expression that returns a 'Workbook' object

Example
In this example, Microsoft Excel determines the setting for updating links
and notifies the user.

Sub UseUpdateLinks()

Dim wkbOne As Workbook

Set wkbOne = Application.Workbooks(1)

Select Case wkbOne.UpdateLinks
Case xlUpdateLinksAlways
MsgBox "Links will always be updated " & _
"for the specified workbook."
Case xlUpdateLinksNever
MsgBox "Links will never be updated " & _
"for the specified workbook."
Case xlUpdateLinksUserSetting
MsgBox "Links will update according " & _
"to user settting for the specified workbook."
End Select

End Sub



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Lynn. Rickards
Sent: Wednesday, April 19, 2006 6:02 PM
To: Suresh Govindachar
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Re: Opening an Excel workbook with links to other data sources

Suresh Govindachar wrote:
> Hello,
> 
>   Issue:  opening an excel file brings up a dialog box
>   stating that the "workbook contains links to
>   other data sources" and asks if the data
>   should be updated.  
> 
>   Just-in's suggestion of adding "$Excel->{DisplayAlerts} = 0;" 
>   to modify the code to be:
> 
>   use Win32::OLE qw(in with);
>   use Win32::OLE::Const 'Microsoft Excel';
> 
>   my $Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
>   Win32::OLE->new('Excel.Application', 'Quit');  
> 
>  $Excel->{DisplayAlerts} = 0;  
> 
>   my $Book  = $Excel->Workbooks->Open($file); # open Excel file
>   my $Sheet = $Book->Worksheets(1);   # select worksheet
number 1
>   
>  $Book->Close;
> 
>   did not enable the perl code to prevent Excel from bring up 
>   that dialog box.
>   
>   Just-in's other suggestion was "If not you may have to fudge
>   something with Win32::GuiTest", but didn't elaborate on
>   the "something" ...  
> 
>   So one thought is to have two threads -- one thread is as
>   above;  the other thread periodically searches for
>   appearence of the Excel dialog box, and when it finds one,
>   uses SendKeys to get rid of the box.
> 
>   Before I actually try the above scheme, any critique on
>   it? or any other suggestions?
> 
>   Thanks,
> 
>   --Suresh

my $Book  = $Excel->Workbooks->Open($file, {'UpdateLinks' => 3});

The value 3 I got from some VB code someplace I forget, and have
no clue what it means - hunted on MSDN to no avail. Anyone?

BTW Options to book->Open are fully listed in the Object Browser.

HTH - Lynn.



___
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: Opening an Excel workbook with links to other data sources

2006-04-20 Thread Jarvis, John
[Sorry again, left out the most important part]

Const xlUpdateLinksUserSetting = 1
Const xlUpdateLinksNever = 2
Const xlUpdateLinksAlways = 3

-Original Message-
From: Jarvis, John 
Sent: Thursday, April 20, 2006 11:03 AM
To: 'Lynn. Rickards'; Suresh Govindachar
Cc: perl-win32-users@listserv.ActiveState.com
Subject: RE: Opening an Excel workbook with links to other data sources



[Sorry for the top post, only got a few seconds to get this in...]

For what it's worth, the Excel 2003 VBA Help offers this clue to the
'UpdateLinks':

UpdateLinks Property
Returns or sets an XlUpdateLink constant indicating a workbook's setting for
updating embedded OLE links. 
Read/write.

XlUpdateLinks can be one of these XlUpdateLinks constants. 
xlUpdateLinksAlways Embedded OLE links are always updated for the specified
workbook. 
xlUpdateLinksNever Embedded OLE links are never updated for the specified
workbook. 
xlUpdateLinksUserSetting Embedded OLE links are updated according to the
user's settings for the specified workbook. 

expression.UpdateLinks
expressionRequired. An expression that returns a 'Workbook' object

Example
In this example, Microsoft Excel determines the setting for updating links
and notifies the user.

Sub UseUpdateLinks()

Dim wkbOne As Workbook

Set wkbOne = Application.Workbooks(1)

Select Case wkbOne.UpdateLinks
Case xlUpdateLinksAlways
MsgBox "Links will always be updated " & _
"for the specified workbook."
Case xlUpdateLinksNever
MsgBox "Links will never be updated " & _
"for the specified workbook."
Case xlUpdateLinksUserSetting
MsgBox "Links will update according " & _
"to user settting for the specified workbook."
End Select

End Sub



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Lynn. Rickards
Sent: Wednesday, April 19, 2006 6:02 PM
To: Suresh Govindachar
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Re: Opening an Excel workbook with links to other data sources

Suresh Govindachar wrote:
> Hello,
> 
>   Issue:  opening an excel file brings up a dialog box
>   stating that the "workbook contains links to
>   other data sources" and asks if the data
>   should be updated.  
> 
>   Just-in's suggestion of adding "$Excel->{DisplayAlerts} = 0;" 
>   to modify the code to be:
> 
>   use Win32::OLE qw(in with);
>   use Win32::OLE::Const 'Microsoft Excel';
> 
>   my $Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
>   Win32::OLE->new('Excel.Application', 'Quit');  
> 
>  $Excel->{DisplayAlerts} = 0;  
> 
>   my $Book  = $Excel->Workbooks->Open($file); # open Excel file
>   my $Sheet = $Book->Worksheets(1);   # select worksheet
number 1
>   
>  $Book->Close;
> 
>   did not enable the perl code to prevent Excel from bring up 
>   that dialog box.
>   
>   Just-in's other suggestion was "If not you may have to fudge
>   something with Win32::GuiTest", but didn't elaborate on
>   the "something" ...  
> 
>   So one thought is to have two threads -- one thread is as
>   above;  the other thread periodically searches for
>   appearence of the Excel dialog box, and when it finds one,
>   uses SendKeys to get rid of the box.
> 
>   Before I actually try the above scheme, any critique on
>   it? or any other suggestions?
> 
>   Thanks,
> 
>   --Suresh

my $Book  = $Excel->Workbooks->Open($file, {'UpdateLinks' => 3});

The value 3 I got from some VB code someplace I forget, and have
no clue what it means - hunted on MSDN to no avail. Anyone?

BTW Options to book->Open are fully listed in the Object Browser.

HTH - Lynn.



___
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: Iffor

2006-04-20 Thread John Deighan

At 12:44 AM 4/20/2006, Chris Wagner wrote:

At 10:42 AM 4/20/2006 +1000, Sisyphus wrote:
>On the subject of replacing brackets with modifiers (which I think was also
>raised earlier on), I was surprised to find that using a modifier is about
>25% faster than brackets:
>'modifier' => 'for(@x) {$z1++ if $_ != 3}',
>'brackets' => 'for(@y) {if($_ != 3){$z2++}}',

That is actually pretty well known.  The reason is that the former is a
short circuit style operation.  The code has a simple bifurcation.  In the
latter it is a code block which has to be setup for all the potential things
u can put in a code block.  Like my's, labels, etc.  Simply entering a curly
bracket costs money.  That's why it's best to avoid them unless ur stringing
just way too many and's and or's together.


And is there some reason that the compiler couldn't optimize that 
away by checking

to see if there are any my's, labels, etc. and avoiding the setup in that case?

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


Re: running a perl app

2006-04-18 Thread John Shea
Bruce,To determine the correct path for your perl interpretor, use:    which perl-- John T SheaThere are 2 kinds of people in the world,those who finish what they start ...
On 4/18/06, Ng, Bill <[EMAIL PROTECTED]> wrote:
First,You're writing to a Win32 (Read: Windows) mailing list. =)Second,You're either missing or misspelling the path to the perlinterpreter as your first line in every script.  Your first line should
always be:-#!/usr/bin/perl (or whatever the path is to your perl binary)-Hope this helps.Bill Ng-Original Message-From: 
[EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf OfbruceSent: Tuesday, April 18, 2006 3:22 PM
To: Perl-Win32-Users@listserv.ActiveState.comSubject: running a perl apphi..using linux. when i do "perl foo.pl" everything works ok. when i do
"./foo.pl" i get errors.. i've set the exe bit "chmod 775 foo.pl"...any idea as to what's going on...thanks-bruce___Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.comTo 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: Non-blocking IO?

2006-04-17 Thread John Serink
Win sockets on Win32?
not really, the only choice you have is IO::Select.
:)
John

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Lyle Kopnicky
Sent: Tuesday, April 18, 2006 12:22 AM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: Non-blocking IO?


Hi folks,

I'm using the HTTP::Daemon module.  Is there any way to do non-blocking 
IO with that?  Thanks.

-- 
Lyle Kopnicky
Software Project Engineer
Veicon Technology, Inc.

___
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


Win32 Perl Threads SLOW memory leak.

2006-04-13 Thread John Serink
Hi All:

The attached script is a performance test model I use for a production
script I have that uses sockets to connect to various targets once per
minute. It used to leak 2 handles per thread per run but that has been
fixed with perl 5.8.8-817. Now that the handles leak is fixed I have
been observing the test script over the last 4 days and she's leaking
memory...quite badly(as is the production code). I have used perfmon to
log the used memory( private bytes) which is growing at a rate of
1688.5t + 20,000,000 where t is time in units of 15 seconds. For
example, for t=240(1 hour) the memory increases 400Kbytes. Over 24
hours, it increases by ~9.6Mbytesand just keeps going up. I'd like
to make my production code a service but can't until I nail down this
memory leak. Handles are stable.

Any ideas?

Cheers,
John
Code is below:
use strict;
use warnings;
use IO::Select;
use Time::HiRes qw(gettimeofday);
use threads; 
use threads::shared;

my $MODBUSPORT=502;
my $UPDATERATE = 30;
my $CONNECTIONTIMEOUT = 10;
my $SOCKREADTIMEOUT = 5;
my $myfile = ">log.log";
my $i=0;
my $responsesIndex = 0;
my $thistime=gettimeofday();
my $starttime=$thistime;
my %responses: shared ;
my %connstatus: shared ;
my %readstatus: shared ;

while(1){
 my %addresses = (  "one  " => 1,
 "two  " => 2,
 "three" => 3,
 "four " => 4,
 "five " => 5,
 "six  " => 6,
 "seven" => 7,
 "eight" => 8,
 "nine " => 9,
 "ten  " => 10,
 "eleven"=> 11,
 "twelve"=> 12,
 "thirteen" => 13,
 "fourteen" => 14,
 "fifteen" => 15,
 "sixteen" => 16,
 "seventeen" => 17,
 "eightteen" => 18,
 "nineteen" => 19,
 "twenty" => 20);
 my %threadIDs ;
 my %conntimeout ;
 my %readtimeout ;

clearscreen();
 $thistime = gettimeofday();
 my @jim = keys(%addresses);
 for($i=0;$inew(\&goconnect, $addresses{$jim[$i]},
$MODBUSPORT);
  $thrconn -> detach();
  $threadIDs{$jim[$i]} = $thrconn->tid();
  if($i==0){
   $responsesIndex = $threadIDs{$jim[$i]};
   print("Responses Index is $responsesIndex\n");
  }
  $connstatus{$threadIDs{$jim[$i]}} =0;
  $readstatus{$threadIDs{$jim[$i]}} =0;
  $conntimeout{$threadIDs{$jim[$i]}} = gettimeofday();
  $readtimeout{$threadIDs{$jim[$i]}} =0;
  $responses{$threadIDs{$jim[$i]}} =0;  
 }
 my $jim = scalar(keys(%connstatus));
 print("the connstatus hash has $jim elements\n");
 while(scalar(keys(%connstatus))>0){
  my @frank=keys(%connstatus);
  for($i=0;$i$CONNECTIONTIMEOUT){
$responses{$frank[$i]}="Connection Timeout";
my $temp = "";
$temp=returnvalue(\%threadIDs,$frank[$i]);
unless($temp){
 $temp="";
}
$temp = $temp." : ".$responses{$frank[$i]}." ".localtime();
print("$temp\n");
delete($connstatus{$frank[$i]});
   } 
  }
  IO::Select->select(undef,undef,undef,0.5);
}

 my $temptime = gettimeofday()-$thistime;
 print("Preparing to wait, $temptime\n");
 my $steve=hashdestroy(\%connstatus);
 $steve = hashdestroy(\%readstatus);
 $steve = hashdestroy(\%readtimeout);
 $steve = hashdestroy(\%conntimeout);
 $steve = hashdestroy(\%threadIDs);

my $runtime = gettimeofday() - $starttime;
 my $runtimehours = int($runtime/3600);
 my $runtimeminutes = int(($runtime/3600 - $runtimehours)*60);
 my $runtimeseconds = int((($runtime/3600 - $runtimehours)*60 -
$runtimeminutes)*60);
 print("Program run time $runtimehours hours $runtimeminutes minutes
$runtimeseconds seconds\n");
 select(STDOUT);
 $|=1;
do {
 my $displaytime = $UPDATERATE - $temptime;
  $displaytime = sprintf("%05.1f", $displaytime);
  print("Time to next query $displaytime seconds\r");
  select(undef,undef,undef,0.1);
  $temptime = gettimeofday()-$thistime;
 } while($temptime < $UPDATERATE);
}

#  subroutine hashdestroy(\%hash) destroys all the remaining elements  #
#  of the hash pointed to by the reference \$hash. It returns the  #
#  number of elements destroyed.   #
#  #

sub hashdestroy
{
 my $jim = shift();
 my @bob=keys(%$jim);
 my $numdel = 0;
 
 foreach my $bill (@bob){
  delete($$ji

RE: :Select perl question

2006-04-06 Thread John Serink
You can't.
IO::Select with pipes and file handles is only supported on Unix.
IO::Select on Win32 only works with Sockets.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, April 06, 2006 2:10 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: IO::Select perl question
> 
> 
> Hi All!
> I am trying to use pipes in win32
> in my main program (in C) I have:
> 
> FILE *fd = _popen("perl d:/umts/catch_in.pl" , "wb");
> int i=12;
> fwrite((void*)&i,1,4,fd);
> ie=fflush(fd);
> _pclose(fd);
> 
> my perl code (in catch_in.pl) is :
> -
> use strict;
> use warnings;
> use IO::File;
> use IO::Select;
> my $in=new IO::File;
> $in->open("<-")  or die "cant open standart input !"; 
> binmode($in); my $buf; my $read_set = new IO::Select($in); # 
>  I commented next cycle #my $cnt=0; #while (!$cnt) { #my 
> @ar=$read_set->can_read('1'); #$cnt=scalar @ar; #} my 
> $n=read($in,$buf,4); exit;
> -
> This works ok.
> But with uncommented cycle 
> prog catch_in.pl hangs !
> My question is - why can_read 
>  always return empty array
> in spite of fact that there are data ready for read ???
> P.S. I tried can_read() also 
> ___
> 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: ActivePerl 5.8.8.817 released-Win32 Threads Leaking handles

2006-03-29 Thread John Serink
Hello Jan and Fellow Users:

The Win32 threads leaking handles bug is fixed! Yippie!
OUTSTANDING! Well done development team.

Have tested it on my leaking handles script and my production code,
looks good. The number of handles open jumps when the threads are
launched and as the detached threads die, the handles drop right back
down again as they should.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Thursday, March 30, 2006 10:50 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.817 released
> 
> 
> ActiveState has released ActivePerl 5.8.8.817 today.  It 
> fixes a number of serious issues that have been found in the 
> 816 release:
> 
> * Restored binary compatibility to previous releases.
> * Fixed several bugs on Windows related to GUI applications and
>   signal handling.  These bugs were introduced in build 816.
> * Updated threads and threads::shared modules to fix resource leaks
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> Build 817 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Upgraded the core threads and threads::shared modules with 
> threads-1.12 and threads-shared-0.99 from CPAN. This fixes 
> the handle leakage on Windows and allows setting the stack 
> size for new threads. It also fixes both the '!=' comparison 
> operator for thread objects and the crashes while joining 
> threads that go re-introduced in build 816.
> 
> =item *
> 
> Fixed several bugs in the new implementation of alarm() for 
> Windows. They did manifest themselves by signals not being 
> delivered, or by GUI applications randomly hanging.
> 
> =item *
> 
> Restored binary compatiblity for SvPV_nolen() and similar 
> macros. This incompatibility made it impossible to use 
> perlapp for Unix on Tk based applications.
> 
> =item *
> 
> Reintroduce PL_memory_wrap for binary compatiblity.
> 
> =item *
> 
> The C builtin now ignores directories matching the 
> given name when searching @INC.
> 
> =back
> 
> 
> ___
> 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: accurate timing in windows

2006-03-29 Thread John Serink
You need to be counting actual HW clock ticks. Win32::GetTickCount()
will return the HW timer count...believe its incremented every
millisecond. SW timers won't work.

Also, you can't use sleep for anything other than integer seconds. If
you want to sleep for periods smaller than a second, you need to use
either the IO::Select module or the select( undef, undef, undef,
timetosleep) function. Timetosleep can be any value down to 0.001.

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Spencer_Lists
> Sent: Wednesday, March 29, 2006 5:33 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: accurate timing in windows
> 
> 
> Greetings perl-win32-users,
> 
> I have a TK application that sends MIDI messages to various 
> devices. I need to accurately time the occurrence of these 
> events in spite of what windows is doing. It have tried the 
> hires time module as well as the until function and the 
> results are not accurate enough. It has been suggested that 
> the only way to have accurate event timing in windows is to 
> use the multimedia timer. Is there a perl module that 
> accesses this timer or any other way to do so? I just need to 
> repeat the same sequence of events in a loop so I need 
> something that functions like until or sleep. Will a loop 
> running in perl still be subject to timing variations caused 
> by other windows processes even using the multimedia timer? 
> If so, is there any way around this?
> 
> The actual loop has a lot more going on to update graphics 
> etc. but this is basically what I need to do:
> 
> sub repeat_note{
> my $note = shift;
> while(1){
> $midi_obj->play_note($note,0.0,60,(1),0) || print 
> $midi_obj->error() . "\n" and $midi_obj->reset_error();
> sleep ($notedur/1000);
> $midi_obj->note_off($note,0.0,60,(1),1) || print 
> $midi_obj->error() . "\n" and $midi_obj->reset_error();
> $notearray[$note] = 0;
> sleep($offdur/1000);
> }
> }
> 
> 
>  -- Best regards, Spencer_Lists Chase 
> mailto:[EMAIL PROTECTED] 67550 Bell Springs Rd. 
> Garberville, CA 95542  Postal service only. Laytonville, CA 
> 95454  UPS only. [EMAIL PROTECTED] 
> http://www.spencerserolls.com 
> http://www.spencerserolls.com/MidiValve.htm (707) 984-8356
> 
> ___
> 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: Perl book sale at Suntec City (Singapore)

2006-03-26 Thread John Serink
Where at Suntec?

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Monday, March 27, 2006 10:01 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Perl book sale at Suntec City (Singapore)
> 
> 
> Ok, I know this is relevant to a specific few, but it's too 
> good a deal...
> 
> I've just gotten my hands on 5 Perl books, for a total of only SGD 40 
> (about USD 25). Includes: mod_perl (O Reilly), Perls of Wisdom, 
> Template::Toolkit, Perl Algorithms, and Mason.
> 
> For those who are travelling enroute to Singapore, let me 
> know and I'll 
> give you directions. ___
> 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: Implementing or Emulating TSRs in Win32 Console Apps

2006-03-16 Thread John Serink
Hi Veli:

There are several way to do what you want. What not use threads?
You could use IO::Select as well but that only works for sockets on Win32 
unfortunately, in Linux it works with console handles as well.

Threads is the most straight forward but I've had problems with threads 
crashing the 5.8.8-816 perl interpriter so mgith have to use 5.8.7-815.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Veli-Pekka Tätilä
> Sent: Friday, March 17, 2006 12:57 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Implementing or Emulating TSRs in Win32 Console Apps
> 
> 
> Hi,
> Is it possible to do a DOS TSR-program in Perl? In this 
> context I mean an 
> app which runs as long as you've got a DOS session open but 
> which can lurk 
> in the background, accepting commands or processing hotkeys. 
> TSRs were sort 
> of magical in the DOS days as it was a single-tasking OS and 
> I recall many 
> of the assistive technologies I used to use back then ran as 
> terminate and 
> stay resident programs. I'm only familiar with the technology 
> from the user 
> point of view and have no idea how it is implemented 
> technically.  I do know 
> many of the TSR based access aids are no good in XP but that might be 
> because of other low level things than the TSR code it self, 
> I don't know.
> 
> If, however, true TSRs are not possible to implement or might be 
> unsupported, even as C-based extensions, are there any good 
> work-arounds in 
> Win32 console apps? I've got some console app ideas which 
> would require this 
> kind of operation. Basically I'd like to maintain an illusion 
> of the user 
> having run a program, being able to interact with the shell (cmd.exe) 
> normally and control the background program via some special 
> hotkeys or 
> command-line switches to the perl script (/u for unload, /s 
> for status 
> etc...). I'd also like to post stuff asynchronously on screen 
> so that the 
> output would appear right away, rather than, say, after an 
> enter press for 
> submitting the next command. I suppose this is some kind of 
> non-blocking 
> write. The OS is Win XP and I'd prefer modules available via 
> PPM if there 
> are any.
> 
> Lastly, out of curiosity how do these things work in Unix? I 
> haven't used 
> much of it but the first example that came to mind is the app 
> which let's 
> you know of new mail in SunOs.
> 
> Any help appreciated as usual.
> 
> -- 
> 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


FW: ActivePerl 5.8.8.816 released

2006-03-16 Thread John Serink
Hi All:

After installing perl 5.8.8-816 I ran my handles leak program to see if
perl is still leaking handles when using shared arrays and hashes with
threads. Problem is, I don't have an answer on whether it still leaks
handles because the interpreter crashes in the midst of lunching the
threads. It does this with my handlesleak7.pl script and with my
production code, the perl interpreter crashes and I get Dr. Watson come
up asking me to email Mickeysoft.

handlesleak7.pl is attached.

Uninstalling 5.8.8-816 and putting back 5.8.7-815.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler.
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C.
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor>
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
>

RE: ActivePerl 5.8.8.816 released

2006-03-15 Thread John Serink
Hi All:

After installing perl 5.8.8-816 I ran my handles leak program to see if
perl is still leaking handles when using shared arrays and hashes with
threads. Problem is, I don't have an answer on whether it still leaks
handles because the interpreter crashes in the midst of lunching the
threads. It does this with my handlesleak7.pl script and with my
production code, the perl interpreter crashes and I get Dr. Watson come
up asking me to email Mickeysoft.

handlesleak7.pl is attached.

Uninstalling 5.8.8-816 and putting back 5.8.7-815.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816 
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for 
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta 
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now 
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that 
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler. 
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides 
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C 
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is 
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C. 
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar 
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when 
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the 
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory 
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor> 
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
> 
> 
> ___
> Perl-Win32-Users mailing list 
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


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


RE: System resources used by Perl script

2006-03-14 Thread John Serink
>From the Active per docs:
Devel::DProf - a Perl code profiler

* NAME
* SYNOPSIS
* DESCRIPTION
* PROFILE FORMAT
* AUTOLOAD
* ENVIRONMENT
* BUGS
* SEE ALSO

NAME

Devel::DProf - a Perl code profiler

SYNOPSIS

perl -d:DProf test.pl

DESCRIPTION

The Devel::DProf package is a Perl code profiler. This will collect
information on the execution time of a Perl script and of the subs in
that script. This information can be used to determine which subroutines
are using the most time and which subroutines are being called most
often. This information can also be used to create an execution graph of
the script, showing subroutine relationships.

To profile a Perl script run the perl interpreter with the -d debugging
switch. The profiler uses the debugging hooks. So to profile script
test.pl the following command should be used:

perl -d:DProf test.pl

When the script terminates (or when the output buffer is filled) the
profiler will dump the profile information to a file called tmon.out. A
tool like dprofpp can be used to interpret the information which is in
that profile. The following command will print the top 15 subroutines
which used the most time:

dprofpp

To print an execution graph of the subroutines in the script use the
following command:

dprofpp -T

Consult dprofpp for other options.

PROFILE FORMAT

The old profile is a text file which looks like this:

#fOrTyTwO
$hz=100;
$XS_VERSION='DProf 19970606';
# All values are given in HZ
$rrun_utime=2; $rrun_stime=0; $rrun_rtime=7
PART2
+ 26 28 566822884 DynaLoader::import
- 26 28 566822884 DynaLoader::import
+ 27 28 566822885 main::bar
- 27 28 566822886 main::bar
+ 27 28 566822886 main::baz
+ 27 28 566822887 main::bar
- 27 28 566822888 main::bar
[]

The first line is the magic number. The second line is the hertz value,
or clock ticks, of the machine where the profile was collected. The
third line is the name and version identifier of the tool which created
the profile. The fourth line is a comment. The fifth line contains three
variables holding the user time, system time, and realtime of the
process while it was being profiled. The sixth line indicates the
beginning of the sub entry/exit profile section.

The columns in PART2 are:

sub entry(+)/exit(-) mark
app's user time at sub entry/exit mark, in ticks
app's system time at sub entry/exit mark, in ticks
app's realtime at sub entry/exit mark, in ticks
fully-qualified sub name, when possible

With newer perls another format is used, which may look like this:

#fOrTyTwO
$hz=1;
$XS_VERSION='DProf 19971213';
# All values are given in HZ
$over_utime=5917; $over_stime=0; $over_rtime=5917;
$over_tests=1;
$rrun_utime=1284; $rrun_stime=0; $rrun_rtime=1284;
$total_marks=6;

PART2
@ 406 0 406
& 2 main bar
+ 2
@ 456 0 456
- 2
@ 1 0 1
& 3 main baz
+ 3
@ 141 0 141
+ 2
@ 141 0 141
- 2
@ 1 0 1
& 4 main foo
+ 4
@ 142 0 142
+ & Devel::DProf::write
@ 5 0 5
- & Devel::DProf::write

(with high value of $ENV{PERL_DPROF_TICKS}).

New $over_* values show the measured overhead of making $over_tests
calls to the profiler These values are used by the profiler to subtract
the overhead from the runtimes.

The lines starting with @ mark time passed from the previous @ line. The
lines starting with & introduce new subroutine id and show the package
and the subroutine name of this id. Lines starting with +, - and * mark
entering and exit of subroutines by ids, and goto &subr.

The old-style +- and --lines are used to mark the overhead related to
writing to profiler-output file.

AUTOLOAD

When Devel::DProf finds a call to an &AUTOLOAD subroutine it looks at
the $AUTOLOAD variable to find the real name of the sub being called.
See Autoloading in the perlsub manpage.

ENVIRONMENT

PERL_DPROF_BUFFER sets size of output buffer in words. Defaults to
2**14.

PERL_DPROF_TICKS sets number of ticks per second on some systems where a
replacement for times() is used. Defaults to the value of HZ macro.

PERL_DPROF_OUT_FILE_NAME sets the name of the output file. If not set,
defaults to tmon.out.

BUGS

Builtin functions cannot be measured by Devel::DProf.

With a newer Perl DProf relies on the fact that the numeric slot of
$DB::sub contains an address of a subroutine. Excessive manipulation of
this variable may overwrite this slot, as in

  $DB::sub = 'current_sub';
  ...
  $addr = $DB::sub + 0;

will set this numeric slot to numeric value of the string current_sub,
i.e., to 0. This will cause a segfault on the exit from this subroutine.
Note that the first assignment above does not change the numeric slot

RE: ActivePerl 5.8.8.816 released

2006-03-13 Thread John Serink
Has the handles leak on Win32 when using shared variables with threads
been fixed?

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816 
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for 
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta 
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now 
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that 
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler. 
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides 
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C 
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is 
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C. 
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar 
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when 
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the 
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory 
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor> 
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
> 
> 
> ___
> 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: old messages?

2006-03-07 Thread John Serink
Yup.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris
> Sent: Wednesday, March 08, 2006 6:55 AM
> To: 'Chris Wagner'; perl-win32-users@listserv.ActiveState.com
> Subject: RE: old messages?
> 
> 
> 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.
> 
> 
> 
> I've been getting them all day.
> 
> - Chris
> 
> 
> ___
> 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: Change network interface parameters via Perl

2006-03-07 Thread John Serink
You could just use netsh.



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Monday, February 28, 2005 7:18 PM
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: RE: Change network interface parameters via Perl
> 
> 
> Assuming you are on NT/Win2K/XP/2003 You could try WMI... 
> This is hacked together from my build system and untested but 
> it should give you the general idea. Some references here: 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/wmisdk/
> wmi/win32_networkadaptersetting.asp
> 
> Paul
> 
> 
> use Win32::OLE
> 
> my $x = 
> Win32::OLE->GetObject("WinMgmts://$ENV{COMPUTERNAME}/root/cimv2");
> my $y = $x->ExecQuery(qq(SELECT * FROM Win32_NetworkAdapter 
> WHERE AdapterType = "Ethernet 802.3"));
> 
> my $NewIP   = "192.168.0.1";
> my $NewMask = "255.255.255.0";
> my $NewGateway  = "192.168.0.254";
> my $NewDNS  = [ ("192.168.0.10","192.168.0.50" ];
> 
>  foreach my $adapter (in $y) {
>   my $settings = 
> $adapter->Associators_(undef,"Win32_NetworkAdapterConfiguration");
>   for my $setting (in $settings) {
>   next unless $setting->{IPEnabled} == 1;
>   # We only get to here if the adapter is 
> ethernet and ip enabled
>   my $IPAddress = $setting->{IPAddress}->[0];
>   my $Mask  = $setting->{IPSubnet}->[0];
>   my $Gateway   = $setting->{DefaultIPGateway}->[0];
>   my $DHCPState = $setting->{DHCPEnabled};
>   my $AdapterIndex = $adapter->{Index};
>   my $AdapterName = $adapter->{Description};
>   
>   print "\t\tOld ip details for adapter $ApapterIndex
> ($AdapterName): IP - $IPAddress DHCP - $DHCPState\n";
>   
>   my $result = $setting->EnableStatic([ $NewIP ], [
> $NewMask ]);
>   print "\t\tSet ip to $NewIP (result $result)\n";
>   
>   my $result = $setting->SetGateways([ $NewGateway ], [ 1
> ]);
>   print "\t\tSet gateway to $NewGateway (result
> $result)\n";
>   
>   my $result = $setting->SetDNSServerSearchOrder($NewDNS);
>   print "Set DNS servers to " . join(",",@$NewDNS) .
> "(result $result)\n";
>   
>   exit;
>   }
> }
> 
> -Original Message-
> 
> *
> Gloucester Research Limited believes the information 
> provided herein is reliable. While every care has been 
> taken to ensure accuracy, the information is furnished 
> to the recipients with no warranty as to the completeness 
> and accuracy of its contents and on condition that any 
> errors or omissions shall not be made the basis for any 
> claim, demand or cause for action.
> *
> 
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marcos Lorenzo de Santiago
> Sent: 28 February 2005 09:59
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: Change network interface parameters via Perl
> 
> I need to change the network interface parameters (ie: IP, 
> Gateway, Mask,
> DHCP...) via Perl, is there any module I could use? and/or 
> documentation on it? I've been trying to use netsh command 
> from Windows XP and parsing its output but I guess there 
> might be another prettier way to do this.
> 
> 
> TIA.
> Regards,
> m4c.
> 
> -- 
> ,-
> -.
> | Mathematics is the only science where one never knows what  
>  |
> | one is talking about nor whether what is said is true.  
>  |
> | -- Russell  
>  |
> |-
> -|
> | Labs. Technician  | 
>  |
> | Department of Telematic Engineering   | Debian 
> GNU/Linux Powered |
> | Universidad Carlos III de Madrid  | 
>  |
> |---|
> .--.  |
> |   |   
> |o_o | |
> |  _|  .''`.
> |:_/ | |
> | |~~  @| Marcos Lorenzo de Santiago| : :' :   // 
>   \ \|
> | |     | E-mail:  [EMAIL PROTECTED]| `. `'   (|  
>| )   |
> | |     | Telephone: (+34) 91-624-9959  |   `-   /'\_ 
>   _/`\   |
> | |_| Web: www.it.uc3m.es/marcos|
> \___)=(___/   |
> |   | 
>  |
> `-
> -'
> 
> 
> ___
> Perl-Win32-Users mailing list 
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.Act

RE: Battery info on a laptop

2006-03-05 Thread John Serink
Use this as a hack template till you get your head around it:
#!perl

# Simple Perl Script to illustrate use of WMI to gather system
information
# and display it in the same format at the Windows Management Console

use Win32::OLE qw(in with);
use Win32::Registry;

# Pick a host that you have the necessary rights to monitor

$host = "johnathlonxpm";

# Gather System Information

$WMI = Win32::OLE->new('WbemScripting.SWbemLocator') ||
 die "Cannot access WMI on local machine: ", Win32::OLE->LastError; 
 
$Services = $WMI->ConnectServer($host) ||
 die "Cannot access WMI on remote machine: ", Win32::OLE->LastError; 

# Gather Computer System Information
 
$sys_set = $Services->InstancesOf("Win32_ComputerSystem");
foreach $sys (in($sys_set)) 
 {  
  $system_name = $sys->{'Caption'};
  $system_type = $sys->{'SystemType'};
  $system_manufacturer = $sys->{'Manufacturer'};
  $system_model= $sys->{'Model'};
 }
 

# Gather Processor Information
$processor_set = $Services->InstancesOf("Win32_Processor");
foreach $proc (in($processor_set)) 
 {
  $proc_description= $proc->{'Caption'};
  $proc_manufacturer   = $proc->{'Manufacturer'};
  $proc_mhz= $proc->{'CurrentClockSpeed'};
 }


# Gather BIOS Information

#$bios_set = $Services->InstancesOf("Win32_BIOS");
#foreach $bios (in($bios_set)) 
# {  
#  $bios_info   = $bios->{'Version'};
# }

# Gather Time Zone Information

$loc_set = $Services->InstancesOf("Win32_TimeZone");
foreach $loc (in($loc_set)) 
 {
  $loc_timezone  = $loc->{'StandardName'};  
 }

# Gather Operating System Information

$os_set = $Services->InstancesOf("Win32_OperatingSystem");
foreach $os (in($os_set)) 
 {
  $os_name = $os->{'Caption'};
  $os_version  = $os->{'Version'};
  $os_manufacturer = $os->{'Manufacturer'};
  $os_build= $os->{'BuildNumber'};
  $os_directory= $os->{'WindowsDirectory'};
  $os_locale   = $os->{'Locale'}; 
  $os_totalmem = $os->{'TotalVisibleMemorySize'};
  $os_freemem  = $os->{'FreePhysicalMemory'};
  $os_totalvirtmem = $os->{'TotalVirtualMemorySize'};
  $os_freevirtmem  = $os->{'FreeVirtualMemory'};
  $os_pagefilesize = $os->{'SizeStoredInPagingFiles'}; 
 }

$tempstuff = $Services->InstancesOf("Win32_BaseBoard");

foreach my $sysvar (in($tempstuff)){
$bbcaption  = $sysvar ->{'Caption'};
$bbconfigoptions= $sysvar ->{'ConfigOptions'};
$dddepth= $sysvar ->{'Depth'};  
$bbheight   = $sysvar ->{'Height'};
$bbwidth= $sysvar ->{'Width'};
$bbweight   = $sysvar ->{'Weight'};
$bbmanufacturer = $sysvar ->{'Manufacturer'};
$bbmodel= $sysvar ->{'Model'};
$bbname = $sysvar ->{'name'};
$bbpartnumber   = $sysvar ->{'PartNumber'};
$bbproduct  = $sysvar ->{'Product'};
$bbrequiredescript  = $sysvar ->{'RequirementsDescription'};
$bbsku  = $sysvar ->{'SKU'};
$bbslotlayout   = $sysvar ->{'SlotLayout'};
$bbtag  = $sysvae ->{'Tag'};
}

# Now convert the system's Locale to a string
# Use the Rfc1766 Database stored in the Registry as a lookup table

$main::HKEY_LOCAL_MACHINE->Open("SOFTWARE\\Classes\\MIME\\Database\\Rfc1
766",$Rfc1766);
$Rfc1766->GetValues(\%Values);
foreach $key (keys %Values)
 {
  $key = $Values{$key};
  if ($$key[0] eq $os_locale)
   {
($lang, $country) = split(/\;/, $$key[2]);
last;
   } 
 }

print "System Summary Information\n";
print "--\n";
print "OS Name\t\t\t\t$os_name\n";
print "Version\t\t\t\t$os_version Build $os_build\n";
print "OS Manufacturer\t\t\t$os_manufacturer\n";
print "System Name\t\t\t$system_name\n";
print "System Manufacturer\t\t$system_manufacturer\n";
print "System Model\t\t\t$system_model\n";
print "System Type\t\t\t$system_type\n";
print "Processor\t\t\t$proc_description $proc_manufacturer ~$proc_mhz
Mhz\n";
#print "BIOS Version\t\t\t$bios_info\n";
print "Windows Directory\t\t$os_directory\n";
print "Locale\t\t\t\t$country\n";  
print "Time Zone\t\t\t$loc_timezone\n";
print "Total Physical Memory\t\t$os_totalmem KB\n";
print "Available Physical Memory\t$os_freemem KB \n";
print "Total Virtual Memory\t\t$os_totalvirtmem KB\n";
print "Available Virtual Memory\t$os_freevirtmem KB\n";
print "Page File Space\t\t\t$os_pagefilesize KB\n";
print("Caption is $bioscaption\n");
print("Base Board caption is $bbcaption\n");
print("Base Board configuration options @$bbconfigoptions\n");
print("Base Board depth is $bbdepth inches\n");
print("Base Board height is $bbheight inches\n");
print("Base Board width is $bbwidth inches\n");
print("Base Board weight is $bbweight lbs\n");
print("Base Board manufacturer is $bbmanufacturer\n");
print("Base Board model is $bbmodel\n");
print("Base Boa

RE: Battery info on a laptop

2006-03-04 Thread John Serink
Use the appropriate WMI classes with the Win32::OLE module.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of andrew Black
> Sent: Sunday, March 05, 2006 2:10 AM
> To: perl-win32-users
> Subject: Battery info on a laptop
> 
> 
> Hi
> Does anyone know if it is possible to get hold of the battery 
> information on an XP laptop via perl (or any other prog 
> language) Looking for whether on AC power / level of the battery etc
> 
> Andrew
> ___
> 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: [aswin32] RE: Perl Bug (again)

2006-02-18 Thread John Deighan

At 04:50 PM 2/17/2006, Robert May wrote:
my is a compile time directive that creates the lexically scoped $i, 
giving is scope from its definition until the end of the enclosing block.


Assignment is a run time operation.  In your example the modified 
assignment doesn't get executed, so the value of $i is *not 
defined*, in current perl's it happens to take the 'undef' value.



NOTE: The behaviour of a my statement modified with a statement 
modifier conditional or loop construct (e.g. my $x if ...) is 
undefined. The value of the my variable may be undef, any previously 
assigned value, or possibly anything else. Don't rely on it. Future 
versions of perl might do something different from the version of 
perl you try it out on. Here be dragons.




OK, this was an excellent explanation of what is going on, so now I 
understand it and can thus avoid it. Still, we have the following 
situation: A construct in the language which is syntactically valid 
has an undefined behaviour. And, I admit, if I had read all of the 
voluminous Perl documentation, I would have eventually come across 
that fact. Furthermore, that construct has a behaviour that should 
never occur in a programming language, namely, a variable local to a 
function retains its value across invocations of that function.


I might further point out that with both "use strict" and "use 
warnings", there is no indication that I've used a bad construct in 
the code. When I execute with "use strict" and "use warnings", there 
are some warnings, but only having to do with use of uninitialized 
values in '==' comparisons and '.' operators. When we have a 
construct that is easily detected by the compiler, and has an 
undefined result, with warnings in the documentation about its use - 
how can there not be a warning generated? 


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


RE: Perl Bug (again)

2006-02-17 Thread John Deighan


At 01:06 PM 2/17/2006, Joe Discenza wrote:
Fascinating! You
have one misconception right off: The "my" line is never
executed (not even to make the new variables) if $L is
false.
OK, then, consider this program. Notice that there's a global $i
which has the value 5. Now, when func() is called, if the "my
$i" did not create a new lexically scoped variable, then the print
line would print "i = 5". But it doesn't - obviously because
the lexical variable was created, but is undefined because $b is
false.
our $i = 5;
our $b = 0;
func();
sub func {
my $i = 3 if $b;
print("i = $i\n");
}


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


Re: Perl Bug (again)

2006-02-17 Thread John Deighan

At 01:29 PM 2/17/2006, Chris Wagner wrote:

At 12:46 PM 2/17/2006 -0500, John Deighan wrote:
>OK, same caveat as before - apparent bugs in Perl are usually user
>errors, but once again, I'm stumped. Here is my code. The problem I
>have is in the second call to getCached(), specifically, the line:
>
>my($nextID,$maxID) = @$L if $L;

I think this is the error.  Notice the if part.  If $L is undefined, nothing
before the if takes place, including the my declaration.  Put the my's up by
themselves and all works as expected.  You always have to be careful in
strining too many shortcuts together.


That in no way explains where the values that end up in those 
variables come from. Also, see my other post about the creation of 
the lexical variables in statement like "my $var =  if 
". If I'm wrong in that post, I'd like to know why.


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


Perl Bug (again)

2006-02-17 Thread John Deighan
OK, same caveat as before - apparent bugs in Perl are usually user 
errors, but once again, I'm stumped. Here is my code. The problem I 
have is in the second call to getCached(), specifically, the line:


my($nextID,$maxID) = @$L if $L;

The parameter to getCached, $Customer, has a different value than 
during the first call. Because of that, the variable $L is undefined. 
What I expect the statement above to do is to create 2 new variables, 
$nextID and $maxID. Then, if $L has a true value in it, it's treated 
as a reference to a list and the first 2 values in that list would be 
assigned to the variables. However, if $L is false, then the 
variables would be left undefined. What's really blowing my mind is 
the that values in $nextID and $maxID get the values THAT THEY WERE 
ASSIGNED DURING THE PREVIOUS CALL TO THIS FUNCTION. Wow! They're "my" 
variables inside the getCached() function. How could they end up with 
values from a previous invocation of the function?


I've added the output from when I run this below. BTW, I'm running 
ActiveState ActivePerl v. 5.8.7 Build 815 under MS Windows 2000 Server.


# ---
use strict;

our $hCache = {};

my $id1 = getCached('x');
my $id2 = getCached('y');

print("id1 = '$id1\n");
print("id2 = '$id2\n");

# ---

sub getCached { my($Customer) = @_;

my $L = $hCache->{$Customer};
print(defined($L) ? "L defined\n":"L undefined\n");
my($nextID,$maxID) = @$L if $L;
print("nextID = '$nextID', maxID = '$maxID'\n");
if ($nextID==$maxID) {
($nextID,$maxID) = getNextMax($Customer);
$hCache->{$Customer} = [$nextID+1, $maxID];
}
else {
++$hCache->{$Customer}->[0];
}
return $nextID;
} # getCached()

# ---

sub getNextMax { my($CustomerName) = @_;

if ($CustomerName eq 'x') {
return (100,150);
}
elsif ($CustomerName eq 'y') {
return (200,250);
}
} # getNextMax()


# ---
OUTPUT:
# ---
C:\Scripts>testIDs.pl
L undefined
nextID = '', maxID = ''
L undefined
nextID = '100', maxID = '150'
id1 = '100
id2 = '100

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


Does a Perl module already exist for this?

2006-02-14 Thread John Townsend








In my Perl scripts I often need to perform two basic
math/statistical operations:

 

1. given a list of numbers, return their average

 

2. given a list of numbers, toss the highest and the lowest,
return the result

 

I already have Perl functions that perform these tasks, but
I suspect there’s a Perl module out there that does this for me. Any
suggestions?

 

---

John Townsend

AGM Print/PDF Port /Fargo
QE Lead

5-7204, [EMAIL PROTECTED]

---

 






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


Re: Perl bug?

2006-02-08 Thread John Deighan

At 03:09 PM 2/8/2006, Glenn Linderman wrote:
Now that I understand the situation, I can offer the following as a 
way to safely do what I was trying to do in the first place - by 
creating an anonymous function and assigning it to a variable named 
$gettoken, then calling it with the syntax   &$gettoken(). This has 
the effect of forcing the closure (i.e. the anonymous function) to 
be re-built each time that parse() is called instead of just the 
first time. (Actually, this was suggested to me by Steve Hurst, 
though at that time I still didn't understand why this was any 
different than my original code).


Yes, I guess that will work.  I'm not sure that the performance 
would be as good as passing passing the $list to the gettoken 
function, though. So it depends on whether your goal is to emulate 
Pascal, or to have good performance.  I haven't done the performance 
study, but the thought of "rebuilding the closure" each time sounds 
expensive :)


Good point. I think I'll just always pass in the parameters.

New rule to self: When putting one function inside another, pass all 
required data in - don't rely on the inside function being able to 
access data in the enclosing function (unless, of course, that's 
really the behaviour you want, i.e. for the data to remain the same 
over multiple calls to the outside function). Thanks.


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


Re: Perl bug?

2006-02-08 Thread John Deighan

At 12:10 PM 2/8/2006, Glenn Linderman wrote:
On approximately 2/8/2006 6:40 AM, came the following characters 
from the keyboard of John Deighan:
I realize that most things that look like bugs in Perl are in 
reality programmer bugs, but I can't figure out why the second call 
to the function "parse()" in the code below fails..
So, $lTokens is a reference from a sub, to a variable declared 
outside of the sub (specifically, to the $lTokens declared in parse 
on its first invocation), thus making gettoken a closure and 
causing that instance of $lTokens to be preserved as part of the 
state of the closure.



return undef;
}
my $token = shift(@$lTokens);


During the first sequence of calls to gettoken, it modifies that 
saved value, eventually reducing it to an empty list.  During the 
second call to parse, regardless of the fact that a new variable 
$lTokens has been instantiated by the second call, doesn't change 
the state of the closure gettoken, which has captured the first 
instance of $lTokens (and then modified that value).


I had quite a discussion about this sort of thing with Dave 
Mitchell, who seems to be the closure expert in p5p, on the p5p list 
some years back, when I first "discovered" closures.  Read about 
closures in the Perl documentation for more enlightenment.  I think 
I kind of understand them at this point, and am willing to discuss 
it further if reading the perl documentation about closures, and 
comparing it to what you have done in your example here, doesn't 
provide enlightenment to you. Perhaps you already understand 
closures, but didn't realize that perl provided them?  I was in the 
state of having heard that perl provided them, but not really 
understanding what they were.


I think I understand, but let me summarize: The function gettoken() 
is created as a separate object, which contains a copy of the 
variable $lTokens in the enclosing function parse() at the point that 
parse() is first called. At that point, the variable $lTokens points 
to an array containing 3 items, but during the first running of 
parse(), those items are removed. When the second call to parse() 
occurs, the function gettoken() is not rebuilt, but still contains a 
reference to the original array, which is empty, and which the new 
instance of $lTokens does not refer to. So, in fact, gettoken() is 
not getting tokens from the list referred to by the variable 
$lTokens, but instead from the original array, which is now empty.


Part of my problem here stems from wanting functions to work like 
they do in Pascal, where you can create functions inside of 
functions, where the inside functions can manipulate the variables 
defined in their enclosing functions. To me, this is very intuitive 
and a very powerful abstraction mechanism. You can't do that in C, 
where all functions are top level. However, the syntax in Perl fooled 
me into thinking that the embedded functions work like they would in 
Pascal. I didn't realize that they were really closures, which I have 
worked with before, but usually by creating anonymous functions and 
returning them as the result of a function call. Now that I 
understand the situation, I can offer the following as a way to 
safely do what I was trying to do in the first place - by creating an 
anonymous function and assigning it to a variable named $gettoken, 
then calling it with the syntax   &$gettoken(). This has the effect 
of forcing the closure (i.e. the anonymous function) to be re-built 
each time that parse() is called instead of just the first time. 
(Actually, this was suggested to me by Steve Hurst, though at that 
time I still didn't understand why this was any different than my 
original code).


Anyway, here's the code that works, and now I understand why the 
previous code didn't work. I've removed the unused parameter from the 
parse() function (it was left over from when I stripped out 
irrelevant code to this problem) and renamed the variable $lTokens in 
the parse() function to $list so as to not have 2 different variables 
with the same name, but other than that, the main change was to 
change the "sub gettoken {" to "my $gettoken = sub {" to force the 
rebuilding of the closure to occur each time that parse() is called.



use strict;

my $lTokens = [qw(2 * 2)];
my $errmsg = parse($lTokens);
print($errmsg ? "ERROR: $errmsg\n" : "OK\n");

$lTokens = [qw(2 * 2)];
my $errmsg = parse($lTokens);
print($errmsg ? "ERROR: $errmsg\n" : "OK\n");

# ---

sub parse { my($list) = @_;

my $gettoken = sub {

if (@$list==0) {
return undef;
}
my $token = shift(@$list);
return $token;
}; # gettoken()

my $tok = &$gettoken();
print("T

Perl bug?

2006-02-08 Thread John Deighan
I realize that most things that look like bugs in Perl are in reality 
programmer bugs, but I can't figure out why the second call to the 
function "parse()" in the code below fails. According to my debugger 
(from ActiveState's Perl Development Kit), the function parse() gets 
a correct list of 3 tokens in parameter $lTokens, but when the 
embedded function gettoken() is called, it thinks that $lTokens is an 
empty list. This only happens the second time that parse() is called, 
not the first time. I'm just completely baffled.


P.S. Please don't send me e-mails about how to get this working right 
by modifying the code. I'm sure I can do that, and besides, the real 
code is considerably more complicated than this. I want to know why 
this code does not work as I expect. Anyway, here's the code and the 
output I get (I'm running ActivePerl 5.8.7 Build 815 under Windows 
2000 Server):


use strict;

my $lTokens = [qw(2 * 2)];
my $errmsg = parse($lTokens);
print($errmsg ? "ERROR: $errmsg\n" : "OK\n");

$lTokens = [qw(2 * 2)];
my $errmsg = parse($lTokens);
print($errmsg ? "ERROR: $errmsg\n" : "OK\n");

# ---

sub parse { my($lTokens, $callback) = @_;

sub gettoken {

if (@$lTokens==0) {
return undef;
}
my $token = shift(@$lTokens);
return $token;
} # gettoken()

my $tok = gettoken();
print("TOKEN: '$tok'\n");
return("Empty Input") if !$tok;
$tok = gettoken();
while ($tok) {
print("TOKEN: $tok\n");
$tok = gettoken();
}
}


---
OUTPUT:
---
C:\Scripts>testGrammar2.pl
TOKEN: '2'
TOKEN: *
TOKEN: 2
OK
TOKEN: ''
ERROR: Empty Input

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


RE Multi Dimensional Arrays

2006-02-01 Thread Jarvis, John








Amit wrote:

 

>Hello all,
>  I am a newbee in perl. Just wanted some guidance so as to how to
implement multidimensional arrays in perl. I have >to create an 2-d array
with 26*26 of all the english alphabets so that for each row and column i can
have a partiulcar >value like a to a =1
>b to a=2;
>I am just not getting how to implement this. 
>Can someone suggest something.
>Thanks 
>Amit.

 



Best advice: Learn from wizards.  

Example: check out O'Reilly books, (such as 'Perl Cookbook');


   look up "multidimensional arrays",


   then do what they do.

 

 



"Complex (multilevel) data structures in Perl are
always put together using references.  What appear to be 'two-dimensional
arrays' or 'arrays of arrays' are always implemented as
arrays of array references, in the same way that two-dimensional arrays in C
can be arrays of pointers."



 

HTH






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


RE: SQL Server "Invalid Cursor State"

2006-01-24 Thread John Deighan

At 10:46 AM 1/24/2006, Ray Albert wrote:
Hello, I just successfully ran your code against my database. Is it 
possible you lost the database connection?


I don't think so. It's very repeatable. However, I think this code 
used to work, so I got to thinking about the versions of Perl, SQL 
Server, etc. that I'm running. Here they are. It would probably help 
me if you'd send me the versions on the computer where the code worked.


OS: Microsoft Windows 2000 Server  v. 5.0.2195 SP4 Build 2195
Perl: ActivePerl 5.8.7 Build 815
DBI: version 1.49
DBD-ODBC: version 1.13
SQL Server: Personal Edition 8.00.760 (SP3)


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


SQL Server "Invalid Cursor State"

2006-01-24 Thread John Deighan
Using the DBI with Microsoft SQL Server, I'm trying to get data back 
from a stored procedure call and getting an "Invalid Cursor State" 
error at the execute() call below (it never gets to the 
fetchrow_array call). Has anyone else run into this? Can anyone help?


my $sth = $dbh->prepare("exec sp_helpdb");
my $rv = $sth->execute();
my($dbname,$size,$owner) = $sth->fetchrow_array();
while ($dbname) {
.
($dbname,$size,$owner) = $sth->fetchrow_array();
}

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


threads and consoles

2006-01-16 Thread John Serink
Hi All:

Is there a way for a thread to have its own console separate from the
calling process?

Cheers,
john

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


Re: Yet another regex question

2006-01-12 Thread John Deighan
At 10:19 AM 1/12/2006, 
=?koi8-r?Q?=E1=D2=D4=C5=CD=20=E1=D7=C5=D4=C9=D3=D1=CE?= wrote:

If you want tab instead of space after each country code, try this:

while () {
  if (/\d\s[A-Z]{3}\s/) {
s/(\d\s[A-Z]{3})\s/$1\t/g;
  }
  print FILETO $_;
}



I don't see the point of the if statement. Why not just do the 
s/.../g as the only statement in the while loop.


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


RE: Info on reading COM ports

2006-01-08 Thread John Serink
Win32::Serialport

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Rajesh Vattem
> Sent: Saturday, January 07, 2006 2:54 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Info on reading COM ports
> 
> 
> 
> Hi,
> I am looking for ways to read a COM port (USB and baud rate > 
> 115200). Can some one advise me which is the efficient way to 
> do this. Thanks & Regards, Rajesh.
> 
> 
> 
> **
> The information contained in this email and any attachments
> is likely to be confidential and legally privileged, and is 
> for the intended recipient named above only. Any copying, 
> dissemination, disclosure of or use of this email or its 
> attachments unless authorised by us is prohibited, except 
> that you may forward this email and/or attachments to a third 
> party on a strict "need to know" basis. 
> 
> If you have received this email in error, please notify us 
> immediately by replying to the email or by calling 
> +91-80-26492700. Please then delete this email and any full
> or partial copies of it.
> 
> You as the intended recipient must be aware and accept 
> that emailis not a totally secure communications medium.
> 
> Although we have taken all reasonable steps to make 
> sure this email and any attachments are free from viruses, 
> we do not (to the extent permitted by law) accept any liability 
> whatsoever for any virus infection and/or compromise of 
> security caused by this email and any attachment.
> 
> No contract may be formed or documents served by you 
> on or with us by this email or any attachments unless 
> expressly agreed otherwise by us. 
> 
> Any views expressed in this email or attachments by 
> an individual are not necessarily those of UbiNetics 
> India (Private) Limited.
> 
> **
> 
> ___
> 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: MS SMTP and MS FTP server information

2005-12-31 Thread John Serink
Hi Steven:

Ok cool, I got it going with this:
use Win32::OLE qw (in);
use strict;
use warnings;

my $IIS = Win32::OLE->GetObject("IIS://johnathlonxpm");
my $PathList = $IIS->GetDataPaths("AuthAnonymous",0);


print("$PathList");
print("\n");

my $thislong = scalar(@$PathList);
print("This long is $thislong\n");
for(my $i=0; $i -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Steven Manross
> Sent: Saturday, December 31, 2005 10:46 AM
> To: Paul Sobey; perl-win32-users@listserv.ActiveState.com
> Subject: RE: MS SMTP and MS FTP server information
> 
> 
> Use an ADSI editor like the IIS 6 Metabase Explorer, ADSVW or others..
> 
> The metabase is stored here:
> 
> IIS://SERVERNAME
> 
> >From there you can do all sorts of cool stuff...
> 
> I use it to do some SOX auditing of IIS settings..
> 
> Realtime access and every possible setting is exposed via 
> this interface.
> 
> Perl can access it as well via the same interface.
> 
> Please forgive me if there are typos.
> 
> -
> 
> use Win32::OLE qw (in);
> 
> my $IIS = Win32::OLE->GetObject("IIS://Servername");
> $PathList = IIS->GetDataPaths("AuthAnonymous",0);
> 
> foreach $Path (in $PathList) {
>   if ($Path eq "IIS://" . $strSrv . 
> "/W3SVC/Info/Templates/Secure Web Site/Root" ||
>   $Path eq "IIS://" . $strSrv . "/W3SVC/Info/Templates/Public Web
> Site/Root") {
> #Do nothing..  these are templates
>   } else { 
> $iisnode = Win32::OLE->GetObject($Path);
> if ($iisnode->{AuthAnonymous} == 1) {
>   print $strSrv . " -- AUTHANONYMOUS -- " . $Path."\n";
> }
>   }
> }
>  
> Steven
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Wednesday, December 28, 2005 7:59 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: RE: MS SMTP and MS FTP server information
> 
> > How can I find this stuff with Perl?
> > I need to dump the SMTP and ftp settings, what MS calls properties,
> > from a machine for a report but the setup is done using IIS 
> with GUIs.
> > 
> > Anyone know how to do this? Where to get the information from? I've 
> > scoured the registry and can't find where Gates' hides it.
> 
> Depends on which version of IIS you mean. IIS 6 stores its 
> info in a plain xml file, system32\inetsrv\metabase.xml. You 
> can open this and play with standard tools, although you need 
> to configure IIS to allow edits while running, or shutdown 
> IIS, before making changes. You should find most of what you 
> need in there. Alternatively, you could check out the 
> ADSI/WMI providers:
> 
> http://www.microsoft.com/technet/prodtechnol/WindowsServer2003
> /Library/I
> IS/43a51d34-7c81-413b-9727-ec9a19d0b428.mspx
> 
> IIS 5 is not as easy since the metabase is a proprietry 
> binary format, but there are still command line/COM 
> interfaces to management I think.
> 
> I've never used any of this stuff but it looks promising.
> 
> Cheers,
> Paul
> 
> *
> Gloucester Research Limited believes the information provided 
> herein is reliable. While every care has been taken to ensure 
> accuracy, the information is furnished to the recipients with 
> no warranty as to the completeness and accuracy of its 
> contents and on condition that any errors or omissions shall 
> not be made the basis for any claim, demand or cause for action.
> 
> The information in this email is intended only for the named 
> recipient. If you are not the intended recipient please 
> notify us immediately and do not copy, distribute or take 
> action based on this e-mail.
> 
> Gloucester Research Limited, 5th Floor, Whittington House, 
> 19-30 Alfred Place, London WC1E 7EA
> *
> 
> ___
> 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


MS SMTP and MS FTP server information

2005-12-28 Thread John Serink
Hi All:

How can I find this stuff with Perl?
I need to dump the SMTP and ftp settings, what MS calls properties, from
a machine for a report but the setup is done using IIS with GUIs.

Anyone know how to do this? Where to get the information from?
I've scoured the registry and can't find where Gates' hides it.

Cheers,
John

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


RE: How to quit when Windows shut down?

2005-12-20 Thread John Serink
You'll have to install the resource kit.
You canget the tools at www.microsoft.com


> -Original Message-
> From: Octavian Rasnita [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 20, 2005 4:11 PM
> To: John Serink; Ted Zeng; perl-win32-users@listserv.ActiveState.com
> Subject: Re: How to quit when Windows shut down?
> 
> 
> I couldn't find the shutdown command under Windows 2000 Teddy
> 
> ----- Original Message - 
> From: "John Serink" <[EMAIL PROTECTED]>
> To: "Ted Zeng" <[EMAIL PROTECTED]>; 
> 
> Sent: marti, 20 decembrie 2005 03:31 AM
> Subject: RE: How to quit when Windows shut down?
> 
> 
> C:\>shutdown /?
> Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m 
> \\computername] [-t xx] [-c "comment"] [ -d up:xx:yy]
> 
> No args Display this message (same as -?)
> -i  Display GUI interface, must 
> be the first
> option
> -l  Log off (cannot be used with 
> -m option)
> -s  Shutdown the computer
> -r  Shutdown and restart the computer
> -a  Abort a system shutdown
> -m \\computername   Remote computer to
> shutdown/restart/abort
> -t xx   Set timeout for shutdown to xx seconds
> -c "comment"Shutdown comment (maximum of 127
> characters)
> -f  Forces running applications to close
> without warning
> -d [u][p]:xx:yy The reason code for the shutdown
> u is the user code
> p is a planned shutdown code
> xx is the major reason code 
> (positive integer less than 25
> 6)
> yy is the minor reason code 
> (positive integer less than 65
> 536)
> 
> Use the -f switch.
> 
> John
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] 
> On Behalf 
> > Of Ted Zeng
> > Sent: Tuesday, December 20, 2005 6:53 AM
> > To: perl-win32-users@listserv.ActiveState.com
> > Subject: How to quit when Windows shut down?
> >
> >
> > Hi,
> >
> > I have a perl script that runs in an infinite loop whenever 
> a machine 
> > starts.
> >
> > My problem is, when I shut down the PC, Windows could not Stop the 
> > script. It put the dialog asking if user wants to stop the process.
> >
> > Is there a way in the script to quit automatically when 
> Windows shut 
> > down?
> >
> >
> > Ted zeng
> >
> > ___
> > 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 quit when Windows shut down?

2005-12-19 Thread John Serink
C:\>shutdown /?
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t
xx] [-c "comment"] [
-d up:xx:yy]

No args Display this message (same as -?)
-i  Display GUI interface, must be the first
option
-l  Log off (cannot be used with -m option)
-s  Shutdown the computer
-r  Shutdown and restart the computer
-a  Abort a system shutdown
-m \\computername   Remote computer to
shutdown/restart/abort
-t xx   Set timeout for shutdown to xx seconds
-c "comment"Shutdown comment (maximum of 127
characters)
-f  Forces running applications to close
without warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive
integer less than 25
6)
yy is the minor reason code (positive
integer less than 65
536)

Use the -f switch.

John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ted Zeng
> Sent: Tuesday, December 20, 2005 6:53 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: How to quit when Windows shut down?
> 
> 
> Hi,
> 
> I have a perl script that runs in an infinite loop whenever a 
> machine starts.
> 
> My problem is, when I shut down the PC, Windows could not
> Stop the script. It put the dialog asking if user wants to 
> stop the process.
> 
> Is there a way in the script to quit automatically when 
> Windows shut down?
> 
> 
> Ted zeng
> 
> ___
> 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 detect a disconnected socket?

2005-12-19 Thread John Serink
Hi Foo:

Partial reads means partial reads...
If you sending whole lines at one end you;ll probably not get the whole
lines all the time at the other.
You have to be prepared for that.

Cheers,
John

> -Original Message-
> From: Foo Ji-Haw [mailto:[EMAIL PROTECTED] 
> Sent: Monday, December 19, 2005 4:42 PM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: how to detect a disconnected socket?
> 
> 
> John Serink wrote:
> 
> >Ok, if you're using sockets I strongly recommend you ALWAYS using 
> >sysread and syswrite as they baypass standard IO buffereing.
> >
> >Be careful with sysread, it cand and will return partial reads, you 
> >MUST be prepared for that.
> >
> >Unless you want your program to block on sysread, you should use 
> >IO::Select. Now, from Stein's nEtwork Programming with Perl, as File 
> >handle is ready for reading when: 1. There is at least 1 
> byte of data 
> >in the file handle's input buffer, 2. There is an EOF on the file 
> >handle, the next call to sysread will return 0 in this case. With 
> >normal files this occurs at EOF, with sockets this occurs when the 
> >remote peer closes the connection, 3. There is a pending 
> error on the 
> >socket. The next sysread call will return undef and the 
> error will be 
> >in $!.
> >
> >
> >
> >So, what you are interested in is 2 or 3 or both.
> >  
> >
> Cool. Thanks for the tip John. When you mean partial reads, you don't 
> mean to say that any form of data corruption is taking place 
> right? It's 
> just that I will have to be responsible for putting Humpty 
> Dumpty (aka 
> the fragmented data) back together again?
> 
> 

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


RE: how to detect a disconnected socket?

2005-12-18 Thread John Serink
Ok, if you're using sockets I strongly recommend you ALWAYS using
sysread and syswrite as they baypass standard IO buffereing.

Be careful with sysread, it cand and will return partial reads, you MUST
be prepared for that.

Unless you want your program to block on sysread, you should use
IO::Select. Now, from Stein's nEtwork Programming with Perl, as File
handle is ready for reading when:
1. There is at least 1 byte of data in the file handle's input buffer,
2. There is an EOF on the file handle, the next call to sysread will
return 0 in this case. With normal files this occurs at EOF, with
sockets this occurs when the remote peer closes the connection,
3. There is a pending error on the socket. The next sysread call will
return undef and the error will be in $!.



So, what you are interested in is 2 or 3 or both.

Code accordingly.

Cheers,
John 
 


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Monday, December 19, 2005 11:28 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: how to detect a disconnected socket?
> 
> 
> Hi all, I have the same issue (see subject title) as Trever in the 
> mailing list. Unfortunately reading through the mailing list 
> archive it 
> seems that his problem was not resolved. I'm hoping to have 
> better luck 
> with you guys. :)
> 
> Basically, I need to know if my IO::Socket::INET socket connection is 
> disconnected by the remote peer, in which case I will have to 
> close the 
> socket, reuse the thread for the next connection.
> 
> There were some mentions on using IO::Select:
> my $select = IO::Select->new($sock);
> while ($select->can_read)
> {
> ...
> }
> 
>  But it seems that it does not help in detecting the connection state 
> (it keeps returning 1).
> 
> Any ideas/ hints will be appreciated. Thanks. 
> ___
> 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: Finding the user's "home" directory?

2005-12-07 Thread John Garvin
On 12/7/05, Paul Hoffman <[EMAIL PROTECTED]> wrote:
> Greetings. I'm assuming I'm just missing something obvious here, but
> how do I find the current user's "home" directory (C:\Documents and
> Settings\)? I didn't see it in the Win32 module, but I could
> have missed it.
>
> --Paul Hoffman
>

I don't think Windows knows what $HOME (or rather, %HOME%) is. At
least NT and 2000 don't. However %ENV has some useful hints - in
particular, $ENV{'USERPROFILE'} looks reliable in my limited testing.
--
jpg

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


Re: Finding the user's "home" directory?

2005-12-07 Thread John Garvin
> On 12/7/05, Paul Hoffman <[EMAIL PROTECTED]> wrote:
> > Greetings. I'm assuming I'm just missing something obvious here, but
> > how do I find the current user's "home" directory (C:\Documents and
> > Settings\)? I didn't see it in the Win32 module, but I could
> > have missed it.
> >
> > --Paul Hoffman
> >
>
> I don't think Windows knows what $HOME (or rather, %HOME%) is. At
> least NT and 2000 don't. However %ENV has some useful hints - in
> particular, $ENV{'USERPROFILE'} looks reliable in my limited testing.

D'oh! make that $ENV{'HOMEPATH'}


--
jpg

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


RE: Inet::Socket::INET's line read fails

2005-12-05 Thread John Serink
Use sysread. You might want to use the IO:Select module to check if the
call will block before calling...
gives you a bit more control.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Tuesday, December 06, 2005 12:30 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Inet::Socket::INET's line read fails
> 
> 
> Hi all,
> 
> Just want to share and ask something about reading from the 
> sockets. Normally my connection to the Other Side receives 
> line inputs. But not 
> all the time the eol character is standard across the various remote 
> connections; sometimes it's just a 0x0D.
> 
> I realise that <$socket> does not always work, even with $/=char(13). 
> The safest way so far seems to be 'doing it yourself' with a loop 
> repeating getchar() calls until you hit the expected EOL 
> character. It 
> works, but I suspect the high hit rate on the function call 
> is not optimal.
> 
> If anyone has a better idea (or my $/=char(13) is just plain wrong), 
> please reply. Thanks. ___
> 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: Executing an external program from a perl scrip.

2005-12-05 Thread John Serink
First:
use "\" not "/".
Second:
You have to escape the "\" with a second "\" when using double quotes.

Your line needs to read:
$sys="C:\\antiword\\antiword.exe -t -w 1 document.doc >
C:\\Inetpub\\wwwroot\\somedir\\document.txt";

That shou'd work.

Alternatively, you could do it this way:
$sys='C:\antiword\antiword.exe -t -w 1 document.doc >
C:\Inetpub\wwwroot\somedir\document.txt";

That should work also.

Cheers,
john
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alejandro Santillan
> Sent: Tuesday, December 06, 2005 3:03 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Executing an external program from a perl scrip.
> 
> 
> Trying to migrate a perl script from linux to windows (IIS), 
> I need to execute a command line from within the perl script. 
> This snippet worked fine in linux (provided the path is 
> correct), but it didn't work in windows:
> 
> $sys="C:/antiword/antiword.exe -t -w 1 document.doc > 
> C:/Inetpub/wwwroot/somedir/document.txt";
> system($sys);
> 
> The snippet works fine if the script is run from the DOS 
> window, or by double clicking, but is makes nothing when it 
> is executed as a CGI. I've double checked that the 
> destination folder has write permissions working fine. Is the 
> "system(...);" sentence not appropriate under the windows 
> envirnonment?
> 
> Thanks,
> Alejandro
> 
> 
> ___
> 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


  1   2   3   4   5   >