[23560] in Perl-Users-Digest
Perl-Users Digest, Issue: 5768 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 8 18:05:41 2003
Date: Sat, 8 Nov 2003 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 8 Nov 2003 Volume: 10 Number: 5768
Today's topics:
Re: "pack" perldoc error? (Anno Siegel)
binmode and the diamond operator (J. Romano)
Re: binmode and the diamond operator (Tad McClellan)
Re: bit sequence match (Jay Tilton)
Re: bit sequence match <edady2002@yahoo.com>
Code Help <karigna_no spam@verizon.net>
Re: Code Help <grazz@pobox.com>
Re: Code Help (William Herrera)
Re: Code Help <jurgenex@hotmail.com>
Re: Code Help <noreply@gunnar.cc>
Re: Code Help <karigna_no spam@verizon.net>
Re: Code Help (James E Keenan)
Re: Code Help (Tad McClellan)
Re: fork process to handle fifo input (Ole)
How to send string to a window?? <keeper@iosys.no-ip.org>
Re: How to send string to a window?? <noreply@gunnar.cc>
Re: ole, wmi, what the hell did I change? <ivanbrug@online.microsoft.com>
Problems installing Bundle::CPAN <milambar@sorcery.net>
unlink and big files <ruben@NOSPAMtextinfo.nl>
Re: unlink and big files <mikeflan@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Nov 2003 21:09:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: "pack" perldoc error?
Message-Id: <bojm1r$pui$1@mamenchi.zrz.TU-Berlin.DE>
J. Romano <jl_post@hotmail.com> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> news:<bod6f1$n78$1@mamenchi.zrz.TU-Berlin.DE>...
[...]
> So correct me if I'm wrong here:
>
> When I want to pack and unpack strings to/from a C structure that
> requires that its strings be NULL-terminated, I should pack and unpack
> with "Z".
>
> But when I want to pack and unpack strings to/from a record for use
> with a Perl script (that doesn't require a NULL-terminator), I should
> pack with "a" (to pad with null bytes) and unpack with "Z" (to strip
> off trailing null bytes). Although I unpack with "Z", packing with
> "a" would allow me to make use of the extra character that would
> otherwise get used as a null terminator.
First off, your equivalence is wrong. Not every string in C needs a
trailing zero, and on the other hand, zero-bytes can be meaningful in
Perl strings as well.
I'm not sure against what eventualities you are trying to guard yourself.
If you don't need padding, use 'a' for both directions, and don't generate
any padding while pack()-ing. If we're talking fixed-length fields
(sorry if that has been clear in the thread, I'm not sure right now),
the a/Z combo looks about right, because then padding *will* happen for
short strings.
Anno
------------------------------
Date: 8 Nov 2003 12:26:17 -0800
From: jl_post@hotmail.com (J. Romano)
Subject: binmode and the diamond operator
Message-Id: <b893f5d4.0311081226.367bbedc@posting.google.com>
Hi,
I've had a little Perl problem recently that I've been wondering if
there is a solution for.
I'm using ActiveState Perl for Win32, and I need to read in binary
files. I use the diamond operator in a while loop after setting slurp
mode (in order to read in the whole file at once). In other words, my
code looks something like this:
$/ = undef; # set "slurp" mode
while (<>) {
my $fileLen = length $_;
print "File \"$ARGV\" contains $fileLen bytes.\n";
}
With this script, someone could type
perl script.pl file1 file2 file3
and get output like:
File "file1" contains 15 bytes.
File "file2" contains 21 bytes.
File "file3" contains 133 bytes.
Now, I realize that I can find the size of a file by using the -s
filetest operator, but that's not what I want to do (I just printed
the file length as an example). Ultimately I want to peek into the
files and look at the values at specific bytes. But in order to do
this I have to make sure that the \n\r (or \r\n) combination doesn't
get converted to one character (I've been burned by this before).
So I need to set binmode() on these files, but how do I do it with
the diamond operator? The only immediate solution I can think of is
to re-write the code so that it opens and closes a filehandle, like
this:
foreach my $file (@ARGV) {
$/ = undef; # set "slurp" mode
open(FILE, $file) or die "Cannot read \"$file\": $!";
binmode(FILE);
$_ = <FILE>;
close(FILE);
my $fileLen = length $_;
print "File \"$file\" contains $fileLen bytes.\n";
}
This way I have to add four more lines of code and check if open was
successful. I can definitely do it this way, but if there is a
quicker way of using binmode() with the diamond operator, I'd like to
know about it.
So, does anyone know if it is possible to set binmode() when using
the diamond operator (specifically in "slurp" mode)?
Thanks in advance,
Jean-Luc
------------------------------
Date: Sat, 8 Nov 2003 15:26:47 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: binmode and the diamond operator
Message-Id: <slrnbqqnsn.bp5.tadmc@magna.augustmail.com>
J. Romano <jl_post@hotmail.com> wrote:
> I use the diamond operator in a while loop after setting slurp
> mode (in order to read in the whole file at once).
> So I need to set binmode() on these files, but how do I do it with
> the diamond operator?
binmode ARGV;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 08 Nov 2003 19:24:12 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: bit sequence match
Message-Id: <3fad3e95.945123424@news.erols.com>
Edo <edady2002@yahoo.com> wrote:
: e.g, if the code gets 20 matches from %h2. then those matches are
: identical to %h1 in as a sorted-whole so
: if %h1 = (1 => '000001', 2 => '000010', 3 => '000100');
: and there are in the "key-sorted-%h2"
: (20 => '000001', 21 => '000010', 22 => '000100')
: (41 => '000001', 42 => '000010', 43 => '000100')
: (111 => '000001', 112 => '000010', 113 => '000100')
:
: then I need those above 3 lines in array of hrefs.
I see now. The sequence of values in %h1 can occur more than once in
%h2. That was the missing piece of the puzzle. See how this grabs you.
my %h1 = (
1 => '000001', 2 => '000010', 3 => '000100'
);
my %h2 = (
20 => '000001', 21 => '000010', 22 => '000100',
41 => '000001', 42 => '000010', 43 => '000100',
111 => '000001', 112 => '000010', 113 => '000100'
);
my @k1 = sort {$a <=> $b} keys %h1;
my @k2 = sort {$a <=> $b} keys %h2;
my $look_for = pack('(B6)*' => @h1{ @k1 });
my $look_in = pack('(B6)*' => @h2{ @k2 });
my @results;
while( $look_in =~ /(?=\Q$look_for\E)/g ) {
push @results,
{
map { $_ => $h2{$_} }
@k2[ $-[0] .. $-[0]+@k1-1 ]
};
}
Now instead of using index() to find where the sequence of values in %h1
occurs in %h2, it uses a match operator and $-[0] to determine where the
sequence begins. The /g switch will catch all occurrences of the
sequence. The "\Q...\E" will escape any regex metacharacters. The
"(?=...)" zero-width lookahead is there in case the sequence of values
in %h1 can have overlapping occurrences in %h2.
------------------------------
Date: Sun, 09 Nov 2003 07:30:05 +1100
From: Edo <edady2002@yahoo.com>
Subject: Re: bit sequence match
Message-Id: <3FAD524D.9040406@yahoo.com>
my %h1 = (1 => '00', 2 => '10', 3 => '11');
my %h2 = (20 => '00', 21 => '10', 22 => '11',
30 => '10', 31 => '00', 32 => '00',
41 => '10', 42 => '11', 43 => '10',
111 => '00', 112 => '10', 113 => '11');
my @lookfor = map { $h1{$_} } sort keys %h1;
my $lookfor = 0;
my (@h3, $tmph);
for (sort keys %h2) {
$tmph = {} unless $lookfor;
if ($h2{$_} eq $lookfor[$lookfor]) {
$tmph->{$_} = $h2{$_};
$lookfor = ($lookfor + 1) % @lookfor;
}
push @h3, $tmph if !$lookfor and keys %$tmph;
}
for (@h3) {
print %{$_}, "\n";
}
the above code puts
111001121011311
211022112000
310041104211
it nees to put out the following the keys
202122 #keys 20 21 22 whose values are 00 10 11
111112113 #keys 111 112 113 whose values are 00 10 11
ok here is what I am thinking in perl
my @lookfor = map { $h1{$_} } sort keys %h1; #saves the 3 values from %h1
my $lookfor = 0;
my (@h3, $tmph, @lookin);
my @lookin; #to save a range of 3 values from %h2
for (sort keys %h2) {
#build @lookin with next 3 values of %h2
for (0 .. $#lookfor) { # 0 .. 3
push @lookin, #graps the values of keys 20 21 22
}
if (@lookfor == @lookin) { #001011 cmp 100010
#put that section of %h2 in @h3 which is AoHref
}
} #the next iteration @lookin graps values of keys 21 22 30 which should
match the values in the @lookfor
for (@h3) {
print %{$_}, "\n";
}
------------------------------
Date: Sat, 08 Nov 2003 19:35:03 GMT
From: "Kenny" <karigna_no spam@verizon.net>
Subject: Code Help
Message-Id: <Hzbrb.5529$hB5.3732@nwrdny02.gnilink.net>
I need some code help on a small piece that is giving me some problems:
my @Files = glob 'c:\tmp\*.html';
foreach $i (@Files){
print "$i\n"; #just verifying the data in the array
}
print "\n"; #another troubleshooting aid
foreach $i (@Files) {
while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
print "$1\n";
push (@tempwords, $1);
}
}
The code above reads all *.html files from a directory, then each file is
read for words which are then pushed onto an array. The first section is
reading the files from the c:\tmp directory but the words are not been read
and pushed onto the array.
Any help would be appreciated.
K
------------------------------
Date: Sat, 08 Nov 2003 20:03:37 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Code Help
Message-Id: <t_brb.2931$bQ3.1589@nwrdny03.gnilink.net>
Kenny <karigna_no spam@verizon.net> wrote:
> my @Files = glob 'c:\tmp\*.html';
[...]
> foreach $i (@Files) {
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
> print "$1\n";
> push (@tempwords, $1);
> }
> }
>
> The code above reads all *.html files from a directory, then each file is
> read for words which are then pushed onto an array.
Where are you reading the files? The foreach() loop is just processing
the file *names*.
# untested
@ARGV = glob 'c:/tmp/*.html' unless @ARGV;
while (<>) {
push @words, /\b([a-z][-a-z]{3,})\b/ig;
}
--
Steve
------------------------------
Date: Sat, 08 Nov 2003 20:09:24 GMT
From: wherrera@lynxview.com (William Herrera)
Subject: Re: Code Help
Message-Id: <3fad4ce1.404518584@news2.news.adelphia.net>
On Sat, 08 Nov 2003 19:35:03 GMT, "Kenny" <karigna_no spam@verizon.net> wrote:
>I need some code help on a small piece that is giving me some problems:
Your code fails to read the files. You can do this on the command line, but
observe also the way I do it below. Also, your regex does not discriminate what
html is code and what is content. I sugges one of the parsers for HTML on CPAN
for that.
>
>my @Files = glob 'c:\tmp\*.html';
>foreach $i (@Files){
> print "$i\n"; #just verifying the data in the array
>}
>print "\n"; #another troubleshooting aid
>
>foreach $i (@Files) {
>
>
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
> print "$1\n";
> push (@tempwords, $1);
> }
>}
>
>The code above reads all *.html files from a directory, then each file is
>read for words which are then pushed onto an array. The first section is
>reading the files from the c:\tmp directory but the words are not been read
>and pushed onto the array.
>
>Any help would be appreciated.
>
>K
>
>
=====================
#!/usr/bin/perl -w
use strict;
use warnings;
my @Files = glob 'c:\tmp\*.html';
my @tempwords;
my $i;
foreach $i (@Files){
print "$i\n"; #just verifying the data in the array
}
print "\n"; #another troubleshooting aid
foreach $i (@Files) {
open(HTFILE, "$i") or die "Cannot open $i: $!";
my @lines = <HTFILE>;
close HTFILE;
foreach(@lines) {
while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
print "$1\n";
push (@tempwords, $1);
}
}
}
==============
---
Use the domain skylightview (dot) com for the reply address instead.
------------------------------
Date: Sat, 08 Nov 2003 20:13:41 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Code Help
Message-Id: <V7crb.13812$E9.3977@nwrddc01.gnilink.net>
Kenny wrote:
[...]
> foreach $i (@Files) {
Ok, for each filename in the list do
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
something with $_.
Well, your code doesn't define $_ anywhere and you are not opening or
reading the files in your list anywhere, either.
> print "$1\n";
> push (@tempwords, $1);
> }
> }
>
> The code above reads all *.html files from a directory, then each
> file is read for words which are then pushed onto an array. The first
> section is reading the files from the c:\tmp directory
Well, it reads the names of the files, which are in c:\tmp, and stores those
names in @files.
> but the words
> are not been read and pushed onto the array.
Because you not reading the files anywhere.
jue
------------------------------
Date: Sat, 08 Nov 2003 21:12:04 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Code Help
Message-Id: <bojjhm$1ffvok$1@ID-184292.news.uni-berlin.de>
Kenny wrote:
> I need some code help on a small piece that is giving me some
> problems:
>
> my @Files = glob 'c:\tmp\*.html';
> foreach $i (@Files){
> print "$i\n"; #just verifying the data in the array
> }
> print "\n"; #another troubleshooting aid
>
> foreach $i (@Files) {
>
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
> print "$1\n";
> push (@tempwords, $1);
> }
> }
>
> The code above reads all *.html files from a directory, then each
> file is read for words which are then pushed onto an array.
Only if you by "file" mean "filename".
> The first section is reading the files from the c:\tmp directory
> but the words are not been read and pushed onto the array.
Try replacing
while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
with
while ( $i =~ /\b([a-z][-a-z]+)\b/ig){
http://www.perldoc.com/perl5.8.0/pod/perlsyn.html#Foreach-Loops
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 08 Nov 2003 21:51:58 GMT
From: "Kenny" <karigna_no spam@verizon.net>
Subject: Re: Code Help
Message-Id: <2Adrb.10680$y95.240@nwrdny01.gnilink.net>
Thanks guys...
"William Herrera" <wherrera@lynxview.com> wrote in message
news:3fad4ce1.404518584@news2.news.adelphia.net...
> On Sat, 08 Nov 2003 19:35:03 GMT, "Kenny" <karigna_no spam@verizon.net>
wrote:
>
> >I need some code help on a small piece that is giving me some problems:
>
> Your code fails to read the files. You can do this on the command line,
but
> observe also the way I do it below. Also, your regex does not discriminate
what
> html is code and what is content. I sugges one of the parsers for HTML on
CPAN
> for that.
>
> >
> >my @Files = glob 'c:\tmp\*.html';
> >foreach $i (@Files){
> > print "$i\n"; #just verifying the data in the array
> >}
> >print "\n"; #another troubleshooting aid
> >
> >foreach $i (@Files) {
> >
> >
> > while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
> > print "$1\n";
> > push (@tempwords, $1);
> > }
> >}
> >
> >The code above reads all *.html files from a directory, then each file
is
> >read for words which are then pushed onto an array. The first section is
> >reading the files from the c:\tmp directory but the words are not been
read
> >and pushed onto the array.
> >
> >Any help would be appreciated.
> >
> >K
> >
> >
> =====================
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> my @Files = glob 'c:\tmp\*.html';
> my @tempwords;
> my $i;
> foreach $i (@Files){
> print "$i\n"; #just verifying the data in the array
> }
> print "\n"; #another troubleshooting aid
> foreach $i (@Files) {
> open(HTFILE, "$i") or die "Cannot open $i: $!";
> my @lines = <HTFILE>;
> close HTFILE;
> foreach(@lines) {
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
> print "$1\n";
> push (@tempwords, $1);
> }
> }
> }
>
> ==============
>
> ---
> Use the domain skylightview (dot) com for the reply address instead.
------------------------------
Date: 8 Nov 2003 14:24:27 -0800
From: jkeen@concentric.net (James E Keenan)
Subject: Re: Code Help
Message-Id: <b955da04.0311081424.2ed25e48@posting.google.com>
"Kenny" <karigna_no spam@verizon.net> wrote in message news:<Hzbrb.5529$hB5.3732@nwrdny02.gnilink.net>...
> I need some code help on a small piece that is giving me some problems:
>
[snip]
> foreach $i (@Files) {
>
>
> while ( $_=~/\b([a-z][-a-z][-a-z][-a-z]+)\b/ig){
One of your problems is right here. You're iterating over @Files with
$i, but your lvalue for the binding operator is $_. Also, it seems to
me that you're defining a "word" as containing 4 or more characters,
the first of which must be a letter, and the next 3 or more of which
must be either letters or a hyphen. Is that what you intended? In
particular, are the names of the relevant .html files forbidden to
contain numerals or the underscore character?
jimk
------------------------------
Date: Sat, 8 Nov 2003 16:51:43 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Code Help
Message-Id: <slrnbqqsrv.1mv.tadmc@magna.augustmail.com>
Kenny <karigna_nospam@verizon.net> wrote:
> Thanks guys...
If you really mean that, then please learn to quote your
followups properly. Thank you.
http://web.presby.edu/~nnqadmin/nnq/nquote.html
[ snip TOFU ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Nov 2003 12:54:47 -0800
From: oviaudmurat@web.de (Ole)
Subject: Re: fork process to handle fifo input
Message-Id: <c640408c.0311081254.47d99506@posting.google.com>
i have ( tried to ) taken into consideration your improvement
suggestions. ( or better : your hints to render my project possible ).
BTW, excuse my bad english!!
I hope you ( both ) are willingly to criticize these last ( almost
final )
perl scripts. Apart from some "start-stop-daemon" issues, ( i think
those are
debian GNU / Linux specific ), the programs are working fine. And,
apart from what you hopefully will find and point out, i have to
render the scripts able
to initialize the key for the message queue(s) ids dynamically.
You may surely use these scripts if you like
( take that as a joke ).
I hope the examinations - commitee will not decapitate me.
Thanks for any further hints and for those already given.
Ole Viaud-Murat.
I have left the functions, that store and save data behind.
1.) the process that prepares the data and sends it to 1.)
#!/usr/bin/perl
##############################################################################
# File : ipt_input_logger.pl
# Descr : Process that reads data coming from a fifo. The data is
then
# analyzed and put into a data package. This package is then
put into
# a message queue to be read by a client process that
prepares the
# data to be saved into a DB
##############################################################################
use POSIX;
use IPC::SysV qw( IPC_NOWAIT );
use IPC::Msg qw( S_IRWXU );
use constant KEY => 1234;
use warnings;
use strict;
# check, if the process already runs, or under circumstances the pid
# file still exists.
if ( -f "/var/run/ipt_input_logger.pid" ) {
die "I'm already running. Check /var/run !\n";
}else {
# open logfile handle
open ( my $LOGFH, ">>/var/log/ipt_input_log" ) or die "cannot open
logfile: $!";
# fork to become daemon
if (( my $pid = fork ( )) == 0 ) {
print "starting ipt_input_logger...\n";
# create message queue, to that the log data will be sent
my $msg_queue = new IPC::Msg ( KEY, S_IRWXU );
local $| = 1;
local $SIG{ INT } = \&clean_all;
local $SIG{ TERM } = \&clean_all;
my $fifo_path = "</dev/ipt_input";
my @message_buffer;
save_pid ( $pid );
eval {
# enter loop, that will atach to fifo when possible
while ( open ( my $fifo, $fifo_path ) or die "no fifo here")
{
# read what comes
while ( <$fifo> ) {
# if message queue is unavailable due to msgmax, save
it to
# buffer otherwise, send entry and flush buffer to
queue
# ( i assume unwisely that msgmax is the only reason
for error )
eval {
$msg_queue->snd( 1, $_, IPC_NOWAIT );
for ( my $i=0; $i < @message_buffer; $i++ ) {
$msg_queue->snd( 1, pop( @message_buffer ),
IPC_NOWAIT );
}
};
# if the buffer grows too large, shout panic to logfile
if ( $@ ) {
push ( @message_buffer, $_ );
if ( @message_buffer > 1024 ) {
my $msg = sprintf( "[%s] : PANIC! someone is
stressing this machine !!!\n", localtime() );
$msg .= sprintf( "\@message_buffer is growing too
large ( size = %d )\n", @message_buffer );
print $LOGFH $msg;
}
next;
}
}
}
};
catch_error ( $LOGFH, $@ );
}elsif ( $pid > 0 ) {
catch_error ( $LOGFH, $@ );
exit(0);
}else {
die "fork failed: $!";
}
}
sub clean_all {
my $LOGFH = shift;
if ( $@ ) {
print $LOGFH $@;
}
if ( -f "/var/run/ipt_input_logger.pid" ) {
unlink( "/var/run/ipt_input_logger.pid" );
}
exit( 0 );
}
sub catch_error {
my $LOGFH = shift;
my $error_msg = shift;
if ( $error_msg ) {
print $LOGFH "[ " . localtime ( ) . " ]:" . $error_msg;
exit(-1);
}
exit(0);
}
sub save_pid {
my $pid = shift;
open ( my $FH, ">/var/run/ipt_input_logger.pid" ) or die "Cannot
open pid file:$!";
print $FH $pid . "\n";
close ( $FH );
}
##############################################################################
2.) the process that awaits the prepared data:
#!/usr/bin/perl
##############################################################################
# File : ipt_client.pl
# Descr : Process that reads the log data put into a message queue
# and prepares the data so that it can be saved into the DB.
##############################################################################
use POSIX;
use IPC::SysV qw( IPC_CREAT );
use IPC::Msg;
use Ptrack_DB;
use constant INTERVAL => 1;
use constant KEY => 1234;
use constant SAVEINTERVAL => 60;
use warnings;
use strict;
my $months = {
'Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4, 'May' => 5, 'Jun'
=> 6,
'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec'
=> 12
};
if (( my $pid = fork ( ) ) == 0 ) {
my $store = {};
my $ptrack = Ptrack_DB->connect ( "iptrack" );
my $msg_queue = new IPC::Msg( KEY, IPC_CREAT );
my ( $start, $end );
$start = time ( );
open ( my $LOGFH, ">>/var/log/ipt_client.log" ) || die "Cannot open
logfile:$!";
local $| = 1;
# daemonize
chdir("/");
umask(0);
setsid();
while ( $msg_queue->rcv( my $buffer, 1024 ) ) {
$end = time ();
if ( defined ( $buffer ) ) {
my ( $year, $month, $day, $time, $src, $dst, $direction);
my $tcp_header_content = {};
if ( $buffer =~
/((^[JFMASOND]..)(\s?\d+)(\s?(..):(..):(..)))/ ) {
$year = (localtime( ))[ 5 ] + 1900;
$month = $$months{ $2 };
$day = $3;
$time = $4;
}
if ( $buffer =~ /(FW(\s)(\w+))/ ) {
$direction = $3;
}
$buffer =~ s/((^(...) (.)+ (..):(..):(..) 2pk kernel:)|(FW
(\w+):)|(DF)|(ACK)|(DYN)|(SYN)|(PSH)|(FIN)|(RST))//g;
for my $field ( split ( " ", $buffer ) ) {
my ( $flag, $value ) = split( "=", $field );
$tcp_header_content->{ $flag } = $value;
}
put_into_store ( $tcp_header_content, $store, $direction );
}
if ( $end - $start > SAVEINTERVAL ) {
save_data ( $store, $ptrack, $LOGFH );
$store = { };
$start = time ( );
$end = time ( );
}
my $now = localtime ( );
}
}elsif ( $pid > 0 ) {
exit(0);
}
------------------------------
Date: Sat, 08 Nov 2003 22:09:45 +0100
From: Keeper <keeper@iosys.no-ip.org>
Subject: How to send string to a window??
Message-Id: <bojm5f$fhf$3@nemesis.news.tpi.pl>
Hi All,
I want to send value of a variable (string of characters) from my perl
program to an currently active window (in X Windows) with a blanking
cursor (as if value of that variable was typed on keyboard).
Can you tell me, how to do this in the simplest way??
Thanks,
Keeper
------------------------------
Date: Sat, 08 Nov 2003 22:14:24 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to send string to a window??
Message-Id: <bojn6t$1ehg3q$1@ID-184292.news.uni-berlin.de>
Keeper wrote:
> Hi All,
Stop this multiposting!!!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 8 Nov 2003 12:36:35 -0800
From: "Ivan Brugiolo [MSFT]" <ivanbrug@online.microsoft.com>
Subject: Re: ole, wmi, what the hell did I change?
Message-Id: <#wwHBgjpDHA.392@TK2MSFTNGP11.phx.gbl>
I'm not familiar woth PERL,
but the code below is changing the default value on the class and not the
value on the instance.
Is this expected and intended ?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"woof" <drubnone@yahoo.com> wrote in message
news:7b21a826.0311080734.7ce56709@posting.google.com...
> Here's my very first stab at wmi. What did I change? I was trying
> to change SystemStartupDelay in Win32_ComputerSystem.Name=WX4
> The wmi browser says I changed nothing. If I run this and read
> only, it says I did.... change something. I get the "55".
> Thanks.
>
> use Win32::OLE;
>
> $wmi = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate,
> (security)}//./") || die;
>
> ($obj = $wmi->Get("Win32_ComputerSystem")) || die;
>
> # commented out and run again to check for change.
> #$obj->{"SystemStartupDelay"} = "55";
> #$obj->Put_();
>
> $s = $obj->{"SystemStartupDelay"};
> print qq(Is the new value $s\n);
------------------------------
Date: Sat, 08 Nov 2003 20:38:57 +0000
From: Allan K Preston <milambar@sorcery.net>
Subject: Problems installing Bundle::CPAN
Message-Id: <pan.2003.11.08.20.38.55.871241@sorcery.net>
# perl -MCPAN -e shell
<cpan> install Bundle::CPAN
After a fair while, it finally terminates with:
Bundle summary: The following items in bundle Bundle::CPAN had installation
problems:
Bundle::libnet and the following items had problems during recursive
bundle calls: Data::Dumper
I've googled on this error, and the most common cause, Data/Dumper.pm
being installed in two different places, doesn't apply.
[root@services milambar]# locate Data/Dumper.pm
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/Data/Dumper.pm
[root@services milambar]#
Im at a loss, and it seems until this is rectified, no other CPAN modules
want to install either.
Can anyone offer any help, or suggest things to look for?
Milambar@sorcery.net
------------------------------
Date: Sat, 08 Nov 2003 22:19:20 +0100
From: Ruben van Engelenburg <ruben@NOSPAMtextinfo.nl>
Subject: unlink and big files
Message-Id: <3fad5e4a$0$191$3b62cedd@news.wanadoo.nl>
Hi all,
I'm using unlink in a script to purge old backup files (tarballs).
Now perl returns an error when it tries to unlink one of those files:
"Value too large for defined data type"
The tarballs are pretty big; over 2 GB. Does this mean unlink doesn't
support large files like that? Is this a bug? And what can I do about it?
I'm using perl 5.6.0 on Linux.
Thanks in advance.
Regards,
Ruben.
------------------------------
Date: Sat, 08 Nov 2003 23:03:55 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: unlink and big files
Message-Id: <3FAD7712.CDBF082E@earthlink.net>
Ruben van Engelenburg wrote:
> Hi all,
>
> I'm using unlink in a script to purge old backup files (tarballs).
> Now perl returns an error when it tries to unlink one of those files:
>
> "Value too large for defined data type"
>
> The tarballs are pretty big; over 2 GB. Does this mean unlink doesn't
> support large files like that? Is this a bug? And what can I do about it?
>
> I'm using perl 5.6.0 on Linux.
> Thanks in advance.
>
> Regards,
> Ruben.
A Google search will produce a ton of pages discussing this
issue. Here are just a few:
http://www.ussg.iu.edu/hypermail/linux/kernel/0108.1/1440.html
http://www.redhat.com/archives/redhat-list/2002-July/msg00442.html
http://sources.redhat.com/ml/bug-gnu-utils/2000-02/msg00108.html
Apparently it is not Perl related.
Mike Flannigan
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 5768
***************************************