Skriptdepot: Perl

Suchen und ersetzen auf der Kommandozeile (mit Backup der originalen Datei)

perl -i.bak -pe '{  s/such/ersetz/g;  }' dateien

** Perl-Module installieren:**

 perl -MCPAN -e 'install <Module>'

Installierte Perl-Module auf der Kommandozeile anzeigen:

perl -MExtUtils::Installed -le "for(ExtUtils::Installed->new()->modules()) {print}"

instmodsh

perldoc perlmodlib  (vorinstallierte Module)
perldoc perllocal   (individuelle Module)

Windows mit ActivePerl incl. Perl Package Manager:

ppm list

Linux mit Installmanager wie "rpm" oder "dpkg":

find `perl -e 'print "@INC"'` -name '*.pm' -print | sort [| grep ...] [| tee ~/Perl-modules-installed.txt]

WIN32: Einen speziellen Prozess beenden

use strict;
use Win32;
use Win32::Process;
use Win32::Process::Info;
 
my $server = "\\\\Server.domäne.com";    # "" für localmachine
my $exe = "yourexe.exe"        # Name der Processdatei
 
my $pi = Win32::Process::Info->new($server);
foreach my $hashref ($pi->GetProcInfo())
{
   my $exitcode = undef;
   print "Process: $hashref->{Name}\n";
   if(lc($hashref->{Name}) eq $exe)
   {
      Win32::Process::KillProcess($hashref->{ProcessId}, $exitcode);
   }
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License