[31739] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3002 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 24 09:09:24 2010

Date: Thu, 24 Jun 2010 06:09:05 -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           Thu, 24 Jun 2010     Volume: 11 Number: 3002

Today's topics:
    Re: How to use Regex to breakdown a pattern and use the sln@netherlands.com
    Re: How to use Regex to breakdown a pattern and use the <gjwpp88@gmail.com>
    Re: How to use Regex to breakdown a pattern and use the <ben@morrow.me.uk>
    Re: How to use Regex to breakdown a pattern and use the <tadmc@seesig.invalid>
    Re: UNIX datagram sockets <tadmc@seesig.invalid>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: UNIX datagram sockets <xhoster@gmail.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: UNIX datagram sockets <xhoster@gmail.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: who stole my returned list? <marc.girod@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 23 Jun 2010 17:10:04 -0700
From: sln@netherlands.com
Subject: Re: How to use Regex to breakdown a pattern and use the pattern to  break down a string
Message-Id: <vc85265onjn32h85n1u1kh9bo5scd9nsui@4ax.com>

On Wed, 23 Jun 2010 13:53:37 -0700 (PDT), ChrisC <gjwpp88@gmail.com> wrote:

>I want to keep # data and disregard X data/position in a string that
>is being read from a serial port.

As someone said tr/X#/xa/ and unpack would be the way to go.
However, without an anchor or other frame reference, this will
do you absolutely no good whatsoever.

-sln


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

Date: Wed, 23 Jun 2010 13:53:37 -0700 (PDT)
From: ChrisC <gjwpp88@gmail.com>
Subject: Re: How to use Regex to breakdown a pattern and use the pattern to  break down a string
Message-Id: <28f13cf5-2e90-478f-a649-a624c87b8b32@s9g2000yqd.googlegroups.com>

On Jun 22, 10:36=A0pm, Tad McClellan <ta...@seesig.invalid> wrote:
> ChrisC <gjwp...@gmail.com> wrote:
> > I will get a user defined patten "XXXXX##', "##XXXXX##", "##XX##XX##",
> > "XXX" etc. =A0How to break down this string pattern using Regex and
> > apply it to data;
>
> That depends entirely on what meaning you assign to
> the "X" and "#" characters in your pattern language.
>
> What meaning do you assign to the "X" and "#" characters in your
> pattern language?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
> The above message is a Usenet post.
> I don't recall having given anyone permission to use it on a Web site.

Tad,

I want to keep # data and disregard X data/position in a string that
is being read from a serial port.


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

Date: Wed, 23 Jun 2010 22:41:22 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to use Regex to breakdown a pattern and use the pattern to  break down a string
Message-Id: <2lbaf7-3j52.ln1@osiris.mauzo.dyndns.org>

[please don't quote .sigs]

Quoth ChrisC <gjwpp88@gmail.com>:
> On Jun 22, 10:36 pm, Tad McClellan <ta...@seesig.invalid> wrote:
> > ChrisC <gjwp...@gmail.com> wrote:
> > > I will get a user defined patten "XXXXX##', "##XXXXX##", "##XX##XX##",
> > > "XXX" etc.  How to break down this string pattern using Regex and
> > > apply it to data;
> >
> > That depends entirely on what meaning you assign to
> > the "X" and "#" characters in your pattern language.
> >
> > What meaning do you assign to the "X" and "#" characters in your
> > pattern language?
> 
> I want to keep # data and disregard X data/position in a string that
> is being read from a serial port.

    my $pat  = "XXXXX##";
    my $data = "1234567";

    $pat =~ tr/X#/xa/;

    my $input = join "", unpack $pat, $data;

Ben



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

Date: Wed, 23 Jun 2010 16:37:16 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: How to use Regex to breakdown a pattern and use the pattern to break down a string
Message-Id: <slrni24vb7.eds.tadmc@tadbox.sbcglobal.net>

ChrisC <gjwpp88@gmail.com> wrote:
> On Jun 22, 10:36 pm, Tad McClellan <ta...@seesig.invalid> wrote:
>> ChrisC <gjwp...@gmail.com> wrote:
>> > I will get a user defined patten "XXXXX##', "##XXXXX##", "##XX##XX##",
>> > "XXX" etc.  How to break down this string pattern using Regex and
>> > apply it to data;
>>
>> That depends entirely on what meaning you assign to
>> the "X" and "#" characters in your pattern language.
>>
>> What meaning do you assign to the "X" and "#" characters in your
>> pattern language?
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
>> The above message is a Usenet post.
>> I don't recall having given anyone permission to use it on a Web site.


You are not supposed to quote .sigs.

Please don't do that.

Have you seen the posting guidelines that are posted here frequently?


> Tad,
>
> I want to keep # data and disregard X data/position in a string that
> is being read from a serial port.

You said:

    Pattern "XXXXXXXX##" to break out string "00000078.7\r\n" to get
    "00000078.7";

that does not match up with your new rules, as you should get ".7" by
these new rules...


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Wed, 23 Jun 2010 16:51:07 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: UNIX datagram sockets
Message-Id: <slrni25056.eds.tadmc@tadbox.sbcglobal.net>

John Kelly <jak@isp2dial.com> wrote:

> But I say
> that with Perl, there's more than one way to shoot yourself in the foot.


We had that thread 10 years ago...  :-)

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/4b19828eac7abe68/a97f4d7d02afa8ff?q=#a97f4d7d02afa8ff


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Wed, 23 Jun 2010 23:53:17 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <n77526hjvsd4mmrro2ae2046l61fuma2hs@4ax.com>

On Wed, 23 Jun 2010 16:51:07 -0500, Tad McClellan <tadmc@seesig.invalid>
wrote:

>John Kelly <jak@isp2dial.com> wrote:
>
>> But I say
>> that with Perl, there's more than one way to shoot yourself in the foot.
>
>
>We had that thread 10 years ago...  :-)
>
>http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/4b19828eac7abe68/a97f4d7d02afa8ff?q=#a97f4d7d02afa8ff

Heh.

Once I found perltidy, I started liking Perl a little more.  To me, Perl
seems like an ambiguous monstrosity.  Fun, but spooky.



-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 19:27:41 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: UNIX datagram sockets
Message-Id: <tdsaf7x5ok.ln2@goaway.wombat.san-francisco.ca.us>

On 2010-06-23, John Kelly <jak@isp2dial.com> wrote:
>
> I explained why I posted it, but you didn't like that explanation, and
> you continued arguing.  If you want to act like a troll, then so be it.

Aren't you the same guy who posts repeatedly about the dh program, even
though the few people who made any reply asked you to stop?  See e.g.

http://groups.google.com/group/comp.unix.shell/browse_thread/thread/42bf7ae993e6f97b

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Wed, 23 Jun 2010 19:17:54 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: UNIX datagram sockets
Message-Id: <4c22c806$0$19730$ed362ca5@nr5-q3a.newsreader.com>

John Kelly wrote:
> On Wed, 23 Jun 2010 13:04:03 -0400, "Uri Guttman" <uri@StemSystems.com>
> wrote:
> 
>> because they usually do. nothing you posted was signifigant as it was
>> basic udp code that you can get from modules, books, documentation,
>> etc. it wasn't particularly interesting
> 
>> not rude at all. but an odd posting in any case. seriously, what was
>> your point? education? illumination?
> 
> It's easy to find INET socket example code, but harder to find UNIX
> socket example code.  Some of the few I found didn't work at all, and
> Stein's example didn't explain the relationship between the Local and
> Peer arguments when using SOCK_DGRAM.

Unfortunately your example doesn't seem to explain that relationship, 
either.


Xho


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

Date: Thu, 24 Jun 2010 02:58:55 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <c7i52610cpmiot51gua2hiibjaglrte476@4ax.com>

On Wed, 23 Jun 2010 19:27:41 -0700, Keith Keller
<kkeller-usenet@wombat.san-francisco.ca.us> wrote:

>Aren't you the same guy who posts repeatedly about the dh program, even
>though the few people who made any reply asked you to stop?  See e.g.
>
>http://groups.google.com/group/comp.unix.shell/browse_thread/thread/42bf7ae993e6f97b

Seebs is only one person.  And I don't read his posts.

But why should that concern you, in this thread?  Are you a troll too?


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Thu, 24 Jun 2010 03:01:56 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <9hi526100b8u1gd87jk19m0gjs4t28954k@4ax.com>

On Wed, 23 Jun 2010 19:17:54 -0700, Xho Jingleheimerschmidt
<xhoster@gmail.com> wrote:

>> Stein's example didn't explain the relationship between the Local and
>> Peer arguments when using SOCK_DGRAM.
>
>Unfortunately your example doesn't seem to explain that relationship, 
>either.

I thought the code made it clear.  What don't you understand about it?


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 20:09:20 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: UNIX datagram sockets
Message-Id: <0suaf7xu9l.ln2@goaway.wombat.san-francisco.ca.us>

On 2010-06-24, John Kelly <jak@isp2dial.com> wrote:
> On Wed, 23 Jun 2010 19:27:41 -0700, Keith Keller
><kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>
>>Aren't you the same guy who posts repeatedly about the dh program, even
>>though the few people who made any reply asked you to stop?  See e.g.
>>
>>http://groups.google.com/group/comp.unix.shell/browse_thread/thread/42bf7ae993e6f97b
>
> Seebs is only one person.  And I don't read his posts.

Did you know that "e.g." means "for example", as in "this is one example
of many"?

> But why should that concern you, in this thread?  Are you a troll too?

It concerns me because people who engage in trollish behavior shouldn't
be accusing others of trolling.  But I certainly won't carry on the
debate any further.  (Or perhaps "take the bait" is more apt.)

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Wed, 23 Jun 2010 20:15:19 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: UNIX datagram sockets
Message-Id: <4c22cdc3$0$19669$ed362ca5@nr5-q3a.newsreader.com>

John Kelly wrote:
> On Wed, 23 Jun 2010 19:17:54 -0700, Xho Jingleheimerschmidt
> <xhoster@gmail.com> wrote:
> 
>>> Stein's example didn't explain the relationship between the Local and
>>> Peer arguments when using SOCK_DGRAM.
>> Unfortunately your example doesn't seem to explain that relationship, 
>> either.
> 
> I thought the code made it clear.  What don't you understand about it?
> 
> 
Why are you unlinking them?  What point does $node serve in the client?

Xho


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

Date: Thu, 24 Jun 2010 04:01:07 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <dlk526lg8k70b8v8k8ef1fp3ri76lp7h6u@4ax.com>

On Wed, 23 Jun 2010 20:15:19 -0700, Xho Jingleheimerschmidt
<xhoster@gmail.com> wrote:

>John Kelly wrote:
>> On Wed, 23 Jun 2010 19:17:54 -0700, Xho Jingleheimerschmidt
>> <xhoster@gmail.com> wrote:
>> 
>>>> Stein's example didn't explain the relationship between the Local and
>>>> Peer arguments when using SOCK_DGRAM.
>>> Unfortunately your example doesn't seem to explain that relationship, 
>>> either.
>> 
>> I thought the code made it clear.  What don't you understand about it?
>> 
>> 
>Why are you unlinking them?

IO::Socket::UNIX->new does a bind() for you, automatically.  If the name
already exists in the filesystem, bind() will fail.


>What point does $node serve in the client?

This can be confusing, and that's why I posted.

To achieve two way communication over UNIX datagram sockets, both server
and client must bind to a socket.  But NOT THE SAME ONE!

The server binds to the server socket, and the client binds to the
client socket.  Notice that two different file names are required.
That's what Local => $node is for.  They each bind to their own "Local"
socket.

Then the server sits there and waits for incoming connections on his
"Local" /tmp/server.sock.

Now say the client wants to talk.  He's already bound his own "Local"
/tmp/client1.sock.  But he also has to specify what "Peer" he wants to
talk to, in this case the server, which resides at /tmp/server.sock.

When the server gets a packet from the client, he knows where it came
from, because the client did a bind() to his own "Local" client socket
before sending.  If the client omits the bind() step, the client can
send to the server, but the packet will not carry a peer address, and
the server won't know where it came from.


>Xho

-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Thu, 24 Jun 2010 04:13:46 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <t6m526572nc4u3e82qn48c7ocqpvt6mv0i@4ax.com>

On Wed, 23 Jun 2010 20:09:20 -0700, Keith Keller
<kkeller-usenet@wombat.san-francisco.ca.us> wrote:

>On 2010-06-24, John Kelly <jak@isp2dial.com> wrote:
>> On Wed, 23 Jun 2010 19:27:41 -0700, Keith Keller
>><kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>>
>>>Aren't you the same guy who posts repeatedly about the dh program

>> But why should that concern you, in this thread?  Are you a troll too?
>
>It concerns me because people who engage in trollish behavior shouldn't
>be accusing others of trolling.  But I certainly won't carry on the
>debate any further.  (Or perhaps "take the bait" is more apt.)

Some people think anyone who says anything they don't like, is a troll.

I started this thread with useful material, but you bring up defamatory
posts from other ngs, completely unrelated to the topic.

See wikipedia for a definition of trolling.


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Thu, 24 Jun 2010 13:00:33 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <n1k6265mdkp25hpsvgkcrfuq2ao8ld1qsk@4ax.com>

On Thu, 24 Jun 2010 04:01:07 +0000, John Kelly <jak@isp2dial.com> wrote:

>>What point does $node serve in the client?

>This can be confusing, and that's why I posted.

Or at least one reason.  Another is:

UNIX datagram sockets are not widely understood.  The books that discuss
them usually leave them last, with little supporting material to explain
why they are so useful.  Books tend to focus on stream sockets.

But for many applications of intra-server communications, stream sockets
are not needed, and are overkill.  With stream sockets, you have to keep
track of all the connections, which means more work for the programmer.

Datagram sockets are easier because there are no connections.  You just
use bind() to establish each node's address, and then, any node can talk
to any other node, at random.  Because the kernel handles buffering for
you, UNIX datagram sockets are always reliable, and datagrams are always
delivered in order.  So you never lose any packets.

UNIX datagram sockets are underrated.  Once you understand the basic
code required, they're easy, and you can be a socket programmer without
a hard learning curve.

Perl helps too.  You can throw some Perl scripts together and presto,
you have a socket application.

What's the point of tools anyway, if not to make work easier?  You don't
need to be an expert to make effective use of tools.


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Thu, 24 Jun 2010 04:49:31 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: Re: who stole my returned list?
Message-Id: <28a99cf0-977f-43d8-bb2d-7b19d99c5101@j4g2000yqh.googlegroups.com>

I am sorry that my question didn't inspire anybody...
I continue my debugging:

  DB<14> $mod = $sync->_lsco

  DB<15> p $mod

  DB<16> x $sync->_lsco
0  '/view/emagiro_t7/vobs/atcctest/foo/d'


Er... funny, isn't it?
I go to the return statement of the _lsco function, set 'trace' on,
and do a 'r'.
I get a transcript of running the DESTROY members for two objects (and
I did fix something related since yesterday), and get now (end only):

ClearCase::Argv::DESTROY(/home/emagiro/perl/lib/ClearCase/Argv.pm:
855):
855:	    $? |= $ret;
list context return from ClearCase::SyncTree::_lsco:
0  '/view/emagiro_t7/vobs/atcctest/foo/d'
ClearCase::SyncTree::checkin(/vobs/atcctest/ClearCase-SyncTree/blib/
lib/ClearCase/SyncTree.pm:1218):
1218:	    my %checkedout = map {$_ => 1} $self->_lsco;

So, now the function would return something, but the address returned
to is completely weird! That's not where I started from!
As it seems, a different place in the code, where the same function is
called!?

I have corrupted my stack, as it seems...

I'll run the same under an other perl...

Marc


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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 3002
***************************************


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