[30844] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2089 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 31 16:10:00 2008

Date: Wed, 31 Dec 2008 13:09:24 -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           Wed, 31 Dec 2008     Volume: 11 Number: 2089

Today's topics:
        DateTime and Thread::Running conflict skendric@fhcrc.org
    Re: fail running an external C program into a Perl CGI  (Kiss Gabor)
    Re: fail running an external C program into a Perl CGI  yairl@savion.huji.ac.il
    Re: fail running an external C program into a Perl CGI  <syscjm@sumire.gwu.edu>
    Re: fail running an external C program into a Perl CGI  (Kiss Gabor)
    Re: hash table usage questions <tzz@lifelogs.com>
    Re: hash table usage questions sln@netherlands.com
    Re: hash table usage questions sln@netherlands.com
    Re: hash table usage questions <tim@burlyhost.com>
    Re: hash table usage questions sln@netherlands.com
    Re: hash table usage questions <tim@burlyhost.com>
    Re: hash table usage questions sln@netherlands.com
    Re: hash table usage questions sln@netherlands.com
    Re: hash table usage questions <tzz@lifelogs.com>
    Re: hash table usage questions sln@netherlands.com
    Re: ISINNET Function (or similar) <mvdwege_public@myrealbox.com>
    Re: ISINNET Function (or similar) <hjp-usenet2@hjp.at>
    Re: ISINNET Function (or similar) <antgoodlife@gmail.com>
    Re: ISINNET Function (or similar) <tzz@lifelogs.com>
    Re: searching for franken <tim@burlyhost.com>
    Re: searching for franken <someone@example.com>
    Re: searching for franken <jurgenex@hotmail.com>
    Re: Unit test that checks for "croak" sln@netherlands.com
        Why not Ruby? <xahlee@gmail.com>
    Re: Why not Ruby? <gnewsg@gmail.com>
    Re: Why not Ruby? <tim@burlyhost.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 31 Dec 2008 09:45:28 -0800 (PST)
From: skendric@fhcrc.org
Subject: DateTime and Thread::Running conflict
Message-Id: <baeedab9-74c7-4ce3-85f0-b9dd2fb2e642@u18g2000pro.googlegroups.com>

how do i trouble-shoot this?  conceptually, how can one module
(Thread::Running) hammer Perl's ability to poke through the file
system?

guru> cat test
#!/usr/bin/perl
use DateTime;
use Thread::Running;
my $dt = DateTime->now( time_zone => 'local' );
guru>./test
Could not find file for 'DateTime::TimeZone::Local::Unix' at /usr/lib/
perl5/site_perl/5.8.8/load.pm line 256.
guru>

gur
u> cat test
#!/usr/bin/perl
use DateTime;
#use Thread::Running;
$dt = DateTime->now( time_zone => 'local' );
guru> ./test
guru>

guru> pwd
/usr/lib/perl5/site_perl/5.8.8/DateTime/TimeZone/Local
guru> l Unix.pm
-r--r--r-- 1 skendric users 7239 Nov  7 20:32 Unix.pm
guru>

--sk

stuart kendrick
fhcrc


------------------------------

Date: Wed, 31 Dec 2008 09:17:22 +0000 (UTC)
From: kissg@niif.hu (Kiss Gabor)
Subject: Re: fail running an external C program into a Perl CGI script
Message-Id: <gjfdb2$q3f$1@turmix.ikk.sztaki.hu>

In article <911fe1ab-a8ce-4170-a89b-e64ba28c9f2c@r27g2000vbp.googlegroups.com>,
	yairl@savion.huji.ac.il writes:
>> > I 'm trying to execute a small C program into the Perl CGI working
>> > with apache server and it fail . I used `cmd` , sytem, qx( ) , open

> first thanks to everybody that answered.
> It's a common CGI script running into cgi-bin. I don't think it's a
> permition problem because i can execute shell orders. It's something
> into these C programs that it doesn't work correctly in the webserver
> enviroment.

Why don't you trace apache processes and their children?

Gabor


------------------------------

Date: Wed, 31 Dec 2008 04:31:59 -0800 (PST)
From: yairl@savion.huji.ac.il
Subject: Re: fail running an external C program into a Perl CGI script
Message-Id: <6ab04d2d-73d9-46cf-92bb-0af8ec0dfd16@r36g2000prf.googlegroups.com>

On Dec 31, 11:17=A0am, ki...@niif.hu (Kiss Gabor) wrote:
> In article <911fe1ab-a8ce-4170-a89b-e64ba28c9...@r27g2000vbp.googlegroups=
 .com>,
> =A0 =A0 =A0 =A0 ya...@savion.huji.ac.il writes:
>
> >> > I 'm trying to execute a small C program into the Perl CGI working
> >> > with apache server and it fail . I used `cmd` , sytem, qx( ) , open
> > first thanks to everybody that answered.
> > It's a common CGI script running into cgi-bin. I don't think it's a
> > permition problem because i can execute shell orders. It's something
> > into these C programs that it doesn't work correctly in the webserver
> > enviroment.
>
> Why don't you trace apache processes and their children?
>
> Gabor

