[22752] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4973 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 12 09:06:25 2003

Date: Mon, 12 May 2003 06:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 12 May 2003     Volume: 10 Number: 4973

Today's topics:
        "ndbm store" error on Solaris  <dontspamme@dontspam.com>
    Re: "ndbm store" error on Solaris  <dontspamme@dontspam.com>
    Re: "ndbm store" error on Solaris  <dontspamme@dontspam.com>
    Re: 8255A Chip <PookieMonster@>
    Re: Bloody Java Proselytisers!!! <bik.mido@tiscalinet.it>
    Re: Bloody Java Proselytisers!!! <p.lord@russet.org.uk>
    Re: bootstrap (Anno Siegel)
    Re: check IP address <mgjv@tradingpost.com.au>
    Re: check IP address <farmers@ihug.com.au>
        Client/Server <chip@afcoms.NOSPAM.com>
    Re: Client/Server <josef.moellers@fujitsu-siemens.com>
    Re: command interface (not a shell) <News@LearnQuick.Com>
        egrep exclude (Herb Burnswell)
    Re: How can I pack an IP address into four binary bytes <nobull@mail.com>
        make <bsd_devil@web.de>
    Re: make <bsd_devil@web.de>
    Re: make <tassilo.parseval@rwth-aachen.de>
    Re: make <bsd_devil@web.de>
    Re: Month number being returned is incorrect <jehoshua@my-deja.com>
        Perl & bison. <devulapa@cis.ohio-state.edu>
    Re: Perl & bison. <ndronen@io.frii.com>
        problem with starting path (Math55)
    Re: RegExp  Question <bigj@kamelfreund.de>
        sound module (Todd Smith)
    Re: Try to find a hash element but no luck (Sara)
    Re: Try to find a hash element but no luck <tassilo.parseval@rwth-aachen.de>
    Re: Why is POE idle most of the time? (jtd)
    Re: Why Perl is so difficult to learn? <bernard.el-hagin@DODGE_THISlido-tech.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 12 May 2003 03:47:24 -0700
From: "Shehzaad Nakhoda" <dontspamme@dontspam.com>
Subject: "ndbm store" error on Solaris 
Message-Id: <l2Lva.6$tA3.151@news.oracle.com>

Hello,

I've run into a problem with periodic errors with the following error
message that cause my perl program to exit abnormally:

ndbm store returned -1, errno 27, key
"1052131392769|217.225.201.81|56:1052131056:156
948" at <perl file path> line <perl file name>, <INFILE> line 204057.

I'm using a dbm backed hash, which does grow to about 345MB file size (as
seen by the 'du' command). Running repeatedly causes the exact same error
with the same key. I should also mention that the hash file size shown by
'ls' is quite humungous: 936187058176 (over 900 Gb). Disk space is plentiful
and close to half full only.

The particular line of code is basically trying to assign a value to a key
in the hash.

$self->${ext_hash_ref}->${key} = $data

The error above is produced on Solaris 5.6 (perl version 5.6.1).

Running the same program on Solaris 5.8 causes a similar error, except the
offending key and hash file size are different and errno is 2.

It seems Perl is spitting out this message when seeing an error returned by
the dbm_store library call.

I have also previously seen errno 9 but that seems a spurious case and I
haven't been able to reproduce that.

I tried figuring out the meaning of the error codes by looking in
/usr/include/sys/errno.h, but I'm quite confused because of the following
#define ENOENT  2       /* No such file or directory            */
#define EBADF   9       /* Bad file number                      */
#define EFBIG   27      /* File too large                       */


The question is is this the right place to look for clues on the meaning of
the error codes? Does the DBM implementation on Solaris (ndbm) have any
implicit limitations on size? How does Perl extract the error returned by
the dbm library. Does it use the DBM_Error function correctly as documented?

Could errno 27 and errno 2 symptoms of the same problem? Does the DBM
implementation on Solaris 5.6 and 5.8 differ enough to cause this
discrepancy?

I would appreciate any insight that Solaris and/or Perl gurus may have on
this issue.

I can be reached at "shehzaad at cs dot stanford dot edu"

Thanks in advance.
Shehzaad








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

Date: Mon, 12 May 2003 03:50:54 -0700
From: "Shehzaad Nakhoda" <dontspamme@dontspam.com>
Subject: Re: "ndbm store" error on Solaris 
Message-Id: <G5Lva.7$tA3.124@news.oracle.com>

Correction:

Errno 27 is seen on Solaris 5.8, Errno 2 is seen on Solaris 5.6

Thanks.
Shehzaad

"Shehzaad Nakhoda" <dontspamme@dontspam.com> wrote in message
news:l2Lva.6$tA3.151@news.oracle.com...
> Hello,
>
> I've run into a problem with periodic errors with the following error
> message that cause my perl program to exit abnormally:
>
> ndbm store returned -1, errno 27, key
> "1052131392769|217.225.201.81|56:1052131056:156
> 948" at <perl file path> line <perl file name>, <INFILE> line 204057.
>
> I'm using a dbm backed hash, which does grow to about 345MB file size (as
> seen by the 'du' command). Running repeatedly causes the exact same error
> with the same key. I should also mention that the hash file size shown by
> 'ls' is quite humungous: 936187058176 (over 900 Gb). Disk space is
plentiful
> and close to half full only.
>
> The particular line of code is basically trying to assign a value to a key
> in the hash.
>
> $self->${ext_hash_ref}->${key} = $data
>
> The error above is produced on Solaris 5.6 (perl version 5.6.1).
>
> Running the same program on Solaris 5.8 causes a similar error, except the
> offending key and hash file size are different and errno is 2.
>
> It seems Perl is spitting out this message when seeing an error returned
by
> the dbm_store library call.
>
> I have also previously seen errno 9 but that seems a spurious case and I
> haven't been able to reproduce that.
>
> I tried figuring out the meaning of the error codes by looking in
> /usr/include/sys/errno.h, but I'm quite confused because of the following
> #define ENOENT  2       /* No such file or directory            */
> #define EBADF   9       /* Bad file number                      */
> #define EFBIG   27      /* File too large                       */
>
>
> The question is is this the right place to look for clues on the meaning
of
> the error codes? Does the DBM implementation on Solaris (ndbm) have any
> implicit limitations on size? How does Perl extract the error returned by
> the dbm library. Does it use the DBM_Error function correctly as
documented?
>
> Could errno 27 and errno 2 symptoms of the same problem? Does the DBM
> implementation on Solaris 5.6 and 5.8 differ enough to cause this
> discrepancy?
>
> I would appreciate any insight that Solaris and/or Perl gurus may have on
> this issue.
>
> I can be reached at "shehzaad at cs dot stanford dot edu"
>
> Thanks in advance.
> Shehzaad
>
>
>
>
>
>




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

Date: Mon, 12 May 2003 03:56:54 -0700
From: "Shehzaad Nakhoda" <dontspamme@dontspam.com>
Subject: Re: "ndbm store" error on Solaris 
Message-Id: <gbLva.8$tA3.101@news.oracle.com>

I must be spacing out. Please ignore the last message. The original post is
correct. (i.e. errno 27 ==> Solaris 5.6, errno 2 ==> Solaris 5.8)

<your favorite curse>

Thanks.

"Shehzaad Nakhoda" <dontspamme@dontspam.com> wrote in message
news:G5Lva.7$tA3.124@news.oracle.com...
> Correction:
>
> Errno 27 is seen on Solaris 5.8, Errno 2 is seen on Solaris 5.6
>
> Thanks.
> Shehzaad
>
> "Shehzaad Nakhoda" <dontspamme@dontspam.com> wrote in message
> news:l2Lva.6$tA3.151@news.oracle.com...
> > Hello,
> >
> > I've run into a problem with periodic errors with the following error
> > message that cause my perl program to exit abnormally:
> >
> > ndbm store returned -1, errno 27, key
> > "1052131392769|217.225.201.81|56:1052131056:156
> > 948" at <perl file path> line <perl file name>, <INFILE> line 204057.
> >
> > I'm using a dbm backed hash, which does grow to about 345MB file size
(as
> > seen by the 'du' command). Running repeatedly causes the exact same
error
> > with the same key. I should also mention that the hash file size shown
by
> > 'ls' is quite humungous: 936187058176 (over 900 Gb). Disk space is
> plentiful
> > and close to half full only.
> >
> > The particular line of code is basically trying to assign a value to a
key
> > in the hash.
> >
> > $self->${ext_hash_ref}->${key} = $data
> >
> > The error above is produced on Solaris 5.6 (perl version 5.6.1).
> >
> > Running the same program on Solaris 5.8 causes a similar error, except
the
> > offending key and hash file size are different and errno is 2.
> >
> > It seems Perl is spitting out this message when seeing an error returned
> by
> > the dbm_store library call.
> >
> > I have also previously seen errno 9 but that seems a spurious case and I
> > haven't been able to reproduce that.
> >
> > I tried figuring out the meaning of the error codes by looking in
> > /usr/include/sys/errno.h, but I'm quite confused because of the
following
> > #define ENOENT  2       /* No such file or directory            */
> > #define EBADF   9       /* Bad file number                      */
> > #define EFBIG   27      /* File too large                       */
> >
> >
> > The question is is this the right place to look for clues on the meaning
> of
> > the error codes? Does the DBM implementation on Solaris (ndbm) have any
> > implicit limitations on size? How does Perl extract the error returned
by
> > the dbm library. Does it use the DBM_Error function correctly as
> documented?
> >
> > Could errno 27 and errno 2 symptoms of the same problem? Does the DBM
> > implementation on Solaris 5.6 and 5.8 differ enough to cause this
> > discrepancy?
> >
> > I would appreciate any insight that Solaris and/or Perl gurus may have
on
> > this issue.
> >
> > I can be reached at "shehzaad at cs dot stanford dot edu"
> >
> > Thanks in advance.
> > Shehzaad
> >
> >
> >
> >
> >
> >
>
>




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

Date: Sun, 11 May 2003 23:07:29 -0500
From: Pookie <PookieMonster@>
Subject: Re: 8255A Chip
Message-Id: <le7ubvkm4n6102f4af7tp4tlcdqpan25o1@4ax.com>

On 11 May 2003 18:06:08 GMT, Joona I Palaste <palaste@cc.helsinki.fi>
wrote:

>Herbert Andress <handress@spam.blokcck> scribbled the following
>on comp.lang.c:
>> Is it likely that a small picoJava II embedded system would include an
>> 8255 chip?
>
>What was... <looks at the crosspost list> oh, never mind.

It would depend what they're doing with it, but it doesn't sound
likely.


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

Date: Mon, 12 May 2003 09:10:39 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <l3iubvgemh2p6ub4h5rd4bu9bj9uga3kqb@4ax.com>

On 9 May 2003 13:09:36 GMT, Rudolf Polzer
<denshimeiru-sapmctacher@durchnull.ath.cx> wrote:

>I'll redo the comparison with the n queens problem, even including
>languages like Prolog - and will post the results. It might be
>interesting.

Then you might be interested in giving a peek into this website:
<http://www.bagley.org/~doug/shootout/>


Michele
-- 
$\=q.,.,$_=q.print'  ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;


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

Date: 12 May 2003 13:02:51 +0100
From: Phillip Lord <p.lord@russet.org.uk>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <vfwugwqsno.fsf@rpc71.cs.man.ac.uk>

>>>>> "Charlton" == Charlton Wilbur <cwilbur@mithril.chromatico.net> writes:

  Charlton> Phillip Lord <p.lord@russet.org.uk> writes:

  >> >>>>> "Charlton" == Charlton Wilbur
  >> >>>>> <cwilbur@mithril.chromatico.net>
  >> writes:
  >>
  Charlton> My point was not to argue language advocacy, Charlton>
  >> but to point out the reasons that Java is so popular.  It
  >> Charlton> doesn't give the good programmer anything that he can't
  >> Charlton> find in Perl or C++ *spit* or C or Ruby or Python, but
  >> it Charlton> does have real benefits for mediocre programmers.
  >>
  >> As far as I could tell from your post, many, or most, of the
  >> benefits would also cover talented programmers as well surely?

  Charlton> Some of the benefits, yes.  But the restrictions that add
  Charlton> support for mediocre programmers also restrict good
  Charlton> programmers.  Bondage-and-discipline syntax and semantics
  Charlton> are not a benefit to good programmers, and the restriction
  Charlton> to a single paradigm (object-orientation with the
  Charlton> model-view-component pattern) that's largely encouraged by
  Charlton> the standard library is certainly not beneficial to a good
  Charlton> programmer.


It depends what you need. If I am writing code that needs to get up
and running quickly, then I would agree with you. Java's privacy
restrictions, for instance, can be a pain in the ass. 

There again, if I am writing code that I want someone else to be able
to work with, then its a good thing. 

Personally I would argue that being restricted to one paradigm is less
of a problem for a good programmer, as a good programmer should be
able to translate their favourite idioms freely between paradigms. 

Phil


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

Date: 12 May 2003 08:49:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: bootstrap
Message-Id: <b9nn67$oh0$1@mamenchi.zrz.TU-Berlin.DE>

Sisyphus <kalinabears@hdc.com.au> wrote in comp.lang.perl.misc:
> Hi,
> I note that some modules (extensions) contain:
> bootstrap This_Module;
> while others contain:
> bootstrap This_Module $VERSION;
> 
> What determines whether the "$VERSION" needs to be bootstrapped ?

The bootstrap function itself doesn't use the $VERSION argument.
In fact, bootstrap() does nothing more than do some (quite a bit of)
preparation, and then call a function all XS modules must by convention
define.  This function is called with the same parameter list as
bootstrap() itself.  What it does with its parameters is entirely up
to the programmer, there is nothing that can be said in general.

> (I built the PAR module with Compress-Zlib-1.14 installed on my computer and
> it worked fine. I then updated Compress-Zlib to version 1.19. After that,
> whenever I run any pp-built executable, I get the fatal error
> "Compress::Zlib object version 1.14 does not match bootstrap parameter
> 1.19....".

So apparently Compress::Zlib checks the version it is supposed to
build against the version actually found.  Seems reasonable.

> One way to fix that is to recompile PAR.

That would be the correct way.

> As an alternative, I tried altering the bootstrap in Zlib.pm from:
> bootstrap Compress::Zlib $VERSION;
> to:
> bootstrap Compress::Zlib;
> 
> I then rebuilt the ("Hello world") executable with pp - but  it produced an
> error when I ran the executable. It was difficult to tell just what that
> error was because it also crashed the computer, and I didn't have time to
> read the error message. As a result of that crash I deduce that the
> inclusion of "$VERSION" in the bootstrap command is of some significance -
> hence my question.)

Well, it looks like the versions of Compress::Zlib are in actual
fact incompatible.  No use cheating...

Anno


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

Date: Mon, 12 May 2003 02:19:26 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: check IP address
Message-Id: <slrnbbu15e.3gj.mgjv@verbruggen.comdyn.com.au>

[Please, do not top-post]

On Mon, 12 May 2003 08:32:23 +1000,
	Hugo <farmers@ihug.com.au> wrote:
> "Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
> news:slrnbbt7vo.kua.sholden@flexal.cs.usyd.edu.au...
>> On Mon, 12 May 2003 04:58:23 +1000, Hugo <farmers@ihug.com.au> wrote:
>> > Hi,
>> >
>> > I am trying to write a perl script to check if the ip address is match
> the
>> > one in a file.txt e.g. 192.12.2.1. The code I use is:
>> >
>> > if ($ARGV[0] != $newhash{$hostname}) {print "something here"}
>> >
>> > However, the code checks anything up to 192.1 and it doesn't matter what
> you
>> > type after that i.e. it says 192.12sadasdsadb is the same as 192.12.2.1
>> > ??????
>>
>> If you want to compare strings use the string comparison ops ('ne' in
>> this case).
>>
>> Read the perlop documentation (perldoc perlop).
>
> umm.....I don't think it is the problem with ne, eq, ==, !=.......etc As I
> can successfully check the so called hostname <----"string"  (with "eq"). If
> use ne or eq my script even can't recognize any ip address.

Yes, the problem is with the operator you use to check for equality. A
dotted quad IP address is a string. You use eq and ne to compare
strings. If you enable warnings, Perl will even tell you about it.

I am here assuming that the values of %newhash are dotted quad IP
addresses.

> Is it necessary to "split" the "." ? The dot is char. or number?

There is no need to split anything. The whole address is a string.
Treat it like one.

Martien
-- 
                        | 
Martien Verbruggen      | I took an IQ test and the results were
Trading Post Australia  | negative.
                        | 


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

Date: Mon, 12 May 2003 21:58:35 +1000
From: "Hugo" <farmers@ihug.com.au>
Subject: Re: check IP address
Message-Id: <b9o29k$4d4$1@lust.ihug.co.nz>

cool~~in fact you guys are correct. ^^

Also, after I change to use "ne" I found that there is a different between
using telnet (port: 23) and SSH (port: 22). Don't know how to explain but
the test result will be different even with the same arguments.

So, finially I change the condition to test if something is "eq" something,
and the problem has been fixed!!

thanks again for anyone's help ^^


"James E Keenan" <jkeen@concentric.net> wrote in message
news:b955da04.0305111649.2af0317d@posting.google.com...
> "Hugo" <farmers@ihug.com.au> wrote in message
news:<b9m6go$l1c$1@lust.ihug.co.nz>...
> > Hi,
> >
> > I am trying to write a perl script to check if the ip address is match
the
> > one in a file.txt e.g. 192.12.2.1. The code I use is:
> >
> > if ($ARGV[0] != $newhash{$hostname}) {print "something here"}
> >
> > However, the code checks anything up to 192.1
>
> because != is the operator for numerical inequality: "is not equal
> to".  It expects a number on the right hand side.  You want a regular
> expression.
>
> What you want is probably something like this:
>     if ($ARGV[0] !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) {print
> "something here"}
> (Of the top of my head I don't know the exact spec for an ip address,
> but this is close enough to get you started.




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

Date: Mon, 12 May 2003 12:38:31 GMT
From: "Chip" <chip@afcoms.NOSPAM.com>
Subject: Client/Server
Message-Id: <bBMva.17120$Jf.8454856@news1.news.adelphia.net>

I am trying to have a client send a directory "/home/chip/"
to a server and have the server return the contents of the
directory to the client.

here is what I have for the server:

#!/usr/bin/perl
#
# server.pl
#
use IO::Socket;
$sock = new IO::Socket::INET(   LocalPort => 1500,
                                Type => SOCK_STREAM,
                                Listen => 10,
                                Reuse => 1
                              ) or die "can't create socket\n";
print "waiting...\n";
while($datasock = $sock->accept())
{
        print "got a connection\n";
        $filename = <$datasock>;
        print "Received $filename";
        chop $filename;
        opendir(DIRHANDLE, "$filename");
        @filelist=readdir(DIRHANDLE);
                while(<DIRHANDLE>)
                {
                        print $datasock $_;
                }
        close(DIRHANDLE);
        close($datasock);
}


and here is what I have for the client:

#!/usr/bin/perl
#
#  client.pl
#
use IO::Socket;
$socket = IO::Socket::INET->new (PeerAddr => 'localhost',
                                 PeerPort => 1500,
                                 Proto => "tcp",
                                 Type => SOCK_STREAM)
                                 or die "can't create socket\n";
print "got a socket\n";
print "enter a directory ";
chop($fn = <STDIN>);
print $socket "$fn\n";
print while(<$socket>);
print "***done with $fn\n";
close ($socket);

As you can guess I'm not getting anything back.  Any and all help
would be greatly appriceated.

Thanks
Chip




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

Date: Mon, 12 May 2003 14:50:50 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Client/Server
Message-Id: <3EBF98AA.15E65B26@fujitsu-siemens.com>

Chip wrote:

> while($datasock =3D $sock->accept())
> {
>         print "got a connection\n";
>         $filename =3D <$datasock>;
>         print "Received $filename";
>         chop $filename;
>         opendir(DIRHANDLE, "$filename");
>         @filelist=3Dreaddir(DIRHANDLE);
>                 while(<DIRHANDLE>)


# Educated guess:
		  foreach (@filelist)
# End educated guess

>                 {
>                         print $datasock $_;
>                 }
>         close(DIRHANDLE);
>         close($datasock);
> }

Josef
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Mon, 12 May 2003 01:19:16 GMT
From: "Herb Martin" <News@LearnQuick.Com>
Subject: Re: command interface (not a shell)
Message-Id: <oECva.71522$8e7.3417894@twister.austin.rr.com>

> I was reading the Description of cpan - easily interact with CPAN from the
> command line. it says This "script provides a command interface (not a
> shell) to CPAN.pm." sorry for the novice question. what is the differenc

Someone else may be able to offer some extremely
picky distinction but I don't believe the words are that
well defined -- they are established rather from common
usage.

I think of CPAN as a shell (because I enter it to execute
certain commands and leave it to return to my ordinary
command interface.)  I don't worry that the docs claim it
is a "command interface" and "not a shell", I just use it.

Herb Martin
Try ADDS for great Weather too:
http://adds.aviationweather.noaa.gov/projects/adds




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

Date: 11 May 2003 21:12:37 -0700
From: patyoung13@hotmail.com (Herb Burnswell)
Subject: egrep exclude
Message-Id: <3b38898e.0305112012.7af3e9b8@posting.google.com>

Hi All,

I am a novice programmer and have been trying to figure out the best
way to approach the following issue.  I have a perl script that checks
nightly build logs for all of our build platforms.  It's pretty simple
but I would like to add to it.  Right now I do a:

chdir $builddir;

	$commandline = "find . -type f -name *.log | xargs egrep -i error";
	system ($commandline); 


What I would like to do is exclude certain strings from the grep
without having to pipe them in to additional greps like:

find . -type f -name *.log | xargs egrep -i error | egrep -i -v
\"First string I want to exclude\" | egrep -i -v \"Second string I
want to exclude\" | .......


Ideally, I would like to add an exclude variable for each platform
like:


foreach (@platforms)
{

	if ($_ eq "aix")
	{

	$commandline = "find . -type f -name *.log | xargs egrep -i error |
egrep -i -v $aix_exclude_strings";
	system ($commandline); 

	}

	elsif ($_ eq "irix")
	{

	$commandline = "find . -type f -name *.log | xargs egrep -i error |
egrep -i -v $irix_exclude_strings";
	system ($commandline); 

	}

}

I have tried this many ways but have been unable to get it to work. 
Is this even possible?  If not is there a way to have it read a file
that has all the platform exclude strings?  Can anyone point me in the
right direction?  Am I going about this all wrong?  Any assistance is
greatly appreciated.

Thanks in advance,

Herb


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

Date: 12 May 2003 12:41:31 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: How can I pack an IP address into four binary bytes ?
Message-Id: <u9el34bast.fsf@wcl-l.bham.ac.uk>

Mina Naguib <spam@thecouch.homeip.net> top-posts:

[ Please don't top-post.  It is rude. ]

> Anthony wrote:
> > For example if  my IP address is
> > 234.243.09.3
> > how do I verify the number < 255 and  then write it to  a file as a
> > four binary bytes ?

> You can use the inet_aton function provided in the Socket library:

> Another alternative is to pack it yourself.

> $packed = pack("C4", split(/\./, $ip));

Neiher of the above actually validate that $ip is in dotted-quad
format.

If you already know $ip is a valid dotted-quad representation of a
32-bit IP address an entertaining (but definitely _not_ recommended)
alternative is:

$packed = eval($ip);

Just to reiterate, I'm _not_ suggesting anyone do this.  I mention it
only for entertainment value.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 12 May 2003 12:52:58 +0200
From: "BSD" <bsd_devil@web.de>
Subject: make
Message-Id: <b9nqv1$l2mbk$1@ID-172702.news.dfncis.de>

I am running RedHat 9.0 ...
I am trying
[root@Linux root]# perl -MCPAN -e 'install Bundle::CPAN'
 ...
Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Warning: links not found in PATH
Where is your links program? []
Where is your wget program? [/usr/bin/wget]
Where is your ncftpget program? [/usr/bin/ncftpget]
Where is your ftp program? [/usr/bin/ftp]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]
 .....
<skip>
I checked make ...
[root@Linux root]# which make
/usr/bin/make

what could be wrong? or should I ignore the warning?

BSD




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

Date: Mon, 12 May 2003 12:57:56 +0200
From: "BSD" <bsd_devil@web.de>
Subject: Re: make
Message-Id: <b9nr8a$ktsch$1@ID-172702.news.dfncis.de>

sorry I mean the links program.

"BSD" <bsd_devil@web.de> wrote in message
news:b9nqv1$l2mbk$1@ID-172702.news.dfncis.de...
> I am running RedHat 9.0 ...
> I am trying
> [root@Linux root]# perl -MCPAN -e 'install Bundle::CPAN'
> ...
> Where is your gzip program? [/bin/gzip]
> Where is your tar program? [/bin/tar]
> Where is your unzip program? [/usr/bin/unzip]
> Where is your make program? [/usr/bin/make]
> Warning: links not found in PATH
> Where is your links program? []
> Where is your wget program? [/usr/bin/wget]
> Where is your ncftpget program? [/usr/bin/ncftpget]
> Where is your ftp program? [/usr/bin/ftp]
> What is your favorite pager program? [/usr/bin/less]
> What is your favorite shell? [/bin/bash]
> .....
> <skip>
> I checked make ...
> [root@Linux root]# which make
> /usr/bin/make
>
> what could be wrong? or should I ignore the warning?
>
> BSD
>
>




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

Date: 12 May 2003 10:16:33 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: make
Message-Id: <b9nsa1$n0o$1@nets3.rz.RWTH-Aachen.DE>

Also sprach BSD:

> I am running RedHat 9.0 ...
> I am trying
> [root@Linux root]# perl -MCPAN -e 'install Bundle::CPAN'
> ...
> Where is your gzip program? [/bin/gzip]
> Where is your tar program? [/bin/tar]
> Where is your unzip program? [/usr/bin/unzip]
> Where is your make program? [/usr/bin/make]
> Warning: links not found in PATH
> Where is your links program? []
> Where is your wget program? [/usr/bin/wget]
> Where is your ncftpget program? [/usr/bin/ncftpget]
> Where is your ftp program? [/usr/bin/ftp]
> What is your favorite pager program? [/usr/bin/less]
> What is your favorite shell? [/bin/bash]
> .....
><skip>
> I checked make ...
> [root@Linux root]# which make
> /usr/bin/make
> 
> what could be wrong? or should I ignore the warning?

Ignore it. On first invocation CPAN.pm checks several means to do the
same task. For retrieving modules from a CPAN-mirror either links, wget,
ftp etc. could be used. As long as it finds one of them, it's ok. If you
install LWP or Net::FTP and some other Perl modules, it will gradually
use less and less external programs when installing a module and instead
rely on Perl modules doing the same thing.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Mon, 12 May 2003 13:27:26 +0200
From: "BSD" <bsd_devil@web.de>
Subject: Re: make
Message-Id: <b9nsvl$l6hf3$1@ID-172702.news.dfncis.de>

> Ignore it. On first invocation CPAN.pm checks several means to do the
okay.





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

Date: Mon, 12 May 2003 11:24:43 +1000
From: Peter Richards <jehoshua@my-deja.com>
Subject: Re: Month number being returned is incorrect
Message-Id: <aqttbv8poa9t540mq592354v9lp2t8pme2@4ax.com>

Hi Janek,

On Sun, 11 May 2003 08:39:46 +0200, "Janek Schleicher"
<bigj@kamelfreund.de> wrote:

[SNIP]
>I prefer not to think about the whole problem,
>instead I write it simple as:
>
>use POSIX qw/strftime/;
>
>$outfile = "$base_dir/" . strftime("%Y-%m-%d-", localtime);

Wow, that's a lot easier. I assume if variable $seq has the next order
number, then to append it, I would just need"

$outfile .= sprintf "%7.7d", $seq;

Thanks,

Peter


Peter Richards
peter_j_richards@nospamplease.com
 (but use hotmail to email)


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

Date: Sun, 11 May 2003 23:29:13 -0400
From: Ananth Devulapalli <devulapa@cis.ohio-state.edu>
Subject: Perl & bison.
Message-Id: <Pine.LNX.4.33.0305112325210.16100-100000@n2.nowlab.cis.ohio-state.edu>

Hi,

I am encountering a peculiar problem for which i could not find any
reference on the web.

 I am building a program that uses flex and bison to generate a parser for
a simple shell. Now to add some more features to it i was trying to embed
perl into it by including <EXTERN.h> and <perl.h>. But it seems that perl
also uses bison, which is creating a name conflict during program load.

 This is what the loader is cribbing about:

flex -l -t test.l > testL.c
bison -v test.y -o testY.c
gcc -g -DEBUG -I/usr/local/include -I/usr/lib/perl5/5.6.0/i386-linux/CORE
-c testY.c
gcc -g -DEBUG -o nshell testY.o shell.o internal.o pipe.o history.o
-DDEBUG -L/usr/local/lib  
/usr/lib/perl5/5.6.0/i386-linux/auto/DynaLoader/DynaLoader.a
-L/usr/lib/perl5/5.6.0/i386-linux/CORE -lperl -lnsl -ldl -lm -lfl -lc
-lcrypt

/usr/lib/perl5/5.6.0/i386-linux/CORE/libperl.a(toke.o): In
function `Perl_yylex': toke.o(.text+0x2c60): multiple definition of
`Perl_yylex' testY.o:/home/3/devulapa/762/lab5/test.l:173: first defined
here /usr/bin/ld: Warning: size of symbol `Perl_yylex' changed from 3057
to 42206 in toke.o /usr/lib/perl5/5.6.0/i386-linux/CORE/libperl.a(toke.o):
In function `Perl_yyerror': toke.o(.text+0x130c0): multiple definition of
`Perl_yyerror' testY.o:/home/3/devulapa/762/lab5/test.y:191: first defined
here /usr/bin/ld: Warning: size of symbol `Perl_yyerror' changed from 27
to 1071 in toke.o collect2: ld returned 1 exit status

It turns out that in CORE/embed.h perl has defined yylex to Perl_yylex and
similarly yy* to Perl_yy* so on which is the reason behind the conflict.

Is there a simple way to solve this problem? Are there any better
places where i can address this problem?

I am running perl on linux x86.

TIA,
-Ananth
-- 
Ananth Devulapalli,
DL-774,
CIS Department,
THE OHIO STATE UNIVERSITY,
COLUMBUS, OH, 43201.
Office ph: (614)-292-8501
Home   ph: (614)-291-2425




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

Date: 12 May 2003 04:12:45 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: Perl & bison.
Message-Id: <3ebf1f3d$0$203$75868355@news.frii.net>

Ananth Devulapalli <devulapa@cis.ohio-state.edu> wrote:
AD> Hi,

AD> I am encountering a peculiar problem for which i could not find any
AD> reference on the web.

AD>  I am building a program that uses flex and bison to generate a parser for
AD> a simple shell. Now to add some more features to it i was trying to embed
AD> perl into it by including <EXTERN.h> and <perl.h>. But it seems that perl
AD> also uses bison, which is creating a name conflict during program load.

AD>  This is what the loader is cribbing about:

You want to say "linker" instead of "loader."  No?

AD> flex -l -t test.l > testL.c
AD> bison -v test.y -o testY.c
AD> gcc -g -DEBUG -I/usr/local/include -I/usr/lib/perl5/5.6.0/i386-linux/CORE
AD> -c testY.c
AD> gcc -g -DEBUG -o nshell testY.o shell.o internal.o pipe.o history.o
AD> -DDEBUG -L/usr/local/lib  
AD> /usr/lib/perl5/5.6.0/i386-linux/auto/DynaLoader/DynaLoader.a
AD> -L/usr/lib/perl5/5.6.0/i386-linux/CORE -lperl -lnsl -ldl -lm -lfl -lc
AD> -lcrypt

AD> /usr/lib/perl5/5.6.0/i386-linux/CORE/libperl.a(toke.o): In
AD> function `Perl_yylex': toke.o(.text+0x2c60): multiple definition of
AD> `Perl_yylex' testY.o:/home/3/devulapa/762/lab5/test.l:173: first defined
AD> here /usr/bin/ld: Warning: size of symbol `Perl_yylex' changed from 3057
AD> to 42206 in toke.o /usr/lib/perl5/5.6.0/i386-linux/CORE/libperl.a(toke.o):
AD> In function `Perl_yyerror': toke.o(.text+0x130c0): multiple definition of
AD> `Perl_yyerror' testY.o:/home/3/devulapa/762/lab5/test.y:191: first defined
AD> here /usr/bin/ld: Warning: size of symbol `Perl_yyerror' changed from 27
AD> to 1071 in toke.o collect2: ld returned 1 exit status

AD> It turns out that in CORE/embed.h perl has defined yylex to Perl_yylex and
AD> similarly yy* to Perl_yy* so on which is the reason behind the conflict.

AD> Is there a simple way to solve this problem? Are there any better
AD> places where i can address this problem?

See the -p flag to bison.  From the man page:

    -p prefix
    --name-prefix=prefix
        Rename the external symbols used in the parser so that they start
        with prefix instead of yy.  The precise list of symbols renamed is
        yyparse, yylex, yyerror, yylval, yychar, and yydebug.
              
        For example, if you use -p c, the names become cparse, clex, and
        so on.

Regards,

Nicholas

-- 
"Why shouldn't I top-post?"    http://www.aglami.com/tpfaq.html
"Meanings are another story."  http://www.ifas.org/wa/glossolalia.html


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

Date: 12 May 2003 05:10:33 -0700
From: magelord@t-online.de (Math55)
Subject: problem with starting path
Message-Id: <a2b8188a.0305120410.39f2b209@posting.google.com>

hi, i have a question concerning the below program. when i  start it
with "/", it works fine (linux), but as soon as i enter another
starting path like "/home/hello/"
it stops with an error message: (its dos, because i have no linux
here)

Tk::Error: parent element "c:./programme/Adobe" does not exist at
C:/Perl/site/lib/Tk.pm line 228.

whats wrong and how can i change the code so it might work?

THANKS A LOT!!!

use Tk;
require Tk::HList;
$top = MainWindow->new();
$h = $top->Scrolled('HList', 
                    '-drawbranch'     => 1, 
                    '-separator'      => '/',
                    '-indent'         => 15,
                    '-command'        => \&show_or_hide_dir,
                    )->pack('-fill'   => 'both',
                            '-expand' => 'y');

$icons{"open"}   = $top->Bitmap(-file => './open_folder.xbm');
$icons{"closed"} = $top->Bitmap(-file => './folder.xbm');

show_or_hide_dir(@ARGV);
MainLoop();

#-----------------------------------------------------------------------
sub show_or_hide_dir {    # Called when an entry is double-clicked
    my $path = $_[0];
    return if (! -d $path);  # Not a directory.
    if ($h->info('exists', $path)) { 
        # Toggle the directory state. 
        # We know that a directory is open by examining the next
        # entry: it is open if it is a substring of the current path
        $next_entry = $h->info('next', $path);
        if (!$next_entry || (index ($next_entry, "$path/") == -1)) {
            # No. open it
            $h->entryconfigure($path, '-image' => $icons{"open"});
            add_dir_contents($path);
        } else {
            # Yes. Close it by changing the icon, and deleting its
subnode.
            $h->entryconfigure($path, '-image' => $icons{"closed"});
            $h->delete('offsprings', $path);
        }
    } else {
        die "'$path' is not a directory\n" if (! -d $path);
        $h->add($path, '-itemtype' => 'imagetext',
                '-image' => $icons{"open"}, '-text' => $path);
        add_dir_contents($path);
    }
}

sub add_dir_contents {
    my $path = $_[0];
    my $oldcursor = $top->cget('-cursor');
    $top->configure('-cursor' => 'watch');
    $top->update();
    my @files = <$path/*>;
    foreach $file (@files) {
        $file =~ s|//|/|g;
        ($text = $file) =~ s|^.*/||g;
        if (-d $file) {
            $h->add($file, '-itemtype' => 'imagetext',
                    '-image' => $icons{"closed"}, '-text' => $text);
        } else {
            $h->add($file, -itemtype => 'text',
                    '-text' => $text);
        }
    }
    $top->configure('-cursor' => $oldcursor);
}


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

Date: Mon, 12 May 2003 04:52:14 +0200
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: RegExp  Question
Message-Id: <pan.2003.05.12.02.49.23.51626@kamelfreund.de>

Gunnar Hjalmarsson wrote at Sun, 11 May 2003 12:11:48 +0200:

>>>     $line = '1/13/03 "Joe Somebody"<joe@somewhere.com>';
>>>     ($address) = $line =~ /<([^>]+)>/;
>> 
>> Or a bit shorter:
>>        ($address) = $line =~ /<(.+?)>/;
> 
> Yeah, two characters shorter.
> 
> However, I'm used to avoid playing with greediness when it isn't 
> necessary, since I have experienced that Perl may be confused by too 
> much use of it in more complex regexes. I'm not sure; maybe it's just 
> me who have made mistakes and blame Perl without deserving it. Would 
> be interested in comments from others.
> 
> Let me add, to avoid misunderstandings, that I don't think Janek's 
> suggestion in this particular case would be a problem. ;-)

It's sure more a question of personal style,
but for me it's more confusing and dangerous to work with a lot of fancy
characters in a row.
/<([^>]+)>/
are characters looking all nearly the same (only the + is obviously on the
first view for me - at least after a long day)
while (.+?) consists of very distinguished characters.
That might sound strange, but I often had silly typos that are little 
changings (with a { instead of a [, removing accidentially the ^, 
switching ([ to [( ) that wasn't obviously when I typed it, but leaded 
to errors. Of course, most of them are compiler errors, 
but these are also 2/3 wasted minutes to find the error.

I also try to avoid negations and to express what I want as directly as
possible. Here in this case it is, match everything enclosed by '<' up till
to the next '>'. I find the most direct way to say it in a regexp is '<'
as starting, up till to next = '.*?' or '.+?' (where up till to last would
be the simple greedy '.*' or '.+').

A last reason is that I try to write code so, that simple changings should
only affect one changing at the code.
E.g. imagine, that instead of <...>, now [....] style would be used
(might sound uncommon to this specific problem,
 but you often have such situation with "..." => '...' or ':....:' =>
 '%...%' or similar)
In my favored way I have to do 2 changings that I would both have
suspected and never forgot (change the starting and end character), 
while in your way I would need also a 3rd changing that is more of
technically nature and unexpected. (Especially as it will still work in
many cases)


All that is of course not that critical,
but combined with the 2 characters less to type enough reason for me to
favor the /<(.+?)>/ style.


Greetings,
Janek


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

Date: 11 May 2003 23:02:39 -0700
From: smittod@auburn.edu (Todd Smith)
Subject: sound module
Message-Id: <ed3092e7.0305112202.6906d943@posting.google.com>

I'd like to find a sound module that can listen to a streaming source,
chop it up into tiny bits (like by the millisecond) and return
information such as $bit->amplitude, $bit->pitch, $bit->tone. And then
let me put together a list of bits with a certain vloume, pitch, tone
and play the sound out in realtime, without writing a wav file. Is
there anything like that?

-thanks
-todd


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

Date: 12 May 2003 05:36:53 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Try to find a hash element but no luck
Message-Id: <776e0325.0305120436.4995d04@posting.google.com>

"David G" <DavidG997@yahoo.com> wrote in message news:<b9m3i8$kq6ut$1@ID-82947.news.dfncis.de>...
> I have a defined hash loaded as follows:
> 
 .
 .

> 
> if (exists $database{$inphost})
> {
>   print "\nfound hash element\n";
>   }
> else
> {
>   print "\nHash element not found\n";
> }
>  Will using the large C and not the small c casue this ?
> If not how to do I find it ?
> 
> TIA


I always use 

  if defined $h{element}

Which seem to work as I'd expect in every case. When I first learned
Perl I used "exists" but abandoned it when I discovered that it seemed
to be a subset of "defined".

Why does "exists" exist?

-Gx


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

Date: 12 May 2003 13:02:01 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Try to find a hash element but no luck
Message-Id: <b9o609$411$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Sara:

> I always use 
> 
>   if defined $h{element}
> 
> Which seem to work as I'd expect in every case. When I first learned
> Perl I used "exists" but abandoned it when I discovered that it seemed
> to be a subset of "defined".

It's not. Actually defined() is a subset of exists() when counting the
number of cases in which these two return true.

> Why does "exists" exist?

Because it does something else than defined(). Try this:

    my %hash = ( 1 => undef );
    print "defined value" if defined $hash{ 1 };
    print "key exists"    if exists $hash{ 1 };

Sometimes you want to allow undefined values. That's where exists()
should be used.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 12 May 2003 02:16:02 -0700
From: adwser@hotmail.com (jtd)
Subject: Re: Why is POE idle most of the time?
Message-Id: <c57c103.0305120116.7a9ec3b8@posting.google.com>

Rocco Caputo <troc@netrus.net> wrote in message news:<slrnbbts1t.1hhb.troc@eyrie.homenet>...
> On 5 May 2003 21:39:03 -0700, jtd wrote:
> > Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3EB6C298.A2624B35@earthlink.net>...
> >> jtd wrote:
> >> > 
> >> > I wrote a simple test script using POE that created a single session
> >> > with a single handler that simply incremented a counter (0..1000) and
> >> > then yielded to itself. The script took 10s to run. When I profiled
> >> > it, dprofpp showed that the total user+system time was less than 0.8s.
> >> > 
> >> > What is happening here? Shouldn't POE use as much CPU time as the OS
> >> > scheduler allows?
> >> > 
> >> > Jtd
> >> 
> >> Maybe there were other things running on your computer?
> > 
> > Nothing intensive, the CPU was mostly idle according to top. Could it
> > be that POE's scheduler has fixed (time) resolution?
> 
> Chances are good you're running Linux.  Before POE 0.26 (released
> yesterday), there was a work-around for older Linux kernels that
> incurred a heavy penalty on those systems.
> 
> Version 0.26 removes the work-around, increasing performance a lot on
> Linux systems.  Give it a try with the latest release.  Thanks!
> 
> -- Rocco Caputo - troc@pobox.com - http://poe.perl.org/

You're right, it runs much faster on POE 0.26! Thanks,

Rob


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

Date: Mon, 12 May 2003 05:51:33 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Why Perl is so difficult to learn?
Message-Id: <slrnbbudg6.1v3.bernard.el-hagin@gdndev25.lido-tech>

Mina Naguib wrote:
> 
> ldd wrote:
>> Hi,
>> 
>> I am a very newbie. Have a few question regarding Perl
>> 
>> 1) What does the second asterisk do in this expression?
> 
> The same thing the first asterisk does in the expression.  As a matter 
> of fact, the same thing any asterisk does in any perl-style regular 
> expression.


That's not a true statement:


m/ \*/;


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

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 4973
***************************************


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