useful blogs

2016-03-13 Thread Andrew Solomon
>From time to time a student asks me a question and answering it turns into
a blog post. It just occurred to me that these answers might be useful to
some of the people on this list.

http://blog.geekuni.com/2016/03/perl-flip-flop.html
http://blog.geekuni.com/2016/01/vim-tt-html-highlighting-and-tag-matching.html
http://blog.geekuni.com/2015/06/three-ways-to-implement-sessions.html
http://blog.geekuni.com/2015/05/how-to-install-different-versions-of-perl.html
http://blog.geekuni.com/2015/02/comparing-booleans-in-perl.html

cheers

Andrew


Re: reading directories using perl in windows

2016-03-13 Thread Shawn H Corey
On Sun, 13 Mar 2016 09:48:20 -0500
Mike Flannigan  wrote:

> 
> FYI, there is no error.  If the directory
> path has no spaces it works fine, if the directory
> path has spaces it prints the path up to the 1st space
> and just goes back to a cursor line.
> 
> 
> Mike

Yup. The default glob() function s based on the C-shell and spaces are
separators. If your file names have spaces, use the BSD glob. This will
replace glob() with one that allows spaces in the file names.

use File::Glob qw( :bsd_glob );

> 
> 
> On 3/6/2016 5:04 AM, beginners-digest-h...@perl.org wrote:
> > Subject:
> > Re: reading directories using perl in windows
> > From:
> > Akshay Mohit 
> > Date:
> > 3/1/2016 4:49 AM
> >
> > To:
> > Arghya Das 
> > CC:
> > Perl Beginners 
> >
> >
> > Could you please send the exact error which you are getting as I 
> > Copy/Pasted the exact code which you had given and it is working 
> > properly for me. I have only given the directory which is present
> > in my system.
> >
> > use strict;
> > use warnings;
> >
> > my $dir = "C:/Python_Exercise/*";
> > my @files = glob( $dir );
> >
> > foreach (@files ){
> >print $_ . "\n";
> > }
> 



-- 
Don't stop where the ink does.
Shawn

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




Re: reading directories using perl in windows

2016-03-13 Thread Mike Flannigan


FYI, there is no error.  If the directory
path has no spaces it works fine, if the directory
path has spaces it prints the path up to the 1st space
and just goes back to a cursor line.


Mike


On 3/6/2016 5:04 AM, beginners-digest-h...@perl.org wrote:

Subject:
Re: reading directories using perl in windows
From:
Akshay Mohit 
Date:
3/1/2016 4:49 AM

To:
Arghya Das 
CC:
Perl Beginners 


Could you please send the exact error which you are getting as I 
Copy/Pasted the exact code which you had given and it is working 
properly for me. I have only given the directory which is present in 
my system.


use strict;
use warnings;

my $dir = "C:/Python_Exercise/*";
my @files = glob( $dir );

foreach (@files ){
   print $_ . "\n";
}




Re: Forking as another user

2016-03-13 Thread Peter Scott
On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote:
> The snippet below works to fork as a specific user, if run as root.
> However, it generates zombies.  The functions wait() or waitpid() seem
> to be available to use to stop that, but if I insert either of them in
> the outer while loop, only one client can connect at a time.
> 
> What modification can prevent zombies yet allow multiple concurrent
> clients to attach?

You need the WNOHANG option on your wait() to make it nonblocking.

-- 
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=9780133036268

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