Re: Patches

2004-12-30 Thread Randy W. Sims
Octavian Rasnita wrote:
Hi all,
Does anyone know if there are perl modules for applying patches?
I have seen on many lists that are provided some patches for some perl
modules, and probably they can be applied automaticly under Unix using
"patch" for .dif files, but I cannot do this under Windows.
So, are there any perl modules that can do this job under Windows?
(Because otherwise I have to do it manually and it is not very easy).
You can get a port of patch and diffutils from from the GnuWin32 
project[1]. There is also WinMerge[2].

1. 
2. 
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Patches

2004-12-30 Thread Octavian Rasnita
Hi all,

Does anyone know if there are perl modules for applying patches?

I have seen on many lists that are provided some patches for some perl
modules, and probably they can be applied automaticly under Unix using
"patch" for .dif files, but I cannot do this under Windows.

So, are there any perl modules that can do this job under Windows?
(Because otherwise I have to do it manually and it is not very easy).

Thank you.

Teddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: IO::Socket::UNIX questions

2004-12-30 Thread mgoland


- Original Message -
From: Dave Kettmann <[EMAIL PROTECTED]>
Date: Thursday, December 30, 2004 5:23 pm
Subject: IO::Socket::UNIX questions

> Hello list,
Hi Dave,
> 
> I am working with UNIX Sockets and have some questions that I cant 
> seem to find answers to on the web.
It can be hard to find a good site on all IPC programming. Check out "Network 
programing with Perl", by Lincoln Stein. 

perldoc perlipc is a good start.

> 
> 1: Are UNIX sockets bi-directional?
yes, SOCK_STREAM type
> 
> 2: If so, what is the proper way to 'setup' the connection? (will 
> post what I have below)
what you have looks correct, no need to specify Type [ SOCK_STREAM is default]. 
I think the problem you may have is in setting permissions on socket files. 
Does the child have access priveledge to write to that file ?? what is the 
UMASK or you server process ?? Post more code, and output along with debug 
print umask in your server code.


> 
> 3: Do UNIX sockets have less overhead than INET sockets?
That all depends, it can go both way's. UNIX sockets, is comunicatting through 
files. Faster way would be to communicate through pipe's.

HTH,
Mark G. 
> 
> Here is what I have for the OO connections:
> 
> Server:
> 
> my $server = IO::Socket::UNIX->new(Local => "/tmp/mysock",
>   Type  => SOCK_DGRAM,
>   Listen=> 5 )
>  or die $@;
> 
> Client:
> 
> my $client = IO::Socket::UNIX->new (
>   Type  => SOCK_DGRAM,
>   Peer  => "/tmp/mysock",
>   )
> or die $@;
> 
> Right now, I am able to send information from the client to the 
> server, but not the other way around. When I try this, I get:send: 
> 
> Cannot determine peer address at server.pl line 21
> 
> Here are lines 17-22:
> 
>  if($text ne 'exit')
>  {
>print "\nReceived message '", $text,"'\n";
>my $send = "I got: $text\n";
>$server->send($send,128);# <--- Line 21
>  }
> 
> I have tried multiple things with the creation of the socket, but 
> cant get the right combination. I am beginning to think that UNIX 
> sockets are not bi-directional, but I hope someone proves me wrong.
> 
> If more information is needed, let me know.
> 
> Thanks for the help,
> 
> Dave Kettmann
> NetLogic
> 636-561-0680
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: IO::Socket::UNIX questions

2004-12-30 Thread Jonathan Paton
> I am working with UNIX Sockets and have some questions
> that I cant seem to find answers to on the web.

Since the questions was interesting enough to me, I thought
I would research the answer.  "Perl Cookbook" contains an
entire chapter on this.  I am not a socket programmer!

> 1: Are UNIX sockets bi-directional?

>From "man 2 socket" (linux):

   SOCK_STREAM
  Provides sequenced,  reliable,  two-way,  connection-based  byte
  streams.  An out-of-band data transmission mechanism may be sup-
  ported.

   SOCK_DGRAM
  Supports datagrams (connectionless,  unreliable  messages  of  a
  fixed maximum length).

If you choose PF_UNIX and SOCK_STREAM, then you would expect
something akin to TCP.  Similarly, PF_UNIX and SOCK_DGRAM
would give something akin to UDP.

So, datagrams are connectionless, and by extension are
one way.  With a datagram, a message is transferred
between processes, and that is that.

> 2: If so, what is the proper way to 'setup' the connection? ...

Try choosing SOCK_STREAM instead of SOCK_DGRAM.

> 3: Do UNIX sockets have less overhead than INET sockets?

I believe so, but the difference might not be that great.  Which
seams more appropriate?

May the man pages help you in your quest.

Jonathan Paton

-- 
#!perl
$J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2-18 6+13
17+6 02+1 2-10 00+4 00+8 3-13 3+12 01-5 2-10 01+1 03+4
00+4 00+8 1-21 01+1 00+5 01-7 >=~/ \S\S \S\S /gx) {m/(
\d+) (.+) /x,, vec$ J,$p +=$2 ,8,= $c+= +$1} warn $J,,

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: h2xs directory structure in perl-5.8.x?

2004-12-30 Thread Randy W. Sims
Alex Daniloff wrote:
Hello Perl people,
Recently, upgrading to perl v5.8.5 I've noticed that h2xs lays out module
directory structure in a quite different way than before.
Prior to this I could create a module e.g. Data::Loader
h2xs -XA -n Data::Loader
And it would create directory Data, then subdirectory Loader with Loader.pm
module and other files.
The full path to the module looks like /Data/Loader/Loader.pm
If I want to create another module e.g. Data::Reader
h2xs would put it into /Data/Reader/Reader.pm
Which is logically correct.
How the same command produces directory Data-Loader with service files and 
subdirectory lib in which it creates subdirectory Data in which it creates
the module Loader.pm
The full path to the module looks like /Data-Loader/lib/Data/Loader.pm
For another module e.g. Data::Reader it will be
/Data-Reader/lib/Data/Reader.pm
Why? Makes no sense to me. What the hell is going on with h2xs?

Thank you in advance for any clues or practical help.
That behaviour was changed to reflect current conventions for directory 
layout. If you look at other modules that perform the same function, 
Module::Starter[1] & ExtUtils::ModuleMaker[2], you'll see that they 
behave the same way.

1. 
2. 
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Net::RawIP Compile

2004-12-30 Thread Welsh, Ed


Hopefully this is an appropriate place to field this.  Let me know otherwise.

I am attempting to instal the Net::RawIP perl module and keep getting heinous 
compile errors.  I'll
take any suggestions as to research resources.  This is a fairly clean install 
of perl and Fedora.
I'm thinking that the old code (2000) isn't compatible with the newer gcc.  Can 
someone try this on an
older gcc install?

thanks

Environment:
Fedora Core 3
Perl 5.8.5
Libpcap 0.8.3
Gcc 3.4.3

Here are the compile errors:

[EMAIL PROTECTED] Net-RawIP-0.1]# make
cp RawIP.pm blib/lib/Net/RawIP.pm
AutoSplitting blib/lib/Net/RawIP.pm (blib/lib/auto/Net/RawIP) cp 
RawIP/libpcap.pod
blib/lib/Net/RawIP/libpcap.pod /usr/bin/perl 
/usr/lib/perl5/5.8.5/ExtUtils/xsubpp  -typemap /usr/lib/
+perl5/5.8.5/ExtUtils/typemap -typemap typemap  RawIP.xs > RawIP.xsc & & 
+mv RawIP.xsc RawIP.c
gcc -c   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -f
+no-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_
+FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386
+ -mtune=pentium4   -DVERSION=\"0.1\" -DXS_VERSION=\"0.1\" -fPIC "-I/u
+sr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"  -D_LINUX_ -D_ETH_ - 
+D_IFLIST_ -D_GLIBC_ RawIP.c
RawIP.xs: In function `ip_opts_creat':
RawIP.xs:444: error: label at end of compound statement
RawIP.xs: In function `tcp_opts_creat':
RawIP.xs:543: error: label at end of compound statement
RawIP.xs: In function `XS_Net__RawIP_tcp_pkt_parse':
RawIP.xs:764: warning: use of cast expressions as lvalues is deprecate
+d
RawIP.xs:790: warning: use of cast expressions as lvalues is deprecate
+d
RawIP.xs: In function `XS_Net__RawIP_icmp_pkt_parse':
RawIP.xs:823: warning: use of cast expressions as lvalues is deprecate
+d
RawIP.xs: In function `XS_Net__RawIP_generic_pkt_parse':
RawIP.xs:863: warning: use of cast expressions as lvalues is deprecate
+d
RawIP.xs: In function `XS_Net__RawIP_udp_pkt_parse':
RawIP.xs:897: warning: use of cast expressions as lvalues is deprecate
+d
RawIP.xs: In function `XS_Net__RawIP_dispatch':
RawIP.xs:1289: warning: use of cast expressions as lvalues is deprecat
+ed
RawIP.xs: In function `XS_Net__RawIP_loop':
RawIP.xs:1311: warning: use of cast expressions as lvalues is deprecat
+ed
make: *** [RawIP.o] Error 1

Ed Welsh


The information transmitted in this e-mail is intended only for the addressee 
and may contain confidential and/or privileged material. 
Any interception, review, retransmission, dissemination, or other use of, or 
taking of any action upon this information by persons or entities
other than the intended recipient is prohibited by law and may subject them to 
criminal or civil liability. If you received this communication 
in error, please contact us immediately at 816.421.6611, and delete the 
communication from any computer or network system.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: xml module

2004-12-30 Thread Bob Showalter
Patricio Bruna V wrote:
> i need to parse out one big xml file, 592K, but the only thing i need
> to do its eliminate some tags, where the lang attribute is not es
> (, fox example).
> I think its a simple thing to do, so here its the question, what perl
> module do you recommend for this task?

XML::SAX + XML::SAX::Base

You can write a very simple filter for this kind of thing.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




IO::Socket::UNIX questions

2004-12-30 Thread Dave Kettmann
Hello list,

I am working with UNIX Sockets and have some questions that I cant seem to find 
answers to on the web.

1: Are UNIX sockets bi-directional?

2: If so, what is the proper way to 'setup' the connection? (will post what I 
have below)

3: Do UNIX sockets have less overhead than INET sockets?

Here is what I have for the OO connections:

Server:

my $server = IO::Socket::UNIX->new(Local => "/tmp/mysock",
   Type  => SOCK_DGRAM,
   Listen=> 5 )
  or die $@;

Client:

my $client = IO::Socket::UNIX->new (
   Type  => SOCK_DGRAM,
   Peer  => "/tmp/mysock",
   )
or die $@;

Right now, I am able to send information from the client to the server, but not 
the other way around. When I try this, I get:send: 

Cannot determine peer address at server.pl line 21

Here are lines 17-22:

  if($text ne 'exit')
  {
print "\nReceived message '", $text,"'\n";
my $send = "I got: $text\n";
$server->send($send,128);# <--- Line 21
  }

I have tried multiple things with the creation of the socket, but cant get the 
right combination. I am beginning to think that UNIX sockets are not 
bi-directional, but I hope someone proves me wrong.

If more information is needed, let me know.

Thanks for the help,

Dave Kettmann
NetLogic
636-561-0680

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




xml module

2004-12-30 Thread Patricio Bruna V
i need to parse out one big xml file, 592K, but the only thing i need to
do its eliminate some tags, where the lang attribute is not es (, fox example).
I think its a simple thing to do, so here its the question, what perl
module do you recommend for this task?

thx.
-- 
Patricio Bruna  http://www.linuxcenterla.com
Ingeniero de Proyectos  Mariano Sánchez Fontecilla 310
Red Hat Certified Engineer  Las Condes, Santiago - CHILE
Linux Center Latinoamerica  Fono: 2745000



signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada	digitalmente


Re: Copying a hash-of-hashes

2004-12-30 Thread Alfred Vahau
Hi,
The three CPAN modules suitable for copying data structures are:
Storable, Data::Dumper and FreezeThaw. Of these, Storable offers the 
dclone method which addresses the
problem on hand.

use Storable qw(dclone);
$ref2 = dclone ($ref1);
The method works on references to scalars, arrays and hashes.
alfred,

Bakken, Luke wrote:
Hello List, 
To explain the problem I am having, I wrote a simple snipet 
that doesn't do 
anything meaningful other than illustrating the behaviour I 
want to avoid:

my %hoh = (
   1 => {
   a => 5, b => 5
   },
   2 => 5
  );
my @res = &RANDOMSUB;  #call a random subroutine
print "$hoh{1}{a}  $hoh{2} \n";
sub RANDOMSUB {
   my %hohcopy = %hoh;
   $hohcopy{1}{a} = 2;
   $hohcopy{2} = 2;
}
   

Search for "clone" on search.cpan.org
 

--
Alfred Vahau
IT Services - University of Papua New Guinea
PO Box 320 - University PO - NCD 134
Papua New Guinea
Ph. (675) 3267277 - Fax. (675) 3267187 - Mobile: (675) 6888926
email: [EMAIL PROTECTED]



Copying a hash-of-hashes

2004-12-30 Thread Bakken, Luke
> Hello List, 
> To explain the problem I am having, I wrote a simple snipet 
> that doesn't do 
> anything meaningful other than illustrating the behaviour I 
> want to avoid:
> 
> my %hoh = (
> 1 => {
> a => 5, b => 5
> },
> 
> 2 => 5
>);
> 
> 
> my @res = &RANDOMSUB;  #call a random subroutine
> 
> print "$hoh{1}{a}  $hoh{2} \n";
> 
> 
> sub RANDOMSUB {
> my %hohcopy = %hoh;
> 
> $hohcopy{1}{a} = 2;
> $hohcopy{2} = 2;
> }

Search for "clone" on search.cpan.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Copying a hash-of-hashes

2004-12-30 Thread Dave Gray
> The question is whether there is an elegant way to produce a complete copy
> of a hash-of-hashes-of-hashes-...-of-hashes for internal subroutine purposes
> and make sure that all references will be translated properly as well,
> leaving the subroutine no ability to modify the main hash.

You might also look at Data::Dumper[1], which traverses a data
structure and produces an eval-able result.

[1] 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE : Copying a hash-of-hashes

2004-12-30 Thread Jose Nyimi


> -Message d'origine-
> De : Peter Rabbitson [mailto:[EMAIL PROTECTED]
> Envoyé : jeudi 30 décembre 2004 04:58
> À : beginners@perl.org
> Objet : Copying a hash-of-hashes
> 
> Hello List,
> To explain the problem I am having, I wrote a simple snipet that
doesn't
> do
> anything meaningful other than illustrating the behaviour I want to
avoid:
> 
> my %hoh = (
> 1 => {
> a => 5, b => 5
> },
> 
> 2 => 5
>);
> 
> 
> my @res = &RANDOMSUB;  #call a random subroutine
> 
> print "$hoh{1}{a}  $hoh{2} \n";
> 
> 
> sub RANDOMSUB {
> my %hohcopy = %hoh;
> 
> $hohcopy{1}{a} = 2;
> $hohcopy{2} = 2;
> }
> 
> >From my understanding since in the subroutine I am working with a
local
> hash
> %hohcopy all the values assigned to it have no meaning in the main
body.
> However the print produces 2, 5 instead of the desired 5, 5. As far as
my
> understanding goes this is due to the fact that $hohcopy{1} holds a
> reference to $hoh{1} instead of recreating it's internal structure
> entirely
> from the root to the leaves while performing a copy.
> 
> The question is whether there is an elegant way to produce a complete
copy
> of a hash-of-hashes-of-hashes-...-of-hashes for internal subroutine
> purposes
> and make sure that all references will be translated properly as well,
> leaving the subroutine no ability to modify the main hash.
> 
> Thank you.
> 

Hello,

This is well known behavior.
Try google on "deep copy" ...

On elegant way I know to do a "deep copy" in Perl
is to use dclone method of Storable module.

Something à la:

use Storable qw(dclone);
my $hohcopy_ref = dclone \%hoh;

HTH,

José.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]