Re: Getting Clientside PerlScript to work
I have it installed on my machine in C:\perl\bin. I registered it and tried "cscript //E:PerlScript c:\GetDrive.pl", which gets drive info on my machine, and it worked fine. To register the file, goto Start->Run-> Type in regsvr32.exe c:\perl\bin\perlse.dll. (or whereever you have perl installed) If that doesn't work (because it can't find regsvr32.exe), then you will need to type in the full path to regsvr32.exe (c:\windows\system32 maybe on your machine). Thank you, -William - Original Message - From: Donald To: [EMAIL PROTECTED] Sent: Friday, April 05, 2002 11:07 PM Subject: Getting Clientside PerlScript to work I've installed ActivePerl under W95 and Chosen to include all options given. The documentation says that PerlScript should be installed and setup to work but not even the "PerlScript Examples" in the documentation work. Perl works fine from DOS and *.PL files run OK in windows but "cscript //E:PerlScript filename.pl" reports that it can't find the scripting engine and IE5.5 just seems to ignore any scripts with "language=PerlScript" Can anyone help me register PERLSE.DLL so IE and WSH will work with it? thanks Donald mailto:[EMAIL PROTECTED]
Getting Clientside PerlScript to work
I've installed ActivePerl under W95 and Chosen to include all options given. The documentation says that PerlScript should be installed and setup to work but not even the "PerlScript Examples" in the documentation work. Perl works fine from DOS and *.PL files run OK in windows but "cscript //E:PerlScript filename.pl" reports that it can't find the scripting engine and IE5.5 just seems to ignore any scripts with "language=PerlScript" Can anyone help me register PERLSE.DLL so IE and WSH will work with it? thanks Donald mailto:[EMAIL PROTECTED]
Re: Tk and Drag-n-Drop
- Original Message - From: "Adam Frielink" <[EMAIL PROTECTED]> To: "Perl-Win32-Users (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, April 03, 2002 3:33 PM Subject: Tk and Drag-n-Drop > Is it possible to drag and drop a file reference into a Tk app A quick search on Google and a bit of editing provided me with this example from Slaven Rezic, it even accepts multiple filenames. # use Tk; use Tk::DropSite qw(Win32); $mw=tkinit; $mw->Label(-text => "The drop area:")->pack; $drop_widget = $mw->Scrolled('Listbox', -scrollbars => "osoe", )->pack; $drop_widget->DropSite(-dropcommand => [\&accept_drop, $drop_widget], -droptypes => 'Win32'); MainLoop; sub accept_drop { my($c, $seln) = @_; my $filename; my $own = $c->SelectionExists('-selection'=>$seln); my @targ = $c->SelectionGet('-selection'=>$seln,'TARGETS'); foreach (@targ) { if (/FILE_NAME/) { $filename = $c->SelectionGet('-selection'=>$seln,'FILE_NAME'); $drop_widget->insert('end',$filename); last; } if ($^O eq 'MSWin32' && /STRING/) { $filename = $c->SelectionGet('-selection'=>$seln,$_); $drop_widget->insert('end',$filename); last; } } } ## --- Jack ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Reading and writing files in Unicode
Can PERL read and write UNICODE files? -- Daniel Peterson LBNL - Berkeley Lab Energy Sciences Network - ESnet E-Mail:[EMAIL PROTECTED] Voice:(510) 486-7275 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How Perl Helped Find My Missing Gigabyte
For those who have the GNU Unix 'find' command (I use Cygwin), you can just do this: find YourDirList -type f -size +100c -printf '%s %p\n' | sort -n This will find any files 1,000,000 bytes or larger and list them with their sizes in numerically ascending order. Lots of power in GNU Unix commands, especially when combined. -- Mike Arms -Original Message- From: Warner, William A [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 12:51 PM To: Perl-Win32-Users Subject: RE: How Perl Helped Find My Missing Gigabyte Jim, I like your code. FYI, you can do the same thing with Windows Explorer. Select Tools, Find, Files or Folders..., Advanced. It has a selection box that lets you select "at least" and an entry box for the file size. Quite a gotcha you documented. My PC has gotten slower and slower too. I still haven't figured out why. I'm not low on disk space. The disk has been defragmented. I don't have a virus on it. I'm thinking that maybe my registry has grown too big. I guess I'll have to reinstall the OS sometime. Any ideas? Bill Warner -Original Message- From: James E Keenan [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 5:15 PM To: Perl-Win32-Users Subject: How Perl Helped Find My Missing Gigabyte I share the following account of a problem I recently experienced using Perl and Textpad on a Windows 98 box. It may help other Perl-Win32-Users avoid headaches. In January I installed RedHat Linux 7.2 as a dual boot on my Windows98 box. Prior to the partitioning my C: drive had 6.4G. Recognizing that Windows is a memory hog, when I partitioned I allocated approx 3.3G to Windows and 3.1G to Linux. I know that before partitioning I had used slightly less than 2G. Hence, I expected that after partitioning a check on disk usage would show that my Windows partition (hda1 as viewed from Linux) would appear to be slightly less than two-thirds full. And so it was. In late March, however, when I would go to check available disk space on the Windows drive, I would find that I only had 175M free space left; my Windows drive appeared to be >95% full! Other than a "Microsoft Critical Update" and 5-6 CPAN modules, I hadn't installed any new software on the Windows side in the previous 2 months. What could explain the sudden disappearance of approximately 1 gigabyte of free space? I was very afraid I had contracted a virus, especially since I got a Windows alarm box indicating I had been infected when I opened a news message on comp.lang.perl.misc on March 30 or 31. I updated my virus definitions and ran every Norton/Symantec program I had -- but found no indication of any viral infection or damage therefrom. I began uninstalling software I had not recently used, including my entire Java for Windows installation. But all this, not surprisingly, freed up only 250-300M on my C: drive; it was still more than 90% full. Everything on the Windows side was slowing down. At an Easter dinner, of all places, a fellow guest overheard me talking first about my computer problem and then about my love for Perl. He said, "Yes, it's always a problem doing this in Windows, because you have to click on each directory icon in Explorer to find out its size. But if you know Perl, you should be able to write something which identifies the largest files on your system." I was embarrassed that I hadn't thought of this, but once the challenge had been laid down, I had to pick it up. After several nights of sweat, I developed the script below. I first tested it out on smaller directories on my Linux partition, then mounted Windows on my Linux file system and called the script as a background process. Since I have over 100,000 files on the Windows side, the script took somewhere between 5 and 10 minutes to run. But when it did it clearly identified 2 files, each created within the last 3 months, as being massively larger than anything else on the partition (including the windows swap file). Their name and sizes were: txp42f6.tmp930,473kb txp12f5.tmp 86,742kb Note that they total slightly over 1 gig. I said, "Aha!" I examined these files with both vi from the Linux side and DOS Edit from the Windows side. They were filled with the following strings repeated endlessly: Use of uninitialized value in modulus (%) at insertfeed.pl line 8. Use of uninitialized value in pattern match (m//) at dmhis1.pl line 28. A massive file filled with Perl error messages? I suddenly grasped what had gone wrong. When I write Perl on Windows I use Textpad, which, in general, I really love, particularly the fact that you can run Perl scripts from inside Textpad. But when you get a runaway script (say, an infinite loop), using Textpad's "Stop" command sometimes doesn't really stop the process. (This seems to happen more when I try to run a Perl script that requires command-line arguments from inside Textpad; I haven't devoted the time to finding out why.) Sometimes the process keeps
Question re: Perl and CGI script
I have a perl script that runs fine when I run it standalone. It basically reads a file from a network drive and writes output to a network drive. When I call this from a the web page it fails. (Error sometimes points to access permissions) A few facts: the apache web server is running local on this machine the script is in cgi-bin the html document that calls the perl script is in htdocs the apache service is running under the system account (assumably with privileges) kicker: if this runs with the input and output to/from the local C:\ drive there is no problem running from the html document Can this failure be a result of the service not understanding the drive mappings? Thanks Andrew ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: outlook automation problem
On Fri, 5 Apr 2002, Joseph P. Discenza wrote: > [EMAIL PROTECTED] wrote, on Wednesday, April 03, 2002 12:42 PM > : One one particular system, the following code does not work, even > : though Outlook is installed and working correcly: > : > : eval {$ol= Win32::OLE->GetActiveObject('Outlook.Application')}; > : unless (defined $ol) { > : $ol= Win32::OLE->new('Outlook.Application'); > : } > : > : if (defined $ol) > : { > : $olConsts = Win32::OLE::Const->Load ('Microsoft Outlook*'); > : } > : > : The Const->Load doesn't produce any errors, but the script fails when > : it relies on one of the constants. I've got round the problem by using > : the integers instead of the hash, but it's not very nice. What might be > : the reason why this is not working? I'm not sure where to look for the > : type library, or what to look for in the registry... > > I haven't seen a response to this yet, so here goes. Have you looked > in the doc for Win32::OLE::Const? Trying "perldoc Win32::OLE::Const" > produces a page of doc that includes this info: > > The load method also accepts an OLE object as a parameter. In this > case the OLE object is queried about its containing type library and > no registry search is done at all. Interestingly this seems to be > slower. > > EXAMPLES > use Win32::OLE; > use Win32::OLE::Const; > my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); > my $xl = Win32::OLE::Const->Load($Excel); > > So it looks like all you need to do is > > $olConsts = Win32::OLE::Const->Load ($ol); > > to get your hash. > Of course, it rarely hurts to check for errors. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Making a Hash from a subset of values in an Array
On Fri, 5 Apr 2002 [EMAIL PROTECTED] wrote: > Here is one way to do it, although it does use a while loop. > > $ans = qx {'some function'}; > $myhash{$1} = $2 while $ans =~ /(\w+)\s+CHAR\s+(\d+)/g; > Your code uses a "loop", i.e. a while loop. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Making a Hash from a subset of values in an Array
On Fri, 5 Apr 2002, Rousseau, Paul wrote: > Hello, > >I have an array of results from a system call that I want to parse > through to create a hash. > > @ans = qx {'some function'}; > > Here is the array contents, stored in a variable @ans. There are 12 array > entries. > > @ans = > Session already open > > > Table XREF is: > XREFNAMECHAR 32 XREFDIMEN CHAR 16 > > XREFDOMAIN CHAR 8 XREFTASKCHAR 8 > > XREFCTNAME CHAR 16 XREFTBLNAM CHAR 16 > > XREFRECID CHAR 16 XREFCOLUMN CHAR 16 > > XREFSUBRID CHAR 16 > > Indices: > XREF: XREFNAME,XREFCTNAME,XREFDIMEN,XREFTBLNAM,XREFRECID > > > I want to create a hash, %myhash, based on the word before the text, CHAR, > and the number after. For example, from the text, "XREFNAMECHAR 32", > I want to add to %myhash, XREFNAME and 32. Note that a given @ans array > element may contain zero or two instances of the text, "CHAR". > > Something like > > $myhash{"XREFNAME"} = 32; > $myhash{"XREFDIMEN"} = 16; > > I am looking for a way to do this without having to loop through the @ans > array, looking at each element for the text, "CHAR", then populating the > hash. I am looking for perhaps, some kind of global regex to apply to the > @ans array like > > /(\w+)\s+CHAR\s+(\d+)/g > > Another regex I tried on a known array element, $ans[6], is /CHAR/s ; then I > used system variables $` and $' to get the before and after strings. For > example, > > $ans[6] =~ /CHAR/s; > $myhash{$`} = $'; > > Would the map or grep function be the way to go? Any help would be > appreciated. > You seem open to the idea of using map or grep but you also said you didn't want to loop through the array. Both map and grep "loop" through the array, processing each array element. An alternative is to put the array in double quotes and apply your regex to the resulting scalar value. One approach could be: ($_="@ans")=~s/(\w+)\s+CHAR\s+(\d+)/&build_hash($1,$2)/ge; I'll leave writing the &build_hash sub and what it returns as an exercise. Of course you could have also just received a scalar from the qx and avoided using an array at all, e.g. $_ = qx {'some function'}; [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: MQSeries module and remote queue managers
>> "patrick" == patrick mannion <[EMAIL PROTECTED]> writes: >patrick> The returned error is $compcode 2, $reason 2058 (Queue >patrick> manager name not valid or not known.). I checked name >patrick> resolution (that's fine), and I'm a member of the remote mqm >patrick> group so it's not a security issue. I also get this with all >patrick> hosts and remote qm's I attempt to connect to. I'm at a >patrick> loss... and I spent the weekend digging thru the pod, the MQI >patrick> Application Programming Reference (IBM Redbook), and >patrick> Google. Does anyone have any ideas, thoughts, or experience >patrick> here? > >- Are there any messages in the AMQERR0x.LOG files on the remote queue > manager? > >- Is the Svrconn channel defined, and is the server listening on port > 1415? > >- Can you connect remotely using the IBM-supplied utilities? > >- I don't use MQCONNX directly, so try the following: > > use MQSeries; > use MQSeries::QueueManager; > > $ENV{"MQSERVER"} = "SYSTEM.ADMIN.SVRCONN/TCP/mqhub(1415)"; > my $qmgr_name = 'MQHUB.TESTQM'; > my $qmgr = MQSeries::QueueManager::->new('QueueManager' => $qmgr_name) || >die "Could not connect"; > >--67445C09FE9C948D94567212-- There's no messages in the log, and in fact from a network trace i do not see any outbound traffic... the SVRCONN is defined, and the qm's are accessible from the mmc. The IBM-supplied utilities work as well. I tried your sample code, with the one change of use MQClient::MQSeries; rather than use MQSeries; and I still get the same error. Any other ideas, or am I just up a creek here? Thanks again... ** The information contained herein is confidential and is intended solely for the addressee(s). It shall not be construed as a recommendation to buy or sell any security. Any unauthorized access, use, reproduction, disclosure or dissemination is prohibited. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall assume any legal liability or responsibility for any incorrect, misleading or altered information contained herein. ** ** The information contained herein is confidential and is intended solely for the addressee(s). It shall not be construed as a recommendation to buy or sell any security. Any unauthorized access, use, reproduction, disclosure or dissemination is prohibited. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall assume any legal liability or responsibility for any incorrect, misleading or altered information contained herein. ** ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE:Write to a file issue
Here's something close: while ($line = < { next if $line=~/^\s*$/; #you can take this out if you want extra blank lines print NEW $line; print "\n\ttest/n" if $line=~ /^vendor-class "PXEClient" {/; } [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer On Fri, 5 Apr 2002, Jorge Goncalvez wrote: > > Hi, I have this: > I write to a file like this: > . > while ($line = < { > >if ($line=~ /^vendor-class "PXEClient" {/ ) >{ > print NEW ("test") or die "je ne peux écrire dans > $nouveau : $!"; >} > > . > > but my file it is like this: > . > # PXE Class > vendor-class "PXEClient" { > > > default-lease-time 1800; > max-lease-time 1800; > option dhcp-class-identifier "PXEServer"; > > } > > and after it is like this: > testvendor-class "PXEClient" { > > > default-lease-time 1800; > max-lease-time 1800; > option dhcp-class-identifier "PXEServer"; > } > > and i wanted > > vendor-class "PXEClient" { > > test > default-lease-time 1800; > max-lease-time 1800; > option dhcp-class-identifier "PXEServer"; > } > > how can i do this ? > Thanks. > > > ___ > 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
Santtu Kyrohonka ei ole paikalla.
Olen poissa toimistosta alkaen 05.04.2002 ja palaan vasta 08.04.2002. Työmatkalla perjantaina 5.4. ja paikalla taas maanantaina Santtu Kyröhonka ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How Perl Helped Find My Missing Gigabyte
Jim, I like your code. FYI, you can do the same thing with Windows Explorer. Select Tools, Find, Files or Folders..., Advanced. It has a selection box that lets you select "at least" and an entry box for the file size. Quite a gotcha you documented. My PC has gotten slower and slower too. I still haven't figured out why. I'm not low on disk space. The disk has been defragmented. I don't have a virus on it. I'm thinking that maybe my registry has grown too big. I guess I'll have to reinstall the OS sometime. Any ideas? Bill Warner -Original Message- From: James E Keenan [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 5:15 PM To: Perl-Win32-Users Subject: How Perl Helped Find My Missing Gigabyte I share the following account of a problem I recently experienced using Perl and Textpad on a Windows 98 box. It may help other Perl-Win32-Users avoid headaches. In January I installed RedHat Linux 7.2 as a dual boot on my Windows98 box. Prior to the partitioning my C: drive had 6.4G. Recognizing that Windows is a memory hog, when I partitioned I allocated approx 3.3G to Windows and 3.1G to Linux. I know that before partitioning I had used slightly less than 2G. Hence, I expected that after partitioning a check on disk usage would show that my Windows partition (hda1 as viewed from Linux) would appear to be slightly less than two-thirds full. And so it was. In late March, however, when I would go to check available disk space on the Windows drive, I would find that I only had 175M free space left; my Windows drive appeared to be >95% full! Other than a "Microsoft Critical Update" and 5-6 CPAN modules, I hadn't installed any new software on the Windows side in the previous 2 months. What could explain the sudden disappearance of approximately 1 gigabyte of free space? I was very afraid I had contracted a virus, especially since I got a Windows alarm box indicating I had been infected when I opened a news message on comp.lang.perl.misc on March 30 or 31. I updated my virus definitions and ran every Norton/Symantec program I had -- but found no indication of any viral infection or damage therefrom. I began uninstalling software I had not recently used, including my entire Java for Windows installation. But all this, not surprisingly, freed up only 250-300M on my C: drive; it was still more than 90% full. Everything on the Windows side was slowing down. At an Easter dinner, of all places, a fellow guest overheard me talking first about my computer problem and then about my love for Perl. He said, "Yes, it's always a problem doing this in Windows, because you have to click on each directory icon in Explorer to find out its size. But if you know Perl, you should be able to write something which identifies the largest files on your system." I was embarrassed that I hadn't thought of this, but once the challenge had been laid down, I had to pick it up. After several nights of sweat, I developed the script below. I first tested it out on smaller directories on my Linux partition, then mounted Windows on my Linux file system and called the script as a background process. Since I have over 100,000 files on the Windows side, the script took somewhere between 5 and 10 minutes to run. But when it did it clearly identified 2 files, each created within the last 3 months, as being massively larger than anything else on the partition (including the windows swap file). Their name and sizes were: txp42f6.tmp930,473kb txp12f5.tmp 86,742kb Note that they total slightly over 1 gig. I said, "Aha!" I examined these files with both vi from the Linux side and DOS Edit from the Windows side. They were filled with the following strings repeated endlessly: Use of uninitialized value in modulus (%) at insertfeed.pl line 8. Use of uninitialized value in pattern match (m//) at dmhis1.pl line 28. A massive file filled with Perl error messages? I suddenly grasped what had gone wrong. When I write Perl on Windows I use Textpad, which, in general, I really love, particularly the fact that you can run Perl scripts from inside Textpad. But when you get a runaway script (say, an infinite loop), using Textpad's "Stop" command sometimes doesn't really stop the process. (This seems to happen more when I try to run a Perl script that requires command-line arguments from inside Textpad; I haven't devoted the time to finding out why.) Sometimes the process keeps going ... and going ... and you don't find out about it until you go to shutdown Windows, at which point you get a Windows alarm box and you are asked if you want to shutdown the ongoing program known as "Perl." I guess that in some cases a Textpad .tmp file is created (in C:\Windows\temp) and, if the process is not caught quickly enough, it can grow to fill one's hard disk. Once I deleted the two txp*.tmp files listed above, my free space on the Windows side returned to over 1G. (Big sigh of relief!) Here's the program I wrote to fi
RE: Write to a file issue
Based on the program that you sent, and what I understand of what you're asking, you need to read in the entire file, parse it, internally represent it, and then write it back out... HTH, Ricky > -Original Message- > From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]] > Sent: Friday 05 April 2002 11:08 AM > To: Morse, Richard E. > Subject: RE: Write to a file issue > > > I tried but it didn't work > In fact I wanted to write only one time for exemple "test" > but with my code it > adds "test" always i run my program. > Thanks if you could help me. > I would be very grateful. > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: outlook automation problem
[EMAIL PROTECTED] wrote, on Wednesday, April 03, 2002 12:42 PM : One one particular system, the following code does not work, even : though Outlook is installed and working correcly: : : eval {$ol= Win32::OLE->GetActiveObject('Outlook.Application')}; : unless (defined $ol) { : $ol= Win32::OLE->new('Outlook.Application'); : } : : if (defined $ol) : { : $olConsts = Win32::OLE::Const->Load ('Microsoft Outlook*'); : } : : The Const->Load doesn't produce any errors, but the script fails when : it relies on one of the constants. I've got round the problem by using : the integers instead of the hash, but it's not very nice. What might be : the reason why this is not working? I'm not sure where to look for the : type library, or what to look for in the registry... I haven't seen a response to this yet, so here goes. Have you looked in the doc for Win32::OLE::Const? Trying "perldoc Win32::OLE::Const" produces a page of doc that includes this info: The load method also accepts an OLE object as a parameter. In this case the OLE object is queried about its containing type library and no registry search is done at all. Interestingly this seems to be slower. EXAMPLES use Win32::OLE; use Win32::OLE::Const; my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); my $xl = Win32::OLE::Const->Load($Excel); So it looks like all you need to do is $olConsts = Win32::OLE::Const->Load ($ol); to get your hash. Good luck, Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 574.243.6040 ext. 300fax: 574.243.6060 Providing Financial Solutions and Compliance for over 30 Years * Please note that our Area Code has changed to 574! * ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs