Re: Line-oriented socket I/O using select()

2013-01-14 Thread Vic Sage
On Jan 13, 2013, at 8:35 PM, Charles DeRykus dery...@gmail.com wrote:

 On Sun, Jan 13, 2013 at 3:03 PM, Vic Sage vic.s...@icloud.com wrote:
 
 What I *want* is to block until an entire \n-terminated string [can that 
 be referred to as a line?]  can be retrieved from one of my clients.  I'm 
 sure I could work out the logic to maintain application-level buffers, but I 
 suspect I would merely be reinventing the wheel, one bug at a time :-).   
 What does the experienced Perl programmer - or socket-level programmer in 
 general - do in this situation?
 
 
 I'm not experienced in heavy duty socket-level programming
 but you may want to invest in learning POE:
 
  https://poe.perl.org
 
 It's already refined many of the wheels you'll need and appears well
 documented.

Wow - that is one substantial package!  POE looks like a pretty steep learning 
curve; however, it appears as if POE::Wheel::ReadWrite might be what is needed. 
 I've never tried my hand at working with event loops - and I'd be interested 
to hear if there's a general consensus that this is much preferable to my 
old-school approach of just looping on a select().


Line-oriented socket I/O using select()

2013-01-13 Thread Vic Sage
I'm writing a multiplexed TCP-based server that reads \n-terminated strings 
from clients and does something with them.  Since this is one process with 
multiple client connections, it uses select() (or, actually, can_read from 
IO::Select) to block until data has arrived from any client.

It's my understanding that TCP does not preserve message boundaries.  That 
is, if a client writes:

$sock-autoflush(1);
print $sock abel\n;
print $sock baker\n;
print $sock charlie\n;

... there are no guarantees about what will be returned from the server's 
system buffer by sysread() when select() pops.  It could be a, or abel\n, 
or abel\nbak, etc.  

What I *want* is to block until an entire \n-terminated string [can that be 
referred to as a line?]  can be retrieved from one of my clients.  I'm sure I 
could work out the logic to maintain application-level buffers, but I suspect I 
would merely be reinventing the wheel, one bug at a time :-).   What does the 
experienced Perl programmer - or socket-level programmer in general - do in 
this situation?

VS

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Recommendations for emacs customizations for editing Perl

2012-09-12 Thread Vic Sage
On Sep 11, 2012, at 11:45 PM, Shlomi Fish shlo...@shlomifish.org wrote:

 Hi pangj,
 
 On Wed, 12 Sep 2012 12:28:54 +0800
 pangj pa...@riseup.net wrote:
 
 Have been coding perl with VIM always.
 
 
 Good for you, but the original question was about Emacs and it is a legitimate
 question. 

I had no idea how popular Vi/Vim was until I recently joined this company.  
Emacs wasn't even installed!  I made a mighty effort to switch to Vim after 18 
years of using Emacs, but after two months I was still making the same mistakes 
- the zen of Vi[m] just never really dawned.

(It once took me six weeks of programming in C, cursing it the whole way, to 
realize what a waste the previous 14 years of coding assembler had been.  Same 
for switching to Unix from MVS.  I figure two months is enough to unlearn just 
about anything.)

But, yes, as Shlomi points out, I *am* looking for suggestions from experienced 
Perl programmers who use - and customize - Emacs :-)

V

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Recommendations for emacs customizations for editing Perl

2012-09-12 Thread Vic Sage

On Sep 12, 2012, at 5:59 AM, Paul Anderson wackyvor...@me.com wrote:

 Install PDE from CPAN and it'll work alright. It works fine for me on 5.16.1. 

So it does.  

I was concerned that PDE hadn't been updated in four years.  But I gather it 
works well with all the recent syntax?

V

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Recommendations for emacs customizations for editing Perl

2012-09-11 Thread Vic Sage
I'd like to hear some recommendations from this list for customizations to emacs for coding Perl.One seemingly respected site,http://emacswiki.org/emacs/PerlLanguage, has a lot of links but unfortunately some are pretty dated. For example, the Perl Develop Environment,http://search.cpan.org/dist/Emacs-PDE/, last updated in 2008, wouldn't install because my version of Perl (5.16.1) was "too far out of date." So of course the question is, how up-to-date is emacswiki.org?As I say, I'm running Perl 5.16.1, and emacs 24.something. I do have cperl-mode.el, but there are also a lot of goodies out there like variable-name completion and templates that look very useful. I mostly don't want to be installing and troubleshooting stuff that hasn't been updated in five years and/or isn't "generally regarded" to be top quality.Thanks for any pointers or even advice about what to avoid :)Vic

Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread Vic Sage
On Sep 11, 2012, at 10:24 PM, John SJ Anderson geneh...@genehack.org wrote:
 Well, there's the 'Tweakers Anonymous' talk I gave at YAPC…
 
 * slides: http://www.slideshare.net/genehackdotorg/tweakers-anonymous-13313552
 * video: http://www.youtube.com/watch?v=A3_lY-zlzik

Okay - good points to keep in mind.

 
 There's also my Emacs config: https://github.com/genehack/emacs (the Perl 
 stuff is mostly in etc/perl.el)

Okay, this looks good but I don't know how to install it.  I have a .emacs file 
and a .emacs.d directory in my home directory; you have an init.el file and 
bin, etc, and share directories.  Can you give me the idiot's guide?  :)

V
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/