Perl 5.6.1 on Win 2000

2005-03-10 Thread sadanand limaye
Hi ,
I had built perl 5.6.1 with libwin32-0.19 on
windows2000.   Earlier i was using perl 5.005 and the
starting script which calls 2 processes in background
as 
  system(start /b xyz.pl );
  $command = abc.exe ... ;
  `$command`;
  works fine with perl 5.005.

But after I changed perl to perl 5.6.1 , when i tried
with wperl.exe,and debugged the perl script , a new
cmd process launches, and unless I close that cmd
window , 2 processes doesn't start. 

When similar debug is done with perl 5.005 , similar
window launches but also exit immediately and 2
processes starts. 

Why a new cmd process does not terminate ?

Thanks and regards,
Sadanand





__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


How to 'touch' in Windows

2005-03-10 Thread Maxmelbin Neson (RBIN/EDM3)
Title: How to 'touch' in Windows






Hi,

If I need to create a blank file in Unix I do touch file name 


How do I do it in Windows ??/


Regards

Maxmelbin Neson

-

Robert Bosch India Limited

Engineering Services - DS - Methods and Tools (RBIN/EDM3)

123 Industrial Layout - Hosur Road - Bangalore 560 095 - INDIA

Telephone: +91 80 5119-4532 Fax: +91 80 2508-1404

[EMAIL PROTECTED]

www.bosch.com


Reputation is what men and women think of us; character is what God and angels know of us.


-Thomas Paine




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


Re: How to 'touch' in Windows

2005-03-10 Thread Bruno Georges
Have a look at: ExtUtils::Command
Check ActieState doc.

perl -MExtUtils::Command -e touch

Bruno Georges

Glencore International AG
Tel. +41 41 709 3204
Fax +41 41 709 3000


|-+-
| |   Maxmelbin Neson (RBIN/EDM3) |
| |   [EMAIL PROTECTED]|
| |   Sent by:  |
| |   [EMAIL PROTECTED]|
| |   veState.com   |
| | |
| | |
| |   10.03.05 13:43|
| | |
|-+-
  
|
  | 
   |
  |To:  perl-win32-users@listserv.ActiveState.com 
   |
  |cc:  
   |
  |Subject: How to 'touch' in Windows   
   |
  | 
   |
  |Distribute:  
   |
  |Personal?   |---|
   |
  || [ ] x |
   |
  ||---|
   |
  | 
   |
  
|




Hi,
 If I need to create a blank file in Unix I do touch file name


How do I do it in Windows ??/


Regards
Maxmelbin Neson
-

Robert Bosch India Limited
Engineering Services - DS - Methods and Tools (RBIN/EDM3)
123 Industrial Layout  -  Hosur Road -  Bangalore 560 095  -  INDIA
Telephone: +91 80 5119-4532  Fax: +91 80 2508-1404
[EMAIL PROTECTED]
www.bosch.com


Reputation is what men and women think of us; character is what God and
angels know of us.


-Thomas Paine


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








*  
*  LEGAL DISCLAIMER
*  This message contains confidential information for
*  the exclusive use of the person mentioned above.
*

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


RE: How to 'touch' in Windows

2005-03-10 Thread Anderson, Mark (Service Delivery)

Why not just use open()?


Kind regards,

Mark Anderson
Service Improvement Programme
Level 2, 113 Dundas Street
Edinburgh, EH3 5DE
Tel: 0131 523 8786
Mob: 07808 826 063


 -Original Message-
 From: [EMAIL PROTECTED]
 [SMTP:[EMAIL PROTECTED] On Behalf Of
 Maxmelbin Neson (RBIN/EDM3)
 Sent: Thursday, March 10, 2005 12:43 PM
 To:   perl-win32-users@listserv.ActiveState.com
 Subject:  How to 'touch' in Windows
 
 *** WARNING : This message originates from the Internet ***
 
 
 
 Hi, 
  If I need to create a blank file in Unix I do touch file name 
 
 How do I do it in Windows ??/ 
 
 Regards 
 Maxmelbin Neson 
 --
 --- 
 Robert Bosch India Limited 
 Engineering Services - DS - Methods and Tools (RBIN/EDM3) 
 123 Industrial Layout  -  Hosur Road -  Bangalore 560 095  -  INDIA 
 Telephone: +91 80 5119-4532  Fax: +91 80 2508-1404 
 [EMAIL PROTECTED] 
 www.bosch.com file://www.bosch.com 
 
 Reputation is what men and women think of us; character is what God and
 angels know of us. 
 
 -Thomas Paine 
 
   File: ATT524686.txt  


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial 
Services Authority and represents The Royal Bank of Scotland Marketing Group. 
The Bank sells life policies, collective investment schemes and pension 
products and advises only on the Marketing Group's range of these products and 
on a With-Profit Bond produced by Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The Royal Bank of 
Scotland plc does not accept responsibility for changes made to this message 
after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, 
it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will not 
adversely affect its systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry out 
such virus and other checks as it considers appropriate.

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


Re: How to 'touch' in Windows

2005-03-10 Thread Chris Wagner
Cygwin provides touch.





--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede males

0100

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


RE: How to 'touch' in Windows

2005-03-10 Thread Paul Sobey
Title: How to 'touch' in Windows



Would this suit you?

open FILE, "file";
close FILE;




From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
Maxmelbin Neson (RBIN/EDM3)Sent: 10 March 2005 
12:43To: perl-win32-users@listserv.ActiveState.comSubject: 
How to 'touch' in Windows

Hi, If I 
need to create a blank file in Unix I do touch file name 

How do I do it in Windows ??/ 
Regards Maxmelbin Neson - 
Robert Bosch India Limited 
Engineering Services - DS - Methods 
and Tools (RBIN/EDM3) 123 
Industrial Layout - Hosur Road - Bangalore 560 095 
- INDIA Telephone: +91 80 
5119-4532 Fax: +91 80 2508-1404 [EMAIL PROTECTED] www.bosch.com 
"Reputation is what men and 
women think of us; character is what God and angels know of us." 
-Thomas Paine 

* 

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


Re: Strange behaviour reading accents

2005-03-10 Thread Marcos Lorenzo de Santiago
On Thursday 10 March 2005 01:59, Sisyphus wrote:
  Si I think you can do it using the Encode module, but I don't have a demo 
  Si script. I do have a script that uses Text::Iconv which is reproduced here:

Any code will help :)

  Si use warnings;
  Si use strict;
  Si use Text::Iconv;
  Si 
  Si my $tocode = cp850;
  Si my $fromcode = cp1252;
  Si 
  Si my $text = chr(241);
  Si print $text, \n; # prints ±
  Si 
  Si my $converter = Text::Iconv-new($fromcode, $tocode);
  Si my $converted = $converter-convert($text);
  Si 
  Si print $converted, \n; # prints ñ
  Si 
  Si __END__
  Si 
  Si # VALID CODESETS:
  Si # iso-8859-1
  Si # cp850  (DOS)
  Si # cp1252 (windows)
  Si # utf-8
  Si 
  Si my $fromcode = cp850;
  Si my $tocode = cp1252;
  Si 
  Si # £ = ALT 0163 = ord(156)
  Si 
  Si my $text = chr(156);
  Si 
  Si # To print the pound-sterling symbol to the console:
  Si print $text, \n;
  Si 
  Si # To print the pound-sterling symbol to  o.txt:
  Si my $converter = Text::Iconv-new($fromcode, $tocode);
  Si my $converted = $converter-convert($text);
  Si print $converted, \n;
  Si open(OUT, o.txt);
  Si print OUT $converted;
  Si close(OUT);
  Si 
  Si Hope it helps.

I hope it does, I'm about to try this right now. I just wanted to thank you the 
tip

regards,
m4c.


