Re: implement a simple Telnet like Daemon in perl

2004-02-03 Thread tanman
Why reinvent the wheel? MS$ has the standard Unix RSH client built-in to WinNT and its 
descendants (not sure about Win98 and it's bretheren), and the server (RshSvc) is 
available from the Win2K Resource Kit, or the Windows Services for Windows. This will 
work for all command-line interfaces. I'm not sure about pseudo-graphicals like EDIT, 
but since that's just DOS line drawing characters, I don't see why that wouldn't work, 
too.

If you need a true graphical interface, you can use Windows Terminal Services, but 
then, this is not a scripting issue.

- Original Message -
From: Jeremy A [EMAIL PROTECTED]
Date: Tuesday, February 3, 2004 4:25 am
Subject: RE: implement a simple Telnet like Daemon in perl

 Hi all,
 
 I was not able to get any replies, as the mailing list was acting 
 up, and i 
 was not recieving any mail. now i am able too. So please reply again.
 
 
 I have been struggling to understand the Telnet Protocol, but the 
 RFC's are 
 like greek, and there are no good books for covering Telnet, and 
 my mind is 
 too stupid to wrap around it.
 
 
 I would like to create a telnet like protocol, that is easy for my 
 own use. 
 How do you go about redirecting IO from the command shell, over 
 sockets, 
 and emulate on the other end.
  eg, suppose I instantiate the prompt, open( PRMPT, cmd.exe 
 |); on the 
 server script. - this is not useful, because it creates a separate 
 process, 
 so you cannot manipulate it over a socket.
 how do you grab the separate process and send IO to the socket?
 
 also, how do i send console graphics over socket, suppose i were 
 to 
 instantiate  dos edit.
 
 Then there is the issue of moving typing across the screen, 
 backspace, 
 delete, space, tab, enter etc.
 
 
 One idea I have, (and this may sound stupid), is to download (on-
 the-fly) 
 the program (eg edit) or find a local copy and instantiate it 
 locally, 
 making it seem as if you are running it on the server, when it is 
 actually 
 on the client. then, lets say you save the text file, the file 
 once saved, 
 gets uploaded to the server...sounds funny..eh...still may be 
 hard.and there are alot of unusual console apps.
 
 
 
 Any Ideas, anyone?
 
 Thanks in advance for any help.
 
 Jeremy A. 
 
 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 

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


Re: PAR-.79 help

2004-02-03 Thread Trevor Joerges
Alex,

Is your compiler (nmake or GNU make) located in your system path somewhere?

It looks like the MakeFile is not finding it. What I would recommend is
downloading the Microsoft nmake and placing it in your CL\WinNT directory
but rename it to make.exe. Also, I'm not sure why your command perl
Makefile.PL is trying to fetch the .par file - mine didn't do that. My
results look like this:

E:\Perl Modules\PAR-0.79perl Makefile.PL
*** ExtUtils::AutoInstall version 0.56
*** Checking for dependencies...
[Core Features]
- File::Temp   ...loaded. (0.13)
- Compress::Zlib   ...loaded. (1.16 = 1.16)
- Archive::Zip ...loaded. (1.06 = 1)
- Module::ScanDeps ...loaded. (0.38 = 0.37)
- PAR::Dist...loaded. (0.06 = 0.06)
*** ExtUtils::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for the par.exe program
Writing Makefile for PAR

Your 2nd question regarding PerlApp, it is very easy to use but it is not
free. It comes with the Perl Development Kit (PDK).

Trevor.

- Original Message - 
From: alex p [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 11:05 AM
Subject: Re: PAR-.79 help


 My output

  
 C:\Documents and Settings\win32 tools\par\PAR-0.79perl Makefile.PL
 *** ExtUtils::AutoInstall version 0.56
 *** Checking for dependencies...
 [Core Features]
 - File::Temp   ...loaded. (0.13)
 - Compress::Zlib   ...loaded. (1.16 = 1.16)
 - Archive::Zip ...loaded. (1.06 = 1)
 - Module::ScanDeps ...loaded. (0.38 = 0.37)
 - PAR::Dist...loaded. (0.06 = 0.06)
 *** ExtUtils::AutoInstall configuration finished.
 Fetching 'PAR-0.79-MSWin32-x86-multi-thread-5.8.0.par' from
www.cpan.org...
 Fetching failed:
 No compiler found, won't generate 'script/parl.exe'!
 Writing Makefile for PAR
 \

 I have manually tried to download the
 'PAR-0.79-MSWin32-x86-multi-thread-5.8.0.par from CPAN using PPM but
cant
 find it???

 How well and/or easy is PerlApp??



 From: Trevor Joerges [EMAIL PROTECTED]
 To: alex p [EMAIL PROTECTED]
 Subject: Re: PAR-.79 help
 Date: Tue, 3 Feb 2004 10:53:44 -0500
 
 It all worked fine for me. I just downloaded the PAR archive from CPAN
and
 expanded it into a separate directory. I changed to that directory and
ran:
 
 perl Makefile.PL
 nmake
 nmake test
 nmake install
 
 And it all built fine. I just haven't tried using it yet. Personally I
use
 PerlApp.
 
 HTH,
 Trevor.
 
 
 - Original Message -
 From: alex p [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 03, 2004 10:35 AM
 Subject: Re: PAR-.79 help
 
 
   I do have nmake installed.  It is my understanding that a PAR needs to
 be
   created..--- I dont know how to do that?? or whre do i find:
  
   vcvars32.bat or equivalent
  
  
  
   From: Trevor Joerges [EMAIL PROTECTED]
   To: alex p [EMAIL PROTECTED]
   Subject: Re: PAR-.79 help
   Date: Tue, 3 Feb 2004 09:31:16 -0500
   
   Try it using either nmake from Microsoft or GNU make for Windows.
   
   GNU http://unxutils.sourceforge.net/
   Microsoft
  
 
http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.ex
 e
   
   HTH,
   Trevor Joerges
   #~~~
   $_=q;USFWPSZK.ZKPFSHFT,kvtuZbopuifsZQZibdl,qpxfsfeZcyZQ,,iuuq://;.
  
q;xxx.;.q;~,[EMAIL PROTECTED],;;s;~;tfoenjnf.dpn;g;y;B-x;A-w;;s;P;perl;g;s;,;\n;g;
   s;Y; ;g;print;
   #~~~
   
   
   - Original Message -
   From: alex p [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, February 02, 2004 11:27 AM
   Subject: PAR-.79 help
   
   
 Hello all,

 I am attempting to install PAR 0.79 to be able to turn my .pl
 scripts
   into
 .exe's but am having the following troulbes:

 error when MAKEfilePL.pl is executed

 Fetching 'PAR-0.79-MSWin32-x86-multi-thread-5.8.0.par' from
   www.cpan.org...
 Fetching failed:
 No compiler found, won't generate 'script/parl.exe'!
 Writing Makefile for PAR

 \Error
 Per the documentation (see below)

 Also, if you do not have the compiler ( which i do not!) used to
   compile
 your version or
 Perl (e.g. Microsoft Visual C++ for ActivePerl -- do not forget to
 run
 vcvars32.bat or equivalent ( what is equivalent???)  before
 perl
 Makefile.PL!), and nobody
 has generated a Windows-specific PAR yet, you will not be able to
 generate binary executables using 'pp'

 How do I create a WINDOWS-SPECIFIC PAR??

 Please help.

 TYIA

 _
 There are now three new levels of MSN Hotmail Extra Storage!
Learn
   more.
 http://join.msn.com/?pgmarket=en-uspage=hotmail/es2ST=1

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

   
   
  
   

RE: Help with Apache on Win32

2004-02-03 Thread Michael Krygowski
Michael,

Go here:
www.sysinternals.com

Download the Process Explorer tool.  It's invaluable and great!!  :-)  They have lots 
of other great tools which are worth the download as well.

Hope that helps.

- Michael Krygowski



-Original Message-
From: Michael C. Davis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 10:02 AM
To: [EMAIL PROTECTED]
Subject: Help with Apache on Win32


Hi, I'm running Apache with mod_perl on win32, the Perl being ActiveState
5.8.0 build 806.  All this is working fine.  

My question has to do with detecting hanging processes.  I can tell I have
hanging processes (at times) because my CPU monitor pegs at 100%, and
netstat shows TIME_WAIT connections from myself to myself, yet when I used
Ctrl+ATL+DEL nothing unusual shows on the list.  

Can anyone suggest a freeware or shareware tool that gives a more complete
list of running processes?  Or a better way to use what comes with Windows
(Win98 in my case)?

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

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


RE: Help with Apache on Win32

2004-02-03 Thread Michael C. Davis
You're my new hero.  B-bye Task Manager.

At 01:48 PM 2/3/04 -0500, Michael Krygowski wrote:
Michael,

Go here:
www.sysinternals.com

Download the Process Explorer tool.  It's invaluable and great!!  :-)
They have lots of other great tools which are worth the download as well.

Hope that helps.

- Michael Krygowski



-Original Message-
From: Michael C. Davis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 10:02 AM
To: [EMAIL PROTECTED]
Subject: Help with Apache on Win32


Hi, I'm running Apache with mod_perl on win32, the Perl being ActiveState
5.8.0 build 806.  All this is working fine.  

My question has to do with detecting hanging processes.  I can tell I have
hanging processes (at times) because my CPU monitor pegs at 100%, and
netstat shows TIME_WAIT connections from myself to myself, yet when I used
Ctrl+ATL+DEL nothing unusual shows on the list.  

Can anyone suggest a freeware or shareware tool that gives a more complete
list of running processes?  Or a better way to use what comes with Windows
(Win98 in my case)?

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


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


How to strip out EOF characters

2004-02-03 Thread Charlie Anderson
I need to count the number of lines in a series of files for a database
load validation.  However, some of the files have hex 1A imbedded in the
middle of the file, so my while loop dies a premature death.  Any
suggestions on how to proceed would be welcome.  Snip below, TIA,


open (tablehandle, $fileDir) || die;
binmode tablehandle;
while (tablehandle) {
  $tableline = $_;
  $filerowcount ++;
}
print total count $filerowcount\n;
close (tablehandle);


Charlie Anderson
Duke Energy Field Services - IT
303-605-1689


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


Re: How to strip out EOF characters

2004-02-03 Thread $Bill Luebkert
Charlie Anderson wrote:

 I need to count the number of lines in a series of files for a database
 load validation.  However, some of the files have hex 1A imbedded in the
 middle of the file, so my while loop dies a premature death.  Any
 suggestions on how to proceed would be welcome.  Snip below, TIA,

The binmode should allow you to read any binary data including an
Windoze EOF.  There must be something you're not showing us.  How
about a *complete* failing snippet (small as possible) - you have to
be doing something wrong to come to your conclusion.

 open (tablehandle, $fileDir) || die;
 binmode tablehandle;
 while (tablehandle) {
   $tableline = $_;
   $filerowcount ++;
 }
 print total count $filerowcount\n;
 close (tablehandle);

You might also wish to change tablehandle to FH or TH to
eliminate any warnings.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

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


Re: How to strip out EOF characters

2004-02-03 Thread Charlie Anderson

Here is the complete (test) script, its part of a larger script, but this
one fails all by itself.

$fileDir = shift @ARGV;
# $myvar = srctree.txt;
print opening file $fileDir\n;
  open (tablehandle, $fileDir) || ($errorcheck2 = TRUE);
   if ($errorcheck2 eq TRUE)
{
 print mainlog ERROR \- data table $table$data_ext missing for
validation\n;
 $error_flag = TRUE;
}
   $filerowcount = 0;
   binmode tablehande;
   while (tablehandle)
#  until (eof (tablehandle)==1)
{
$tableline = $_;
 #  $tableline = tablehandle;
  $filerowcount ++;
print $tableline\n;
 print current count = $filerowcount\n;
}
close (tablehandle);
print total count $filerowcount\n;


Also,

Here is part of the file to be processed.

DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99404Cumultv EOC in Actg Principle Cumultv EORT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99405Purchase Accounting Adj.  Purchase ART_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99406Interacct Transfers (reclassesInteracct RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99407Intercompany TransfersIntercompaRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99408Add'tInvestment Expenditures  Add'tInveRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99409Add'tInc's in Resv/Accrl Exp. Add'tInc'RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99411Add'tOth Bal Sheet Chn'g  Add'tOth RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99412Add't-Capital ExpendituresAdd't-CapiRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
99413Add't-Increase in DebtAdd't-IncrRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting  4  5
DU

Charlie Anderson
Duke Energy Field Services - IT
303-605-1689


   
 
  $Bill Luebkert 
 
  [EMAIL PROTECTED]To:   Charlie Anderson [EMAIL 
PROTECTED]   
  .netcc:   [EMAIL PROTECTED] 
 
   Subject:  Re: How to strip out EOF 
characters
  02/03/2004 02:30 
 
  PM   
 
   
 
   
 




Charlie Anderson wrote:

 I need to count the number of lines in a series of files for a database
 load validation.  However, some of the files have hex 1A imbedded in the
 middle of the file, so my while loop dies a premature death.  Any
 suggestions on how to proceed would be welcome.  Snip below, TIA,

The binmode should allow you to read any binary data including an
Windoze EOF.  There must be something you're not showing us.  How
about a *complete* failing snippet (small as possible) - you have to
be doing something wrong to come to your conclusion.

 open (tablehandle, $fileDir) || die;
 binmode tablehandle;
 while (tablehandle) {
   $tableline = $_;
   $filerowcount ++;
 }
 print total count $filerowcount\n;
 close (tablehandle);

You might also wish to change tablehandle to FH or TH to
eliminate any warnings.

--
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic
http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)







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


Re: How to strip out EOF characters

2004-02-03 Thread $Bill Luebkert
Charlie Anderson wrote:

 Here is the complete (test) script, its part of a larger script, but this
 one fails all by itself.
 
 $fileDir = shift @ARGV;
 # $myvar = srctree.txt;
 print opening file $fileDir\n;
   open (tablehandle, $fileDir) || ($errorcheck2 = TRUE);
if ($errorcheck2 eq TRUE)
 {
  print mainlog ERROR \- data table $table$data_ext missing for
 validation\n;
  $error_flag = TRUE;
 }
$filerowcount = 0;
binmode tablehande;
while (tablehandle)
 #  until (eof (tablehandle)==1)
 {
 $tableline = $_;
  #  $tableline = tablehandle;
   $filerowcount ++;
 print $tableline\n;
  print current count = $filerowcount\n;
 }
 close (tablehandle);
 print total count $filerowcount\n;

This is not a complete program and doesn't compile.  When you
post a snippet to this group, 1) put a use strict and -w (or use
warnings) at the top.  2) run the script as you will be posting
it to make sure it fails as described.

Here's my altered version which runs fine (I inserted a ^Z into
the middle of your data using VIM for testing).  It produced an
additional line of output:

current count = 12
?

current count = 13

use strict;
my $fileDir = shift @ARGV || 'data/foo.txt';

print opening file $fileDir\n;
my $errorcheck2;
my $error_flag;
open TH, $fileDir or $errorcheck2 = TRUE;
if ($errorcheck2 eq TRUE) {
print ERROR - data table $fileDir missing for validation\n;
$error_flag = TRUE;
}
my $filerowcount = 0;
binmode TH;
while (TH) {
my $tableline = $_;
$filerowcount++;
print $tableline\n;
print current count = $filerowcount\n;
}
close TH;

print total count $filerowcount\n;

__END__


 Also,
 
 Here is part of the file to be processed.
 
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99404Cumultv EOC in Actg Principle Cumultv EORT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99405Purchase Accounting Adj.  Purchase ART_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99406Interacct Transfers (reclassesInteracct RT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99407Intercompany TransfersIntercompaRT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99408Add'tInvestment Expenditures  Add'tInveRT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99409Add'tInc's in Resv/Accrl Exp. Add'tInc'RT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99411Add'tOth Bal Sheet Chn'g  Add'tOth RT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99412Add't-Capital ExpendituresAdd't-CapiRT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5
 DUKENRESOURCE_TYPE 01/01/1940ACCOUNTING  ROLLFORWARD_RPTG
 99413Add't-Increase in DebtAdd't-IncrRT_GROUPS Accounting
 RT_DETAILSRoll Forward Reporting  4  5


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)


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


Re: How to strip out EOF characters

2004-02-03 Thread Andy_Bach
Isn't it a little silly to go on to try and read from whichever file 
handle after the open has failed?  You've got two flags set (errorcheck2 
and error_flag), so at least use  one to skip around the while .

It looks like you're expecting to have a number of possible failures - 
make sure to include useful data like file name that failed and why:
if ($errorcheck2 eq TRUE)
   {
  print mainlog ERROR \- data table $table$data_ext missing for 
validation ($fileDir open failed: $!)\n;
  $error_flag = TRUE;
 }

Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED] 
VOICE: (608) 261-5738  FAX 264-5030

I'm just doing my job, nothing personal, sorry.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to strip out EOF characters

2004-02-03 Thread Chris Snyder
I might also add that:
1) I did not have to use binmode.
2) I came up with the correct number of lines (5)

Note that even if you do not have an ending CrLf at the end of the file, the
last line will be counted.  If you you have any characters after the final
CrLf, they will be counted as a new line (another way of stating the same
thing).

-- Chris Snyder


I wrote:

Seems like a little case of WYSINWYG or What You see is NOT What You Get.
It may even be a bug somewhere (presumably in the command window).

I ran a simple test in the debugger with this file:

this is a line
this is a second line
this one has the 1A (X) character
this is the fourth line
this is the fifth line

Where the X is, I replaced it with hex 1A.

Then I ran a simple read and print script, outputting to STDOUT and a file:

 BEGIN 
use strict;

open FH, 1a.txt or die cannot find file;
open OUT, test.txt or die no output;

my $numLines = 0;
while (FH) {
print OUT ...$_;
print ...$_;
$numLines++;
}
#print Number of lines = $numLines\n;
 END 

The screen output does not match the file output.
screen output:

...this is a line
...this is a second line
...this one has the 1A (...this is the fourth line
...this is the fifth line

file output:
...this is a line
...this is a second line
...this one has the 1A (X) character
...this is the fourth line
...this is the fifth line

The file output I retrieved by using a text editor.  However, if you just
use type test.txt, the output looks like the screen output.  So, the first
thing to learn is that if you print a string with a hex 1A directly to the
screen, Windoze barfs.  That does not mean that the string is corrupt, just
the printing to the screen.

If you thought that was a little confusing, try it in a debugger.  It gets
worse.

This is a screen capture from debugging after I got to the line with the hex
1A:

--- snip ---
  DB4 p $_
this one has the 1A (
  DB5 use Data::Dumper

  DB6 p Data::Dumper::Dumper $_
$VAR1 = 'this one has the 1A (';

  DB7 p length $_
34
  DB8 p substr $_, 22
) character
--- snip ---

Printing the string appears to truncate it.  Even using Data::Dumper it
appears to truncate it (see DB6).  However, the whole string is there (see
DB7) as the length of the string reflects the correct length.  If you
print a substring after the hex 1A character (see DB9, you see that it is,
in fact, still there.

So what conclusion can we reach, class?  The obvious one is Use Unix, but
that is not germane.  I, personally,  conclude that we need to be wary when
dealing with hex 1A and command window in a Windoze environment -- WYSINWYG.
I would also imagine that it is dependent upon the version that you run.  My
company hates me, so I am running Windows 98.  Hopefully, things are better
under XP.  I can test it at home (where my wife likes me and I run XP).

Finally, don't reach any conclusion based upon what is painted on the screen
in this case.  Print to a file if need be.  Look at the original file and
the output file (using a hex editor, if necessary) to reach the right
conclusion.

Anyone want to repeat my steps under other versions of Windoze and let me
know if you get the same results?

-- Chris Snyder


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


perl proxy for browser

2004-02-03 Thread Jeremy A
hi all,

I found this perl proxy code on the net.
I am trying to make this proxy work that my internet explorer browser can 
use. my future plan is to monitor information with this proxy.
To set this up, in internet explorer, i went to menu Tools-Internet 
Options-Connections-Lan Settings. checked use proxy server for your 
lan, entered in the address 192.168.1.101, entered in the port 80
I then executed the proxy script, then re-opened internet explorer and went 
to a site eg www.msn.com.

the proxy script would print (in the console) Client: GET 
http://www.msn.com/ HTTP/1.0, then it hangs, and so does internet explorer.

What is wrong with this script? how can i get it to work?

Thanks in advance for your help,

Regards,

Jeremy A.

---perl proxy code i found

use strict;

use IO::Socket;
use IO::Select;
my $proxyPort = 80;

my $destHost  = 192.168.1.101;
my $destPort  = 80;
my $proxy = IO::Socket::INET-new (
   LocalPort = $proxyPort,
   Type  = SOCK_STREAM,
   Reuse = 1,
   Listen= 10);
binmode $proxy;

while (my $client = $proxy-accept()) {
  binmode $client;
  my $dest = IO::Socket::INET-new (
PeerAddr= $destHost,
PeerPort= $destPort);
  binmode $dest;

  my $select = new IO::Select;
  $select - add ($dest);
  $select - add ($client);
  autoflush $dest;
  autoflush $client;
  while (my @ready = $select-can_read) {
foreach my $fd (@ready) {
  if ($fd == $client) {
my $clientLine = $client;
print Client: $clientLine;
print $dest $clientLine;
  }
  if ($fd == $dest) {
my $destLine = $dest;
print Dest: $destLine;
print $client $destLine;
  }
}
  }
}









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


Perl WMI locks profile when executed unattended

2004-02-03 Thread Frank Pikelner
I have a script that produces status information for server queues. When I
execute the script from the server command line I obtain the desired
results. When the script is executed unattended by the local account of
servers (using AutoExNT from Win2k resource kit) service the local profile
of the account used to executes the script gets locked (unable to delete the
profile). This would indicate that something is still open and the profile
cannot be closed properly by the system. 

I would appreciate if someone could have a look and let me know if there is
something obvious I'm missing. The code in question is should only be the of
the *** SUB HW_INV ***


# *** MODULES ***
   use DBI;
   use DBD::mysql;
   use Socket;
   use Sys::Hostname;
   use Win32::OLE qw(in with);

# *** VARIABLES ***
   my $count   = 0;
   my $host= hostname();
   my $db = 'DBI:mysql:testDB:test.domain.com;
   my $username = 'user';
   my $pass = 'password';
   
# *** CONSTANTS ***
   my %detectedErrorState = (
  0   = [ Unknown ],
  1   = [ Other ],
  2   = [ No error ],
  3   = [ Low paper ],
  4   = [ No paper ],
  5   = [ Low toner ],
  6   = [ No toner ],
  7   = [ Door open ],
  8   = [ Jammed ],
  9   = [ Offline ],
  10  = [ Service requested ],
  11  = [ Output bin full ]);

   my %Status = (
  1   = [ Other ],
  2   = [ Unknown ],
  3   = [ Idle ],
  4   = [ Printing ],
  5   = [ Warmup ],
  6   = [ Stopped printing ],
  7   = [ Offline ]);


# *** MAIN ***
   @ctime = localtime(time);
   $day = $ctime[3];
   $month = $ctime[4] + 1;
   $year = $ctime[5] + 1900;
   $newdate = sprintf(%s-%02s-%02s,$year,$month,$day);
   #printf($newdate\n);
   hw_inv;
   #print ($printer_server: ($count) Printer Alerts. Done.\n);
   #exit(0);
   exit;
# *** END MAIN ***


# *** SUB HW_INV ***
sub hw_inv {
   # Gather Printer Status
   my $WMI = Win32::OLE-new('WbemScripting.SWbemLocator') || die Cannot
access WMI on local server: , Win32::OLE-LastError;
   my $Services = $WMI-ConnectServer($host) || die Cannot access WMI on
remote machine: , Win32::OLE-LastError;
   # Gather Computer System Information
   my $printer_set = $Services-InstancesOf(Win32_Printer);
   my $dbh = DBI-connect($db, $username, $pass) || die $DBI::errstr,\n;
   foreach my $printer (in($printer_set)) {
  my $printer_name = $printer-{'Caption'};
  my $printer_desc = $printer-{'Description'};
  my $printer_error= $printer-{'DetectedErrorState'};
  my $printer_driver   = $printer-{'DriverName'};
  my $printer_jobs = $printer-{'JobCountSinceLastReset'};
  my $printer_location = $printer-{'Location'};
  my $printer_state= $printer-{'PrinterState'};
  my $printer_status   = $printer-{'PrinterStatus'};
  my $printer_stat = $printer-{'Status'};
  my $printer_server   = $printer-{'SystemName'};
  if ($printer_error != 0) {
 $count++;
 my $sql = $dbh-prepare(INSERT INTO SUPPORTPRINTER (Printer, Jobs,
Message, Status, Model, Executed) VALUES
('$printer_name',$printer_jobs,'$detectedErrorState{$printer_error}[0]','$St
atus{$printer_status}[0]','$printer_driver','$newdate'););
 $sql-execute();
  }
  if (($printer_error == 0)  ($printer_status == 1)) {
 $count++;
 my $sql = $dbh-prepare(INSERT INTO SUPPORTPRINTER (Printer, Jobs,
Message, Status, Model, Executed) VALUES
('$printer_name',$printer_jobs,'$detectedErrorState{$printer_error}[0]','$St
atus{$printer_status}[0]','$printer_driver','$newdate'););
 $sql-execute();
  }
   }
   $dbh-disconnect();
}
# *** END HW_INV ***


Frank Pikelner



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


Win32::AdminMisc Anomaly

2004-02-03 Thread steve silvers
Does anyone have a problem running the same script accross different MS 
platforms? I have a snippet below from the Awin32::AdminMisc docs to get the 
diskspace size.

use Win32::AdminMisc;

@Geometry = Win32::AdminMisc::GetDriveGeometry(//server/c\$);
$Free = $Geometry[0] * $Geometry[1] * $Geometry[2];
$Total = $Geometry[0] * $Geometry[1] * $Geometry[3];
print Sectors per cluster: $Geometry[0]\n;
print Bytes per Sector:$Geometry[1]\n;
print Free clusters:   $Geometry[2]\n;
print Total clusters:  $Geometry[3]\n;
print Total Drive Size:$Total\n;
print Total Free Space:$Free\n;
Notice the UNC //server/c\$

This works great on Windows XP and 2003 Server. But does not work on 2000 
Advanced Server? If I set the path on the above to just a local drive c:\\ 
it works.

I took this small snippet and compiled it with perlapp --verbose script.pl 
and copied the .exe to many different servers, and it will not work on 2000?

I also copied it to another 2000 server with the exact same version of Perl 
installed and it won't work.

Does anyone have any ideas as to why?

Thanks in advance
Steve
_
There are now three new levels of MSN Hotmail Extra Storage!  Learn more. 
http://join.msn.com/?pgmarket=en-uspage=hotmail/es2ST=1

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


Re: perl proxy for browser

2004-02-03 Thread $Bill Luebkert
Jeremy A wrote:
hi all,

I found this perl proxy code on the net.
I am trying to make this proxy work that my internet explorer browser 
can use. my future plan is to monitor information with this proxy.
To set this up, in internet explorer, i went to menu Tools-Internet 
Options-Connections-Lan Settings. checked use proxy server for your 
lan, entered in the address 192.168.1.101, entered in the port 80
I then executed the proxy script, then re-opened internet explorer and 
went to a site eg www.msn.com.

the proxy script would print (in the console) Client: GET 
http://www.msn.com/ HTTP/1.0, then it hangs, and so does internet 
explorer.

What is wrong with this script? how can i get it to work?
Kinda of a half-baked solution I should think.  This script might
help you write something more useable (or use as is to monitor) :
http://www.schmerg.com/WrapUp.asp?file=HttpSniffer.html

---perl proxy code i found

use strict;

use IO::Socket;
use IO::Select;
my $proxyPort = 80;

my $destHost  = 192.168.1.101;
my $destPort  = 80;
my $proxy = IO::Socket::INET-new (
   LocalPort = $proxyPort,
   Type  = SOCK_STREAM,
   Reuse = 1,
   Listen= 10);
binmode $proxy;

while (my $client = $proxy-accept()) {
  binmode $client;
  my $dest = IO::Socket::INET-new (
PeerAddr= $destHost,
PeerPort= $destPort);
  binmode $dest;

  my $select = new IO::Select;
  $select - add ($dest);
  $select - add ($client);
  autoflush $dest;
  autoflush $client;
  while (my @ready = $select-can_read) {
foreach my $fd (@ready) {
  if ($fd == $client) {
my $clientLine = $client;
print Client: $clientLine;
print $dest $clientLine;
  }
  if ($fd == $dest) {
my $destLine = $dest;
print Dest: $destLine;
print $client $destLine;
  }
}
  }
}
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32 OLE: How to get content from a MSIE frame?

2004-02-03 Thread Jing Wee
Hi Steven

Thank you very much for your response and leading me to the answer!

I did not get it work with the codes you provided due to error when I ran it:

retrying default method at C:/Perl/site/lib/Win32/OLE/Lite.pm line 156.
Can't call method item on an undefined value at C:\test.pl line 14.
However, with your direction, I modified the variables in the lines:

from
  $browser-frames-item($x)-{name}
to
  $browser-{Document}{Frames}-Item($x)-{Name}
and

from
  $browser-frames-{$name}-document-all-{InnerHTML}
to
  $browser-{Document}{Frames}{$name}{Document}{documentElement}{InnerHTML}
I got the content of the inner frames!  Thank you thank you!  I am truly 
grateful after having stuck on this for a whole week.

Regarding the problem you mentioned, I need an answer to it too.  Hope 
someone will answer to it.

Thanks
Jing Wee

use Win32::OLE qw (EVENTS);

my $url = c:\\frameset.html
my $browser = Win32::OLE-new('InternetExplorer.Application');
$browser-{Visible} = 1;
$browser-Navigate2($url);
while ($browser-{Busy}) {
   sleep 1;
}
$x = 0;
while ($x  ($browser-frames-{length} - 1)) {
  print $browser-frames-item($x)-{name};
  $x++;
  push (@frames,$browser-frames-item($x)-{name})
}
foreach $name (@frames) {
  print frame name: $name\n;
  print $browser-frames-{$name}-document-all-{InnerHTML}.\n;
}
Unless I have a typo somewhere, this should work.  The important things
are the use of the EVENTS keywork in your use statement (which are
needed to look at frames and IE events (like onclick, etc), and the
$browser-frames object to get at each frame on the page.  From there
it's all IE and how to navigate through each element on a page.
You should probably become very familiar with the Internet Explorer
Development pages on MSDN (if you haven't already).  Not to say that I
am a guru or anything.  Just found a lot of good content there.
http://msdn.microsoft.com/workshop/index/default.asp

If you figure out how to navigate to a detached IE window that was
opened from a link that I programatically click on (that link uses a
Java window.open command), I'd love to know how to get to it.  :)
Oh well, now I'm interjecting my own stumbling blocks into your
answer...
Good Luck.

Steven

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jing Wee
Sent: Friday, January 30, 2004 7:51 PM
To: [EMAIL PROTECTED]
Subject: Win32 OLE: How to get content from a MSIE frame?
I need help to retrieve the content of a specific frame from
frameset.html
which contains 2 frames.  However, so far, I only know how to retrieve
the
content of the frameset but not of the embedded frames.
Content of frameset.html:

frameset rows=110,110
  frame name=topframe src=c:\top.html
  frame name=bottomframe src=c:\bottom.html
/frameset
Codes:

my $url = c:\\frameset.html
my $browser = Win32::OLE-new('InternetExplorer.Application');
$browser-{Visible} = 1;
$browser-Navigate2($url);
while ($browser-{Busy}) {
   sleep 1;
}
my $content = $browser-{Document}{documentElement}{innerHTML};
When I execute the code, I get the content of frameset.html.

Appreciate if anyone could help me modify the code to retrieve the
content
of the top.html.
Thanks
Jing Wee
___
Perl-Win32-Users mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


implement a simple Telnet like Daemon (protocol) in perl

2004-02-03 Thread Jeremy A
Hi all,

I have been struggling to understand the Telnet Protocol, but the RFC's are 
like greek, and there are no good books for covering Telnet, and my mind is 
too stupid to wrap around it.

I would like to create a telnet like protocol, that is easy for my own use. 
How do you go about redirecting IO from the command shell, over sockets, 
and emulate on the other end.
 eg, suppose I instantiate the prompt, open( PRMPT, cmd.exe |); on the 
server script. - this is not useful, because it creates a separate process, 
so you cannot manipulate it over a socket.
how do you grab the separate process and send IO to the socket?

also, how do i send console graphics over socket, suppose i were to 
instantiate  dos edit.

Then there is the issue of moving typing across the screen, backspace, 
delete, space, tab, enter etc.

One idea I have, (and this may sound stupid), is to download (on-the-fly) 
the program (eg edit) or find a local copy and instantiate it locally, 
making it seem as if you are running it on the server, when it is actually 
on the client. then, lets say you save the text file, the file once saved, 
gets uploaded to the server...sounds funny..eh...still may be 
hard.and there are alot of unusual console apps.



Any Ideas, anyone?

Thanks in advance for any help.

Jeremy A.

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