RE: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type.

2002-12-13 Thread Stovall, Adrian M.
 -Original Message-
 From: Lee Clemmer [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, December 13, 2002 2:42 PM
 To: [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Subject: Problems with Win32::TieRegistry SetValue for 
 REG_MULTI_SZ type. 
 
 
 When I use this function: 
   $key-SetValue( [Val1,Value2,LastVal], 
 REG_MULTI_SZ ); with a named array, like so: 
   $retval = $key-SetValue(TurfTable, @junklist, 
 REG_MULTI_SZ ); Instead of getting the expected null 
 terminated strings in the value, I get some other weirdness. 
 If you edit the value directly with Regedt32 then you must 
 enter multiple values with carriage returns, which the 
 program (Regedt32) magically transforms into nulls. I've 
 seen in the documentation a reference to a null as '\0' and 
 also, in the documentation for SetValue as \000. 
 
 This is extremely frustrating as I can read the data from the 
 value into an array with no problems, but I cannot update or 
 create a value which is valid. String data gets written there 
 with an odd char. separating the strings. (looks like a 
 little box, used when an invalid ASCII char is present). I'm 
 also a bit unclear on the required two nulls at the end. 
 Must I create an array value containing these, or must I 
 stringify the array and concatenate two nulls to the end?? 
 Which of the formats for null above are correct? 
 
 What the heck is the secret??? There surely is a way to do 
 this EASILY. Any advice would be greatly appreciated. 
 
 I JUST tried this with the syntax shown in the example 
 (valuename,[foo.com,bar.com, bax.com],REG_MULTI_SZ) 
 What is the difference between my named array and an anonymous one?! 
 
 Lee
 

My authoritative source (Programming Perl aka The Camel) says:

You can create a reference to an anonymous array using brackets
(Chapter 4...search the index for [)

So, assuming @junklist = (foo.com,bar.com, bax.com)...

[foo.com,bar.com, bax.com] is NOT the same as @junklist, but

[foo.com,bar.com, bax.com] IS the same as \@junklist.

I don't know for certain that this is the problem, but try turning your
array (@junklist) into an array ref (\@junklist) and see if it works any
better.


perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl
$yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X!
!g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi
n('',Sub(split('');

To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be. 

Adrian Okay, I won't top-post unless it's an emergency Stovall
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type.

2002-12-13 Thread Stovall, Adrian M.
(From the Activestate docs on Win32::TieRegistry...)

snip
REG_MULTI_SZ

These values can also be specified as a reference to a list of strings.
For example, the following two lines are equivalent: 
$key-SetValue( Val1\000Value2\000LastVal\000\000, REG_MULTI_SZ
);
$key-SetValue( [Val1,Value2,LastVal], REG_MULTI_SZ );

Note that if the required two trailing nulls (\000\000) are missing,
then this release of SetValue() will not add them.
/snip

So, what the documentation is telling you is that a null-delimited
concatenation of values (with an extra null at the end) is an
alternative to passing an array reference.

If @junklist = (Val1,Value2,LastVal), then you could write any of
these three forms...

$key-SetValue( [Val1,Value2,LastVal], REG_MULTI_SZ );
$key-SetValue( Val1\000Value2\000LastVal\000\000, REG_MULTI_SZ );
$key-SetValue( \@junklist, REG_MULTI_SZ );

And they mean exactly the same thing.



perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl
$yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X!
!g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi
n('',Sub(split('');

To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be. 

Adrian Okay, I won't top-post unless it's an emergency Stovall
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Can pack do what I want?

2002-12-13 Thread Todd Beverly
Allegakoen, Justin Devanandan wrote:


So question is, if this string was packed with pack in Perl would it be 
interpreted by the hardware that it's pumped into in the same way
that the resultant compiled Pascal output would?

If it helps any here's a sample Pascal line that gets compiled:-

write ('@@@FF1');

The resultant compiled output is a binary file which
doesnt display correctly when pasted in this e-mail.

But when opened with gvim you can see control characters all the way
through i.e.
^@^@^@^F^F1^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^F^
F^F^F^F^F^F^@^@^A/

Could I write pack(a*,
'@@@FF1');
and get it to behave as I expect? 
 

I think that the ascii value of ^@ (control @) is 0   and the ascii 
value of  control F is 6,  expressed as the ascii value of F  70 - 64 
= 6.   If this is the conversion that you're looking for, then something 
like

my $j = '@@@FF1';
$j =~ tr/@A-Z/\000-\026/;
print $j;

might work.



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


Looking for DBD::Oracle Module

2002-12-13 Thread WONG, JOHN \(PBD\)
Hi,

 Does anyone know how to get the DBD::Oralce module to be installed in
5.8.0 build 804?  I had the DBD:Oracle module installed in 5.6.1 before.
I've just upgraded to 5.8.0 yesterday.  I could install DBD::ODBC and
DBD::CSV but couldn't install the DBD::Oracle module.

 Thanks for the help.

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



Re: Can arrays be used as scalars?

2002-12-13 Thread Paul Barker



Hi

What your friend has done is assign the last 
element of the array @dir to $free. Perl array elements are accessed as 
$array_name[element_index] where the element index begins at zero. So to get the 
1st element of @dir you could write print $dir[0], to get the third $dir[2] etc 
...

The index of the last element can be found in $#dir 
so to get the last element you can write $dir[$#dir]. 

To find out how many elements there are in an array 
you could write $num_elemants = $#dir + 1 or you can just evaluate @dir in a 
scalar context ie print scalar(@dir). If you try print @dir however you will get 
the whole array as the print operator works in list context not scalar 
context.

If this is allreally confusing (sorry!) the 
check out thePerl docs (try 'perldoc perldata') or the Camel book, both 
ofwhich probably explain things a whole lot 
better than me !

HTH

Paul


  - Original Message - 
  From: 
  RCTay 
  
  To: [EMAIL PROTECTED] 
  
  Sent: Sunday, November 24, 2002 8:06 
  AM
  Subject: Can arrays be used as 
  scalars?
  
  my( @dir, 
  $free);@dir =3D `dir`;$free =3D $dir[$#dir];
  
  This code was 
  written by a friend of mine. "@dir" was declared as aarray, but in the 
  second line it is used as a scalar. How is thatpossible? There are no 
  warnings given by the interpreter. Can you pleaseexplain why it can be 
  used?


Net::ProxyMod

2002-12-13 Thread Harald Wopenka
Hi there!

I wanted to watch the communication between browser and server and found
that nice ProxyMod-Module. But for some reason it doesnt work.

This is the code:

  use Net::ProxyMod;

  $p = Net::ProxyMod-new(172.16.3.1, 8080, , 0, 1);
  $p-get_conn(\infunc,\outfunc);

  sub infunc
  {
my($data) = @_;
print IN: '$data'\n;
return($data);
  }

  sub outfunc
  {
my($data) = @_;
print OUT: '$data'\n;
return($data);
  }

And this is the output:

  C:\tempproxytest.pl
  Started server at 172.16.3.1:8080
  Connect from 172.16.3.1:1357
  Connecting to 172.16.3.1:8080
  Connect from 172.16.3.1:1358
  Connecting to 172.16.3.1:8080
  Connect from 172.16.3.1:1359
  Connecting to 172.16.3.1:8080

There is nothing else - the browser times out after a while. It doesnt
matter which IP I use for the proxy (172.16.3.1, 127.0.0.1, localhost) - its
always the same :(

Does anyone have any idea what could be wrong?

Harry

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



perlscript killing me

2002-12-13 Thread Nikko Odiseos
I am using perlscript in an asp page that was working fine on one box for a
couple months and I moved it to another.  Now after running for several
hours I get the error (below) on this page which makes no sense.  Nothing
changes if I bounce IIS but if I reboot the box, everything is fine for a
few hours after which it comes back.


PerlScript Error error '80004005'

Can't locate XSLoader.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at C:/Perl/lib/IO.pm line 5. BEGIN failed--compilation
aborted at C:/Perl/lib/IO.pm line 5. Compilation failed in require at
C:/Perl/lib/IO/Handle.pm line 256. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/Handle.pm line 256. Compilation failed in require at
C:/Perl/lib/IO/Seekable.pm line 101. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/Seekable.pm line 101. Compilation failed in require at
C:/Perl/lib/IO/File.pm line 112. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/File.pm line 112. Compilation failed in require at
C:/Perl/lib/FileHandle.pm line 9. Compilation failed in require at (eval 2)
line 7. BEGIN failed--compilation aborted (in cleanup) Can't locate
XSLoader.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at
C:/Perl/lib/IO.pm line 5. BEGIN failed--compilation aborted at
C:/Perl/lib/IO.pm line 5. Compilation failed in require at
C:/Perl/lib/IO/Handle.pm line 256. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/Handle.pm line 256. Compilation failed in require at
C:/Perl/lib/IO/Seekable.pm line 101. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/Seekable.pm line 101. Compilation failed in require at
C:/Perl/lib/IO/File.pm line 112. BEGIN failed--compilation aborted at
C:/Perl/lib/IO/File.pm line 112. Compilation failed in require at
C:/Perl/lib/FileHandle.pm line 9. Compilation failed in require at (eval 2)
line 7. BEGIN failed--compilation aborted 

This does make sense as from the command line I can run `perl -e use
XSLoader` and it returns fine.  Also XSLoader.pm is in c:\perl\lib which is
in the @INC path it says it can't find.  This is an intermittent problem.
The script itself is below.  Any help would be greatly appreciated as I am
in trouble with this!


script language=PerlScript RUNAT=Server
sub fifth {

$session = shift;

$querystr = shift;

#$Response-write(IN SUBROUTINE and user is $sessionbr);
#$Response-write(IN SUBROUTINE and querystr is $querystrbrbr);
$| = 1; # flush on!
use FileHandle; # for includes
use LWP::Simple;# getting a url
use CGI;

# Init some vars.
#
my($contact1) = '[EMAIL PROTECTED]';
my($doc_root) = 'd:/Inetpub';
my($inc_root) = $doc_root . '/toolkit/includes';
my($search_base_url) = 'http://localhost:8765';
my($search_index_url) = $search_base_url . '/index.html';
my($search_query_url) = $search_base_url . '/query.html';


my(%cgi, @cgi_names);
cgi_decode_input(\%cgi, \@cgi_names);


 my($cgi_dir) = 'search';




#---
# Game on - dispatch on command.
#
my($cmd) = $cgi{'cmd'};
$cmd = 'query' if (! $cmd);
if($cmd eq 'query') { cmd_query($session,$querystr); }
else{ cmd_error(); }

# Game over.
exit(0);


#** functions


#
# cmd_query - output the results of an inktomi search query.
#
sub cmd_query
{
#my($qs) = $ENV{QUERY_STRING};
my($user) = shift;
my($qs) = shift;
#if ($qs eq ) {
#$qs = col=technotecharset=iso-8859-1;
#}


my($url) = $qs? $search_query_url . '?' . $qs : $search_index_url;

if ($user == 1) {
if (! $qs) { $url .= ?;}
$url .= iw=1;
}

  # $Response-write(\$url is $urlbr);
my(@info) = get($url);

output_http_start();
$Response-write(@info);

}


#
# cmd_error - oops.
#
sub cmd_error
{
oops('Unknown command: ' . $cmd);
}


#-- support: reply
ops ---
#---
--
#
# oops - output an error and stop.
#
sub oops
{
my($msg) = @_;

output_http_start();
$Response-write(brbr\n);
$Response-write(font color=redbERROR:/b/font %sbrbr\n,
$msg);
$Response-write(Please contact a
href=mailto:$contact1$contact1/a);
$Response-write(to report this problem.brbr\n);
exit(1);
}


# output_http_start - kick out the http header.
#
sub output_http_start
{
my($type) = @_;

$type = 'text/html' if (! $type);
$Response-{ContentType} = $type;
}


#-- support: misc
utils --
#---
--
#
# cgi_decode_input - grok the name/value's out of the cgi request.
#
sub cgi_decode_input
{
my($param, $order) = @_;
my($i, $loc, $key, $val, $param_str);

# Bootstrap if no values.
if (! 

win32::RASE

2002-12-13 Thread lawrence.palkendo
I am currently in the process of building a war dialer.  I am using the
win32::RASE on a windows 98 SE box using standard DUN.
I am currently running into a problem with setting one of the Flags or
keeping the Flag set if I do it manually.

The Flag is under Server Types when you look at a connections
properties.  The Flag I am trying to set is Record a log file for this
connection
If I tell win32::RASE to keepOldFlags it still unchecks this box and I
couldn't find any documentation on how to set this particular flag.

Any help is appreciated.

Thanks
Larry





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



Hash, sort and map function problem

2002-12-13 Thread Paul Rousseau
Hello,

  I have a hash that looks like this:

 my %sql_hash = (A = [2, 6, ],
 Q = [1, 3, ],
 D = [5, 8, ],
 X = [4, 2, ],
 P = [3, 12, ]);

The key is an arbitrary string (e.g. D). The key order is not determined 
by this key string, but by the number in the first value of the associated 
array value.

For example, the following code sorts the hash based on the values 2, 1, 5, 
4 ,3 you see above, and prints out The keys are: Q A P X D

my $c;
print keys are: ;
foreach $c (sort {$sql_hash{$a}-[0] = $sql_hash{$b}-[0]} keys 
%sql_hash)
  {
   print $c ;
  }

For many of you, this is standard Perl stuff.

What I want to do is take the second entry in each value array (i.e. 6, 3, 
8, 2, 12), and use it to break up a long string using the substr function 
(or some other function); place each chunk in the third entry of each value 
array, and base it on the sorting position of the first value.

In other words, sort the hash in the proper order,

 foreach $c (sort {$sql_hash{$a}-[0] = $sql_hash{$b}-[0]} keys 
%sql_hash)

then somehow, pick up the second array value for each key-value pair, add it 
to a running $offset variable, and apply the command,

$sql_hash{$c}-[3] = substr ($mystring, $offset, $sql_hash{$c}-[2]);

where $mystring = stuff  some blanks some words more stuff ;

In the end, my hash looks like

%sql_hash = (A = [2, 6, ff  so],
 Q = [1, 3, stu],
 D = [5, 8,  words mo],
 X = [4, 2, me],
 P = [3, 12, me blanks so]);


I have been looking at the map function to do this, but maybe there is a 
better approach. I thought about sorting the hash first (based on the first 
value) into an array, then using a foreach loop to obtain the second value, 
add it to a running $offset variable, and applying the substr command to 
update the third value.

Any help would be greatly appreciated.

Thank you

Paul Rousseau


_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


RE: .CAB?

2002-12-13 Thread Gerber, Christopher J
Title: RE: .CAB?




  -Original Message-From: FARRINGTON, RYAN 
  [mailto:[EMAIL PROTECTED]]
  damn =) ah well... Thanks I was doing that anyway but I wanted 
  to find a way to do it totally in PERL and not have to rely on a third-party 
  executable
How ambitious are you feeling? M$ seems to be 
keeping the wraps on the DIAMONDAPI calls, but you can find the C header files 
here: http://mateusz.free.fr/mscab/. 
Look at FCI.h (File Compression Interface) inside MsCab061-Src.cab. You 
may be able to work out the Win32::API calls. I haven't played with this 
yet, and am not sure if it is legally redistributable. Is there any 
special reason for using CAB over another format?
Chris

  -Original 
  Message- From: Jan Dubois [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, December 13, 2002 12:17 PM To: Bullock, Howard A. Cc: 'FARRINGTON, RYAN'; 
  [EMAIL PROTECTED]; Perl List Subject: Re: .CAB? 
  On Fri, 13 Dec 2002 12:23:49 -0500, "Bullock, Howard 
  A." [EMAIL PROTECTED] wrote: 
  
  I thought I had seen a Win32::Cabinet module, but can not 
  seem to find it on ActiveState's site or at 
  CPAN.org. 
  It is part of the Perl Dev Kit. But it won't help you 
  extract files from a CAB, it only builds them. 
  
  The only way to access files inside a CAB from Perl (that I 
  know about) is to shell out and run expand.exe to 
  extract the file to the filesystem: 
  | C:\expand -? | Microsoft (R) 
  File Expansion Utility Version 5.00.2134.1 | 
  Copyright (C) Microsoft Corp 1990-1999. All rights reserved. 
  | | Expands one or more compressed 
  files. | | EXPAND [-r] Source 
  Destination | EXPAND -r Source [Destination] 
  | EXPAND -D Source.cab [-F:Files] | 
  EXPAND Source.cab -F:Files Destination | 
  | 
  -r Rename 
  expanded files. | 
  -D Display 
  list of files in source. | 
  Source Source file 
  specification. Wildcards may be used. | -F:Files Name of files to 
  expand from a .CAB. | 
  Destination Destination file | path specification. 
  | 
  Destination may be a directory. | 
  If Source is multiple files and -r is not specified, | 
  Destination must be a directory. 
  Cheers, -Jan 


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.



Re: Net::Telnet on Win2K

2002-12-13 Thread Kevin Pendleton
John,

The problem is outlined in the Net:Telnet documentation.  The loads of 
gibberish is ANSI terminal escape characters.  I haven't worked with that 
exact telnet application, but some allow you to turn ANSI off and on

http://search.cpan.org/author/JROGERS/Net-Telnet-3.03/lib/Net/Telnet.pm

Connecting to a Remote MS-Windows Machine

By default MS-Windows doesn't come with a TELNET server. However third party 
TELNET servers are available. Unfortunately many of these servers falsely 
claim to be a TELNET server. This is especially true of the so-called 
Microsoft Telnet Server that comes installed with some newer versions 
MS-Windows.

When a TELNET server first accepts a connection, it must use the ASCII 
control characters carriage-return and line-feed to start a new line (see 
RFC854). A server like the Microsoft Telnet Server that doesn't do this, 
isn't a TELNET server. These servers send ANSI terminal escape sequences to 
position to a column on a subsequent line and to even position while writing 
characters that are adjacent to each other. Worse, when sending output these 
servers resend previously sent command output in a misguided attempt to 
display an entire terminal screen.

Connecting Net::Telnet to one of these false TELNET servers makes your job 
of parsing command output very difficult. It's better to replace a false 
TELNET server with a real TELNET server. The better TELNET servers for 
MS-Windows allow you to avoid the ANSI escapes by turning off something some 
of them call console mode.

Kevin

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


RE: :Telnet on Win2K

2002-12-13 Thread Bill Royds
The gibberish is ANSI escape sequences for moving the cursor around on the screen 
that the telnet server believes it is connected to. You need to turn it of with the 
ANSI sequence by ensuring that Console mode is no.
From the Net::Telnet POD.
Connecting to a Remote Win32 Machine

  By default, Windows machines don't come with a TELNET service. However,
  third party TELNET servers can be acquired to provide access to a DOS
  shell. As is all too familiar, many of these servers are of inferior
  quality.

  One particularly nasty problem is a server that sends ANSI terminal
  escape sequences despite being told not to. These escape sequences make
  your job of parsing the data much more difficult. You can sometimes
  avoid this with a server that prompts you for *console mode*. Choose
  *no* to console mode.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
John Serink
Sent: Wed November 27 2002 21:08
To: [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Net::Telnet on Win2K


Hi All:

Sorry to be sending this to both Win32-Admin and Win32-users but trying to solicit 
advice from as many parties as possible. Also, apologies for this being so long.
My problem: Differences in the operation of the Win2K Telnet Server (included with 
Win2K) and the Telnet server form the WindozeNT Resource Kit(note, a patch from MS is 
required for the telnet.inf file to install this properly).

I am using the 'waitfor' method at the moment as I have been having problems with the 
cmd method on Win2K (why this is becomes clear later in the discussion).
Here is my test script, dead simple(line numbers are for explanation purposes):
1  use Net::Telnet;
2  use strict;
3  use warnings;
4  
5  my $destination = srecept;
6  my $telnet = new Net::Telnet ( Timeout=10, Prompt= '/\\$/i');
7  my $time = localtime();
8  $telnet - dump_log(dump.txt);
9  $telnet - input_log(input.txt);
10 
11 $telnet-open($destination);
12 #$telnet-waitfor('/login: $/i');# Used for Win2K log on.
13 $telnet-waitfor('/Username: $/i');   #Used for NT log on.
14 $telnet-print('Administrator');
15 $telnet-waitfor('/Password: $/i');
16 $telnet-print('12345');
17 $telnet-waitfor('/\/i');
18 print(We have received the prompt, we are in\n);
19 $time = localtime();
20 print(Sending now at $time\n);
21 $telnet-print('now');
22 print(Waiting for the prompt\n);
23 my ($prematch, $match) =$telnet-waitfor('/C:/i');
24 print(The characters before the $match were:\n);
25 print($prematch\n);
26 $time = localtime();
27 print(finished at $time\n);

Now, this script works perfect using the NT RK Telnet server. This is the output:
*D:\Perl\practice\examples\Telnetperl telnetoff7.pl
*We have received the prompt, we are in
*Sending now at Thu Nov 28 09:44:36 2002
*Waiting for the prompt
*The characters before the C: were:
*now
*
*Thu Nov 28 09:39:48 2002
*
*
*finished at Thu Nov 28 09:44:36 2002
*
*D:\Perl\practice\examples\Telnet

Exactly as one would expect. Now here is the command line output from the script 
running to a Win2K telnet server:
*D:\Perl\practice\examples\Telnetperl telnetoff7.pl
*We have received the prompt, we are in
*Sending now at Thu Nov 28 09:43:05 2002
*Waiting for the prompt
*The characters before the C: were:
*
?[5;1H?[K?[6;1H?[K?[7;1H
*?[K?[8;1H?[K?[9;1H?[K?[10;1H?[K?[11;1H?[K?[12;1H?[K?[13;1H?[K?[14;1H?[K?[15;1H?[K?[16;1H?[K?[17;1H?[
*K?[18;1H?[K?[19;1H?[K?[20;1H?[K?[21;1H?[K?[22;1H?[K?[23;1H?[K?[24;1H?[K?[25;1H?[K?[4;5H?[4;5Hnow?[6;
*1HThu Nov 28 09:35:53 2002?[8;1H
*finished at Thu Nov 28 09:43:05 2002
*
*D:\Perl\practice\examples\Telnetperl telnetoff7.pl

As you can see, loads of gibberish. Obviously, at this stage of the game one looks at 
the dump_log and input_log filesand here is where it gets interesting. Here is the 
dump_log file from NT, the telnet server that works with Net::Telnet as expected:

 0x0: 0a 0d 0a 0d  0a .

 0x0: 45 43 48 4f  20 69 73 20  6f 66 66 2e  0d 0aECHO is off...

 0x0: 57 65 6c 63  6f 6d 65 20  74 6f 20 74  68 65 20 54  Welcome to the T
 0x00010: 65 6c 6e 65  74 20 53 65  72 76 69 63  65 20 42 65  elnet Service Be
 0x00020: 74 61 2e 20  20 54 68 69  73 20 73 65  72 76 69 63  ta.  This servic
 0x00030: 65 20 69 73  20 73 74 69  6c 6c 20 61  0d 0a 77 6f  e is still a..wo
 0x00040: 72 6b 20 69  6e 20 70 72  6f 67 72 65  73 73 2e 20  rk in progress. 
 0x00050: 20 50 6c 65  61 73 65 20  63 68 65 63  6b 20 74 68   Please check th
 0x00060: 65 20 66 6f  6c 6c 6f 77  69 6e 67 20  66 74 70 20  e following ftp 
 0x00070: 6c 6f 63 61  74 69 6f 6e  20 66 6f 72  0d 0a 74 68  location for..th
 0x00080: 65 20 6d 6f  73 74 20 63  75 72 72 65  6e 74 20 76  e most current v
 0x00090: 65 72 73 69  6f 6e 20 6f  66 20 74 68  69 73 20 74  ersion of this t
 0x000a0: 6f 6f 6c 3a  0d 0a 45 43  48 4f 20 69  73 20 6f 66  ool:..ECHO is of
 0x000b0: 66 2e 0d 0a  20 

RE: Help: On what OS am I running

2002-12-13 Thread Peter . Bollinger



Try one of 
these Perl varaiables:


$OSNAME$^O
The name of the operating 
system under which this copy of Perl was built, as determined during the 
configuration process. The value is identical to $Config{'osname'}. 


For example 
under WindowsNT the output of 'print $^O' is 'MSWin32'.

Peter 
Bollinger

  -Original Message-From: Mundell, R. (Ronald) 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, December 02, 2002 1:11 
  PMTo: '[EMAIL PROTECTED]'; 
  [EMAIL PROTECTED]Subject: Help: On what OS 
  am I running
  
  Good Day All
  
  Does any one know how I can 
  determine on what OS a script is running? E.g. am I running on Solaris, 
  windows HP or Linux?
  
  Ronald Mundell
  Nedcor
  BG3
  881-3751(011)
  083407
  


RE: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type.

2002-12-13 Thread Lee Clemmer
Yep! 

Thanks everyone, this was it. I should know better, but the examples
don't show references \@array anywhere. I was forgetting the meaning of
[1, 2, 3] as an anonymous array that would require a reference. 

After making the change from @junklist to \@junklist in my code, it
works properly. 

(Lee crawls away to go re-read the camel book...) 



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



Re: Hash, sort and map function problem

2002-12-13 Thread $Bill Luebkert
Paul Rousseau wrote:

Hello,

  I have a hash that looks like this:

 my %sql_hash = (A = [2, 6, ],
 Q = [1, 3, ],
 D = [5, 8, ],
 X = [4, 2, ],
 P = [3, 12, ]);

The key is an arbitrary string (e.g. D). The key order is not 
determined by this key string, but by the number in the first value of 
the associated array value.

For example, the following code sorts the hash based on the values 2, 
1, 5, 4 ,3 you see above, and prints out The keys are: Q A P X D

my $c;
print keys are: ;
foreach $c (sort {$sql_hash{$a}-[0] = $sql_hash{$b}-[0]} keys 
%sql_hash)
  {
   print $c ;
  }

For many of you, this is standard Perl stuff.

What I want to do is take the second entry in each value array (i.e. 6, 
3, 8, 2, 12), and use it to break up a long string using the substr 
function (or some other function); place each chunk in the third entry 
of each value array, and base it on the sorting position of the first 
value.

In other words, sort the hash in the proper order,

 foreach $c (sort {$sql_hash{$a}-[0] = $sql_hash{$b}-[0]} keys 
%sql_hash)

then somehow, pick up the second array value for each key-value pair, 
add it to a running $offset variable, and apply the command,

$sql_hash{$c}-[3] = substr ($mystring, $offset, $sql_hash{$c}-[2]);

where $mystring = stuff  some blanks some words more stuff ;

In the end, my hash looks like

%sql_hash = (A = [2, 6, ff  so],
 Q = [1, 3, stu],
 D = [5, 8,  words mo],
 X = [4, 2, me],
 P = [3, 12, me blanks so]);


I have been looking at the map function to do this, but maybe there is a 
better approach. I thought about sorting the hash first (based on the 
first value) into an array, then using a foreach loop to obtain the 
second value, add it to a running $offset variable, and applying the 
substr command to update the third value.

You don't need map unless you want to make a complicated looking expr.

This should work:

use strict;
my %sql_hash = (A = [2, 6, ],	# you don't need the 's around the numbers
Q = [1, 3, ],  # if they are intended to be integers
D = [5, 8, ],
X = [4, 2, ],
P = [3, 12, ],
);
my $mystring = stuff  some blanks some words more stuff ;

my $offset = 0;
foreach (sort { $sql_hash{$a}-[0] = $sql_hash{$b}-[0] } keys %sql_hash) {
	$sql_hash{$_}-[2] = substr ($mystring, $offset, $sql_hash{$_}-[1]);
	$offset += $sql_hash{$_}-[1];
}

__END__

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

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



Fw: Interact with IIS built-in session variables

2002-12-13 Thread Jeremy Kister
I sent this about 2 weeks ago, with only one reply that i couldnt use.  If
no one knows the answer, does anyone know where i might find the answer??

BTW:  I am not using PerlScript in ASP - this is just plain ol' perl
directly from IIS.

Thanks,

---
Jeremy Kister
www.jeremykister.com
PGP: http://www.jeremykister.com/jeremy/public_key.asc
---
- Original Message -
From: Jeremy Kister [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 01, 2002 12:54 AM
Subject: Interact with IIS built-in session variables


 Hi,
 I'm running ActivePerl 5.6.1 on a Windows 2000 Server/IIS 5.0.  All seems
to
 work well.

 For the past few weeks, i've been searching for a way for my perl script
to
 communicate with session variables from an ASP script.

 For Example:

 www.jeremykister.com/set.asp contains a simple:
%
 session(foo) = bar
%

 www.jeremykister.com/get.asp contains a simple
%
 response.write session variable 'foo' is set to:   session(foo)
%

 now all I need is for my perl script to be able to interact with that.  i
 need to be able to set session variables that the ASP know about, and i
need
 to read session variables that the ASP have set.

  Is there a way to do this?

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