I did more debug and i found that the C program running into the CGI
under the webserver user can't read or use the socket then it produce
a null pointer and crash. The script works only under root privileges,
i don't understand how before worked and now not. The problem is
connected to permitions to use sockets. i don't have more time to
waste with it then we'll write a perl module for this task, always
modules work fine...


------------------------------

Date: Wed, 31 Dec 2008 08:07:21 -0600
From: Chris Mattern <syscjm@sumire.gwu.edu>
Subject: Re: fail running an external C program into a Perl CGI script
Message-Id: <slrnglmv4p.lcl.syscjm@sumire.gwu.edu>

On 2008-12-31, yairl@savion.huji.ac.il <yairl@savion.huji.ac.il> wrote:
> On Dec 31, 11:17 am, ki...@niif.hu (Kiss Gabor) wrote:
>> In article <911fe1ab-a8ce-4170-a89b-e64ba28c9...@r27g2000vbp.googlegroups.com>,
>>         ya...@savion.huji.ac.il writes:
>>
>> >> > I 'm trying to execute a small C program into the Perl CGI working
>> >> > with apache server and it fail . I used `cmd` , sytem, qx( ) , open
>> > first thanks to everybody that answered.
>> > It's a common CGI script running into cgi-bin. I don't think it's a
>> > permition problem because i can execute shell orders. It's something
>> > into these C programs that it doesn't work correctly in the webserver
>> > enviroment.
>>
>> Why don't you trace apache processes and their children?
>>
>> Gabor
>
> I did more debug and i found that the C program running into the CGI
> under the webserver user can't read or use the socket then it produce
> a null pointer and crash. The script works only under root privileges,
> i don't understand how before worked and now not. The problem is
> connected to permitions to use sockets. i don't have more time to
> waste with it then we'll write a perl module for this task, always
> modules work fine...

Have you changed what port it opens?  Only root can open a port 
below 1024...


-- 
             Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities


------------------------------

Date: Wed, 31 Dec 2008 17:36:11 +0000 (UTC)
From: kissg@niif.hu (Kiss Gabor)
Subject: Re: fail running an external C program into a Perl CGI script
Message-Id: <gjgaib$5ga$1@turmix.ikk.sztaki.hu>

In article <6ab04d2d-73d9-46cf-92bb-0af8ec0dfd16@r36g2000prf.googlegroups.com>,
	yairl@savion.huji.ac.il writes:
> I did more debug and i found that the C program running into the CGI
> under the webserver user can't read or use the socket then it produce
> a null pointer and crash. The script works only under root privileges,

Eeeeer.... you should always check return value of library functions.

Gabor


------------------------------

Date: Wed, 31 Dec 2008 10:10:19 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: hash table usage questions
Message-Id: <86hc4k8gwk.fsf@lifelogs.com>

On Tue, 30 Dec 2008 10:56:04 -0800 (PST) "freesoft12@gmail.com" <freesoft12@gmail.com> wrote: 

fc> Here are the answers to the questions that Tim, Ted had asked:

fc> My Perl project description:

fc> 1) I get thousands of files (lets call them: TFILES) from a C++
fc> program that prints out all the files, being opened by the program
fc> over a period of time, to a log. Hence there are several TFILES that
fc> are opened many times.

You just need a hash with filenames as keys.  Anything else I mentioned
is overkill (but you should be aware that some day you may need to redo
things, so you should abstract the storage functionality iterate/get/put
functions).

fc> 2) My Perl script analyzes the TFILEs and collects & publishes various
fc> statistics about each of the TFILEs.

fc> 3) the user can specify one or more filters (containing one or more
fc> regular expressions) so that they can see the statistics about a
fc> subset of  TFILES (say, just *.cc and *.cpp files).

fc> 4) the filters can be specified in the foll 3 ways:
fc>    a) on the command line
fc>         - All filters are specified on the command line. Hence, I can
fc> populate the hash table with just the TFILEs that match the filter(s)

fc>    b) interactively, from a Perl-Tk GUI
fc>         - For this case, I need to read in all the TFILEs into the
fc> hash table and show the TFILEs to the user in the GUI. The user then
fc> enters the regular expressions to create a filter file. I apply the
fc> filter file and remove the filtered-out TFILEs from the hash table and
fc> show the reduced hash table to the user again in the GUI.

fc> My Question: My results show that there is quite some time spent in
fc> copying the keys in the hash to the Perl-Tk GUI (once for creating the
fc> filters) and then again, to show the filtered results.

Your biggest delay is probably in populating a list widget with the file
names--something Perl can't really improve.  As a test, append the file
names to a text area and see how much faster the operation is.  I don't
see any of your Perl-Tk code so I can't tell what could be slow, but
eliminating widget updates is a good first step to find performance
bottlenecks in GUIs.

