freeze-thaw - socket/file handle to ref then string
hello all, here is a ref/deref problem I need to take a socket handle, convert it to a socket ref, then a scaler string A bit later in the same script, I need to take that scaler string and turn it back to a socket ref, and deref it back to the socket handle. An example would be great, Thanks in advance for all your help. Regards, -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: references
hello again, > > hello all, > > > > here is a ref/deref problem > > > > I need to take a socket handle, convert it to a socket ref, then a scaler > > string > > > > A bit later in the same script, I need to take that scaler string and turn > it > > back to a socket ref, and deref it back to the socket handle. > > Maybe instead of asking for the way to implement your solution, you should > describe the complete problem and see if we can come up with an alternate > solution that is a little less convoluted. :) let me clarify my problem. I have a reference of a subroutine. eg. $sub = "test"; ..deref and execute &$sub; ... sub test { my ($sockethandle,$blah...) = @_; ..do something } in order to pass the paramenters, i decided to do this : sub main { my $sub = "test|$sockethandle"; ($sub,@_) = split(/\|/,$sub); $⊂ } if this is to work correctly, I need to take a socket handle, convert it to a socket ref, then a scaler, so i can pass it as a parameter. in order to use the socket later, i have to take the scaler, convert it to the socket ref, then dereference it. Is there an easier way to pass parameters with a subroutine reference? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
references situation
hello again, > > hello all, > > > > here is a ref/deref problem > > > > I need to take a socket handle, convert it to a socket ref, then a scaler > > string > > > > A bit later in the same script, I need to take that scaler string and turn > it > > back to a socket ref, and deref it back to the socket handle. > > Maybe instead of asking for the way to implement your solution, you should > describe the complete problem and see if we can come up with an alternate > solution that is a little less convoluted. :) let me clarify my problem. I have a reference of a subroutine. eg. $sub = "test"; ..deref and execute &$sub; ... sub test { my ($sockethandle,$blah...) = @_; ..do something } in order to pass the paramenters, i decided to do this : sub main { my $sub = "test|$sockethandle"; ($sub,@_) = split(/\|/,$sub); $⊂ } if this is to work correctly, I need to take a socket handle, convert it to a socket ref, then a scaler, so i can pass it as a parameter. in order to use the socket later, i have to take the scaler, convert it to the socket ref, then dereference it. Is there an easier way to pass parameters with a subroutine reference? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
references of sub and params in a threads::shared variable
how do i use this hash as a shared variable to be used in threads? eg. with threads::shared -Jeremy A > Why not make it a hash? > > my $sub = { ref => \&test, params => [$sockethandle] }; > $sub->{ref}->(@{$sub->{params}}); > > sub test { > my $socket = shift; > # ... > } > > > > hello again, > > > > > > hello all, > > > > > > > > here is a ref/deref problem > > > > > > > > I need to take a socket handle, convert it to a socket ref, then a > scaler > > > > string > > > > > > > > A bit later in the same script, I need to take that scaler string and > turn > > > it > > > > back to a socket ref, and deref it back to the socket handle. > > > > > > Maybe instead of asking for the way to implement your solution, you > should > > > describe the complete problem and see if we can come up with an > alternate > > > solution that is a little less convoluted. :) > > > > let me clarify my problem. > > > > I have a reference of a subroutine. > > > > eg. > > > > $sub = "test"; > > > > ..deref and execute > > > > &$sub; > > > > ... > > > > sub test { > > my ($sockethandle,$blah...) = @_; > > ..do something > > } > > > > > > in order to pass the paramenters, i decided to do this : > > > > sub main { > > > > my $sub = "test|$sockethandle"; > > ($sub,@_) = split(/\|/,$sub); > > > > $⊂ > > } > > > > > > if this is to work correctly, I need to take a socket handle, convert it > to a > > socket ref, then a scaler, so i can pass it as a parameter. in order to > use the > > socket later, i have to take the scaler, convert it to the socket ref, > then > > dereference it. > > > > Is there an easier way to pass parameters with a subroutine reference? > > > > > > > > > > > > > > ___ > > 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 > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: references - inject sub/params into longterm running thread
hi there basically...I have instantiated long term running thread/s. in the main thread, i want to pass a subroutine (code ref) and its parameters into a threads::shared variable, then execute it in a separate thread running in a while loop. I want to do this, because having a group of a couple instantiated long term running threads, before processing starts, would be less expensive, then instantiated many short term threads for each call...which would be expensive and affect performance due to the lag in thread creation. calls and subroutine's/parameters will vary, so injecting the code into a running thread is what i would like. I hope you all now can understand. Thanks in advance for your help. Regards, - Jeremy A. Quoting John Serink <[EMAIL PROTECTED]>: > Why don't you pass the parameters as references. > They work like pointers in C kindof. > > Why do you want to reference your subroutine? > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On > > Behalf Of [EMAIL PROTECTED] > > Sent: Tuesday, July 26, 2005 2:19 AM > > To: $Bill Luebkert > > Cc: perl-win32-users@listserv.ActiveState.com > > Subject: Re: references > > > > > > hello again, > > > > > > hello all, > > > > > > > > here is a ref/deref problem > > > > > > > > I need to take a socket handle, convert it to a socket > > ref, then a > > > > scaler > > > > string > > > > > > > > A bit later in the same script, I need to take that scaler string > > > > and turn > > > it > > > > back to a socket ref, and deref it back to the socket handle. > > > > > > Maybe instead of asking for the way to implement your solution, you > > > should describe the complete problem and see if we can come > > up with an > > > alternate solution that is a little less convoluted. :) > > > > let me clarify my problem. > > > > I have a reference of a subroutine. > > > > eg. > > > > $sub = "test"; > > > > ..deref and execute > > > > &$sub; > > > > ... > > > > sub test { > > my ($sockethandle,$blah...) = @_; > > ..do something > > } > > > > > > in order to pass the paramenters, i decided to do this : > > > > sub main { > > > > my $sub = "test|$sockethandle"; > > ($sub,@_) = split(/\|/,$sub); > > > > $⊂ > > } > > > > > > if this is to work correctly, I need to take a socket handle, > > convert it to a > > socket ref, then a scaler, so i can pass it as a parameter. > > in order to use the > > socket later, i have to take the scaler, convert it to the > > socket ref, then > > dereference it. > > > > Is there an easier way to pass parameters with a subroutine > > reference? > > > > > > > > > > > > > > ___ > > 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
[no subject]
hello all perl gurus, I have a regular expression problem how do i use scalar variables in substitution and complex matching? eg I want the following to work. $string =~ s/^$variable//; $string =~ m/^([^$variable]*)/; thanks in advance for your help. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Regular Expressions and variables
hello all perl gurus, I have a regular expression problem how do i use scalar variables in substitution and complex matching? eg I want the following to work. $string =~ s/^$variable//; $string =~ m/^([^$variable]*)/; thanks in advance for your help. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Extremely fast concat required
hello all I need a fast concat solution. the following works, but it is extremely slow and it stutters. I am not replicating values, each value that is concatonated is unique- the following is example does not illustrate this. about the stuttering...is this a buffering issue? it stutters (pauses) in, what looks like, random increments, though the first increment is 16 -- refer to $count. I am running xp with Activestate 5.8. my $count = 0; for(0..1125000) { $pmem::arr .= "#".$anewvalue; #$anewvalue is random; $count++; print $count,"\n"; } thanks in advance for all your help. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Extremely fast concat required
Randy, thanks for your response. I am trying this. opening a handle to memory, and using syswrite,.but *nothing* gets written. I have never done this before...this is supposed to work. Your help with this is appreciated, thanks in advance. I am running win32 xp with perl 5.8. -Jeremy A. open($fh, '>', \$pmem::arr) || die; for(0...1125000) { my $l = length("$var"); # $var = a random unique value syswrite ($fh,"$var",$l); $count++; print $count,"\n"; } close($fh); print $pmem::arr; Quoting "Randy J. Ray" <[EMAIL PROTECTED]>: > > I need a fast concat solution. the following works, but it is extremely > slow and > > it stutters. I am not replicating values, each value that is concatonated > is > > unique- the following is example does not illustrate this. > > The .= operator is one of Perl's slowest. It generally has to allocate a > completely new SV (internal data structure for scalars), copy over the > original > string, then append the new content. And you're appending *twice*, for each > iteration. At least express <<"#" . $anewvalue>> as "#$anewvalue". > > If memory is not an issue, the following would be significantly faster: > > my $count = 0; > @pmem::arr = (); > > for(0..1125000) > { > push(@pmem::arr, "#$anewvalue"); #$anewvalue is random; > $count++; > print $count,"\n"; > } > $pmem::arr = join('', @pmem::arr); > > I have no idea what would be causing the "stuttering", however. > > Randy > -- > """ > Randy J. Ray Westminster, COhttp://www.rjray.org > [EMAIL PROTECTED] > > Silicon Valley Scale Modelers: http://www.svsm.org > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl inline c and weird buggy-ness
hi there perl gurus. I am creating a module in inline c. I want to concat a very large string fast. I am getting weird crashes for each run. Also, it appears that my string is not being concatinated at all. I am using VC6.0, perl 5.8 on win32 xp. how can I get this to work. your help is appreciated. Thanks. -Jer A. - #!Perl package DSTRING; my $code = <<'END_C'; void concat( char *a, char *b, char *c) // got this function from a website { while( *a ) { /* while( *c++ = *a++ ); */ *c = *a; ++a; ++c; } while( *b ) { *c = *b; ++b; ++c; } *c = '\0'; } char* addString(char* DATA,char* dataToAdd) { concat(DATA, strdup(dataToAdd),DATA); return DATA; } END_C use Inline; Inline->bind(C => $code); 1; my $data = ""; my $count = 0; for(1...10) { print $count,"\n"; $data = DSTRING::addString($data,"testdata"); $count++; } print $data; print "END\n"; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl 5 and hyper operators for manipulating lists
hi all, I am new to hyper operatorsI have been studying them in a perl 6 book. Does using hyper operators,offer better performance, in manipulating lists, than using loops? Can I forget about loops altogether?how complex can I make a hyper statment? Can Hyper operators be implemented in perl 5?..and will this still offer better performance than loops? what other operators can I use to make my programs loopless, and offer better performance? I am not as concerned about readability of code, just doing things efficiently the perl way. Thanks in advance for your input. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl 5.8 threads and Thread::Pool
hi all, I want to create a pool of perl 5.8 threads, but Thread::Pool was built for the old Thread implementation, and it does not work! is there a module for perl 5.8 that creates thread pools? Thanks in advance for your help. -Jer A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
simple perl 5.8 thread pool creation was "perl 5.8 threads and Thread::Pool"
Hi all, Activestate only support v.0.1 of Thread-Pool, while the current module, 0.32 is not supported. The one provided in the activeperl repository (0.1) does not support perl 5.8 threads. How can I implement simple thread-pooling using perl 5.8 threads? I would need some way of injecting code into the loaded threads, have the ability to reuse threads, and keep track of thread slots available. A simple example would be great. I am not an expert when it comes to threads, just so you are aware. thanks, -Jer A previous message: Hi all, Activestate only support v.0.1 of Thread-Pool, while the current module, 0.32 is not supported. The one provided in the activeperl repository (0.1) does not support perl 5.8 threads. How can I implement simple thread-pooling using perl 5.8 threads? I would need some way of injecting code into the loaded threads, have the ability to reuse threads, and keep track of thread slots available. A simple example would be great. I am not an expert when it comes to threads, just so you are aware. thanks, -Jer A ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Webservice Call using Win32::OLE
for: "Call oServXMLHTTP.open("POST", decryptWebServiceURL, False)" try: "$DOM->open("POST",$decryptWebServiceUrl, 0); # 0 = false, 1 = true" hope I have been some help! cheers, -Jer A Quoting "Briggs, Larry" <[EMAIL PROTECTED]>: > Hi I am trying to convert the following VB script webservice call into perl > I am trying to use Win32::OLE. Can this be done and if it can how would I go > about doing this. I have provided the Perl code that I have tried to write > so far. Any help that you can provide to point me in the right direction. > > Const appUserID = "ServiceID" > Const password = "ServicePass" > Const appTokenName = "TokenName" > encryptedToken = Request.Cookies("Cookies") > ' set up data to post to web service > postData = "" > postData = postData & "userID=" & appUserID > postData = postData & "&password=" & password > postData = postData & "&encryptedToken=" & encryptedToken > > ' set URL to web service method > decryptWebServiceURL = > "https://Webserver/decryptTokenService/decryptToken.asmx/decryptToken"; > > ' create ServerXMLHTTP object > Set oServXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") > > ' initialize ServerXMLHTTP object > Call oServXMLHTTP.open("POST", decryptWebServiceURL, False) > > ' set ServerXMLHTTP header to post data > Call oServXMLHTTP.setRequestHeader("Content-Type", > "application/x-www-form-urlencoded") > > ' send request to web service > Call oServXMLHTTP.send(postData) > > ' retrieve results from web service > Set decryptToken = oServXMLHTTP.responseXML > > ' destroy ServerXMLHTTP object > Set oServXMLHTTP = Nothing > > Perlcode > #!perl -w > use strict; > use CGI qw/:standard/; > use CGI::Cookie; > use CGI::CARP qw(fatalsToBrowser); > use MIME::Base64; > $GopaxCookie = $Cookies{"GOPAX"}; > my $ServiceID = "ServiceID"; > my $PassWd = "ServicePass"; > use Win32::OLE qw(in with); > my $Postdata =""; >$Postdata = $Postdata."userID=". $ServiceID ; >$Postdata = $Postdata."password=". $PassWd ; >$Postdata = $Postdata."encryptedToken=". $GopaxCookie; > my $decryptWebServiceUrl = > "https://Webserver/decryptTokenService/decryptToken.asmx/decryptToken";; > > my $DOM = Win32::OLE->new('MSXML2.ServerXMLHTTP') or die "new() failed"; >$DOM->open("POST",$decryptWebServiceUrl, "FALSE"); > > $DOM->setRequestHeader("Content-Type","application/x-www-form-urlencoded"); >$DOM->send($Postdata); >my $Results = $DOM->responseXML; > > Thanks > Larry > ___ > 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
thread pool queue blocking! Was: simple perl 5.8 thread pool creation
hi all, I am trying to implement a thread pool using Thread::Queue. I created a pool of 10 threads. The problem is only one thread is being used, and all jobs are queud up in a line behind the first. Each job is a subroutine call. How can I create this to be multi-tasking? ..eg jobs being executed non-blocking as threads being used as available. Thanks in advance for any help. -Jer A. my code--- my $wthrsz : shared = 0; my $psize : shared = 10; my $thrQ : shared = new Thread::Queue; my @thr; sub createthrp { ($psize) = @_; my $nbr = 0; for(1..$psize) { $thr[$nbr] = threads->create("entrypoint"); $nbr++; } } sub entrypoint { for (;;) { $payload = $thrQ->dequeue_nb; Win32::Sleep(100) and next unless $payload; $wthrsz++; &$payload; $wthrsz--; } } while(1) { #... $thrQ->enqueue(codehere($param)); #... } Quoting "(Chris Wagner)" <[EMAIL PROTECTED]>: > Creating a thread pool isn't hard. Here's a rudimentary example that u > should be able to run with. > > $x = 1; > share $working; > $jobs = new Thread::Queue; > ${"t". ++$x} = thread->create("entrypoint") for (1..10); > > sub entrypoint { > for (;;) { > $commanddata = $jobs->dequeue_nb; > sleep 1 and next unless $commanddata; > $working++; > do_something($commanddata); > $working--; > } > } > > > Now u have a pool of threads, $t1 to $t10. $working tells u how many are > available. The message queue lets u send work that will be picked up by the > next available thread. > > At 06:15 PM 12/9/2006 -0800, [EMAIL PROTECTED] wrote: > >How can I implement simple thread-pooling using perl 5.8 threads? > >I would need some way of injecting code into the loaded threads, have the > >ability to reuse threads, and keep track of thread slots available. > > > >A simple example would be great. I am not an expert when it comes to > threads, > >just so you are aware. > > > > > -- > REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- > "...ne cede malis" > > 0100 > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32-API GetAsyncKeyState
hi all, I need to be able to log keys typed. I cannot use Win32::GuiTest module, because the 'IsKeyPressed' function does not work with perl 5.8. Using the win32 api seems to be a good option. how do i get key strokes using perl and the win32 api? eg. "how do i use GetAsyncKeyState in perl?" Thanks in advance for any help. -Jeremy A. the following is off MSDN. -- Syntax SHORT GetAsyncKeyState( int vKey ); Parameters vKey [in] Specifies one of 256 possible virtual-key codes. For more information, see Virtual-Key Codes. Windows NT/2000/XP: You can use left- and right-distinguishing constants to specify certain keys. See the Remarks section for further information. Return Value If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. However, you should not rely on this last behavior; for more information, see the Remarks. Windows NT/2000/XP: The return value is zero for the following cases: * The current desktop is not the active desktop * The foreground thread belongs to another process and the desktop does not allow the hook or the journal record. Windows 95/98/Me: The return value is the global asynchronous key state for each virtual key. The system does not check which thread has the keyboard focus. Windows 95/98/Me: Windows 95 does not support the left- and right- distinguishing constants. If you call GetAsyncKeyState with these constants, the return value is zero. Remarks The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example, the call GetAsyncKeyState (VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button. You can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling GetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons have been swapped. Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon. You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. Windows NT/2000/XP: You can use the following virtual-key code constants as values for vKey to distinguish between the left and right instances of those keys. CodeMeaning VK_LSHIFTLeft-shift key. VK_RSHIFTRight-shift key. VK_LCONTROLLeft-control key. VK_RCONTROLRight-control key. VK_LMENULeft-menu key. VK_RMENURight-menu key. These left- and right-distinguishing constants are only available when you call the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions. Function Information Minimum DLL Versionuser32.dll HeaderDeclared in Winuser.h, include Windows.h Import libraryUser32.lib Minimum operating systemsWindows 95, Windows NT 3.1 See Also Keyboard Input, GetKeyboardState, GetKeyState, GetSystemMetrics, MapVirtualKey, SetKeyboardState ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32 process auto-restart on error/crash or kill
Hi all, how do i automatically get a script to restart itself on error/crash or kill? I tried $SIG{INT}, but that only works with Ctrl-C, in a console. Lets say i were to kill the process using the Task Manager ("end process"). How do I get the script to automatically restart? Thanks in advance for all your help. Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Blocking ports
Hi all, I have a network problem. how do i block a port(s) programmically in perl, making the port unusable by other software, requiring that port, while the perl script is running. my platform is windows, so the solution must be windows compatible. Thanks in advance for any help. -Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
source port blocking......(a simplistic firewall)
hello all how do i prevent a program's source port from connecting to the internet. eg. suppose, i want to prevent Internet Explorer from connecting to the internet,it would not be port 80, as this is the destination port...am I correct? I suppose, this port blocking would be a simplistic firewall. how do I do this programmically in perl. Thanks in advance for any help. -Jeremy A. >> Hi all, >> >> I have a network problem. >> >> how do i block a port(s) programmically in perl, making the port unusable by >> other software, requiring that port, while the perl script is running. >> >> my platform is windows, so the solution must be windows compatible. >I would think opening a listening socket on that port should handle it. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
program probe
hello there, Sorry for the dumb questions. Is there any way to probe a program to find if and what (socket) ports it uses, in perl? It should be compatible with windows xp service pack 2 (which includes the windows firewall). Thanks in advance for all help. -Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
get a list of installed programs and path to exe.
Hi there, in windows xp/2000 how do i get a list of all installed programs and paths to exe? Thanks in advance. -Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: get a list of installed programs and path to exe.
hi all. here is a start. I want to get values for programs installed. eg. "DisplayName","DisplayVersion" etc. thanks in advance for any help. -Jeremy A. - #!perl use Win32::TieRegistry( Delimiter=>"#", ArrayValues=>0 ); $pound= $Registry->Delimiter("/"); $appKey= $Registry->{"LMachine/SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/"}; foreach $entry ( keys(%$appKey) ) { if($entry =~ m/\{/ig) { last; } if($entry !~ m/KB\d+|IE\d+|IE\w+/ig) { print $entry."\n"; } } - Quoting John Serink <[EMAIL PROTECTED]>: > Go to the registry and peel it out of there. > Win32::TieRegistry is what you're after. > > Have fun, > John > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On > > Behalf Of [EMAIL PROTECTED] > > Sent: Friday, December 10, 2004 9:32 AM > > To: Perl-Win32 > > Cc: [EMAIL PROTECTED] > > Subject: get a list of installed programs and path to exe. > > > > > > Hi there, > > > > in windows xp/2000 how do i get a list of all installed > > programs and paths to exe? > > > > Thanks in advance. > > > > -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 > > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
get a (array)list of icons from registry
Hi all, Is there any way of getting all icons of installed programs from the registry? If so, how do i display them in a tk app? is there support for *.ico in tk? Thanks in advance for any help. -Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ExtractIcon, then write it to file
hello all, how do i extract an icon from an exe file, then write it to a file. here is my code. It does not work. - use Win32::API; my $ExtractIcon = new Win32::API("shell32.dll","ExtractIcon",[N,P,N],'N'); my $icon = $ExtractIcon->Call($$,"C:\\Program Files\\Shareaza\\Shareaza.exe",0); open(ICO,">share.ico"); binmode(ICO); print ICO <$icon>; close(ICO); - Thanks in advance for any help. -Jeremy A. below is the win32 api info for ExtractIcon - The ExtractIcon function retrieves a handle to an icon from the specified executable file, dynamic-link library (DLL), or icon file. To retrieve an array of handles to large or small icons, use the ExtractIconEx function. Syntax HICON ExtractIcon( HINSTANCE hInst, LPCTSTR lpszExeFileName, UINT nIconIndex ); Parameters hInst [in] Handle to the instance of the application calling the function. lpszExeFileName [in] Pointer to a null-terminated string specifying the name of an executable file, DLL, or icon file. nIconIndex [in] Specifies the zero-based index of the icon to retrieve. For example, if this value is 0, the function returns a handle to the first icon in the specified file. If this value is 1, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1. Windows 95/98/Me, Windows NT 4.0 and later: If this value is a negative number not equal to -1, the function returns a handle to the icon in the specified file whose resource identifier is equal to the absolute value of nIconIndex. For example, use 3 to extract the icon whose resource identifier is 3. To extract the icon whose resource identifier is 1, use the ExtractIconEx function. Return Value The return value is a handle to an icon. If the file specified was not an executable file, DLL, or icon file, the return is 1. If no icons were found in the file, the return value is NULL. Remarks You must destroy the icon handle returned by ExtractIcon by calling the DestroyIcon function. Windows 95/98/Me: ExtractIconW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems. Function Information Minimum DLL Version shell32.dll Header Declared in Shellapi.h Import library Shell32.lib Minimum operating systems Windows 95, Windows NT 3.1 Unicode Implemented as ANSI and Unicode versions. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
port number <---> process id, for nt,2000(pro)
hi all, how do i retrieve a port number a process uses from a pid or vice versa. This can be done in xp eg. $ret = Win32::IPHelper::AllocateAndGetTcpExTableFromStack([EMAIL PROTECTED],$bOrder); the above does not work in NT,2000 (pro). This is driving me crazyI cant find an api so i can get it working for all windows (eg. nt,2000). If Zone Alarm can do this, why can't I? is there a wmi way? is there an win32 api way? Thanks in advance for any help. Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
monitoring win32 process (program) memory usage
Hi all, Does anyone know how to monitor memory usage in perl, that is cheap on cpu and works on all windows versions (eg. win95 and newer) Basically i have this background perl process, that continues to eat up memory. my plan for managing it would be if currentmemoryusage > myspecifiedlimit, then kill process and re-instantiate it. My problem is, how do i get the memory usage (total size) given the process id (eg $$). Thanks in advance for your time and help. - Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl/java encrypted socket client/server
hello all, I have a perl server/java client problem I need to create a perl socket server, and a java applet socket client. I know how to do sockets, and encryption on client/server perl is easy.all i do is encrypt the string on the before i print to sockets on one end, and decrypt the string off the socket on the recieving side. my problem is with java, and making it work with perl. the java side is confusing, and i wonder if anyone has any experience with encryption on both ends and make the perl socket stream readable by the java applet and vice versa. does anyone have any examples in eg. a java socket client with encryption, and a perl socket server with encryption, and it's interactions that work well together? Thanks in advance for all help. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Perlapp CGI's on IIS 5.1, XP Pro
Hello there I recently compiled a script that I use on IIS. the script works, but as a binary it does not. the binary is compiled with the exe flag set to "cgi", there for the executable name is eg. "myexe.cgi" when i enter the url, nothing happens, though there is no IIS web page error message. I am using IIS on XP Pro how can i get it working? are there any tricks? any instructions? Thanks in advance for all your help. -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perlctrl tk activex
hi all, what win32-api calls can i make in order to create a client-side activex gui control that can be embedded in an application or internet explorer, using perlctrl. I realize this cannot be done *just using* perlctrl code. What perl win32::api calls can be made to make it work, and in what order? Has anyone hacked this problem before? example code would be great! Thanks in advance, -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
gui activex control
hi all, what win32-api calls can i make in order to create a client-side activex gui control that can be embedded in an application or internet explorer, using perlctrl. I realize this cannot be done *just using* perlctrl code. What perl win32::api calls can be made to make it work, and in what order? Has anyone hacked this problem before? example code would be great! Thanks in advance, -Jeremy A. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs