can't redirect STDERR

2005-06-17 Thread robert johnson
perl 5.8.6 on Win32

i need to redirect STDERR, in order to parse runtime information from a
flash programmer.  the program "monice.exe" runs on either Win98/XP/2000
just fine, but the command i'm using to redirect STDERR does not work on
Win98

heres the offending line in my Perl script:

$pid = open
(PH, "\"C:\\Program Files\\EPITools\\edta22a\\bin\\monice.exe\" 
-vIXP420 -d 192.168.100.251:e < auto_flash.cmd 2>stderr.txt |") 
or die "couldn't fork! $!\n";

note:  -v and -d switches are particular to the monice.exe, and the
auto_flash.cmd is sent to the monice.exe to auto select specific
text-menu options.  there is no issue with any of this.  the problem
(but only on Win98) is with "2>stderr.txt".

now, "2" is supposedly the file descriptor for STDERR.  as ive already
mentioned, it does correctly redirect STDERR to the appropriate text
file in winXP/2000, but not win98.

on Win98 it complains: 'Cant find file "2" specified on command line',
then continues to run the "monice.exe" executable as expected, but dumps
all STDERR to the terminal window (the default behavior), and so my
program doesnt work worth a hoot.

anyone know a way around this?   any help will be much appreciated, as
this is going to be a big PIMA real quick when manufacturing (and their
crappy win98 machines) get held up.

thanks, robert

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


Re: problems with Win32::API import

2005-06-17 Thread Lloyd Sartor
[EMAIL PROTECTED] wrote on 06/17/2005 02:01:21 PM:

> Hi Masters.
> 
> This code on my WinXP crashes perl.
> Searched the list , but only the old syle ( Method 1 or Method 2 ) comes 
up.
> I am trying Method 3 , new with .40 onwards.
> 
> Please can somebody point out my "basic" mistake :
> 
> print "TYPE DWORD is known to Win32::API::Type \n" if 
> Win32::API::Type->is_known('DWORD');
> print "TYPE LPTSTR is known to Win32::API::Type \n" if 
> Win32::API::Type->is_known('LPTSTR');
> 
> my $GetTempPathRetVal = Win32::API->Import('kernel32','DWORD 
GetTempPath( 
> DWORD nBufferLength, LPTSTR lpBuffer )');
> if($GetTempPathRetVal eq 0) {
> die "Can't import API GetTempPath : $^E\n";
> }
> 
> 
> my $lpBuffer = '-'x80;
> my $returnval = GetTempPath(79,$lpBuffer);
> my $TempPath = substr($lpBuffer,0,$returnval);
> 
> print "Temp path is : $TempPath !!\n";

This problem was recently discussed. Please check the archives. The fix is

# around 158 in Win32::API::Type.pm if you comment these three lines out,
# it should work:

#   if($is_pointer and $packing eq 'c') {
#   $packing = "p";
#   }

This now works:

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

Win32::API->Import('kernel32',
  'DWORD GetTempPathA(DWORD ccBuffer, LPSTR lpszBuffer)') or
  die "Import GetTempPathA: $^E";
my $lpszBuffer = pack 'Z*', ' ' x 80;
my $ret = GetTempPathA (80, $lpszBuffer);
printf "ret='%s'; lpszBuffer='%s'\n", $ret, substr $lpszBuffer, 0, $ret;

__END__

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


problems with Win32::API import

2005-06-17 Thread Sumitro Chowdhury

Hi Masters.

This code on my WinXP crashes perl.
Searched the list , but only the old syle ( Method 1 or Method 2 ) comes up.
I am trying Method 3 , new with .40 onwards.

Please can somebody point out my "basic" mistake :

print "TYPE DWORD is known to Win32::API::Type \n" if 
Win32::API::Type->is_known('DWORD');
print "TYPE LPTSTR is known to Win32::API::Type \n" if 
Win32::API::Type->is_known('LPTSTR');


my $GetTempPathRetVal = Win32::API->Import('kernel32','DWORD GetTempPath( 
DWORD nBufferLength, LPTSTR lpBuffer )');

if($GetTempPathRetVal eq 0) {
   die "Can't import API GetTempPath : $^E\n";
}


my $lpBuffer = '-'x80;
my $returnval = GetTempPath(79,$lpBuffer);
my $TempPath = substr($lpBuffer,0,$returnval);

print "Temp path is : $TempPath !!\n";


Sumitro Chowdhury


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


RE: Win32::API and Unicode filenames

2005-06-17 Thread Jan Dubois
Siebe wrote:
> Considering Perl cannot open files with Unicode filenames by default

Well, not by default, but you can work around this.  Check out:

http://www.nntp.perl.org/group/perl.unicode/2779

Cheers,
-Jan


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


Win32::API and Unicode filenames

2005-06-17 Thread Siebe Tolsma



Hello!
 
Considering Perl cannot open files with Unicode 
filenames by default I decided to create a Win32 module which imports functions 
like CreateFileW from kernel32.dll and let it write/read files through that. The 
OS I am writing this for will always be Windows, and in all cases >= 2K (so 
2K, XP, 2K3, etc). I have no interest in supporting older systems like 9x and NT 
(yet?). I've already implemented a some of the functions (fopen, fclose, fread, 
fwrite, fseek) and the basic thing works, but, there is one "slight" 
problem/oddity.
 
I have the following code:
 
my $fname = pack("H*", 
"e68aa5e7bab82e706c");   $fname = decode("utf8", 
$fname);   $fname = encode("UTF-16LE", $fname);
 
# Open a file handle to the file 
:)if(fopen(\my $fh, ">", $fname)) { # Fails!
 
This however fails miserably, with an error that 
it cannot create the file (even though it is UTF-16LE, which is supposely the 
encoding used on NTFS). But, when I bump in a "print" in the middle it works 
like a charm (creates the file, then later on in the if() block writes "Hello World!" to it).. This, to me, 
is very odd because "print" shouldn't do anything with the variable (but when 
using non-Unicode filenames the print is not required and everything runs 
OK!):
 
my $fname = pack("H*", 
"e68aa5e7bab82e706c");   $fname = decode("utf8", 
$fname);   $fname = encode("UTF-16LE", $fname);
 
print 
"$fname\n";
 
# Open a file handle to the file 
:)if(fopen(\my $fh, ">", $fname)) { # Works?!
 
Does anyone have a solution to this of the top of 
their head? I've included the fopen() subroutine for reference. The __mode() sub simply converts the mode types like 
">" and "<" to their corrosponding LONG values. $apis is an array reference filled with the APIs I use 
(I didn't want the imported functions directly into the modules 
namespace).
 
Any help would be appreciated! :)
 
Siebe Tolsma
BOT2K3 Team [ http://bot2k3.net ]
 
--
 
sub fopen {    # open 
FILEHANDLE,MODE,EXPR    my $sref = shift; # 
Reference    my $mode = shift; # < > >> +< 
+> +>>    my $file = shift; # Filename
 
    # Check what mode we 
want..    my $fmode = 
__mode($mode); # Valid mode?
    if($fmode > 0) 
{    # HANDLE CreateFile( LPCTSTR 
lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, 
    
# LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD 
dwFlagsAndAttributes, 
    
# HANDLE hTemplateFile 
);    # 
Determine how to open (and create if necessary) the 
filemy $fop = ($mode =~ 
/>>/ ? OPEN_ALWAYS : ($mode =~ /    
# Open the file with the API..    my 
$fh = $apis->[0]->Call($file, $fmode, 0, 0, $fop, FILE_ATTRIBUTE_NORMAL, 
0);    if($fh != 
INVALID_HANDLE_VALUE) 
{    # Bless 
the object and pass it 
back    
return bless($$sref = [$fh,$mode,$fmode], 
__PACKAGE__);   
} else { cluck("Could not create handle to file \"$file\"\n"); 
}} else { cluck("Could not determine mode for 
opening from \"$mode\"\n"); }
    return 
0;}
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl-Win32-Users Digest, Vol 17, Issue 19

2005-06-17 Thread Liza Das
Hi,

I am trying to call an Oracle procedure using this Perl command however the
procedure is not being called.
The procedure takes accepts one parameter which I'm passing using $file.

Is the syntax ok?

$test="sqlplus login/[EMAIL PROTECTED]
[EMAIL PROTECTED]:\\ftpscript\\name_of_file_script.sql '$file'";
system($test);
print $test;

Thanks,
Liza

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, June 16, 2005 3:05 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Perl-Win32-Users Digest, Vol 17, Issue 19


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

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

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

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


Today's Topics:

   1. RE: 64 Bit ActivePerl (John Serink)
   2. RE: Oraperl, Win2k, Oracle_Home problems (Hope Peter)
   3. Re: 64 Bit ActivePerl ($Bill Luebkert)
   4. Net::SSH::W32Perl (Peter Leong)
   5. RE: 64 Bit ActivePerl (Paul Sobey)
   6. Re: Net::SSH::W32Perl (Sisyphus)
   7. Coping Records from one Database to another with Blank Data
  in a  field (Royer, Robby E (Compaq))
   8. RE: Coping Records from one Database to another with Blank
  Data in a  field (Gerber, Christopher J)


--

Message: 1
Date: Thu, 16 Jun 2005 13:41:22 +1200
From: "John Serink" <[EMAIL PROTECTED]>
Subject: RE: 64 Bit ActivePerl
To: "Paul Sobey" <[EMAIL PROTECTED]>,

Message-ID:
<[EMAIL PROTECTED]>

Content-Type: text/plain;   charset="us-ascii"

Hi Paul:

If you'll notice, this is a Win32 group. That is perl, on a Win32
platform, not perl on a Win64 platform. If you want the latter, you'll
likely have to compile from source.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Paul Sobey
> Sent: Wednesday, June 15, 2005 7:47 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: FW: 64 Bit ActivePerl
>
>
> Anybody from ActiveState listening? Is there a better place
> to send this?
>
> Cheers,
> Paul
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Paul Sobey
> Sent: 10 June 2005 17:11
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: 64 Bit ActivePerl
>
> Hi All,
>
> We've just taken delivery of our first AMD Opteron boxes, and
> after installing Windows 2003 64 bit, I note that the WSH
> hooks in ActivePerl don't seem to work with it. Does anybody
> know if this will be fixed soon, or even if there are plans
> to release a full 64 bit version of ActivePerl?
>
> 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.
> *
>
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>



--

Message: 2
Date: Wed, 15 Jun 2005 22:18:26 -0400
From: "Hope Peter" <[EMAIL PROTECTED]>
Subject: RE: Oraperl, Win2k, Oracle_Home problems
To: <[EMAIL PROTECTED]>,

Message-ID:
<[EMAIL PROTECTED]>

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

Just a follow up
I found a bit of code that would check all available DBI drivers and their
data sources.

#!/usr/bin/perl -w
use DBI;
my @drivers = DBI->available_drivers();

die "No drivers found!\n" unless @drivers; # should never happen
foreach my $driver ( @drivers ) {
print "Driver: $driver\n";
my @dataSources = DBI->data_sources( $driver );
foreach my $dataSource ( @dataSources ) {
print "\tData Source is $dataSource\n";
}
print "\n";
}exit;

When this was run from the command prompt I got

Driver: Oracle
Data Source is DBI:Oracle:Space
Data Source is DBI:Oracle:GSS

When run from the web page all that comes up is
   Driver: Oracle

I can not figure out why the web version isnt working correctly.
Pete



From: [EMAIL PROTECTED] on behalf of Hope
Peter
Sent: Wed 6/15/2005 09:26
To: [EMAIL PROTECTED];
perl-win32-users@listserv.ActiveState.com
Subject: Oraperl, Win2

RE: Coping Records from one Database to another with Blank Data ina field

2005-06-17 Thread Peter Guzis
Expanding on what Dietmar stated, here is another way which should be more 
tolerant of multiple data types, and is potentially more efficient if used more 
than once in the same script.  Note I am assuming you are using DBI and some 
educated guesses have been made on which data types are appropriate for your 
query.



use DBI ':sql_types';

# connect to database

my $dbh = DBI->connect('source', 'login', 'password', \%args);

# prepare statement

my $sth = $dbh->prepare(q!
  INSERT INTO Table_Of_SearchConditions (
SC_lintPID,
SC_etSearchType,
SC_stSearchCondition,
SC_lintSearchCondition
  ) VALUES (
?,
?,
?,
?
  )
!);

# bind parameters

$sth->bind_param(1, undef, SQL_INTEGER);
$sth->bind_param(2, $newAddPID, SQL_INTEGER);
$sth->bind_param(3, $SearchType, SQL_VARCHAR);
$sth->bind_param(4, $SearchCond, SQL_VARCHAR);
$sth->bind_param(5, $SearchCondCh, SQL_VARCHAR);

# execute statement

$sth->execute;

# possible to re-use $sth here

# close statement handle when finished

$sth->finish;

# disconnect from database

$dbh->disconnect;



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Dietmar Fiehn, Dr.
Sent: Thursday, June 16, 2005 11:05 PM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: AW: Coping Records from one Database to another with Blank Data
ina field


Hello Robby,
I don't know what database interface you are using. Here is an example for dbi 
using parameter in a statement. You should use this mechanism instead of 
dynamic sql (your method) because the database has a chance to cache the 
execution-plan of the sql-statement. You may even use prepared statements and 
execute ist only with new values. have look at DBI's "prepare" method.
 
$db->do("INSERT INTO Table_Of_SearchConditions (SC_lintPID,
SC_etSearchType, SC_stSearchCondition, SC_lintSearchCondition ) VALUES
(?, ?, ?, ?)", undef, $newAddPID, $SearchType, $SearchCond, $SearchCondCh);
 
Dietmar

-Ursprüngliche Nachricht- 
Von: Royer, Robby E (Compaq) [mailto:[EMAIL PROTECTED] 
Gesendet: Do 16.06.2005 17:06 
An: 'Perl-Win32-Users@listserv.ActiveState.com' 
Cc: 
Betreff: Coping Records from one Database to another with Blank Data in 
a field


I am trying to merge 2 database table into a new database. In merging 
the
two databases I have run into an issue. When I insert data into the new
table from the old table that has a field that is blank I get the 
following
error. See Below for code, error and table Description. Can you help


Table Description

Table_Of_SearchConditions
SC_lintPID  Number
SC_etSearchType,Number
SC_stSearchConditionText
SC_lintSearchCondition Number "Can be blank"

Code Sample

$stmt = "INSERT INTO Table_Of_SearchConditions (SC_lintPID,
SC_etSearchType, SC_stSearchCondition, SC_lintSearchCondition ) VALUES
('$newAddPID', '$SearchType', '$SearchCond', '$SearchCondCh')";

$rc   = $db->Sql($stmt);
die qq(SQL failed "$stmt": ), $db->Error(), qq(\n) if $rc;




___
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::GUI::AxWindow

2005-06-17 Thread Anton Ganeshalingam
Could someone please tell me why I can't get the following code to work. 
The javascript doesn't work when embeding html.

Please help
tks
Anton

use Win32::GUI;
use Win32::GUI::AxWindow;  # Main Window
my $user = undef;
my $html = undef;
 get_html();
my $font = Win32::GUI::Font->new(
-name => "Times New Roman",
-size => 10,
-bold => 1
);

my $Window = new Win32::GUI::Window (
   -name => "Window",
   -title=> "GlobeLocator Client",
   -post => [100, 100],
   -size => [1000, 800],
);

# Add a WebBrowser AxtiveX
$Control = new Win32::GUI::AxWindow  (
-parent  => $Window,
-name=> "Control",
-control => "$html",
-pos => [0, 0],
-size=> [400, 400]
  );  # Register some event

$Control->CallMethod("Navigate");
  $Window->DrawMenuBar();
  $Window->Show();
  Win32::GUI::Dialog();  # Main window event handler
  
sub Window_Resize {

  if (defined $Window) {
  ($width, $height) = ($Window->GetClientRect)[2..3];
  $Control->Move   (0, 0);
  $Control->Resize ($width, $height);
  }
}

sub get_html{

  ($html = <

Your title here







HELLO WORLD




HTML


}


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