Ted


------------------------------

Date: Wed, 31 Dec 2008 19:23:21 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <b1fnl4tdnb8ss93plfqk5dj8ubh7ak2c1o@4ax.com>

On Tue, 30 Dec 2008 10:56:04 -0800 (PST), "freesoft12@gmail.com" <freesoft12@gmail.com> wrote:

>
>Here are the answers to the questions that Tim, Ted had asked:
>
>My Perl project description:
>
I'm pretty sure I asked the question.

>1) I get thousands of files (lets call them: TFILES) from a C++
>program

There is no such thing as a C++ program. There are only programs
written in C++ (or other languages).

> that prints out all the files, being opened by the program
>over a period of time, to a log.

The executable in question prints out entire files to a log file?
What files are they, and where do they come from? Over and over again
huh? And they are .c or .cc or .cpp files to boot. Thousands of times
over and over and over and over again huh? What about the file names,
same thing.. thousands and thousands of times over and over again?

> Hence there are several TFILES that
>are opened many times.
>
Thousands and thousands of times, over and over again...

>2) My Perl script analyzes the TFILEs and collects & publishes various
>statistics about each of the TFILEs.
>
You havn't got a script, thats why you post here. You never have a script,
thats why you post here. Its pretty clear why you post here...
Now your publishing statistics.

>3) the user can specify one or more filters (containing one or more
>regular expressions) so that they can see the statistics about a
>subset of  TFILES (say, just *.cc and *.cpp files).
>
So the user can specify regular expression filters to parse said thousands
and thousands of said published statistics of said thousands and thousands
of said file's opened by a C++ program. Say like *.c or *.cc or *.cpp or *.cxx..
Not too regy expressionist.

>4) the filters can be specified in the foll 3 ways:
>   a) on the command line
>        - All filters are specified on the command line. Hence, I can
>populate the hash table with just the TFILEs that match the filter(s)
>
You really can't pass in regular expressions from the command line.
For reasons I won't go into, its extremely limited and virtually useless.
The mechanics for such uselessness far outweights the uselessness itself.

>   b) interactively, from a Perl-Tk GUI

Perhaps you should do a native program with real controls using C++.

>        - For this case, I need to read in all the TFILEs into the
>hash table and show the TFILEs to the user in the GUI. The user then
>enters the regular expressions to create a filter file. I apply the
>filter file and remove the filtered-out TFILEs from the hash table and
>show the reduced hash table to the user again in the GUI.
>
But, how do you get all those published statistics for thousands and 
thousands of files, over and over and over.

>My Question: My results show that there is quite some time spent in
>copying the keys in the hash to the Perl-Tk GUI (once for creating the
>filters) and then again, to show the filtered results.
>
Generally, there is no blocking in the control. If you have thousands
and thousands and thousands to populate a list control with, perhaps
a timer will help to populate it with, and/or use messages.

>Regards
>John

As a long, long, long time C programmer, I notice your focus is on C
source files. Statistically speaking, there are only a few categories
that your intentions fall into. One is Source Control type. If not 
actually trying to implement a flavor of your own..., then trying to gleen
results from existing output, possibly a command line version with its own
script language, that spits out reems and reems of data and statistics.

The other is, your just plain nuts.
Its not good enough to spew buzzwords and hypotheticals and expect
thought to be applied, on your behalf, without respect #1 and humility #2.

sln



------------------------------

Date: Wed, 31 Dec 2008 19:42:57 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <2ninl4ds5ndlhud1fvsaqbnjkmgf3lfg9h@4ax.com>

On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:

>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote: 
>
>s> Why don't you clearly state what your trying to do instead of
>s> grabbing straws and spewing all the buzzwords in the book.
>
>There was nothing in the OP's questions that warranted your rudeness.
>
>s> Not alot of people want to do your work and not get paid for it.  Can
>s> you do my work for me?
>
>You, apparently, assume your time and intelligence are too precious to
>waste helping people for free.  This is not the right forum for you.
>
>Ted
While your Enlish is correct, your grammar punctuates dumb.

sln



------------------------------

Date: Wed, 31 Dec 2008 11:50:48 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: hash table usage questions
Message-Id: <t2Q6l.13177$Ou7.1075@newsfe24.iad>

sln@netherlands.com wrote:

> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com>
> wrote:
> 
>>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote:
>>
>>s> Why don't you clearly state what your trying to do instead of
>>s> grabbing straws and spewing all the buzzwords in the book.
>>
>>There was nothing in the OP's questions that warranted your rudeness.
>>
>>s> Not alot of people want to do your work and not get paid for it. 
>>Can s> you do my work for me?
>>
>>You, apparently, assume your time and intelligence are too precious to
>>waste helping people for free.  This is not the right forum for you.
>>
>>Ted
> 
> While your Enlish is correct, your grammar punctuates dumb.
> 