-- 
,--.
| Iles's Law:  |
| There is always an easier way to do it.  When looking|
| directly at the easy way, especially for long periods,   |
| you will not see it. Neither will Iles.  |
|--|
| 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|\___)=(___/   |
|   |  |
`--'


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


Re: Strange behaviour reading accents

2005-03-10 Thread Marcos Lorenzo de Santiago
On Thursday 10 March 2005 17:25, Chuck Somerville wrote:
  CS But you don't see that. You see ßÚݾ·.  Your e-mail address indicates 
you are in Spain, so you probably have some sort of keyboard with European 
accented characters on it, and your windows is probably configured to use 
keyboard and display handling in DOS windows using Code Page 850 (Multilingual 
Latin 1) for your OEM character set, so (as shown in your e-mail) you see...
  CS  E1 latin small letter sharp s
  CS  E9 latin capital letter u with acute
  CS  ED latin capital letter y with acute
  CS  F3 vulgar fraction three quarters
  CS  FA middle dot
  CS ...which is indeed the ßÚݾ· shown in your e-mail. That character set is 
here...
  CS  http://www.microsoft.com/globaldev/reference/oem/850.htm 

That's right, this one's my case :)

  CS Note that somehow the copy and paste from the DOS window into your 
(Windows) e-mail preserved the visual appearance of the characters. That's 
because Windows tries (in some situations) to preserve the characters as 
viewed moving them between DOS windows and Windows windows.
  CS 
  CS When the MORE command (a DOS command) displayed a FILE (your source) on 
screen, it didn't have any way of knowing you created hex E1 E9 ED F3 FA in 
that print statement in a Windows editor, so it just diaplayed the DOS 
characters for those hex values, using your Code Page 850.
  CS 
  CS Now your test uses 3 different ways of getting the data INTO the 
program...
  CS   via command line argument to the perl program
  CS   via keyboard input to the perl program
  CS   via the perl source of the print statement, edited in Windows
  CS ...and one way of VIEWING the results...
  CS   via the DOS window
  CS ...and you describe another way of viewing results: writing the results 
to a file and viewing the file (probably in Windows), and as you can see, 
different things happen to you depending on how the data got in there, how the 
data comes out, and then how it is viewed.
  CS 
  CS You will have to decide how the finished program is going to be used 
(what kind of input, what kind of output, and where that output will be viewed) 
and then handle the data accordingly. You might have to construct a translate 
routine of you find yourself switching between character sets in the course of 
this processing. The tables referenced above provide all the needed info for 
doing that. If your program is to be used in different countries, you may need 
to think about other code pages and character sets as well.

Yep, I guess my test script was a little bit messy about my desired input and 
output
Well, what I need is parse the output of a cmd command which has several
accented characters and store it in a file. Then I make several operations and 
later
I read the file and then execute a system call passing as arguments some data 
stored
in that file.

  CS This is the starting point for keyboards, Locales, etc., and the 
above-referenced (and all the other) character tables...
  CS  http://www.microsoft.com/globaldev/reference/default.mspx 
  CS ...visit  the Code Pages link.

Wow! never heard about that web pages... interesting!
I think I should take a look.

  CS Does you head hurt yet? Mine does, from writing all this down. I just 
keep a large bottle of aspirin handy, because I work for a printer manufacturer 
with sales worldwide, so these issues are always coming up here.

Yeah! few lines written for lot of information :S

  CS It is too bad IBM didn't use Latin-1 (ECMA-94) in the original IBM PC, 
like all the Unix variations I've ever seen, because then we wouldn't be having 
this discussion. When you move this kind of data between Windows and Solaris 
(for instance) the accented characters all just work. But, IBM (the folks who 
gave us EBCDIC in the '60s) wanted the box-drawing characters so they did what 
they always do - they went off in a corner and invented PC8 from whole cloth. 
Oh well.

Well, here it is when we become useful! Well at least you are useful for
this issue... :)

  CS Cheers (and pass the aspirin),

Hahhaha, yep I think after this I'll get one...

Cheers everybuddy.

-- 
,--.
| Linux: the operating system with a CLUE...  |
| Command Line User Environment.  |
| (seen in a posting in comp.software.testing) |
|--|
| Labs. Technician  |  |
| Department of Telematic Engineering   | Debian GNU/Linux Powered |
| Universidad Carlos III de Madrid  |  |
|---|.--.  |
|   |   |o_o | |
|  _|  .''`.|:_/ | |
| |~~  @| Marcos Lorenzo de Santiago|  

Re: Strange behaviour reading accents

2005-03-10 Thread Marcos Lorenzo de Santiago
On Thursday 10 March 2005 18:47, Marcos Lorenzo de Santiago wrote:
  ML   Si use Text::Iconv;

Where can I find this module for windows? In activestate.com sais it's
not available for windows because it's installation fails.

I tried ppm install Text::Iconv but said it could'nt be found...

Is there any other module that replaces this one?

cheers,
m4c.


-- 
,--.
| BOFH excuse #230:|
| Lusers learning curve appears to be fractal  |
|--|
| 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|\___)=(___/   |
|   |  |
`--'


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


adding a title to a file on windows

2005-03-10 Thread Earthlink-m_ryan



Does anyone know how to add"Comments" to a 
file descriptionfrom the command prompt?

I would like to change a list of files from long 
names to short names, but retain the descriptions in a field like "title" or 
"Comments".

file names are-
nvar_1234_Virginia_Jurisdictional_addendum.pdf
nvar_k1245_Regional_contract.pdf
and I want-
nvar_1234.pdf -- with a 
description of "Virginia_Jurisdictional_addendum"
nvar_k1245.pdf -- 
with a description of "Regional_contract"

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


Re: adding a title to a file on windows

2005-03-10 Thread Chris Wagner
The file comments are part of the file itself.  Are u talking about saving
off the long name somewhere for future reference?



--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede males

0100

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


RE: adding a title to a file on windows

2005-03-10 Thread Peter Eisengrein



First you need a hard-and-fast rule for converting the names. In your 
example it would look like you want everything up to the last number in the 
second "word" (where words are delimited by "_"). Also, is it safe to assume 
they are all in the same directory? If that is the case, it could be something 
like below (also assumes there is only one . in the 
filename):

#UNTESTED

use strict;use File::Copy;

my $dir = '/somedir';my %hash;

opendir(DIR,$dir) || die "can't open $dir : $!\n";my @files = 
readdir(DIR);closedir(DIR);

foreach my $file (@files){my ($name,$ext) = 
split(/\./,$file);my ($newname,$desc) = $name =~ 
/^(.*\d)_(.*)$/;$hash{$name}="$desc";move("$file","$newname\.$ext");}

open(LOG," $log") || outputerror;

foreach my $key (keys %hash){print LOG "$key -- with a 
description of $hash{$key}\n";}



sub outputerror{print "WARNING: Could not open log file for 
writing. THe following files were moved:\n\n";foreach my $file 
(@files){print "$file\n";}

exit 1;}


  -Original Message-From: Earthlink-m_ryan 
  [mailto:[EMAIL PROTECTED]Sent: Thursday, March 10, 2005 1:53 
  PMTo: Perl-Win32-Users@listserv.ActiveState.comSubject: 
  adding a title to a file on windows
  Does anyone know how to add"Comments" to a 
  file descriptionfrom the command prompt?
  
  I would like to change a list of files from long 
  names to short names, but retain the descriptions in a field like "title" or 
  "Comments".
  
  file names are-
  nvar_1234_Virginia_Jurisdictional_addendum.pdf
  nvar_k1245_Regional_contract.pdf
  and I want-
  nvar_1234.pdf -- with a 
  description of "Virginia_Jurisdictional_addendum"
  nvar_k1245.pdf -- 
  with a description of "Regional_contract"
  
  Thank you in advance-
  Matthew
  
  
  
  
  
  This message was scanned by 
  ATX1:56:46 PM ET - 
  3/10/2005
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: adding a title to a file on windows

2005-03-10 Thread Earthlink-m_ryan
Chris wrote:
The file comments are part of the file itself.  Are u talking about saving
off the long name somewhere for future reference?
I guess I didn't explain very well. I would like to access the windows file 
browser functionality in order to add a title or comment to the properties 
of a file for easy reference through the Windows Explorer window.
This is the dialog box one would access by right clicking on the file in 
Windows Explorer and the summary tab in the properties dialog box. Wether 
or not this a part of the file itself I can't say.
I just don't want to go through the files one buy one in the Windows 
Explorer window and change the name and add a description through properties 
dialog box.(There are a couple hundred files.)

Peter supplied this code:
use strict;
use File::Copy;

my $dir = '/somedir';
my %hash;

opendir(DIR,$dir) || die can't open $dir : $!\n;
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files)
{
my ($name,$ext) = split(/\./,$file);
my ($newname,$desc) = $name =~ /^(.*\d)_(.*)$/;
$hash{$name}=$desc;
move($file,$newname\.$ext);
}
open(LOG, $log) || outputerror;
foreach my $key (keys %hash)
{
print LOG $key -- with a description of $hash{$key}\n;
}
sub outputerror
{
print WARNING: Could not open log file for writing. THe following files 
were moved:\n\n;
foreach my $file (@files)
{
 print $file\n;
}
exit 1;
}
I wrote something close to this but only to capture and remove '$desc'. Now 
I need to add this to the files attributes as a Title or Comment.


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


Counting total elements in a reference

2005-03-10 Thread Ben Conrad
Folks,

I'm using Win32::TieRegistry to read a list of elements in a REG_MULTI_SZ
and I need help with the printing of the references returned when I use
$key-SplitMultis(1).

use Win32::TieRegistry ( Delimiter = / ); 
$RegKey = LMachine/System/CurrentControlSet/Services/Tcpip/Linkage/;
$key = $Registry-{$RegKey}; 
$key-SplitMultis(1);   #  returned as a reference to an array of strings
$ValueString = $key-GetValue('bind'); # this is my reference

  All this works and I figured out how to print individual references by:

print $ValueString-[0] \n $ValueString-[1];
 \Device\{531DA74F-9197-42AA-B8D8-BDA2E6F86908}
 \Device\NdisWanIp

The problem arises where I don't know how many strings will be in that
$ValueString MULTI_SZ, could be 2, could be 10.  Does anybody know how can
get the total number of elements in this reference?  I'm thinking something
similar to $num = scalar(@array).

Thanks,

Ben


Ben Conrad
Sr. Network Administrator
180 Old Colony Avenue
Quincy, MA  02170
Passkey International, Inc.
[T] 617.237.8225
[M] 617.852.6206
[F] 617.328.1461
http://www.passkey.com

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


Re: Counting total elements in a reference

2005-03-10 Thread Chris Wagner
I think @{$ValueString} is what u want.

At 04:22 PM 3/10/05 -0500, Ben Conrad wrote:
print $ValueString-[0] \n $ValueString-[1];
 \Device\{531DA74F-9197-42AA-B8D8-BDA2E6F86908}
 \Device\NdisWanIp





--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede males

0100

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


Re: adding a title to a file on windows

2005-03-10 Thread Kevin Carothers
Wow- I never knew those properties even existed...
It is possible there is some sort of a PIF file that's created when
you create comments under the summary tab?

KC

On Thu, 10 Mar 2005 15:26:29 -0500, Earthlink-m_ryan
[EMAIL PROTECTED] wrote:
 Chris wrote:
  The file comments are part of the file itself.  Are u talking about saving
  off the long name somewhere for future reference?
 
 I guess I didn't explain very well. I would like to access the windows file
 browser functionality in order to add a title or comment to the properties
 of a file for easy reference through the Windows Explorer window.
 This is the dialog box one would access by right clicking on the file in
 Windows Explorer and the summary tab in the properties dialog box. Wether
 or not this a part of the file itself I can't say.
 I just don't want to go through the files one buy one in the Windows
 Explorer window and change the name and add a description through properties
 dialog box.(There are a couple hundred files.)
 
 Peter supplied this code:
 
 use strict;
 use File::Copy;
 
 my $dir = '/somedir';
 my %hash;
 
 opendir(DIR,$dir) || die can't open $dir : $!\n;
 my @files = readdir(DIR);
 closedir(DIR);
 
 foreach my $file (@files)
 {
  my ($name,$ext) = split(/\./,$file);
  my ($newname,$desc) = $name =~ /^(.*\d)_(.*)$/;
  $hash{$name}=$desc;
  move($file,$newname\.$ext);
 }
 open(LOG, $log) || outputerror;
 
 foreach my $key (keys %hash)
 {
  print LOG $key -- with a description of $hash{$key}\n;
 }
 
 sub outputerror
 {
  print WARNING: Could not open log file for writing. THe following files
  were moved:\n\n;
  foreach my $file (@files)
  {
   print $file\n;
  }
  exit 1;
 }
 
 I wrote something close to this but only to capture and remove '$desc'. Now
 I need to add this to the files attributes as a Title or Comment.
 
 
 ___
 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


simple reg ex

2005-03-10 Thread lorid
I know this is perl not javascript, I thought I was good at deciphering reg ex
but the 2nd line in this function has got me puzzled.
Can anyone decipher:
 X = (!X ? 2 : X);

function round(number,X) {
 // rounds number to X decimal places, defaults to 2
 X = (!X ? 2 : X);
 return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
 }
thanks
lori
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: simple reg ex

2005-03-10 Thread Peter Guzis
This is not a regular expression, but rather what is know as the ternary 
operator.  It is a terse way of writing an if-else statement with variable 
assignment.  In this case, it is the equivalent of writing:

if (!X) {

  X = 2;

} else {

  X = X;

}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
lorid
Sent: Thursday, March 10, 2005 5:02 PM
To: perl-win32-users
Subject: simple reg ex


I know this is perl not javascript, I thought I was good at deciphering reg ex
but the 2nd line in this function has got me puzzled.
Can anyone decipher:
  X = (!X ? 2 : X);



function round(number,X) {
  // rounds number to X decimal places, defaults to 2
  X = (!X ? 2 : X);
  return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
  }

thanks
lori

___
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: simple reg ex

2005-03-10 Thread lorid
sorry , I sent question too soon, long day.
forgot about the conditional reg ex
(test_value ? if_true : if_false)
lori
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: simple reg ex

2005-03-10 Thread Charles K. Clarkson
lorid  wrote:

: sorry , I sent question too soon, long day.
: 
: 
: forgot about the conditional reg ex

It's not a regular expression. It's an operator.


: (test_value ? if_true : if_false)


Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328

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


Re: Strange behaviour reading accents

2005-03-10 Thread Sisyphus
Marcos Lorenzo de Santiago wrote:
On Thursday 10 March 2005 18:47, Marcos Lorenzo de Santiago wrote:
  ML   Si use Text::Iconv;
Where can I find this module for windows? In activestate.com sais it's
not available for windows because it's installation fails.
I tried ppm install Text::Iconv but said it could'nt be found...
Is there any other module that replaces this one?
Yep (probably) - Encode :-)
For perl 5.8:
ppm install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
For perl 5.6:
ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Text-Iconv.ppd
(Hope I got 'em round the right way :-)
Cheers,
Rob
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl tk binding question

2005-03-10 Thread assistent
i All!
In following snippet 
I have 2 parallel arrays @list and @data
and I want on selecting entry in listbox 
to see corresponding data array element in textbox
using UP and DOWN arrows is OK
but I have to make 2 mouse clicks to make right selection!
MY question - how to modify this scheme 
to made it work with only one mouse click ?
OR may be there other schemes ?
and here is the snippet:
==
use strict;
use Tk;
require Tk::LabFrame;
my $top = new MainWindow;
my $bar=$top-LabFrame(-label = 'buttons bar');
$bar-pack;
my $exi=$bar-Button(-command=\exi,-text='exit');
$exi-pack(-side='left');
my $fr=$top-LabFrame();
$fr-configure(-height='5',-width=30);
$fr-pack(-fill='none');
my $li=$fr-Scrolled(Listbox);
$li-configure(-height='20',-width=20);
$li-pack(-side='left',-expand='no',-fill='none');
my $text0=$fr-Text();
$text0-configure(-height='10',-width=20);
$text0-pack(-side='top',-fill='none');
$li-bind('1' =\li);
$li-bind('Down' =\li);
$li-bind('Up' =\li);
my @list=qw/one two three/;
my @data=qw/data_one... data_two... data_three.../; 
$li-delete(0,'end');
my %revers;
my $i=0;
foreach (@list){$li-insert(end,$_);$revers{$_}=$i++}
$li-focus;
MainLoop;
sub exi{
$top-destroy;
}

sub li{
my $sel=$li-get('active');
my $t=$data[$revers{$sel}];
$text0-delete('0.0','end');
$text0-insert ('0.0',$t) ;
}

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


Re: Counting total elements in a reference

2005-03-10 Thread $Bill Luebkert
Ben Conrad wrote:
 Folks,
 
 I'm using Win32::TieRegistry to read a list of elements in a REG_MULTI_SZ
 and I need help with the printing of the references returned when I use
 $key-SplitMultis(1).
 
 use Win32::TieRegistry ( Delimiter = / ); 
 $RegKey = LMachine/System/CurrentControlSet/Services/Tcpip/Linkage/;
 $key = $Registry-{$RegKey}; 
 $key-SplitMultis(1); #  returned as a reference to an array of strings
 $ValueString = $key-GetValue('bind'); # this is my reference
 
 
 All this works and I figured out how to print individual references by:
 
 
 print $ValueString-[0] \n $ValueString-[1];
 
\Device\{531DA74F-9197-42AA-B8D8-BDA2E6F86908}
\Device\NdisWanIp
 
 
 The problem arises where I don't know how many strings will be in that
 $ValueString MULTI_SZ, could be 2, could be 10.  Does anybody know how can
 get the total number of elements in this reference?  I'm thinking something
 similar to $num = scalar(@array).

This is what I use for the MULTI_SZ :

} elsif ($type == REG_MULTI_SZ) {

if ($split_multi) {
foreach (@$data) {
print '$_' (MSZ)\n;
}
} else {
# last pair of \000's doesn't generate a field with split
my @data = split /\x00/, $data;
print \$data length: , length $data,
   [EMAIL PROTECTED] fields: , scalar @data, \n if $debug;
for (my $ii = 0; $ii  @data; $ii++) {
print '$data[$ii]' (MSZ)\n;
}
}


-- 
  ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs