[19597] in Perl-Users-Digest
Perl-Users Digest, Issue: 1792 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 22 14:05:53 2001
Date: Sat, 22 Sep 2001 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001181908-v10-i1792@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 22 Sep 2001 Volume: 10 Number: 1792
Today's topics:
Re: access old DIBOL file (jeremiah)
Re: access old DIBOL file <dan@tuatha.sidhe.org>
Re: Best way to hide the perl source code.. <em@online.no>
Re: Best way to hide the perl source code.. (Mark)
Re: Best way to hide the perl source code.. (Alex SC)
Re: Best way to hide the perl source code.. <tsee@gmx.net>
Re: Best way to hide the perl source code.. (Logan Shaw)
Re: dead image links <chuck.kahn@sympatico.ca>
extra newline in s command (laura fairhead)
Re: extra newline in s command (Chas Friedman)
Re: File::Find::name problem... (Rob)
Re: File::Find::name problem... (Logan Shaw)
Re: IndigoPerl using the wrong port?? (Mark)
Re: IndigoPerl using the wrong port?? <bart.lateur@skynet.be>
Re: Newbie problem <yalaoui@lexbase.fr>
Re: Newbie problem <Laocoon@eudoramail.com>
Re: Newbie problem <echang@netstorm.net>
Re: newbie question make from 2 variable fields one wit <tsee@gmx.net>
Re: Peek and Poke on Perl? <pne-news-20010922@newton.digitalspace.net>
Re: Perhaps some help for a newbie - uninitialized valu (Logan Shaw)
Re: perl, lvalues, rvalues, and operators <tinamue@zedat.fu-berlin.de>
Re: Schwartzian Transform problem <matthew.garrish@sympatico.ca>
Re: Schwartzian Transform problem <bart.lateur@skynet.be>
Re: win32 stat in directory with 4682 files <peter.korman@verizon.net>
Re: win32 stat in directory with 4682 files <peter.korman@verizon.net>
Re: win32 stat in directory with 4682 files <peter.korman@verizon.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Sep 2001 09:08:32 -0700
From: brimstonesfc@hotmail.com (jeremiah)
Subject: Re: access old DIBOL file
Message-Id: <4a7434b6.0109220808.4ecc907a@posting.google.com>
Jeff Zucker wrote in message news>
> From what I can gather DIBOL is a language, not a database format, so do
> you have a program with data embedded in it, or some sort of output from
> a program?
I'm not sure, I just found out about the project. I've already asked
much the same from the client and I'll post here as I find out more
information.
>If you have a one-time task, you'll probably want to parse
> out the data into some sort of flat file format and then either import
> that into an rdbms or handle it directly with, for example
> DBD::AnyData.
The script is for a bank so I am assuming that it will have to be run
failry often.
Thanks for the info Jeff. I've got to get with the client on a bunch
of issues and will post here again in the next day or so. I just
needed to know if I could do this thing with some help.
Thanks
jeremiah
------------------------------
Date: Sat, 22 Sep 2001 17:47:57 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: access old DIBOL file
Message-Id: <h94r7.25648$NT3.3554414@news1.rdc1.ct.home.com>
jeremiah <brimstonesfc@hotmail.com> wrote:
> I've got a bit of a problem. I need to acces an old DIBOL db via perl.
Wasn't DiBOL some mutant version of COBOL that ran on DEC machines? (I
have a vague recollection of doing DiBOL on PDP 11/70s, but that was
a *long* time ago...) If that's true the files might be stored in
one of the Dec OS' native formats. (What OS was this stuff generated
on?) If that's the case, you might be able to extract the data
either with some of the native tools or VMS perl if you can
get it over to a VMS box.
dan
------------------------------
Date: 22 Sep 2001 15:26:17 +0200
From: Espen Myrland <em@online.no>
Subject: Re: Best way to hide the perl source code..
Message-Id: <87r8szxsp2.fsf@strand.arcanum.net>
Jayakumar Mundunuri <jkumar@atrenta.com> writes:
> Hi Friends!!
>
> Can you suggest me what is the best way to hide perl source code?
>
> perl Compiler/ perlcc / perl Bite code / encrypt / perl Filter ....
>
> I heard the above names but not really attempted to use them.
>
> It would be great help if anybody guide me with some references.
>
> Thanks in advance.
>
chmod 700 perl_source
--
espen
------------------------------
Date: Sat, 22 Sep 2001 13:39:41 GMT
From: mark@artwarren.co.ukNOSPAM (Mark)
Subject: Re: Best way to hide the perl source code..
Message-Id: <3bac93fa.17384443@news.screaming.net>
On Fri, 21 Sep 2001 18:06:21 -0700, Jayakumar Mundunuri
<jkumar@atrenta.com> wrote:
Hi Jay,
A while back I was also wondering how it could be done. I lifted the
following tips from the www.deja.com archives. It seems you can
compile perl into C binary files.
http://www.dejanews.com
Search this newsgroup for, e.g., "undump" and "compiler" or
"obfuscate" to find the numerous discussions regarding this subject,
which also happens to be on the Frequently Asked Questions (FAQ) list
as "How can I hide the source for my Perl program?" and "How can I
compile my Perl program into byte-code or C?".
How can I get a binary version of Perl?
If you don't have a C compiler because for whatever reasons your
vendor did not include one with your system, the best thing to do is
grab a binary version of gcc from the net and use that to compile perl
with. CPAN only has binaries for systems that are terribly hard to get
free compilers for, not for Unix systems.
I would be interested to hear how you solved this problem.
Mark
>Hi Friends!!
>
>Can you suggest me what is the best way to hide perl source code?
>
>perl Compiler/ perlcc / perl Bite code / encrypt / perl Filter ....
>
>I heard the above names but not really attempted to use them.
>
>It would be great help if anybody guide me with some references.
>
>Thanks in advance.
>
>jay
>
------------------------------
Date: 22 Sep 2001 07:37:47 -0700
From: hkmp5@spray.se (Alex SC)
Subject: Re: Best way to hide the perl source code..
Message-Id: <18d79944.0109220637.5007e22@posting.google.com>
Jayakumar Mundunuri <jkumar@atrenta.com> wrote in message news:<3BABE40D.82225D00@atrenta.com>...
> Hi Friends!!
>
> Can you suggest me what is the best way to hide perl source code?
>
> perl Compiler/ perlcc / perl Bite code / encrypt / perl Filter ....
>
> I heard the above names but not really attempted to use them.
>
> It would be great help if anybody guide me with some references.
>
> Thanks in advance.
I'm sure you've read all the "don't do that posts already". And, in
theory, I agree - if you intend to absolutely rely on the source
not being available then don't do that.
Then again, there may be other considerations. For instance, I deploy
perl scipts across a multitude of DOS++ boxen where I work, and I
used to have the problem of users (mostly excel and word mavericks,
mind you) trying to "improve" upon my glorious programming and
breaking all sorts of things in the process. I solved these problems
to my satisfaction by hiding the source. If your problem is similar,
then by all means go ahead.
How, you ask? I didn't want to mess with anything of off CPAN, since
it's not guaranteed to be installed where needed. Instead I use the
MIME::Base64 module, available wherever perl is, unless your install
is _really_ screwed up.
1) Write your script, debug it to your satisfaction.
2) Run the script thru' MIME::Base65::encode_base64.
3) Write a wrapper that looks more or less like
#!/usr/bin/perl -w
use strict;
require 5;
use MIME::Base64 qw(encode_base64 decode_base64);
local($/)=undef;
my $encStr=q(
YOUR NICE ENCODED STRING GOES HERE!
);
my $str=decode_base64($encStr);
eval $str;
4) Distribute this instead of your original script.
Now, will this stop EVIL HACKERS from stealing the efforts
of your startling creativity and valiant efforts? Hell no.
But rest assured that the average Office drone will faint
with panic should he or she happen to open up your magnum
opus with the texteditor and looks at those relentless
marching rows of uniform text. So that particular mission
is accomplished.
The nice thing with this is that your script will still work
anyway perl is available - you won't have to compile for
separate architectures or anything like that. The bad thing
is that it's an efficiency killer - I wouldn't suggest doing
this for a CGI, say, that will be accessed several times
every second. For all those scripts that will run a couple
of times each day, though, it's perfect.
Enjoy!
------------------------------
Date: Sat, 22 Sep 2001 17:08:27 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Best way to hide the perl source code..
Message-Id: <9oi97o$7o6$01$1@news.t-online.com>
"Mark" <mark@artwarren.co.ukNOSPAM> schrieb im Newsbeitrag
news:3bac93fa.17384443@news.screaming.net...
> I would be interested to hear how you solved this problem.
Not by compiling. That doesn't effectively hide the source code.
Steffen
------------------------------
Date: 22 Sep 2001 11:14:17 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Best way to hide the perl source code..
Message-Id: <9oidcp$a7h$1@charity.cs.utexas.edu>
In article <3bac93fa.17384443@news.screaming.net>,
Mark <mark@artwarren.co.ukNOSPAM> wrote:
>A while back I was also wondering how it could be done. I lifted the
>following tips from the www.deja.com archives. It seems you can
>compile perl into C binary files.
What is a "C binary file"? :-)
- Logan
--
"Everybody
Loves to see
Justice done
On somebody else" ( Bruce Cockburn, "Justice", 1981 )
------------------------------
Date: Sat, 22 Sep 2001 12:28:04 -0400
From: "Chuck Kahn" <chuck.kahn@sympatico.ca>
Subject: Re: dead image links
Message-Id: <o_2r7.26165$386.4248252@news20.bellglobal.com>
"Rob - Rock13.com" <rob_13@excite.com> wrote in message
news:Xns91238D3FE27C8rock13com@64.8.1.226...
> It seems images.amazon.com is deliberately not giving a 404 so as
> not to produce broken images. When I request one of those URLs with
> telent its sending a GIF--at least it sends that intially. Though
> for $URL[2] it sends more data.
Maybe if I use $document_length from LWP::Simple; I can determine that
below a certain document length, I am looking at a dead image link.
------------------------------
Date: Sat, 22 Sep 2001 17:23:40 GMT
From: laura_fairhead@my-deja.com (laura fairhead)
Subject: extra newline in s command
Message-Id: <3bacc901.87892259@news.cis.dfn.de>
Hi,
Can anyone explain to me why I'm getting extra
newlines inserted with the s/// command in this
script;
open(FILE,qq[patternfile])
@k=(qq[0000],<FILE>)
while(<>){
/(\d{4})/&& $1<=$#k && s/$1/$k[$1]/
print
}
Every line that has an s/// done on it has
an extra newline and I don't see why it's
doing that.
It is suppossed to replace occurances of 4 digit
numerics with what is on that line in 'patternfile'
This is my 1st attempt at 'perl' so pleaze be
easy on me.... is this a reasonable way of doing
this or is there a better one? Also, can I read a file
into an array in just one command?
thanx
--
: ${L:-aura} # http://lf.8k.com:80
------------------------------
Date: Sat, 22 Sep 2001 17:54:29 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: extra newline in s command
Message-Id: <3baccf85.64409309@news.itouch.net>
On Sat, 22 Sep 2001 17:23:40 GMT, laura_fairhead@my-deja.com (laura
fairhead) wrote:
>Hi,
>
>Can anyone explain to me why I'm getting extra
>newlines inserted with the s/// command in this
>script;
>
>open(FILE,qq[patternfile])
>@k=(qq[0000],<FILE>)
>while(<>){
> /(\d{4})/&& $1<=$#k && s/$1/$k[$1]/
> print
> }
>
>
>Every line that has an s/// done on it has
>an extra newline and I don't see why it's
>doing that.
>
>It is suppossed to replace occurances of 4 digit
>numerics with what is on that line in 'patternfile'
>This is my 1st attempt at 'perl' so pleaze be
>easy on me.... is this a reasonable way of doing
>this or is there a better one? Also, can I read a file
>into an array in just one command?
>
>thanx
>
>--
>: ${L:-aura} # http://lf.8k.com:80
>
Well, your code won't even compile, because several semicolons are
missing.
Assuming your actual code doesn't have this problem, you are
probably getting the newlines from the lines in patternfile.
chas
------------------------------
Date: 22 Sep 2001 09:28:50 -0700
From: robsjobs@hotmail.com (Rob)
Subject: Re: File::Find::name problem...
Message-Id: <4ae33a7b.0109220828.4977b5ec@posting.google.com>
Dave Tweed <dtweed@acm.org> wrote in message news:<3BAC1570.13DED34A@acm.org>...
> Also, you might want to try something like this (untested):
>
> find sub {
> # get the last element of the current path
> my $dir = (split ('/', $File::Find::dir))[-1];
> # print the directory and name if the directory numerically
> # matches the last two digits of the name
> print "$dir/$_\n" if -f && /^\d+$/ && $dir == substr ($_, -2);
> }, ".";
>
> This might actually be more restrictive than you want; for example,
> it won't print the names of files that are in the wrong "bucket".
Actually, all filenames are numbers, never alpha. The only gotcha is
I am writting this to be as independant of platform as I can. I will
need to preset a variable for the directory delimiter before
performing the split. (Another windows perl environment may use "\"
instead of "/" which will work just fine in Unix/Linux.
> Just curious: Do the filenames never end in "00"?
Actually they to, I should have written [1-99] as [0-99]. A file
named 12300 will be in directory "0/".
Thanks for your suggestion!
Robert
------------------------------
Date: 22 Sep 2001 12:46:23 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: File::Find::name problem...
Message-Id: <9oiipf$aio$1@charity.cs.utexas.edu>
In article <4ae33a7b.0109220828.4977b5ec@posting.google.com>,
Rob <robsjobs@hotmail.com> wrote:
>The only gotcha is
>I am writting this to be as independant of platform as I can. I will
>need to preset a variable for the directory delimiter before
>performing the split. (Another windows perl environment may use "\"
>instead of "/" which will work just fine in Unix/Linux.
If you're doing that kind of thing, you might want to do a "perldoc
File::Spec". (And a "perldoc File::Spec::Unix", which is for some
reason where the methods are documented.)
- Logan
--
"Everybody
Loves to see
Justice done
On somebody else" ( Bruce Cockburn, "Justice", 1981 )
------------------------------
Date: Sat, 22 Sep 2001 13:33:02 GMT
From: mark@artwarren.co.ukNOSPAM (Mark)
Subject: Re: IndigoPerl using the wrong port??
Message-Id: <3bac930a.17144365@news.screaming.net>
On Fri, 21 Sep 2001 19:17:38 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
Thanks Bart, I shall try this. I didn't mess with the httpd.conf file,
but when I click on the IndigoPerl menu item show website it opens an
ASP test database I knocked up using the Microsoft Personal Server. I
wonder if having the Microsoft Personal Server installed prior to
IndigoPerl caused some kind of conflict. The dark workings of the
insides of windows are as yet a mystery to me.
Mark
>Mark wrote:
>
>>I have installed IndigoPerl on my PC under Win98, but when I select
>>'start apache' the following error message appears in the dos window;
>>Syntax error on line 237 of c:/program
>>files/indigoperl/conf/httpd.conf:
>>The port number "Files\IndigoPerl\setup.bat" is outside the
>>appropriate range (i.e., 1..65535).
>
>How did you install it? Did you, by any chance, mess with httpd.conf?
>
>>Can anyone advise what this means and how I can cure this problem?
>
>It means that the port number to use is outside the 16 bit range. The
>normal value for a web server is 80, while PerlConsole, also part of the
>IndigoPerl distribution, uses 4444.
>
>So go to the directory "conf" in the IndigoPerl's file root, open the
>file httpd.conf with a text editor. Search for the word "port". On my
>configuration file, it's on line 237. That line is
>
>Port 80
>
>thus normal for a normal http server. Modify that line until reasonable,
>and save the file. Then start Apache again.
>
>--
> Bart.
------------------------------
Date: Sat, 22 Sep 2001 16:01:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: IndigoPerl using the wrong port??
Message-Id: <n9dpqtcag3fafdc9l18vo48o608tb9r376@4ax.com>
Mark wrote:
>Thanks Bart, I shall try this. I didn't mess with the httpd.conf file,
>but when I click on the IndigoPerl menu item show website it opens an
>ASP test database I knocked up using the Microsoft Personal Server. I
>wonder if having the Microsoft Personal Server installed prior to
>IndigoPerl caused some kind of conflict. The dark workings of the
>insides of windows are as yet a mystery to me.
I think you can't be running two servers on the same port at the same
time. Could that be yoor problem? That Apache is in a strange way
complaining that the assigned port number is in use?
If you messed up httpd.conf, there's an example conf file right next to
it. The name includes the term "default", IIRC. Ah, yes: it's
"httpd.conf.default".
--
Bart.
------------------------------
Date: Sat, 22 Sep 2001 17:01:02 +0200
From: "Younes ALAOUI" <yalaoui@lexbase.fr>
Subject: Re: Newbie problem
Message-Id: <9oi945$d9d$1@wanadoo.fr>
Hi,
First thanks for the answer.
I have already installed the MIME::Parser Module but the problem is that
under root all modules are located and not another user even if i re-install
the modules.
I noticed that Unix::Syslog had the same problem.
I think this could be caused by a bad environement.
But i don't know much things about it.
Can you help more plz??
Y.A.
"Laocoon" <Laocoon@eudoramail.com> a écrit dans le message news:
Xns9123EE6D85142Laocooneudoramailcom@62.153.159.134...
> "Younes ALAOUI" <yalaoui@lexbase.fr> wrote in
> news:9ogaib$s4$2@wanadoo.fr:
>
> > Hi,
> >
> > I have this error and i cannot help myself in resolving, can someone
> > help me
> >:
> >
> > Can't locate MIME/Parser/Reader.pm in @INC (@INC contains:
> > /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
> > /usr/lib/perl5/site_perl/5.6.0/i386-linux
> > /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl/5.005
> > /usr/lib/perl5/site_perl) at
> > /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151. BEGIN
> > failed--compilation aborted at
> > /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151.
> >
> You have not installed or have not properly installed
> the MIME::Parser module.. Install the module in the right
> directory.. you can download the module from CPAN :
> http://search.cpan.org/search?mode=module&query=MIME%3A%3AParser
------------------------------
Date: Sat, 22 Sep 2001 17:14:53 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Newbie problem
Message-Id: <Xns9124B0D4892F6Laocooneudoramailcom@62.153.159.134>
"Younes ALAOUI" <yalaoui@lexbase.fr> wrote in
news:9oi945$d9d$1@wanadoo.fr:
> Hi,
>
> First thanks for the answer.
>
> I have already installed the MIME::Parser Module but the problem is
> that under root all modules are located and not another user even if i
> re-install the modules.
>
I'm not sure what u mean here..The module has to be installed in one of the
directories which the @INC array contains (check ur error msg)..
Since i do not use UNIX i don't know if i can help u if its a diff problem..
------------------------------
Date: Sat, 22 Sep 2001 16:31:40 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Newbie problem
Message-Id: <Xns91248048B9E8echangnetstormnet@207.106.92.86>
Please don't top-post. Put each part your reply after the text to
which you are responding. That way readers can follow the sequence of
the discussion. Notice how Laocoon wrote after your question, not
before.
"Younes ALAOUI" <yalaoui@lexbase.fr> wrote in
news:9oi945$d9d$1@wanadoo.fr:
[Reply moved to proper position.)
> "Laocoon" <Laocoon@eudoramail.com> a écrit dans le message news:
> Xns9123EE6D85142Laocooneudoramailcom@62.153.159.134...
>> "Younes ALAOUI" <yalaoui@lexbase.fr> wrote in
>> news:9ogaib$s4$2@wanadoo.fr:
>>
>> > Hi,
>> >
>> > I have this error and i cannot help myself in resolving, can
>> > someone help me
>> >:
>> >
>> > Can't locate MIME/Parser/Reader.pm in @INC (@INC contains:
>> > /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
>> > /usr/lib/perl5/site_perl/5.6.0/i386-linux
>> > /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl/5.005
>> > /usr/lib/perl5/site_perl) at
>> > /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151.
>> > BEGIN failed--compilation aborted at
>> > /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151.
>> >
>> You have not installed or have not properly installed
>> the MIME::Parser module.. Install the module in the right
>> directory.. you can download the module from CPAN :
>> http://search.cpan.org/search?mode=module&query=MIME%3A%3AParser
>
> Hi,
>
> First thanks for the answer.
>
> I have already installed the MIME::Parser Module but the problem is
> that under root all modules are located and not another user even
> if i re-install the modules.
>
> I noticed that Unix::Syslog had the same problem.
> I think this could be caused by a bad environement.
> But i don't know much things about it.
>
> Can you help more plz??
If the module is installed but the path to the module isn't icluded in
@INC, you should be able to add the path to @INC. First find out
precisely where the module is located. Then
use lib <path to module>;
or
push @INC <path to module>;
(replacing <path to module> with the appropriate string) before using
the module.
--
EBC
------------------------------
Date: Sat, 22 Sep 2001 17:03:32 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: newbie question make from 2 variable fields one with a _
Message-Id: <9oi8ug$4lu$06$1@news.t-online.com>
"Walter Soestbergen" <discusNOSPAM@wanadoo.nl> schrieb im Newsbeitrag
news:9ohejk$pq9$1@news1.xs4all.nl...
> $complete_name = $INPUT{'first_name'}_$INPUT{'last_name'};
>
> what am I doing wrong?
Perl.
Anyway, besides telling you to RTFM, I would suggest doing this:
$complete_name = $INPUT{'first_name'} . '_' . $INPUT{'last_name'};
(The . operator merges strings.)
Now, go read the FAQ, the manual, and perhaps Learning Perl.
Steffen
------------------------------
Date: Sat, 22 Sep 2001 19:25:41 +0200
From: Philip Newton <pne-news-20010922@newton.digitalspace.net>
Subject: Re: Peek and Poke on Perl?
Message-Id: <5aipqt8qen1nu2mooa1790tng4l136143h@4ax.com>
On Sat, 22 Sep 2001 12:45:33 GMT, Gary <gamtci1@mpinet.net> wrote:
> Using a direct memory instruction should raise an exception/memory
> violation.
Depends on the operating system. (Any OS worth its salt would, of
course, stop unprivileged user-level code from accessing random bits of
memory, of course. But peek & poke are most commonly used on lesser OSs
such as DOS or CP/M or other 8-bit chip operatings systems anyway.)
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 22 Sep 2001 11:12:41 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Perhaps some help for a newbie - uninitialized value...
Message-Id: <9oid9p$a6r$1@charity.cs.utexas.edu>
In article <MPG.1616006eb886c187989716@news.megalink.net>,
Technician <travis5765@hotmail.clothes.com> wrote:
>Sorry, i tried to copy and paste it but couldn't get netscape to paste
>from a kedit copy so i attached it.
I'm not saying you *can't* do it or that your reasons weren't
understandable. I'm just saying that a number of people don't like it
when you do that.
By the way, it's good that you're thinking in terms of cutting and
pasting. We get post on this newsgroup from time to time from people
who manually copy code and introduce errors into it in the process, and
then say "where's the error in this code?". And then they're surprised
when we point out the "wrong" error, as if there was any way to tell.
>line 75 "for (my $i = 0; $i <= $ips_shown; $i++) {"
>
>$i is defined and filled in this line. $ips_shown is defined and filled
>on line 18 (my $ips_shown = 8;).
When I run your script, I get this warning:
Use of uninitialized value at attacked_snort.pl line 76.
So, I suggest you look on the following line.
>The problem is, i plan to run this via cron (aka Linux scheduling) and
>any text outputed by the script (errors, etc...) are automaticly mailed
>to the cron owner. if this is run every minute, that would produce 86,400
>messages per day.
Wow, your days seem to be about 60 times as long as mine. Mine only
have 1440 minutes in them. :-)
But yes, 1440 messages a day is still annoying.
>I have tried removing the line "use strict" but this had no affect.
Usually removing the "use strict" is not the best plan. You want to
track down your problems and fix them, not tell perl to pretend the
problems don't exist.
>So $ips[$i] would have to be uninitialized to give this error. As i
>stated, there is currently no entry in the requested log that matches the
>query so $ips[$i] is uninitialized at the current moment.
Exactly.
>Now, to correct this, i should be able to add a if statment testing if
>$ips[$i] is null then set $ips[$i] = "000.000.000.000".
:
:
>for (my $i = 0; $i <= $ips_shown; $i++) {
> if (!$ips[$i]) {$ips[$i] = "000.000.000.000";}
> print OUT "<li>$ips[$i]</li>";
>}
That would work. You could just not print anything if it's undefined:
if (defined $ips[$i])
{
print OUT "<li>$ips[$i]</li>";
}
Or (shorter) this:
print OUT "<li>$ips[$i]</li>" if defined $ips[$i];
- Logan
--
"Everybody
Loves to see
Justice done
On somebody else" ( Bruce Cockburn, "Justice", 1981 )
------------------------------
Date: 22 Sep 2001 17:48:59 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: perl, lvalues, rvalues, and operators
Message-Id: <9oiiub$df2o7$1@fu-berlin.de>
Michael Slass <mikesl@wrq.com> wrote:
> I'm coming from a C background, working my way through the excersises
> in _Learning Perl_, and am having a bit of trouble wrapping my mind
> around a particular perl-ish concept.
> If you want to do regexp substitution on a string, of course you do
> $mystring =~ s/regex/subst/
> This assumes that mystring is an lvalue, because it does the
> substitution in place. Is there any kind of regexp substituion
> operator that can work on rvalues - that is, use of this operator
> doesn't change the value on the left, but instead the entire
> expression returns a value (the string as processed by the
> substitution operator)?
> so if the mystery operator is ##, I could do:
> $mystring = ($some_constant_string ## s/regex/subst/)
others told you how to do it
> Why I want this - and perhaps the gurus will find the flaw in my logic
> here:
> Given a subroutine foo() that returns a string, I would like to call
> the routine, mangle the output, and print it in one swell foop:
> print foo($arg, $notherarg) =~ s/regex/subst/;
you can do:
print map {s/regex/subst/;$_} foo($arg, $notherarg);
hth, tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Sat, 22 Sep 2001 10:49:55 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Schwartzian Transform problem
Message-Id: <hv1r7.34652$TN5.4064676@news20.bellglobal.com>
"Steffen Müller" <tsee@gmx.net> wrote in message
news:9ohop3$98l$06$1@news.t-online.com...
> there
> haven't been a lot of Godzilla-isms around in a while - umm, that's not a
> problem, it's a feature!
>
> Steffen
>
Strange how the disappearance corresponds with the beginning of high
school...
Matt
------------------------------
Date: Sat, 22 Sep 2001 15:58:25 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Schwartzian Transform problem
Message-Id: <s6dpqtgrnln4t2m42s66smjofejpnskk06@4ax.com>
Matt Garrish wrote:
>> there
>> haven't been a lot of Godzilla-isms around in a while - umm, that's not a
>> problem, it's a feature!
>Strange how the disappearance corresponds with the beginning of high
>school...
Well, she claims to be an English teacher. I have no reason to doubt
that. (Or was it professor?)
--
Bart.
------------------------------
Date: Sat, 22 Sep 2001 14:31:42 GMT
From: vze26dpn <peter.korman@verizon.net>
Subject: Re: win32 stat in directory with 4682 files
Message-Id: <3BACA0CC.11D12860@verizon.net>
Eric Bohlman wrote:
readdir() is very fast. stat() is a pig.
>
> I don't see anything that's likely to be particularly slow in your code.
> You might try putting a time printout right after the readdir() and see
> how much of the time that takes. It looks like most of your time is being
> spent in readdir() and stat(), and there's not much you can do about them
> (those Perl functions just translate directly into calls to the OS).
------------------------------
Date: Sat, 22 Sep 2001 14:34:03 GMT
From: vze26dpn <peter.korman@verizon.net>
Subject: Re: win32 stat in directory with 4682 files
Message-Id: <3BACA159.5241E67@verizon.net>
"Dr. Peter Dintelmann" wrote:
> Hi Peter,
>
> "Peter Korman" <peter_korman@lotus.com> wrote in message
> news:3BAB4D53.A820FB65@lotus.com...
> How would one speed this up?
> ---------------------------------------------------------
> use cwd;
> @when=localtime();
> print $when[2], ":" , $when[1], ":" , $when[0];
> chdir "G:/ENGLISH/WIN2000/ADV_SERV/I386";
> opendir D, ".";
> @direntries=readdir(D);
> foreach $i (@direntries)
> {
>
> maybe I am wrong but I assume that it is faster to read an
> entry at a time (because you are not building a list first)
>
> while (defined(my $i = readdir D))
> {
> }
>
> Just give it a try.
>
> Regards,
>
> Peter Dintelmann
Yea. It looked worth a try. But it didn't help.
Cheers,
--JPK
------------------------------
Date: Sat, 22 Sep 2001 15:23:54 GMT
From: vze26dpn <peter.korman@verizon.net>
Subject: Re: win32 stat in directory with 4682 files
Message-Id: <3BACAD06.3194899E@verizon.net>
I'm Peter Korman. I'm working at home through verizon's news server.
Dave Tweed wrote:
> Peter Korman wrote:
> > How would one speed this up?
>
> For one thing, posting without HTML would make it easier for people to
> help you.
hmmm... Didn't realize that. If the netscape dialog box under
linux acts the same as the one under NT I'll answer 'text only'.
I just now selected everything in this message and did a
"format -- remove all styles" but I don't know if that will do it.
>
> > 10:15:56.......................10:17:17
>
> So you're stat()ing 4600 files in 81 seconds, or about 56.8 stats/sec.
>
> Since you're not doing anything with the information anyway, I'd take
> out the call to stat() :-)
So would I if this was not just a test case. I narrowed it down to stat()
being the pig. But stat is what I really need to do. I didn't see anything
in the 3rd edition camel book or in 'a mess o' google searches to
suggest a way around it.
> There's nothing else you can do from inside Perl to make stat() any
> faster. Try a different OS? Under NT, the filesystem runs as a separate
> process, so each stat() causes at least two (and maybe more) context
> switches.
I would gladly get divorced from all Micro$oft code. I just can't afford
the alimony payments;-)
> Perhaps Win32::File provides an interface that would let you get the
> information you need all in one go. But then your script would be tied
> to Win32 machines (and maybe that's OK with you).
>
> -- Dave Tweed
If runtime penalty is no more than 3x, I think that is an acceptable
price to pay for portability for a utility that only taxes my patience.
But this is taking about 30x as long as what I consider reasonable.
My feeling is that I should be able to do all the stats in less time than
it takes dos to complete a 'dir /b /s' on the same directory tree.
What I am doing is a recursive decent with lstat and then running
md5 checksums on all the files in the tree. That takes a long time
even when stat or lstat are not pigs.
Getting (l)stats of all the files in one swell foop is kinda what I'd like
to do. Win32::File has only 2 methods documented in the
ActiveState distribution:
GetAttributes(filename, returnedAttributes)
SetAttributes (filename, newAttributes)
Are there any methods that ActiveState is not listing?
My other option is to look into Win32::API hooks. That would
be really ugly. Before I do that I wanna make sure there is not
a cleaner solution.
I guess this could indicate a need for another perl module, but
4000+ entry directories are not the norm anywhere I've ever
been, so I don't know if the module would serve any wide spread
need.
Thanks for your suggestions.
Cheers,
--JPK
------------------------------
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 1792
***************************************