What the hell is Enlish?

-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

Date: Wed, 31 Dec 2008 20:01:26 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <qrjnl4hkchqg4b7ps2vrbec82c2jdkjk5q@4ax.com>

On Wed, 31 Dec 2008 11:50:48 -0800, Tim Greer <tim@burlyhost.com> wrote:

>sln@netherlands.com wrote:
>
>> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com>
>> wrote:
>> 
>>>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote:
>>>
>>>s> Why don't you clearly state what your trying to do instead of
>>>s> grabbing straws and spewing all the buzzwords in the book.
>>>
>>>There was nothing in the OP's questions that warranted your rudeness.
>>>
>>>s> Not alot of people want to do your work and not get paid for it. 
>>>Can s> you do my work for me?
>>>
>>>You, apparently, assume your time and intelligence are too precious to
>>>waste helping people for free.  This is not the right forum for you.
>>>
>>>Ted
>> 
>> While your Enlish is correct, your grammar punctuates dumb.
>> 
>
>What the hell is Enlish?
I meant En'lish..

sln



------------------------------

Date: Wed, 31 Dec 2008 12:03:24 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: hash table usage questions
Message-Id: <geQ6l.13198$Ou7.4091@newsfe24.iad>

sln@netherlands.com wrote:

> On Wed, 31 Dec 2008 11:50:48 -0800, Tim Greer <tim@burlyhost.com>
> wrote:
> 
>>sln@netherlands.com wrote:
>>
>>> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com>
>>> wrote:
>>> 
>>>>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote:
>>>>
>>>>s> Why don't you clearly state what your trying to do instead of
>>>>s> grabbing straws and spewing all the buzzwords in the book.
>>>>
>>>>There was nothing in the OP's questions that warranted your
>>>>rudeness.
>>>>
>>>>s> Not alot of people want to do your work and not get paid for it.
>>>>Can s> you do my work for me?
>>>>
>>>>You, apparently, assume your time and intelligence are too precious
>>>>to
>>>>waste helping people for free.  This is not the right forum for you.
>>>>
>>>>Ted
>>> 
>>> While your Enlish is correct, your grammar punctuates dumb.
>>> 
>>
>>What the hell is Enlish?
> I meant En'lish..
> 
> sln

Maybe you meant Engrish?  Anyway, before you call someone on their
grammar, you should note the difference between your and you're in your
very next post.  This advice comes at no charge to you, and you're
welcome.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

Date: Wed, 31 Dec 2008 20:09:22 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <h9knl4h4qtrcgn8ltpl1lboqmvu7v2373v@4ax.com>

On Wed, 31 Dec 2008 12:03:24 -0800, Tim Greer <tim@burlyhost.com> wrote:

>sln@netherlands.com wrote:
>
>> On Wed, 31 Dec 2008 11:50:48 -0800, Tim Greer <tim@burlyhost.com>
>> wrote:
>> 
>>>sln@netherlands.com wrote:
>>>
>>>> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com>
>>>> wrote:
>>>> 
>>>>>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote:
>>>>>
>>>>>s> Why don't you clearly state what your trying to do instead of
>>>>>s> grabbing straws and spewing all the buzzwords in the book.
>>>>>
>>>>>There was nothing in the OP's questions that warranted your
>>>>>rudeness.
>>>>>
>>>>>s> Not alot of people want to do your work and not get paid for it.
>>>>>Can s> you do my work for me?
>>>>>
>>>>>You, apparently, assume your time and intelligence are too precious
>>>>>to
>>>>>waste helping people for free.  This is not the right forum for you.
>>>>>
>>>>>Ted
>>>> 
>>>> While your Enlish is correct, your grammar punctuates dumb.
>>>> 
>>>
>>>What the hell is Enlish?
>> I meant En'lish..
>> 
>> sln
>
>Maybe you meant Engrish?

Damn, I would never say that, now your marked as an Asian haterrater..

sln



------------------------------

Date: Wed, 31 Dec 2008 20:18:50 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <moknl41oilsgtsqd4819marr125vhn8hhc@4ax.com>

On Wed, 31 Dec 2008 12:03:24 -0800, Tim Greer <tim@burlyhost.com> wrote:

>sln@netherlands.com wrote:
>
>> On Wed, 31 Dec 2008 11:50:48 -0800, Tim Greer <tim@burlyhost.com>
>> wrote:
>> 
>>>sln@netherlands.com wrote:
>>>
>>>> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com>
>>>> wrote:
>>>> 
>>>>>On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote:
>>>>>
>>>>>s> Why don't you clearly state what your trying to do instead of
>>>>>s> grabbing straws and spewing all the buzzwords in the book.
>>>>>
>>>>>There was nothing in the OP's questions that warranted your
>>>>>rudeness.
>>>>>
>>>>>s> Not alot of people want to do your work and not get paid for it.
>>>>>Can s> you do my work for me?
>>>>>
>>>>>You, apparently, assume your time and intelligence are too precious
>>>>>to
>>>>>waste helping people for free.  This is not the right forum for you.
>>>>>
>>>>>Ted
>>>> 
>>>> While your Enlish is correct, your grammar punctuates dumb.
>>>> 
>>>
>>>What the hell is Enlish?
>> I meant En'lish..
>> 
>> sln
>
[snip]
 ..
