user
Skeeve
<p>
The image was created using [http://www.sp-studio.de|South Park Studio] and Gimp.
</p>
<p>
I was introduced to the monastry by [physi]. He was my boss in a project.
</p>
<p>
I picked my name from [google://Skeeve Myth Inc|Robert Asprin's books about M.Y.T.H. Inc.] which I really love.
</p>
<p>Useful Character Set information: [[https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/]]</p>
<p>perlmonk nodes I often use:</p>
<ul>
<li>[284436| DBI recipes]</li>
<li>[693828| Yes, even you can use CPAN]</li>
<li>[Chatterbox FAQ]</li>
<li>[id://43037|What shortcuts can I use ...]</li>
<li>[id://119681|New Link Tags]</li>
<li>[http://nbpfaus.net/~pfau/cbhistory.cgi?site=PM" target="cbhistory|cbhistory]</li>
<li>[id://17645]</li>
<li>[id://1144644]</i>
<li>[id://974233]</i>
</ul>
<p>
My perl skeleton
</p>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case);
use Pod::Usage;
my ( # options
$verbose,
$debug,
$file,
@columns,
);
$file= 'default.txt';
help() unless GetOptions(
'v' => \$verbose,
'verbose!' => \$verbose,
'debug+' => \$debug,
'file=s' => \$file,
'c|column=i' => \@columns,
'h|help' => \&help,
'm|man' => \&man,
);
sub help { pod2usage(-verbose=>1); }
sub man { pod2usage(-verbose=>2); }
print "OKAY\n";
# Program goes here...
=head1 NAME
Getopt::Long / Pod::Usage skeleton
=head1 SYNOPSIS
skeleton.pl [options]
=head1 DESCRIPTION
This is a skeleton I use when creating a new perl script
=head1 OPTIONS
=over 4
=item B<-v>
verbose outoput
=item B<-d>
=item B<-debug>
debug mode
=item B<-file> F<filename>
specify the file to work with
=back
=head1 BUGS
none yet
=head1 TODO
much
=cut
</code>
<br>
Things I might need (again) in the future:<ul>
<li>mkdir -p
<code>
use File::Basename;
mkdir_p("some/long/path");
sub mkdir_p {
return ((-d $_[0]) or (mkdir_p(dirname $_[0]) and mkdir $_[0], 0755));
}
</code>
</li>
<li>IP v4 address manipulations
<code>
#!/usr/bin/perl
use strict;
use warnings;
use Socket;
my $ifconfig='/usr/sbin/ifconfig';
# run ifconfig -a
open my $if, '-|', "$ifconfig -a" or die "Couldn't run $ifconfig: $!\n";
while (<$if>) {
# find a line with "broadcast" in it
# on Solaris this contains all the information I need
next unless /inet\s+(.*?)\s+netmask\s+(.*?)\s+broadcast\s+(.*?)\s*$/;
# keep ip address as it is (a dotted string)
my $iaddr= $1;
# convert the netmask to a "long"
my $netmsk= hex "0x$2";
# dito for the broadcast
my $brdcst= unpack 'N', inet_aton $3;
# How many bits does the netmask have?
my $bits= 31-int(log(0xffffffff ^ $netmsk)/log(2));
# Convert the netmask to a "slashed" IP
my $network= inet_ntoa(pack "N", ($brdcst & $netmsk)) . "/" . $bits;
# show all info found
print "$iaddr\t$network\n";
}
close $if;
</code>
</li>
<li>Reverse DNS Lookup<br>
<code>
use Socket;
my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr(inet_aton("74.125.79.94"));
print $name,$/;
</code>
</li>
<li>Building perl on Solaris with gcc
<ul>
<li>make sure /usr/ccs/bin is <b>not</b> in the path
</li>
<li>make sure make is in the path for "make test" e.g. by <code>
ln -s /usr/ccs/bin/make /usr/local/bin
</code>
</li>
</ul>
</li>
<li>Building perl DBI (on Solaris) with gcc
<code>
perl Makefile.PL CC=gcc LD=gcc CCCDLFLAGS=-fPIC OPTIMIZE=-O3
</code>
This is not necessary if you build your own perl as above in which case the normal process will work.
</li>
<li>Building DBD::mySQL ...<br>
make sure .../mysql/bin is in your path
</li>
<li>CSV splitting without modules<br>
<code>
sub csvsplit {
my (@result);
for ($_[0]) {
s/[\015\012]+$//;
while (s/^"((?:[^"\\]|\\.)*)"// || s/^'((?:[^'\\]|\\.)*)'// || s/^([^,]*)//) {
push(@result, $1);
last unless s/^,//;
}
}
return @result;
}</code>
</li>
</ul>
<p>bit-vec for more than 31 bits.</p>
<code>
my $vec = [];
sub setBit {
my($vec, $offset, $val)= @_;
my $index= $offset >> 31;
my $subset= $offset & 0x7fffffff;
$vec->[$index]||='';
vec($vec->[$index], $subset, 1)= ($val & 1);
}
sub getBit {
my($vec, $offset)= @_;
my $index= $offset >> 31;
my $subset= $offset & 0x7fffffff;
$vec->[$index]||='';
return vec($vec->[$index], $subset, 1);
}
</code>
<a name="signatures">my old signatures
<ul>
<li><code>$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print</code></li>
<li><code>s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e</code></li>
</ul>
</a>
<!-- location:latitude=50.48.41,longitude=6.29.58 -->
<!-- os:OS X,Solaris,IRIX,Linux -->
2024-03-06 04:01:27
7292
386500
280901
952
(near) Aix-La-Chappell, Germany
Europe/Rome