Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Using PAR: risk assessment

by DaWolf (Curate)
on Dec 10, 2004 at 06:45 UTC ( #413772=note: print w/replies, xml ) Need Help??

in reply to Using PAR: risk assessment

Actually I'm having a problem trying to PAR a script I did that shows the proccesses running on Windows and the softwares responsible for them.

I'm not sure if I should be asking this here, but since it's directly related to this post I'll take my chances.

My script uses:
  • Win32::Process::Info
  • Tk
  • Tk::HList
  • Tk::ItemStyle

All this modules were installed via ActiveState's ppm.

When I try to run the .exe created by PAR I get the following Windows error message (please note that I'm translating the message since my natural language and OS language is brazilian portuguese):

"par.exe - Entry point not found. It wasn't possible to locate the Perl_Gsv_placeholder_ptr procedure's entry point in the dynamic library link perl58.dll."

and when I click "Ok" I see this on the command prompt:

Can't locate object method "_Typelibs" via package "Win32::OLE::Const" at C:/Perl/site/lib/Win32/OLE/ line 20. Compilation failed in require at C:/Perl/site/lib/Win32/Process/Info/ line 162. BEGIN failed--compilation aborted at C:/Perl/site/lib/Win32/Process/Info/ line 162. Compilation failed in require at C:/Perl/site/lib/Win32/Process/ line 190. at script/ line 44

If I just run the script with Perl it runs fine.

Here's the code:
#!/usr/bin/perl -w use strict; use Win32::Process::Info; use Tk; use Tk::HList; use Tk::ItemStyle; my $mw = MainWindow->new( -width => 350, -title => 'Processes Monitor', -height => 50 ); my $hlist = $mw->Scrolled( "HList", -header => 1, -columns => 3, -scrollbars => 'osoe', -width => 70, -selectbackground => 'White', )->pack( -expand => 1, -fill => 'both' ); my $hStyle = $hlist->ItemStyle( "text", -foreground => "black", -font => "Verdana 8" ); my $rStyle = $hlist->ItemStyle( "text", -foreground => "blue", -background => "white", -font => "Verdana 8" ); $hlist->header('create', 0, -text => 'ID', -style => $hStyle); $hlist->header('create', 1, -text => 'Nome', -style => $hStyle); $hlist->header('create', 2, -text => 'Executável', -style => $hStyle); my $pi = Win32::Process::Info->new ('lobo', 'WMI'); #"lobo" is my machine's name #$pi->Set (elapsed_as_seconds => 0); # In clunks, not seconds. #@pids = $pi->ListPids (); # Get all known PIDs my @info = $pi->GetProcInfo (); # Get the max #%subs = $pi->Subprocesses (); # Figure out subprocess relationships. for (my $p = 0; $p < scalar @info; $p++) { if (!($info[$p]{'ProcessId'})) { $info[$p]{'ProcessId'} = ''; } if (!($info[$p]{'Name'})) { $info[$p]{'Name'} = ''; } if (!($info[$p]{'ExecutablePath'})) { $info[$p]{'ExecutablePath'} = ''; } my $pid = $info[$p]{'ProcessId'}; my $pnm = $info[$p]{'Name'}; my $pex = $info[$p]{'ExecutablePath'}; $hlist->add($p); $hlist->itemCreate($p, 0, -text => "$pid", -style => $rStyle); $hlist->itemCreate($p, 1, -text => "$pnm", -style => $rStyle); $hlist->itemCreate($p, 2, -text => "$pex", -style => $rStyle); } MainLoop;

Am I missing something here, or it's all ok and the OP should be aware of this?

Thanks and sorry again to post a question inside a reply.

Replies are listed 'Best First'.
Re^2: Using PAR: risk assessment
by Brutha (Friar) on Dec 10, 2004 at 08:28 UTC
    Hello DaWolf,

    I tried Your code on a (german) W2K machine and it works with PAR for me. The difference is just:

    • I use Perl 5.6.1
    • I do not connect to a remote machine. I did :
      Win32::Process::Info->new (undef, 'NT');

    ... but I ran this on a machine without Perl.

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)

      Hi, Brutha.

      First of all thanks a lot for your reply.

      I'll try an upgrade and replacing my machine's name for undef (actually I run this directly on my machine, but I thought the name wouldn't make a difference, since I've used it's name correctly).

      Second, I'd like to apologyze to spurperl and specially to Autrijus Tang (the module author) for putting his work on question.

      -- me!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413772]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2021-04-15 22:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found