> you should note the difference between your and you're in your
>very next post.

You're in your element now and you wan't to tell me something now
but I do'nt kno'w wha't i'ts go'ing to be.

sln



------------------------------

Date: Wed, 31 Dec 2008 14:28:52 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: hash table usage questions
Message-Id: <86zlic6qd7.fsf@lifelogs.com>

On Wed, 31 Dec 2008 19:42:57 GMT sln@netherlands.com wrote: 

s> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:
>> On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote: 

s> Not alot of people want to do your work and not get paid for it.  Can
s> you do my work for me?
>> 
>> You, apparently, assume your time and intelligence are too precious to
>> waste helping people for free.  This is not the right forum for you.

s> While your Enlish is correct, your grammar punctuates dumb.

I'm glad you found time to complain plaintively
while ignoring my point entirely.
We can imagine how tight your schedule must be
to produce such verbal and mental parsimony.

Ted


------------------------------

Date: Wed, 31 Dec 2008 20:30:44 GMT
From: sln@netherlands.com
Subject: Re: hash table usage questions
Message-Id: <uilnl45k1hn37jq406bh11v4ndfmjlcl5e@4ax.com>

On Wed, 31 Dec 2008 14:28:52 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:

>On Wed, 31 Dec 2008 19:42:57 GMT sln@netherlands.com wrote: 
>
>s> On Tue, 30 Dec 2008 09:18:50 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:
>>> On Tue, 30 Dec 2008 01:34:43 GMT sln@netherlands.com wrote: 
>
>s> Not alot of people want to do your work and not get paid for it.  Can
>s> you do my work for me?
>>> 
>>> You, apparently, assume your time and intelligence are too precious to
>>> waste helping people for free.  This is not the right forum for you.
>
>s> While your Enlish is correct, your grammar punctuates dumb.
>
>I'm glad you found time to complain plaintively
>while ignoring my point entirely.
>We can imagine how tight your schedule must be
>to produce such verbal and mental parsimony.
>
>Ted
For you, 1 second.

sln



------------------------------

Date: Wed, 31 Dec 2008 09:22:32 +0100
From: Mart van de Wege <mvdwege_public@myrealbox.com>
Subject: Re: ISINNET Function (or similar)
Message-Id: <863ag4zrcn.fsf@gareth.avalon.lan>

Hans Mulder <hansmu@xs4all.nl> writes:

> One way to check that a network contains an IP addres is to convert all
> three numbers to binary.  If the bitwise "and" of the IP addres and the
> netmask is equal to the network number, then the network contains the
> address:
>
> sub binary { return pack("C4", split(/\./, shift)); }
>
> $ipaddr = "10.16.5.3";
> if ((binary($ipaddr) & binary("255.255.0.0")) eq binary("10.16.0.0")) {
> 	print "$ipaddr is in the network!";
> }
>
> I can understand why the OP prefers to use a module.
>
Why?

Silly question maybe, but I feel using binary ANDs is the most logical
way to handle this. After all, that's *exactly* what the netmask is
for.

Mart

-- 
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.


------------------------------

Date: Wed, 31 Dec 2008 15:43:02 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: ISINNET Function (or similar)
Message-Id: <slrngln17n.o4q.hjp-usenet2@hrunkner.hjp.at>

On 2008-12-31 00:35, Hans Mulder <hansmu@xs4all.nl> wrote:
> Mirco Wahab wrote:
>> Antgoodlife wrote:
>>  sub isInNet {
>>     my @ip  = split /\./, $_[0]; # split ip into net fields
>>     my @net = split /\./, $_[1]; # split network into fields
>>     for( $_[2] =~ /255/g ) {     # iterate over '255' mask fields
>>        return 0 if shift(@ip) ne shift(@net)  # bail if different
>>     }
>>     1
>>  }
>> 
>>  ...
>> 
>> 
>> 
>> suffice? Of course, only for IPV4.
>
> That worked in the early days when the only numbers allowed in a netmask
> were 0 and 255.  In 1993 the rules changed.  Today netmasks can also 
> contain 128, 192, 224, 240, 248, 252 and 254.

The rules changed long before 1993. At the TU Vienna we've had a
(sub)netmask of 255.255.255.128 since at least 1988. You are probably
thinking about "classful routing". Until ca. 1993, the netmask was
implicit in the IP address - if the high byte was between 0 and 127, the
netmask was /8, if the high byte was between 128 and 191, it was /16 and
between 192 and 223 it was /24. Obviously this was only used for global
routing - a flat class A (with 16 million addresses) or class B (with
65536 addresses) network would have been impractical, so there was
always the possibility to split a "net" into "subnets", with arbitrary
subnet masks (our university split their class B network into 512
subnets). Later this was seen as wasteful, and classless routing was
introduced in the backbone, so that intermediate sized networks could be
assigned.

	hp


------------------------------

Date: Wed, 31 Dec 2008 07:37:46 -0800 (PST)
From: Antgoodlife <antgoodlife@gmail.com>
Subject: Re: ISINNET Function (or similar)
Message-Id: <32cb23c2-7d95-4d0f-b496-ad2732c6dbe9@r37g2000prr.googlegroups.com>

On Dec 31, 3:22=A0am, Mart van de Wege <mvdwege_pub...@myrealbox.com>
wrote:
> Hans Mulder <han...@xs4all.nl> writes:
> > One way to check that a network contains an IP addres is to convert all
> > three numbers to binary. =A0If the bitwise "and" of the IP addres and t=
he
> > netmask is equal to the network number, then the network contains the
> > address:
>
> > sub binary { return pack("C4", split(/\./, shift)); }
>
> > $ipaddr =3D "10.16.5.3";
> > if ((binary($ipaddr) & binary("255.255.0.0")) eq binary("10.16.0.0")) {
> > =A0 =A0print "$ipaddr is in the network!";
> > }
>
> > I can understand why the OP prefers to use a module.
>
> Why?
>
> Silly question maybe, but I feel using binary ANDs is the most logical
> way to handle this. After all, that's *exactly* what the netmask is
> for.
>
> Mart
>
> --
> "We will need a longer wall when the revolution comes."
> --- AJS, quoting an uncertain source.

Well, it seems I've actually been able to get the posted module to
work as well as the example above ...  Here's the script incase anyone
has more comments.  Thank you all for your assistance.  (And it works
with .128 and/or other various masks...)

$ipaddr =3D "10.16.127.3";
$network =3D "10.16.0.0";
$netmask =3D "255.255.128.0";

if (isinnet($ipaddr,$network,$netmask)) {
print "$ipaddr is in $network/$netmask";
}
else {
print "$ipaddr not in network";
}

sub isinnet {
 return(1) if ((binary($_[0]) & binary($_[2])) eq binary($_[1]));
}
sub binary { return pack("C4", split(/\./, shift)); }



------------------------------

Date: Wed, 31 Dec 2008 10:22:20 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: ISINNET Function (or similar)
Message-Id: <86d4f88gcj.fsf@lifelogs.com>

On Tue, 30 Dec 2008 11:40:19 -0800 (PST) Antgoodlife <antgoodlife@gmail.com> wrote: 

A> New to perl and this community...Hi all...
A> I've done some javascript / proxy pac work and I was curious if perl
A> has a built in (or if someone can point me to a module) that
A> determines if an IP is in a specific network?  (Similar to proxy.pac
A> isinnet function)

A> For example :

A> #!/usr/bin/perl -w
A> # if ip 10.8.5.3 is in net 10.8.0.0 w/mask 255.255.0.0 return true
A> $ipaddr = "10.8.5.3"
A> print "$ipaddr is in the network!" if isinnet
A> ($ipaddr,"10.8.0.0","255.255.0.0");

A> CIDR notation acceptance is a plus however not required for my
A> question.

Net::Netmask should do what you need, and much more.

Ted


------------------------------

Date: Wed, 31 Dec 2008 00:13:07 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: searching for franken
Message-Id: <oQF6l.25162$hr3.15384@newsfe01.iad>

Tad J McClellan wrote:

> You are not the OP.
> 
> You are Frank.
> 
> The OP was George.

He expects you to keep up with his posting personalities, I guess?
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

Date: Wed, 31 Dec 2008 00:33:04 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: searching for franken
Message-Id: <47G6l.67234$496.65582@newsfe13.iad>

Tad J McClellan wrote:
> Frank <frank@example.invalid> wrote:
>>
>>>>>>   while($html =~ /$what/mg) { # note the /m modifier
>> Pattern modifiers is where you get traction on this.
>>
>> pg 147 :
>>
>> The m//,s///, and qr// operators all accept the following modifers after
>> their final delimiter:
>>
>> /i
>> /s
>> /m
>> /x
>> /o
> 
> 
> Wa' happened to /g ?

You can't use /g with qr//.



John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov


------------------------------

Date: Wed, 31 Dec 2008 01:35:05 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: searching for franken
Message-Id: <vbeml4pvvm7d8pvfke1g4b6osfpck4kuc5@4ax.com>

Tad J McClellan <tadmc@seesig.invalid> wrote:
>Then what did "franken" mean when you wrote it?

Some possibilities:
- the former currency of France, Belgium, Luxembourg, ... (in German)
- the currency of Switzerland (in German)
- the northern part of Bavaria
- the inhabitants of said part of Bavaria
- the people of the Carolingian Empire (called Fränkisches Reich in
German, most famous ruler Carolus Magnus)
- the duchy of Franken
- ....

jue


------------------------------

Date: Wed, 31 Dec 2008 19:59:45 GMT
From: sln@netherlands.com
Subject: Re: Unit test that checks for "croak"
Message-Id: <9gjnl4hm0ft0t0pma0c9osiebntpju9unh@4ax.com>

On Tue, 30 Dec 2008 11:01:59 +0100, "Dr.Ruud" <rvtol+usenet@isolution.nl> wrote:

>Tim Greer wrote:
>> sln@netherlands.com wrote:
>>> Dr.Ruud:
>
>>>> I promote to test the return value of eval.
>>>    ^^^^^^^
>>> what do you mean?
>> 
>> Probably he promotes that method of doing it, unless it meant propose.
>
>I mean "promote". There are known issues in Perl with $@, like $@ 
>loosing a value, like with DESTROY.
>I already proposed @@, so $@[-1] would hold the last one.
>
>And I just hate the decoupled way of "if ($@){}", it is far too distant 
>for my taste. The Perl compiler needs to do crazy things to try to make 
>$@ to be about the previous statement (or block) as much as possible.

Wait, I've known about this for along time. How to catch $@ in its pristine
state. Perhaps and ID, hooked to a state of eval, to be matched later.

sln



------------------------------

Date: Wed, 31 Dec 2008 09:55:23 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Why not Ruby?
Message-Id: <ee5f1b1b-a121-482e-a3c5-2c7b6a2d1ae6@s9g2000prm.googlegroups.com>

Just spent 3 hours looking into Ruby today. Here's my short impression
for those interested.

* Why Not Ruby?
  http://xahlee.org/UnixResource_dir/writ/why_not_Ruby.html

plain text version follows:
--------------------------------------

Why Not Ruby?

Xah Lee, 2008-12-31

Spent about 3 hours looking into Ruby language today.

The articles i read in detail are:

    * Wikipedia: Ruby (programming language)=A8J. Gives general overview.

    * Brief tutorial: "Ruby in Twenty Minutes"
http://www.ruby-lang.org/en/documentation/quickstart/

    * Personal blog by Stevey Yegge, published in 2004-10.
http://steve.yegge.googlepages.com/ruby-tour

The Wikipedia gives the best intro and overview in proper context. The
"Ruby in Twenty Minutes" is just 4 pages. It give you a very concrete
intro to Ruby's syntax and semantics. Stevey Yegge's blog doesn't
teach much and rambles, but provide a little personal view. I read it
because his opinions i respect.

Q: Will you learn Ruby?

No. For practical application, the lang is some 100 times less useful
than each of Perl, Python, PHP, Javascript. For academic study,
functional langs like Mathematica, Haskell, OCaml, erlang, Qz, are far
more interesting and powerful in almost all aspects. Further, there's
also Perl6, NewLisp, Clojure, Scala... With respect to elegance or
power, these modern lang of the past 5 years matches or exceed Ruby.

Q: Do you think Ruby lang is elegant?

Yes. In my opinion, better than Perl, Python, PHP. As a high level
lang, it's far better than Java, C, C++ type of shit. However, i don't
think it is any better than emacs lisp, Scheme lisp, javascript,
Mathematica. Note that Ruby doesn't have a spec, and nor a formal
spec. Javascript has. Ruby's syntax isn't that regular, nor is it
based on a system. Mathemtica's is. Ruby's power is probably less than
Scheme, and probably same as Javascript.

I also didn't like the fact that ruby uses keyword "end" to indicate
code block much as Pascal and Visual Basic, Logo, do. I don't like
that.

Q: Won't Ruby be a interesting learning experience?

No. As far as semantics goes, Ruby is basically identical to Perl,
Python, PHP. I am a expert in Perl and PHP, and have working knowledge
of Python. I already regretted having spent significant amount of time
(roughly over a year) on Python. In retrospect, i didn't consider the
time invested in Python worthwhile. (as it turns out, i don't like
Python and Guido cult, as the lang is going the ways of OOP mumbo-
jumbo with its Python 3 "brand new" future.) There is absolutely
nothing new in Ruby, as compared to Perl, Python, PHP, or Emacs lisp,
Scheme lisp.

Q: Do you recommend new programers to learn Ruby then?

Not particularly. As i mentioned, if you are interested in practical
utility, there's already Perl, PHP, Python, Javascript, which are all
heavily used in the computing industry. If you are interested as a
academic exercise, there's Scheme lisp, and much of functional langs
such as OCaml, Haskell, Mathematica, which will teach you a whole lot
more about computer science, features of language semantics, etc.

Q: Do you condemn Ruby?

No. I think it's reasonably elegant, but today there are too many
languages, so Ruby don't particularly standout for me. Many of them,
are arguably quite more elegant and powerful than Ruby. See:
Proliferation of Computing Languages.



------------------------------

Date: Wed, 31 Dec 2008 12:26:04 -0800 (PST)
From: "Giampaolo Rodola'" <gnewsg@gmail.com>
Subject: Re: Why not Ruby?
Message-Id: <a392efab-b697-4dc1-bd41-83776509f98e@l33g2000pri.googlegroups.com>

On 31 Dic, 18:55, Xah Lee <xah...@gmail.com> wrote:
> Just spent 3 hours looking into Ruby today. Here's my short impression
> for those interested.
>
> * Why Not Ruby?
>  http://xahlee.org/UnixResource_dir/writ/why_not_Ruby.html
>
> plain text version follows:
> --------------------------------------
>
> Why Not Ruby?
>
> Xah Lee, 2008-12-31
>
> Spent about 3 hours looking into Ruby language today.
>
> The articles i read in detail are:
>
>     * Wikipedia: Ruby (programming language)=A8J. Gives general overview.
>
>     * Brief tutorial: "Ruby in Twenty Minutes"http://www.ruby-lang.org/en=
/documentation/quickstart/
>
>     * Personal blog by Stevey Yegge, published in 2004-10.http://steve.ye=
gge.googlepages.com/ruby-tour
>
> The Wikipedia gives the best intro and overview in proper context. The
> "Ruby in Twenty Minutes" is just 4 pages. It give you a very concrete
> intro to Ruby's syntax and semantics. Stevey Yegge's blog doesn't
> teach much and rambles, but provide a little personal view. I read it
> because his opinions i respect.
>
> Q: Will you learn Ruby?
>
> No. For practical application, the lang is some 100 times less useful
> than each of Perl, Python, PHP, Javascript. For academic study,
> functional langs like Mathematica, Haskell, OCaml, erlang, Qz, are far
> more interesting and powerful in almost all aspects. Further, there's
> also Perl6, NewLisp, Clojure, Scala... With respect to elegance or
> power, these modern lang of the past 5 years matches or exceed Ruby.
>
> Q: Do you think Ruby lang is elegant?
>
> Yes. In my opinion, better than Perl, Python, PHP. As a high level
> lang, it's far better than Java, C, C++ type of shit. However, i don't
> think it is any better than emacs lisp, Scheme lisp, javascript,
> Mathematica. Note that Ruby doesn't have a spec, and nor a formal
> spec. Javascript has. Ruby's syntax isn't that regular, nor is it
> based on a system. Mathemtica's is. Ruby's power is probably less than
> Scheme, and probably same as Javascript.
>
> I also didn't like the fact that ruby uses keyword "end" to indicate
> code block much as Pascal and Visual Basic, Logo, do. I don't like
> that.
>
> Q: Won't Ruby be a interesting learning experience?
>
> No. As far as semantics goes, Ruby is basically identical to Perl,
> Python, PHP. I am a expert in Perl and PHP, and have working knowledge
> of Python. I already regretted having spent significant amount of time
> (roughly over a year) on Python. In retrospect, i didn't consider the
> time invested in Python worthwhile. (as it turns out, i don't like
> Python and Guido cult, as the lang is going the ways of OOP mumbo-
> jumbo with its Python 3 "brand new" future.) There is absolutely
> nothing new in Ruby, as compared to Perl, Python, PHP, or Emacs lisp,
> Scheme lisp.
>
> Q: Do you recommend new programers to learn Ruby then?
>
> Not particularly. As i mentioned, if you are interested in practical
> utility, there's already Perl, PHP, Python, Javascript, which are all
> heavily used in the computing industry. If you are interested as a
> academic exercise, there's Scheme lisp, and much of functional langs
> such as OCaml, Haskell, Mathematica, which will teach you a whole lot
> more about computer science, features of language semantics, etc.
>
> Q: Do you condemn Ruby?
>
> No. I think it's reasonably elegant, but today there are too many
> languages, so Ruby don't particularly standout for me. Many of them,
> are arguably quite more elegant and powerful than Ruby. See:
> Proliferation of Computing Languages.

This is not a Ruby group.
I recommend you to go waste your time there.


--- Giampaolo
http://code.google.com/p/pyftpdlib


------------------------------

Date: Wed, 31 Dec 2008 12:35:14 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Why not Ruby?
Message-Id: <6IQ6l.57340$ly1.11422@newsfe19.iad>

Giampaolo Rodola' wrote:

> This is not a Ruby group.
> I recommend you to go waste your time there.

That poster has a frequent habit of cross posting to multiple,
irrelevant news groups.  There's no rhyme or reason to it.  It's best
to just filter the guy's posts.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2089
***************************************


home help back first fref pref prev next nref lref last post