Re: Deploying perl code

2014-07-28 Thread Paul Johnson
On Mon, Jul 28, 2014 at 07:51:12PM +0100, Robert Rothenberg wrote:
> On Thu, Jul 24, 2014 at 4:25 PM, David Cantrell 
> wrote:
> 
> > I'm looking for tools that will make it easy to go from a bunch of code
> > in a release branch on github to an updated bunch of servers, with
> > minimal downtime. If it matters we're using Debian.
> 
> At $previous, we deployed (mainly bespoke) Catalyst apps using the
> following toolchain at a small shop:

If I were designing an environment from scratch I would take a serious
look at docker.  I've been using it recently for cpancover.com and,
whilst it still has some rough edges, I really like the concept of
compartmentalising functionality.  It's probably not the whole solution
(and in this case in particular it may not be any part of the solution)
but I predict a strong future for docker. (Ha! What do I know?)

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: XP-Replacement for Parents

2014-03-27 Thread Paul Johnson
On Thu, Mar 27, 2014 at 11:48:57AM +, Smylers wrote:

> • Newer Windows:  Would the latest Windows run on her hardware? Even if
>   it did, would it run her several-years-old version of WordPerfect?

>   Or would a newer-than-XP-but-not-the-most-recent version of Windows be
>   better? In which case, is it still possible to buy such a version? And
>   how long till the same question crops up again with that?

Another question to consider is whether the scanner would work with a
newer version of Windows.  I have a perfectly good HP Scanjet 5370C for
which there are no drivers available after XP.  (I believe there is a
commercial program which work on Windows 7.)  It works fine with Ubuntu
though.  So do check that if you are considering a Windows upgrade.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Assigning Classes

2013-09-09 Thread Paul Johnson
On Mon, Sep 09, 2013 at 03:10:14PM +, Dave Cross wrote:
> Quoting James Laver :
> 
> >On Mon, Sep 9, 2013 at 2:57 PM, Paul Johnson  wrote:
> >>On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote:
> >>>Prolog. Facts and rules then go solve.
> >>
> >>no
> >
> >Actually, Prolog was my first thought too. The major limitation is
> >fallback behaviour.
> 
> I'm pretty sure that Paul wasn't actually dismissing Prolog. I think
> you'll find he was making a joke.

You're far too kind.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Assigning Classes

2013-09-09 Thread Paul Johnson
On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote:
> Prolog. Facts and rules then go solve.

no

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Assigning anonymous hash to a list

2013-08-01 Thread Paul Johnson
On Wed, Jul 31, 2013 at 10:44:23PM -0300, Hernan Lopes wrote:
> if you dont understood what i meant, i am not going to explain.

I understood, and I'm happy to explain.

> On 7/31/13, Peter Corlett  wrote:
> > On Wed, Jul 31, 2013 at 01:04:11PM -0300, Hernan Lopes top-posted:
> >> it should be the same size to do what he wants... otherwise it wont work.

This is a special case of "it should do what he wants, otherwise it
won't work" which (granted, outside of IT) is generally considered a
truism.


PS Of the three commas I wrote in the paragraphs above, one is in scalar
context, one is in list context, and one is just a comma.

Of the three commas in the previous paragraph, one is Oxford.


[ Please imagine that I have added sufficient smileys, emoticons, emoji,
pictures of cats and ponies, etc. that your day is no worse for having
wasted your time reading this message. ]

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Scope of variables in a function

2013-06-01 Thread Paul Johnson
On Sat, Jun 01, 2013 at 07:03:45PM +0200, Marcel Grünauer wrote:
> On H.25/06/01, at 18:43, Andrew Beverley  wrote:
> 
> >  my $result = "FOO" if $in =~ /foo/;
> 
> Conditional variable declaration is confusing.
> 
> Try:
> 
> my $result;
> $result = "FOO" if $in =~ /foo/;
> 
> See 
> https://metacpan.org/module/Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations

And the official line from perlsyn:

NOTE: The behaviour of a "my", "state", or "our" modified with a statement
modifier conditional or loop construct (for example, "my $x if ...") is
undefined. The value of the "my" variable may be "undef", any previously
assigned value, or possibly anything else. Don't rely on it. Future
versions of perl might do something different from the version of perl you
try it out on. Here be dragons.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net



Re: Alternative sources of Perl programmers

2013-05-14 Thread Paul Johnson
On Tue, May 14, 2013 at 03:54:07PM +0100, Aaron Trevena wrote:
> On 14 May 2013 15:20, Ben Vinnerd  wrote:
> > On 14 May 2013 15:02, Dominic Humphries  wrote:
> >
> >> 50 miles? Luxury! I have to do sixty! :)
> >>
> > Indeed. My previous contract was 223 miles, each way! (I became Travelodge
> > guest of the year during that gig!! lol)
> 
> 223?
> 
> Pah! my last contracting gig was 682 miles each way (Threemilestone,
> Cornwall to Groningen, Netherlands)

I can just about better that with 707 miles (Zurich to Bristol) a few
years ago.

But to echo what has been said before, work from home, decent money and
mail to jobs.perl.org.  Yes, there are caveats, some of which are
different to the caveats for onsite hiring, but it's a good solution for
some people and for some companies.  And I think I'm quite safe in
saying for more companies than are currently working that way.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: h2xs -x

2012-11-07 Thread Paul Johnson
On Mon, Nov 05, 2012 at 01:35:39PM -0800, Yitzchak Scott-Thoennes wrote:
> On Ubuntu 12.04, I was able to follow exactly the example here:
> 
> http://perldoc.perl.org/perlxstut.html#EXAMPLE-4
> 
> except for adding -x to the h2xs invocation and not adding the foo stub to
> the .xs file manually, and all worked just fine.

I think the problem occurs when you #include 

> I'm a little confused that you say modern linux/gcc but appear to have perl
> 5.8.8.

I think it's relative.  As far as I can tell this problem has existed
for many years.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: h2xs -x

2012-11-05 Thread Paul Johnson
Did you ever manage to get anywhere with this?

Or does anyone on the list have any suggestions?


On Fri, Oct 28, 2011 at 03:40:21PM +0100, Dirk Koopman wrote:
> Has anyone managed to get h2xs -x to produce anything on a modern
> gcc / linux combination? It seems to barf parsing the interstices of
> stdio.h etc and, BTW, with totally useless error messages.
> 
> I also notice that debian removed the package on 2008 on the grounds
> that "nobody used it" (and it produced this error then).
> 
> Expecting parenth after identifier in `struct _IO_FILE_plus _IO_2_1_stdin_;
> extern struct _IO_FILE_plus _IO_2_1_stdout_;
> extern struct _IO_FILE_plus _IO_2_1_stderr_;
> # 364 "/usr/include/libio.h" 3 4
> typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t
> __nbytes);
> 
> typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
>  size_t __n);
> 
> typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
> typedef int __io_close_fn (void *__cookie);
> typedef __io_read_fn cookie_read_function_t;
> typedef __io_write_fn cookie_write_function_t;
> typedef __io_seek_fn cookie_seek_function_t;
> typedef __io_close_fn cookie_close_function_t;
> 
> typedef struct
> {
>   __io_read_fn *read;
>   __io_write_fn *write;
>   __io_seek_fn *seek;
>   __io_close_fn *close;
> } _IO_cookie_io_functions_t;
> typedef _IO_cookie_io_functions_t cookie_io_functions_t;
> 
> struct _IO_cookie_file;
> 
> extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int
> __read_write,
> void *__cookie, _IO_cookie_io_functions_t __fns)'
> after `struct _IO_FILE_plus _IO_2_1_stdin_' at
> /usr/local/share/perl/5.8.8/C/Scan.pm line 729.
> 

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Mason

2012-02-29 Thread Paul Johnson
On Wed, Feb 29, 2012 at 06:21:04PM +, Jones, Christopher wrote:
> On 29 Feb 2012, at 17:11, Leo Lapworth wrote:
> 
> > Quoting Christopher Jones :
> > 
> >> I'm looking for a decent book to help get me up to speed with Mason but
> >> could only find "Embedding Perl in HTML with Mason" on Amazon - a paper
> >> edition from 2002 and a more recent 2010 edition on Kindle only.
> > 
> > Mason 2 was released:  Feb 16, 2011 - I'm guessing (but don't know)
> > that it changed quite a bit.
> > 
> > Personally I use Plack + Template toolkit + Catalyst mostly.
> > 
> > But not sure _why_ you want to learn Mason, if it's for an existing site 
> > then
> > the book may be of use.
> 
> New job, old tricks new to old dog
> 
> Have to confess, I didn't realise Mason (1) was quite *that* old

I've learnt enough Mason in the last year to keep an old site up and
running and extend it as required before it gets replaced by a .net
system.  (Yeah, yeah.)  From my point of view, there's little to
recommend using Mason nowadays.  Mason 1 that is, I have no knowledge of
Mason 2.

The only advantage I can think of is that you might like its templating
system.  Personally, I don't really, but I can believe that others
might.

Disadvantages are that it's tied to mod_perl.  I believe that means that
you can't bring plack into the equation which, in turn, means that you
can't take advantage of the plack middleware.  I'd be pleased to be
shown that I'm mistaken here.

Additionally, each template is in the same namespace, and is basically
the body of a subroutine.  This essentially means that you can't use
named subroutines in templates.  You can look on this as encouragement
to move your logic into modules but, as Leo notes, the other side is
that the components can get very messy if you don't heed this
encouragement.

And then I had to hack Mason itself in order to get code coverage
information from the components.

I managed alright with the online book that Dave mentioned, but I wasn't
trying to learn it thoroughly - just well enough.

My best tip, if you need to work with Mason, is to look at the compiled
code in the mason_cache directory to see what's really happening.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: The proper way to open()

2012-02-01 Thread Paul Johnson
On Wed, Feb 01, 2012 at 01:34:05PM +, Smylers wrote:

> Until I started using Perl I'd only ever seen an OR operator (however
> spelt) used for combining boolean expressions, such as:
> 
>   if (!$awoke || $booted > $awoke)
> 
> The concept of 'or if that command failed, here's what to do instead'
> was new to me. I liked it, and that there was an operator for it.

This concept will be familiar to shell programmers.  I wonder whether it
is older than that though.  Does anyone have any earlier examples?

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: 5 minimums for any perl script?

2012-01-30 Thread Paul Johnson
On Mon, Jan 30, 2012 at 04:19:19PM +, Mark Fowler wrote:
> On Mon, Jan 30, 2012 at 3:40 PM, Sam Kington  wrote:
> 
> >>> # Checking return values is a good thing. Checking the return value of
> >>> # close or print STDERR is downright silly.
> 
> > In the code that we write at $WORK, any filehandle we close tends to be a 
> > log file or something, so adding extra boilerplate to our close statements 
> > would just be annoying.
> 
> Why are you doing this by hand?  Why aren't you letting autodie handle
> this for you?

What we really need is for autodie to work on the implicit close on a
lexical filehandle going out of scope.

Someone please write that.

And then fix up all the little bits and bobs around the edges.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: 5 minimums for any perl script?

2012-01-30 Thread Paul Johnson
On Mon, Jan 30, 2012 at 03:00:00PM +, Sam Kington wrote:

> One problem with perlcritic is that many of its rules, out of the box, are 
> silly and annoying. You need to do a fair amount of tweaking to stop it 
> bitching about stuff you don't care about, before you can get to the bits 
> where it's actually useful. Here's $WORK's standard perlcriticrc:

I wouldn't argue with most of those (though I don't use perlcritic
myself anyway) but

> # Checking return values is a good thing. Checking the return value of
> # close or print STDERR is downright silly.
> [InputOutput::RequireCheckedSyscalls]
> functions = :builtins
> exclude_functions = print close

could you explain why you think checking the return value of close() is
silly?  I tend to have the opposite opinion.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Laptop Recommendation

2012-01-24 Thread Paul Johnson
On Tue, Jan 24, 2012 at 03:41:33PM +, Smylers wrote:
> Chris Carline writes:
> 
> > The solution is to run your favourite choice of OS on top of a VM. ...
> > I would also recommend this setup for Windows-based laptops too. ...
> > solves a lot of compatibility issues with non-standard hardware, power
> > management and suspension support

> > I apologise in advance if this solution is insufficiently idealistic
> > for your taste,
> 
> No, it's a good idea, thank you. If I end up buying a laptop with
> Windows or OS X installed I shall definitely give it a go first.

I've been developing primarily on Ubuntu running in VirtualBox for a
couple of years or so now.  I started working this way because Linux
doesn't (didn't?) run well on either my desktop or laptop, though it's
fine on my server.

I find it to be quite a comfortable way or working, with few problems
and some advantages.  The main downsides for me are that deleting large
directories on shared folders sometimes messes up and requires the disk
to be unmounted and remounted (solution, try to remember to do that on
the native OS) and that whenever I do something with Windows and it
wants to be rebooted, I need to stop or suspend the VM.

I tend to use notion as my Window Manager and I leave one frame blank
and view in Seamless Mode.  This means that the host OS is visible in
that blank frame.

I've put the VM on an SSD and given it access to all the CPUs, so it's
quite speedy too.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Google Code-in - urgent assistance required

2011-10-30 Thread Paul Johnson
[ See this post in glorious HTML at
http://blogs.perl.org/users/paul_johnson/2011/10/more-about-gci-2011.html ]

The Google Code-in 2011 (GCI - http://wiki.enlightenedperl.org/gci2011)
will be starting shortly.  This is the programme under which students
aged between 13 and 17 years are encouraged to get involved in open
source projects.  The Perl Foundation would like Perl to be a part of
this programme, bringing both short and long-term benefits to Perl and
the students alike.

Many of you will have seen my previous post
(http://blogs.perl.org/users/paul_johnson/2011/10/gci-2011.html) asking
the Perl community for help in creating tasks for students.  A few of
you have subsequently added tasks to the ideas page
(http://wiki.enlightenedperl.org/gci2011/gci2011/ideas).  For this we
are extremely grateful.  Some of you may well be planning to add some
tasks.  We'll also be very grateful for these tasks.

It's almost time to submit our application.  But for our application to
be successful we really need to add more tasks.  So I'm renewing my
appeal for your help.

We need help from all sorts of people.  From developers, from designers,
from technical writers, from managers, from marketers, from QA people
and testers, from architects, from trainers, from user interface
specialists and from anyone who can speak more than one language.  And
if you're reading this and don't fit into any of those categories then
you undoubtedly have other talents and we probably need you even more.

We need you to visit the ideas page
(http://wiki.enlightenedperl.org/gci2011/gci2011/ideas) and read about
the sort of tasks we need.  Then create a login and add a task.  If you
can't or don't want to create a login, please mail your task to me at
p...@pjcj.net

Here are some suggestions for tasks:

 - Develop a new feature.
 - Port to a new operating system.
 - Fix a bug.  (Go and check your RT queue.)
 - Add tests for a feature.
 - Add tests to improve coverage.  (Take a look at cpancover
   http://pjcj.sytes.net/cpancover/ )
 - Add to or improve documentation.
 - Write a tutorial.
 - Make a tutorial video.
 - Make a promotional video.
 - Add internationalisation (I18N) to a module.
 - Translate documentation, tutorials or web sites.
 - Investigate API changes.
 - Research new ideas. algorithms or libraries.
 - Compare and contrast modules.

But feel free to let your imagination run wild.  Any task that a young
student could perform that would be beneficial to the project is fair
game.

In addition, if you really cannot think of a task to add, but you would
be willing to act as a mentor please add your name to the ideas page
(http://wiki.enlightenedperl.org/gci2011/gci2011/ideas) and note any
areas in which you would be willing to mentor.  In particular we are in
need of mentors who would be able to assist with translation tasks, so
if you speak more than one language please add your name and note which
languages you speak.  We also need mentors who would be happy to work
with students on bugs in modules where the author is unable to do so.
But we're very happy to accept all volunteers.  So please either add a
task or sign up as a mentor.  (Or both.)

But this is getting very urgent.  Our application needs to be on Tuesday
so please don't delay and sign up today!

Thank you very much for your assistance.  I trust that with your help
this year's GCI will be even more successful than last year's.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Should I get my mum a Kindle?

2011-09-25 Thread Paul Johnson
On Sun, Sep 25, 2011 at 11:34:23AM +0100, James Laver wrote:

> If your mother is merely highly intelligent rather than stephen
> hawking standard, she probably doesn't stand a chance with some
> devices.

"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure out
how to use my telephone."

  -- Bjarne Stroustrup

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Should I get my mum a Kindle?

2011-09-21 Thread Paul Johnson
On Tue, Sep 20, 2011 at 03:39:31PM +0100, David Cantrell wrote:
> On Tue, Sep 20, 2011 at 02:33:10PM +0100, Dave Hodgkinson wrote:
> > On 20 Sep 2011, at 14:21, Edmund von der Burg wrote:
> > > Perhaps an iPod Touch with some cloud syncing so you can put music
> > > onto it? No idea about the details though but if my toddler can work
> > > an iPad your Mum should be able to too :)
> > No, he said there's no wifi in the house. iPhone was my first thought
> > or maybe iTouch plus one of those 3G->wifi dongledoofers.
> 
> The great thing about a Kindle is that there's no monthly cost for the
> data.

I'm not very familiar with the Kindle, but I believe it can be rooted.
Perhaps it could be configured to set up a reverse ssh tunnel to one of
your machines on occasion.  From there you could upload or configure
whatever you wanted.

Otherwise a cheap Android handset running CyanogenMod or something
similar could do the same, though in that case you would need an
appropriate mobile contract, of course.  The Orange San Francisco was
going for under a ton a year or so ago.  There may well be better
deals/phones around now.  Though this is all getting dangerously close
to owning a computer.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: PHP

2011-08-03 Thread Paul Johnson
On Wed, Aug 03, 2011 at 08:07:46AM -0700, Randal L. Schwartz wrote:
> >>>>> "Nicholas" == Nicholas Clark  writes:
> 
> Nicholas> Isn't there some quote, roughly "you don't program PHP, you ??? it 
> until it
> Nicholas> works", possibly attributed to Randal Schwartz?
> 
> No, I'm famous for "PHP: Training Wheels without the Bike", as
> illustrated beautifully at http://tnx.nl/php.html.  (Click the image for
> a desktop version.)

“I Never Said Most of the Things I Said” - Yogi Berra

Or perhaps it was Mark Twain or Winston Churchill or George Bernard Shaw or ...

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net



Re: Dear Git Users

2011-07-21 Thread Paul Johnson
On Thu, Jul 21, 2011 at 10:16:42PM +0100, David Cantrell wrote:
> I have a single gigantic repo with all of my perl modules in. It should
> really be broken up into a seperate repo for each module. I would also
> like to move them to github. Does anyone have a recipe for this, which
> won't lose any history? You may assume that I have no branches and
> everything has always been in 'master'.

My notes from when I did this are here:

  http://pjcj.sytes.net/notes/2010/09/25#splitting_a_git_repo

I seem to recall moving stuff to github being fairly straightforward
once you worked out what needed to be done.  I'm afraid that I can
neither remember what I did, nor can I find the instructions on how to
do it on github itself.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: [OT]-ish: Can someone explain this?

2011-07-04 Thread Paul Johnson
On Mon, Jul 04, 2011 at 06:59:46PM +0100, Andrew Suffield wrote:
> On Mon, Jul 04, 2011 at 04:40:48PM +0100, David Cantrell wrote:
> > On Sat, Jul 02, 2011 at 05:32:38PM +0100, Dirk Koopman wrote:
> > 
> > > Here is a bit of C code that is part of something much bigger.
> > > 
> > >   _exit(0);   
> > 
> > Why _exit instead of exit?
> > 
> > exit() DTRT with flushing filehandles.
> 
> Yeah, I forgot to say earlier:
> 
> You almost never want to call _exit() unless you're implementing libc
> or doing evil things with fork().

If you have a program which allocates large dynamic data structures,
cleaning up those structures when the program terminates can be quite
expensive.  Judicious use of _exit(), particularly in C++, can (could?)
be the difference between a program ending almost immediately and a very
noticeable delay.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: RFC: Test::Copyright

2011-06-14 Thread Paul Johnson
On Tue, Jun 14, 2011 at 01:56:44PM +0100, Dave Cross wrote:
> On 06/14/2011 01:45 PM, David Cantrell wrote:
> >
> >CPANTS is over there -->  :-)
> 
> Actually, CPANTS looks a little broken. Its data is almost three years old.
> 
> "CPANTS data generated with Perl 5.010001, Module::CPANTS::Analyse
> 0.82_01 and Module::CPANTS::ProcessCPAN 0.77, at 2008-08-13
> 10:00:03."

There was some work on it during the QA hackathon in Amsterdam a few weeks
ago, but I suspect the effort may have been sabotaged by a surfeit of real
life and a dearth of tuits.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Devel::Cover with Moose?

2011-05-23 Thread Paul Johnson
On Mon, May 23, 2011 at 06:27:22PM +1000, Toby Corkindale wrote:
> Is anyone else using Devel::Cover with Moose, much?
> I seem to get megabytes of warnings displayed even on trivial modules.
> It's trying to create MD5 digests of files containing the materialised
> functions created by __PACKAGE__->meta->make_immutable.
> 
> For example:
> 
> $ cat Foo.pm
> package Foo;
> use Moose;
> __PACKAGE__->meta->make_immutable;
> 1;
> 
> $ perl -MDevel::Cover -e 'use Foo'
> 
> I've filed a bug report, but I don't suppose there's just an easy workaround?

I've read the bug report.  I don't suppose there is, unless you count
piping the output through grep -v "Can't" as an easy workaround.  It's
quite easy, at least.

Is the problem just that there is a lot of noise, or are the results
incorrect in some way too?

The noise I can probably deal with.  The problem is, I suppose, that
Moose is making up filenames and then when Devel::Cover takes it at its
word and goes to look in those files it finds that Moose was actually
telling porky pies, and so it complains about that.

Does Moose consistently format its made up filenames in some way that I
could recognise them?  Is there any useful information in the made up
filenames or should I just ignore them completely?

I realise that this is not the appropriate list for this discussion, but
I'm not on any Moose lists and you didn't ask in perl-qa :-P

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Best practice for unit tests that rely on internet access?

2011-04-29 Thread Paul Johnson
On Fri, Apr 29, 2011 at 11:15:58AM +1000, Toby Wintermute wrote:
> What is the best practice for writing unit tests that rely on internet access?
> 
> ie. You have a CPAN module which is all about talking to a web
> service.. So you have unit tests that do just that.
> What if the system testing it doesn't allow HTTP connections out? The
> tests will fail..

You're running into the limitation (if you want to see it as that) that
modules only really have one type of test.  This isn't usually a
problem, but in the case you mention it is.

I agree that unit tests should mock the service.  However, system tests
(or whatever you happen to call them) should test the actual service.

My suggestion would be to run mocked tests by default and provide a
method to run live tests should the user want to do that.  The user
should also have system tests for their whole application that will test
the live service too.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Leadership Election

2010-10-13 Thread Paul Johnson
On Wed, Oct 13, 2010 at 09:46:34AM +0100, Spiros Denaxas wrote:

> Are we, in all seriousness, putting forward two stuffed animals as
> candidates? If so, what stops somebody from
> vouching for an imaginary entity, like my pet narwhal?

Because that would just be silly.

But mainly because your narwhal missed the nomination deadline.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Good Unix pranks for kids?

2010-09-28 Thread Paul Johnson
On Tue, Sep 28, 2010 at 08:12:38PM +0200, Stefan Scheytt wrote:

> Do you guys know any other fun pranks to play on an unwitting X user from
> a privileged command line?

The old favourites used to be xflip and meltdown, but they might run too
quickly to be appreciated nowadays.  Then there's xroach and xsnow for the
wintertime.

I think that the first perl program I ever wrote, back in the late 80s, read
the rgb.txt file and ran xsetroot to change the background to random colours.
Because that was the sort of thing you did when your university got hardware
that gave you more than 80x24 characters.  Oh, what high jinks!

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Perl Christmas Quiz 2009 Answers

2009-12-09 Thread Paul Johnson
On Wed, Dec 09, 2009 at 01:20:54PM +, Chris Jack wrote:

> I think my answer to question 10 may cause controversy, but it is
> based on a careful reading of the sited webpage.

> 10) What is the highest value of X that is a currently available, stable
> production release of perl 5.X?
> 
> Answer: 8 see http://www.perl.com/download.csp

Unfortunately, I'm not sure that web page should be taken as
authoritative with respect to perl versions.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Perl Christmas Quiz 2009

2009-11-30 Thread Paul Johnson
On Mon, Nov 30, 2009 at 12:14:21PM -0800, Randal L. Schwartz wrote:
> >>>>> "Dave" == Dave Cross  writes:
> 
> >> 1) Without running it to check, what does the following program output?
> >> 
> >> 
> >> my %a = (3,2,1,0);
> >> 
> >> 
> >> for my $b (sort values %a) {
> >> $b += 4;
> >> }
> >> 
> >> 
> >> print $a{1} . "\n";
> 
> Dave> Without running it, I'd say 4. Having now run it, I'm glad that's what 
> I said
> Dave> :)
> 
> When did "sort" start returning lvalues?  I bet if you did this
> on an older Perl, it'd return 0.

But you couldn't use too old a perl or it would get upset by the "for
my".  So probably 5.4.x or so would be the ticket.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Every other

2009-10-30 Thread Paul Johnson
On Fri, Oct 30, 2009 at 11:32:43AM +0100, Philippe Bruhat (BooK) wrote:
> On Fri, Oct 30, 2009 at 10:14:14AM +, Philip Potter wrote:
> > 
> > Actually this is one thing that annoys me about Perl -- there doesn't
> > seem to be a definitive standard to say whether these guarantees are
> > cast-iron or whether they might change with new versions of perl. Or
> > if there is, I haven't seen one. I miss the certainty of the C
> > standard...
> > 
> 
> Well, there's the Perl test suite. I'd say that for the op/ part,
> I expect it to be very definitive and cast-iron.

And if it's not, and that bothers you, submit a new test.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Best practice for releasing Perl modules to staging and live

2009-05-20 Thread Paul Johnson
On Tue, May 19, 2009 at 04:59:50PM -0700, Ask Bjørn Hansen wrote:
>
> On May 19, 2009, at 7:22, Paul Johnson wrote:
>
>> The way I do this is to build perl and all the modules I need on the
>> development machine.  Then I package up the whole lot as a single
>> package.
>
> The big failure in this is that you can only have "one version" of  
> stuff.  One developer experimentally wants to try a new version of  
> Foo::Bar?   Too bad.   Want to deploy two versions of your app on the  
> same box (prod/stage running as different users).  Too bad.   One  
> developer debugging an older version of the application that a partner  
> is using?  Too bad.
>
> Perl modules are part of your application; not of the system.

I'll admit that we're starting to get into "horses for courses"
territory here, but I think that this is where we are differing.

Not that I am fundamentally disagreeing with you, but I'm increasingly
coming to the opinion that if an application is important enough to care
about it's important to have its own environment.  That could be a
dedicated box, a virtual machine, a zone, whatever.  The important thing
is that you have the system tailored to your application and don't need
to worry about how that will affect other applications, since there are
none.

If an application is important then I don't want to have to make the
distinction between application and system.  Neither do I, as a
developer, want to share my development system with anyone else in a way
that stops me doing whatever I want with it.  (Terms and conditions
apply.)

Now, I'm sure with a little creativity and hand-wavy magic one could
arrange some such system in which applications and/or developers share
an environment, but I think I'd rather just fire up another virtual
machine.  And in doing so, your concerns above are neatly sidestepped.

I'm not suggesting this is the correct approach for everyone - it's not
the approach I use for everything either - but it's an approach I like
when the application is important.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net



Re: Best practice for releasing Perl modules to staging and live

2009-05-19 Thread Paul Johnson
On Mon, May 18, 2009 at 04:03:19PM +0100, ian wrote:
> Paul Johnson wrote:
>> On Mon, May 18, 2009 at 02:22:09PM +0100, ian wrote:
>>
>>> How best to ensure different environments have the same versions of 
>>> Perl  modules?
>>
>>> Any other methods that should be considered?
>>
>> Pick a packaging system - preferably the one which is native to your OS.
>> Build your packages on your development system.  Only install packages on 
>> your
>> test and prod systems.
>>
> Are you advising to (re)build CPAN Perl modules this way, or are you  
> just describing what to do with our own Perl modules?
>
> One company I worked at did just this for CPAN modules, but it was a  
> many-day exercise to work out all the dependencies of (for example)  
> Catalyst and to build them all into Debian packages.

The way I do this is to build perl and all the modules I need on the
development machine.  Then I package up the whole lot as a single
package.  The application itself is also packaged up (in my case into a
number of separate packages, but that it not important).

This way, there is no need to worry about (module) dependencies because
I am packaging my perl environment as a whole.  I am never going to
update just a single perl module without rebuilding the entire package.

Building everything myself also ensures that I have complete control
over how it is built.  You could use the perl and cpan modules as
packaged by your vendor, but for anything you care about I would suggest
building your own.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: Best practice for releasing Perl modules to staging and live

2009-05-18 Thread Paul Johnson
On Mon, May 18, 2009 at 02:22:09PM +0100, ian wrote:

> How best to ensure different environments have the same versions of Perl  
> modules?

> Any other methods that should be considered?

Pick a packaging system - preferably the one which is native to your OS.
Build your packages on your development system.  Only install packages on your
test and prod systems.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net


Re: [Gllug-Social] [ANNOUNCE] December social - Bridge House, SE1 - Thurs 4 Dec

2008-12-04 Thread Paul Johnson
On Wed, Dec 03, 2008 at 12:20:04PM +, Andrew Taylor wrote:
> Was it just me? This message took 46 hours to get to me? It was posted
> at 14:57 GMT  on Monday and I received it just befor noon today.

Yes.  (Based on a sample size of two.)

I suspect it has somethig to do with moderation on the various lists.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: Duh v D'oh

2008-11-13 Thread Paul Johnson
On Thu, Nov 13, 2008 at 10:12:25AM +, Peter Haworth wrote:

>   while(my $k=each %h){
> # Explicit iteration of keys
>   }
> 
> You could argue that making it robust in the face of false keys
> reduces the subtlely somewhat, but the extra unwieldiness also
> obscures the intent somewhat in my view:
> 
>   while(defined(my $k=each %h)){
>   }

$ perl -MO=Deparse -e 'while(my $k=each %h){}'
while (defined(my $k = each %h)) {
();
}
$

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: MVC (Re: DBIx::Class - Related Tables)

2008-10-07 Thread Paul Johnson
On Tue, Oct 07, 2008 at 01:33:02PM +0100, Raphael Mankin wrote:
> 
> On Tue, 2008-10-07 at 12:50 +0100, Andy Wardley wrote:
> > 
> > [% # display custom panel based on user status
> >IF user.is_admin;
> >   INCLUDE admin/controls;
> >ELSIF user.is_logged_in;
> >   INCLUDE user/greeting;
> >ELSE;
> >   INCLUDE user/login;
> >END;
> > %]

> If there were many such IF statements in my templates I would tend to
> use separate templates for the user states (or whatever) and let the
> controller route to the appropriate one.

Every conditional is a missed opportunity for a derived class.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: Is -C useless?

2008-09-11 Thread Paul Johnson
On Fri, Sep 12, 2008 at 12:28:22AM +0100, Paul LeoNerd Evans wrote:
> On Thu, 11 Sep 2008 15:19:17 +0200
> Paul Johnson <[EMAIL PROTECTED]> wrote:
> 
> > since the standard streams are already set up
> >   at this point in the execution of the perl interpreter. You can use
> >   binmode() instead to get the desired behaviour.
> 
> Waaait a moment.
> 
> Why can't -C just call binmode itself?
> 
> This is getting stupider by the moment.

Well.  As I recall (in other words, don't blame me if I'm wrong), the
problem wasn't that it couldn't be made to work, but rather than no one could
be found who had the time, ability and inclination to make it work.  But
stopping it being broken was easier.

Perhaps you are that person?  You certainly seem to be at least one third of
the way there.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: Is -C useless?

2008-09-11 Thread Paul Johnson
On Thu, Sep 11, 2008 at 01:52:31PM +0100, Paul LeoNerd Evans wrote:
> On Thu, 11 Sep 2008 13:24:34 +0100
> Paul Orrock <[EMAIL PROTECTED]> wrote:
> 
> > $ chmod 755 test.pl
> > $ ./test.pl
> > 
> > Which gives me the output you want : Hello wérld
> > 
> > Unless I've missed something, which is highly likely
> 
>   $ ll test.pl 
>   -rwxr-xr-x 1 leo leo 48 2008-09-11 13:51 test.pl
> 
>   $ cat test.pl 
>   #!/usr/bin/perl -COL
> 
>   print "Hello w\xe9rld\n";
> 
>   $ ./test.pl 
>   Too late for "-COL" option at ./test.pl line 1.
> 
> By the way, this is perl 5.10. I think it used to work on 5.8.8.

Ah, then you'll have read pod/perl5100delta.pod.

  The B<-C> option can no longer be used on the C<#!> line. It wasn't
  working there anyway, since the standard streams are already set up
  at this point in the execution of the perl interpreter. You can use
  binmode() instead to get the desired behaviour.

Which is just what you seem to have discovered ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: [OT] select and sysread problem on solaris

2008-09-11 Thread Paul Johnson
On Thu, Sep 11, 2008 at 02:36:55AM +0100, Andy Armstrong wrote:
> On 11 Sep 2008, at 02:12, Paul Johnson wrote:
>> Is my assumption correct that if select tells you there is something to
>> be read then there should be something there to be read?  Can anyone
>> think of any other possibilities?
>
>
> 210 + ~30 = ~240 - which is getting close to 255. Since select uses a fixed 
> bit field to represent filenos there's an upper limit on the filenos you 
> can select on. What does this print?
>
> #include 
> #include 
>
> int main( void ) {
> printf( "%d\n", FD_SETSIZE );
> return 0;
> }

Hi Andy,

Thanks for thinking about this.

The output is 1024, but I'm not convinced the problem lies in this area.

The numbers I gave are a little inaccurate (I was trying to remember off
the top of my head early in the morning).  There were previously 343
named pipes being monitored, and there will now be about 60 more.  These
are split between three processes, so each one will be selecting over
about 135 pipes.

As you see, this should be covered and, in addition, I am using
PERLIO=perlio so that Perl's own IO implementation is being used,
allowing 1024 files to be opened per process, rather than the 256 which
would be allowed with Solaris' stdio implementation.

We have just moved from under 128 files per select to just over, but I
don't think this is the problem.  Additionally, the system will seem to
work fine for many Gb of data before this problem is (seemingly
randonly) triggered.

Thanks again for your hint.  Do you (or anyone else) have any more?  (I
know you'd all rather talk about macs and mobiles.)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


[OT] select and sysread problem on solaris

2008-09-10 Thread Paul Johnson
I'm looking for a little help in solving a problem which has me stumped
and couldn't think of anywhere better to come.  That's not the problem
by the way, but I'll take answers to that as well.

I have about 210 named pipes (FIFOs) and three processes which are
running a select over a third of the pipes each, and then calling
sysread on the pipe before writing out the data to log files.

This has been working well in production for almost two years handling
many GB of data daily.

Recently, another thirty or so pipes have been added to this group and
very occassionally I am noticing a problem whereby select will indicate
that a pipe is ready for reading and sysread will attempt to read from
the pipe, but there is actually nothing there to be read, and so the
sysread call hangs waiting for input.

Reproducing this problem is difficult, but I currently have the system
in such a state.  The pipe on which the sysread call is waiting is one
of the new pipes.

I can only think of four possible explanations here:

 1.  My code is broken.  I don't think this is the case but don't want
 to rule it out.

 2.  Some other process has read the data inbetween the select returning
 and the sysread being called.  lsof shows no unexpected processes
 accessing the pipe at the moment and no one should have been on the
 system to have run cat or anything.  last shows nothing suspicious.

 3. Perl's select is broken.

 4. The OS broken.

Is my assumption correct that if select tells you there is something to
be read then there should be something there to be read?  Can anyone
think of any other possibilities?

What is curious to me is that the process writing to the named pipe is
hung.  Is the pipe locked somehow until the sysread call has returned?

Unless I can think of anything better to do, tomorrow I will try to send
some data to the named pipe that is being read to see if that will allow
the sysread to return.  If it does, I should be able to tell whether any
data has been lost from the named pipe, which might indicate that
another process had read it.

I am running perl-5.8.8 on Solaris 8.  The program writing to named pipe
is a Java program which is writing to STDOUT.  That program has been
called using system by a Perl wrapper which has reopened STDOUT to the
named pipe.  The program reading from the named pipe is using PERLIO.

I'm open to any hints, suggestions or solutions.

Thanks for reading this far.  Unless you just skipped to the bottom.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: London.pm Dim sum Thursday 1pm: Leong's Legend

2008-08-27 Thread Paul Johnson
On Wed, Aug 27, 2008 at 10:25:40AM +0100, Leon Brocard wrote:

> We ended up going to Royal Garden during YAPC::Europe and it was
> pretty good. The staff actually thanked us at the end of dinner for
> knowing about dim sum.

For a rather rather generous definition of "us".  It was my first time
of eating dim sum, and I rather enjoyed it.  Though I wasn't tempted in
the least by the chicken feet.  It's possible that they may have
enhanced the experience, but I suspect it to be more likely that they
would have had a detrimental effect.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


Re: Module dependencies

2003-09-08 Thread Paul Johnson

Shevek said:
> On Mon, 8 Sep 2003, Rafael Garcia-Suarez wrote:
>
>> Shevek wrote:
>> >
>> > Surely identifying the dependencies of any one module is incomputable
>> in
>> > general, and most likely incomputable in the specific cases of many
>> > popular modules, especially those with baroque plugin architectures.
>>
>> Of course that depends on whether you want to compute the dependencies
>> yourself, or if you rely on metadata such as the Makefile.PLs and
>> the META.yml files.
>
> I believe that there is a sufficient proportion of Makefile.PL files which
> compute dependencies rather than using a PREREQ_PM to make this an
> unpleasant task.

I tend to check for the presence of modules in Makefile.PL and if they are
not found give a warning to say that certain functionality is unavailable
until they are installed, then check for those modules at runtime if the
functions which need them are called.

What would be nice would be a way to say here is a list of modules which
are nice to have but not required.  Then, if running CPAN or CPANPLUS
those dependencies could be made into prerequisites or left as nice to
have and handled some other way or something.  This would probably break
any static parser unless there was some convention to follow.

Being a heathen, I have no idea how this would interact with Module::Build
or META.yml.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-03 Thread Paul Johnson

Nicholas Clark said:

> At the risk of going off topic, the Perl 5 source isn't exactly pleasant.
> And contains gotos. IIRC I added 2 between 5.6.0 and 5.8.0, but the
> alternative was a big mess of if()s and braces. C doesn't have all the
> nice loop labelling features of a certain other language.

I think I wrote my first ever goto code in C yesterday.  It was a part of
a rewrite of the runops function in Devel::Cover, so I justified it on
performance grounds and it felt quite invigorating.

I wonder whether I could find a way to justify some self modifying code?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Programming Email Filters

2003-09-01 Thread Paul Johnson
On Mon, Sep 01, 2003 at 02:09:58PM -0700, Dave Cross wrote:

> Problem the third.
> 
> I use procmail for my mail filtering, so I need to plug this
> new filter in with that. The processing I need is:
> 
> if email is to a dodgy address then
>save it in 'notme' mailbox
> else
>continue with normal procmail processing
> end
> 
> But my procmail powers are weak and I can't work out how to do
> it. I see that spamassassin adds a new header to the email and
> my next procmail rules does the filtering. That would be an acceptable
> solution if I can't do it all in one rule.

It's not the answer you want, because it doesn't use an external filter,
but I use something like this, which seems to be doing a reasonable job:

:0
* !^TO_\<(x|y|z)@pjcj\.net
notme

Where x, y and z are the addresses on which I expect to receive valid
mail.  The major problem now is remembering all the adresses on which I
expect to receive valid mail.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: ExtUtils::MakeMaker grief -- installing a generated file

2003-07-16 Thread Paul Johnson
On Wed, Jul 16, 2003 at 04:34:40PM +0100, Clayton, Nik [IT] wrote:

> But I can't work out what would be an appropriate way to get ::MakeMaker
> to install the file.  From reading the docs it looks like ::MakeMaker
> scans the source tree before generating 'Makefile', and includes the
> files it found during this scan as files to be installed.  And I can't
> work out how to get this file created before that scan -- at least, not
> in a non-kludgey fashion.
> 
> Of course, something like this in Makefile.PL would work:
> 
> system('./mkconstant.pl > NAI/constants.pm');
> 
> WriteMakefile( ... ); # As normal
> 
> but there has to be a ::MakeMaker supported way of doing this, right?

That's the way I've always done it.  It doesn't really seem any more
kludgey than most of the other stuff which is going on, and since it
works I've not really searched for another way.  Or maybe I have and
I've managed to blot it out of my memory.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: How to make lexical warnings 'die'?

2003-07-14 Thread Paul Johnson

Philip Newton said:
> I'm trying to find out whether I have valid input data and wanted to
> use warnings for this purpose - by adding zero to get a number and
> trapping the "argument is not numeric in addition" warning.
>
> Reading through perllexwarn suggests that I should be able to "use
> warnings FATAL => qw(numeric);" for this. Yet the following code
> doesn't do what I expect:
>
> use warnings FATAL => qw(numeric);
> eval {
>   my $price = $content + 0;
>   print "\n";
>   $totalPrice += $price;
> };
> if($@) {
>   # report an error and "die" with a custom message
> }
>
> In particular, neither is $@ set after this, nor does execution
> terminate completely (in particular, "" is printed even though the
> warning is printed to STDERR.

I dunno.  Works for me.

> This is with ActivePerl 623 (based on 5.6.0).

Solaris 5.6.1 and 5.8.0.

> Any ideas? (Or should I use the regex version or the one based on
> strtod in `perldoc -q determine`?)

I'd look at Scalar::Util::looks_like_number()  I think you'll need the
CPAN version.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Is dynamic inheritance bad?

2003-07-10 Thread Paul Johnson

Shevek said:
> On Thu, 10 Jul 2003, Richard Clamp wrote:
>
>> On Thu, Jul 10, 2003 at 04:14:21PM +0100, Shevek wrote:
>> > But if this were the case (for a general system of this type), then
>> the
>> > type of storage now becomes a matter for the code, rather than just a
>> > configuration variable, and
>> >
>> > my $obj = Factory->new($type, ...)
>> >
>> > becomes in every piece of code:
>> >
>> > my $obj;
>> > if ($type eq 'a') {
>> >$obj = Factory->a(...);
>> > }
>> > elsif ($type eq 'b') {
>> >$obj = Factory->b(...);
>> > }
>>
>> Or, if you're familiar with the fun of perls OO it remains the much
>> more similar:
>>
>>  my $obj = Factory->$type(...);
>
> But now you are allowing configuration variables to modify actual code,
> whereas normally for security reasons one would prefer to keep code and
> data strictly separate. I still prefer the DBI method.

Keep code and data separate?  The code is data.  Or the data is code.  Or
something.

Anyway, to satisfy your security concerns, you don't actually write the
methods, you generate them on the fly in an AUTOLOAD (they'll probably all
be similar anyway) after having checked their validity:

sub AUTOLOAD
{
return if $AUTOLOAD =~ /::DESTROY$/;
my $func = $AUTOLOAD;
    $func =~ s/^.*:://;
carp "Undefined subroutine $func called" unless valid($func);
no strict "refs";
*$func = sub
{
  my $self = shift;
  ...
};
goto &$func
}

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Hundredweight was Re: UK Money, again

2003-07-07 Thread Paul Johnson

Andrew Beattie said:

> On the other hand, if you were somehow able to store a byte
> of information in a single molecule, then you could store
> a yobibyte in a single cup of really hot tea.

The problem would then become one of how you could use your laptop without
spilling some of your data and scalding yourself.  I would also hope that
Maxtor etc would place sufficient warnings to prevent themselves from
being sued.  I suppose you might also find yourself in the unfortunate
position of having some of your modules or ogg files evaporate.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: matching yer conditionals

2003-07-07 Thread Paul Johnson

Simon Wistow said:

> I hate our internal templating language which we affectionateluy refer
> to as "Satan's own templating language" or "Gah, you
> suckle on the wang of a syphillitic mule you pus filled buboe of a
> abomination-stroke-language ... a curse on your creators may they rot
> in hell with their flesh being flayed from them with cocktails
> umbrellas as a thousand incontinent were-elephants micturate on them"

Any chance you could upload it to CPAN?

> But it does have one slightly nice (albeit probably unintentional)
> feature to do with 'if' statements. Since the language can't be indented
> (don't ask - lest you be condemned to the same fate involving pachyderms
> described above) you can do this
>
>
> 
> ...
> 
>
>
> And thus if you have long, nested 'if' statements they become easier to
> edit. Not that it actually cares if they match up or anything.
>
> So I was wondering whether it would be possible/a good thing to have
> something like ...
>
>
> if ($somevar eq 'foo') {
> ...
> } ($somevar eq 'foo')
>
> And have them check to see if they're the same thing.

I'm not sure what advantages this has over proper indentation and a decent
editor.  And besides, duplicate code should be mercilessly factored.  I've
never liked having the condition as a comment after the endif, either.  If
the block is so big that you're not sure what the condition was when you
get to the end, factor out some or all of the block.

As long as you can use a decent language and tools, of course.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Hundredweight was Re: UK Money, again

2003-07-04 Thread Paul Johnson

Peter Haworth said:

> On Tue, 1 Jul 2003 21:28:07 -0400, muppet wrote:

>> " kbyte  1024 byte
>>   megabyte   1024 kbyte
>>   gigabyte   1024 megabyte
>> +terabyte1024 gigabyte
>> +petabyte1024 terabyte
>> +exabyte 1024 petabyte
>> +zettabyte   1024 exabyte
>> +yottabyte   1024 zettabyte"

> Come to think of it, why aren't zetta and yotta the other way round?
> That way you'd at least get (e)x y z at the end, which would make some
> kind of sense.

It was supposed to be exa, yetta, zotta, but they had a German temp and no
one noticed until too late.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Using LWP for protected pages

2003-07-01 Thread Paul Johnson
On Sun, Jun 29, 2003 at 10:45:51PM +0100, Leon Brocard wrote:
> Paul Johnson sent the following bits through the ether:
> 
> > Anyone got any time to write a Javascript library and integrate it into
> > WWW:Mechanize?
> 
> Handily, the mozilla guys went and wrote a JavaScript library for us:
> http://www.mozilla.org/js/spidermonkey/
> 
> And waddaya know, it already has a Perl wrapper:
> http://search.cpan.org/author/CLAESJAC/JavaScript/
> 
> Now it's just a simple matter of programming ;-), Leon

Yes, I did consider that option, but my tuits were incompatible with the
SMOP.  In particular it looks like quite a reasonably sized job messing
about with variables in different frames.  (I'm sure I have the
terminology wrong here.)

Another thing I had to do was make sure that the secure connection was
reused, which is something the ssh library that LWP uses cannot do.  I'd
love to be able to find some time to clean up the hack and get a patch
out.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: Using LWP for protected pages

2003-06-29 Thread Paul Johnson
On Sun, Jun 29, 2003 at 09:01:47AM -0500, Nigel Hamilton wrote:
> Hi COlin,
> 
> Here are some things to try in order:
> 
> * Make sure you're requesting the right URL. Inspect the "action"
> attribute of the  you need to request this URL not the login page.
> 
> * Try setting the UserAgent to: 
>   $this->agent('Mozilla/4.76 [en] (Win98; U)');
> 
> * Make sure the submission is method is the same as the login
> form (is it 'GET' or 'POST'?)
> 
> * Set the 'Referer' of the Request object:
>   $this->post($url, $params, 'Referer' => $referer);
> 
> * Inspect the source HTML of the login page to make sure no
> Javascript is dynamically setting a hidden variable on submission of the
> login page.

One of the things I have found really helpful is to run Live Http
Headers in mozilla.  Then you can see what is really going on.

I also use WWW::Mechanize and dump the agent object.

If the site is using Javascript, you need to work around whatever it's
going.

Anyone got any time to write a Javascript library and integrate it into
WWW:Mechanize?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: ICFP This Weekend

2003-06-28 Thread Paul Johnson
On Sat, Jun 28, 2003 at 01:34:53PM +0100, Shevek wrote:

> I've realised how easy XS is for little tasks, and how my first XS project
> (writing a compiler) was rather jumping in at the deep end, and how
> useless h2xs is.

But you have to

   Always begin with h2xs.
   Always begin with h2xs!
   ALWAYS BEGIN WITH H2XS!

And so I did.

Once.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: UK Money, again

2003-06-26 Thread Paul Johnson

David Wright said:

> Scottish measures are bigger too (from fond memory), I think they might be
> 1/5 gill.
>
> Ooh, and whilst searching for the correct fraction, I found some other
> curious Scots quantities:
>
> 4 gills = 1 mutchkin
> 2 mutchkins = 1 chopin

Which is well on the way to Brahms and Liszt.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: UK Money, again

2003-06-26 Thread Paul Johnson

muppet said:

> volume measures are weird, too:  ounces, cups, pints, quarts, gallons,
> barrels, thimbles, something smaller than an ounce that i can't
> remember

One of my favourite recipes calls for a scant gill of milk, which I always
found rather poetic.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: DBD::Pg - insert_id

2003-06-20 Thread Paul Johnson

Raf said:
> Luis Campos de Carvalho said:
>> Jason Clifford wrote:
>>> On Fri, 20 Jun 2003, Raf wrote:
> ^^^
>
> Lies!  I did not write that!
> It's just poor indentation.
>
>>>
>>> How safe is this in environments where lots of separate processes,
>>> using  separate connections to the database, are updating the same
>>> table?
> 
>>> If you grab the number in advance isn't there a risk that another
>>> process  will insert a record first and get the sequence number you're
>>> expecting?
>>
>>Never. PG handles this concurrency graciously for you.
>>Have a nice day.
>
> I 'know' that.
>
> I feel misquoted. :)

But there is nothing in the above message that says you did write it.  We
can tell that Jason wrote it.

The problem, if there is one, is that Luis left in the attribution line
without quoting you at all.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Where in the world are the London PM'ers [Was: Re: assimilating CPAN]

2003-06-16 Thread Paul Johnson
On Mon, Jun 16, 2003 at 05:41:58PM -0300, Luis Campos de Carvalho wrote:

>   This is very interesting.
>   I was planning go London and meet you all at a social meeting in a 
> near future.
> 
>   What are the London.pm'ers that I will not meet in a social meeting 
> at London?

A couple of years ago we all sent in our coordinates.  I can't seem to
find the london.pm world map now.  Anyone got a URL?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: Golf: word wrap and quote stdin

2003-04-03 Thread Paul Johnson

[EMAIL PROTECTED] said:

> Golfish, obvious or downright cunning answers all welcome:
>
> I'd like to pipe text in (either with just linebreaks, or dos-style
> carriage
> return + linebreak's) and get out word-wrapped lines of not more than 80
> characters prefixed with "> ".

¦ fmt -78 ¦ perl -pe 'print "> "'

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: RegEx for UK Postal Codes

2003-04-01 Thread Paul Johnson

Jon Reades said:

> I'm doing a little UK address validation, and after looking around on
> CPAN didn't come up with much except Reg::Common::zip, and that didn't
> cover UK addresses (Damian, your name is on this Module, are you
> listening? :) ).

Abigail <[EMAIL PROTECTED]> was working on this and apparantly already has
a RE for the UK.  Check the FWP archives for more details, but I don't
remember seeing any release announcements.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




RE: PHP developers are evil

2003-03-28 Thread Paul Johnson

Kim Sinton said:

> I program in PHP and more recently in mod_perl. I generally prefer PHP,
> especially now that PHP 5 is coming out and they are fixing the OO bugs).
> I miss the huge code liberties perl has though.

Freudian slip, or something more sinster.  You decide.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: CPANPLUS and long pathnames

2003-03-20 Thread Paul Johnson
On Thu, Mar 20, 2003 at 10:44:31PM +, Nicholas Clark wrote:
> On Thu, Mar 20, 2003 at 09:58:37PM +, Roger Burton West wrote:
> > On Thu, Mar 20, 2003 at 09:51:25PM +, Kate L Pugh wrote:
> > >So, has anyone else seen this behaviour?  And any idea what I can do
> > >about it?
> > 
> > I am made suspicious by the fact that the surviving filename is 100
> > characters long. File a bug against CPANPLUS?
> 
> CPANPLUS is using Archive::Tar in preference to a tar binary?
> 100 has some significance in the format of tar files, IIRC.
> Try extracting the tar file using Archive::Tar to see what happens?
> (I don't have a copy of either handy)
> If so, file a bug against Archive::Tar? 
> 
> (That way it gets to the (new) Archive::Tar maintainer (Jos Boumans) and
> doesn't bother the cpanplus maintainer (Jos Boumans wearing a different hat))

If Archive::Tar is the problem it might be worth trying the all new,
completely rewritten, just released version, 0.99_01.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: comparing PHP with perl

2003-03-12 Thread Paul Johnson
On Wed, Mar 12, 2003 at 09:31:49PM +0200, Gabor Szabo wrote:

> While if I understand the plan is that the standard Perl distribution 
> will have less modules maybe it should actually go in the
> other direction. Maybe we should have a Perl distribtion that has
> a large number of CPAN modules installed by default.

IIRC, Hugo is planning that 5.10 should come in multiple blessed
distributions, so you can pick the one that is most appropriate to you.

[ Checks the YAPC::Europe proceedings.  Hmmm, no help there.  Checks
  Google.  Yep, that's right.  Google knows everything. ]

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: Frontier::RPC2 and german!

2003-02-24 Thread Paul Johnson
On Thu, Feb 20, 2003 at 05:49:58PM +0100, Philip Newton wrote:
> On 20 Feb 2003 at 16:16, Paul Makepeace wrote:
> 
> > In the case where the vowel is alone and having its sound changed,
> > the absence of an umlaut-enabled system an 'e' is appended to the
> > vowel in question. (Munchen, Muenchen)
> 
> Your statement is right about German, though. (And "ß" gets replaced by
> "ss" or *sometimes* by "sz".)

And the Swiss just don't bother with "ß" at all - it's always "ss".

When perl6-language was arguing over unicode operators I had considered
mentioning that numerous non-English speaking countries get by with
mapping their characters to a-z where necessary, but I thought better of
it and so I'm mentioning it here instead, where the discussion is far
more rational.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: Language optimality (was WWW::Map::UK::Streetmap)

2003-02-11 Thread Paul Johnson

Dirk Koopman said:

> Yes, maybe, but show me one of these systems that _consistantly_
> produces faster code than someone who is "talented". I willingly agree
> that the code is physically produced faster - but it don't go as well.
>
> And this is the nub of it. Basically there aren't enough "talented"
> people to go around. Therefore people try to throw ("talentedly"
> programmed) machines at the problem to try to get a better result than
> average. But that is all you will get: slightly better code a lot
> quicker.

Which then leaves you with a lot of time to:

  - test the code really well
  - profile it to find the real hotspots, and optimise them
  - decide that slightly better is good enough and ship the thing early
  - do something more important or interesting
  - natter on #london.pm

>> It is still worth noting that a Perl implementation of Joe's String
>> Mmunging System will very likely be faster than one written in C simply
>> because Perl's algorithms for string handling will be more efficient
>> than
>> Joe's general purpose C algorithms, since more time and expertise has
>> been
>> put into them.
>
> I can only say that I fundementally disagree. A talented implementation
> will be faster in execution than perl. Period. Actually, I strongly
> suspect that even a pretty shoddy implementation will execute faster
> than perl.

I suspect that depends largely on the nature of the product.  Something
spending a lot of time within perl's opcodes won't be slow.  Using a bad
algorithm, on the other hand, has the potential to be expensive in
whatever language it is programmed.

> Whilst I am about could I remind people of the existance of PCRE? This
> seems to be a pretty good (cluefully hand written) largely perl
> compatible regex library. I use it quite a bit.

I'm not sure what point you are making here.  regcomp.c and regexec.c seem
to be a pretty good (cluefully hand written) largely perl compatible regex
library. I use it quite a bit.

Don't forget XS and Inline::*.  Code in whatever language is appropriate
to the task at hand.  Mix and match.  Buy more memory and a faster
processor.  Be nice.  Life is too short to write user interfaces in low
level languages.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net





Re: Next Gen CPAN

2003-02-10 Thread Paul Johnson

Simon Wistow said:

> And I was thinking about CPAN. Or CPAN v2. Or NextPAN or whatever.
>
>
> Specifically -
>
> QA:
>
> Automatic reporting of test failures, possible refusal of a module from
> CPAN if it doesn't have a certain amount of Test coverage. Maybe
> integrated CPANSTATs so that we can see if things like LWP::Simple

ENOEND ?

I have a start on cpancover at

  http://pjcj.sytes.net/cover/cpancover/cpancover.html

but it's really more of a glorified test suite for Devel::Cover at the
moment.

To my mind, the biggest problem to overcome (and I'm not sure how, or even
if it can be) is the problem of security.  Specifically, the problem of
someone doing more than just threatening to add `rm -rf ~`, or even worse,
`mail [EMAIL PROTECTED] < /etc/passwd` to Makefile.PL.  If I were a
CPAN tester I would be even more worried about this.  I had considered
automatically testing the coverage of newly uploaded modules, but decided
not to for this very reason.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net





Re: Perversity

2003-01-31 Thread Paul Johnson

Lusercop said:

> On Fri, Jan 31, 2003 at 05:08:57PM +, Earle Martin wrote:
>> On Fri, Jan 31, 2003 at 07:08:19AM +, Dave Cross wrote:
>> > It's Jeffery Friedl's regex for checking a valid email address.
>> Oh. Naughty person; he gave me the impression that he'd written it
>> himself!
>
> It also includes all sorts of things that are now deprecated.
>
> An (untested) decompiled version of it is:

IIRC, Jeffrey shows how it was built up in "Mastering Regular Expressions".

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net





Re: How to split 6 digits into 3 lots of 2

2003-01-29 Thread Paul Johnson

Mark Fowler said:

> On Wed, 29 Jan 2003, Dave Cross wrote:
>
>> And that can be simplified to
>>
>> my @array = $input =~ /(..)/g;
>
> And that can be simplified in turn to
>
> my $output = join '-', $input =~ /(..)/g;

And that can be simplified in turn to

my $output = join '-', $input =~ /../g;

Which is basically what I wrote last night :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net





Re: How to split 6 digits into 3 lots of 2

2003-01-28 Thread Paul Johnson
On Tue, Jan 28, 2003 at 11:35:29PM +, Paul Makepeace wrote:
> On Tue, Jan 28, 2003 at 11:22:48PM +, Phil Pereira wrote:
> > Is there an easy way to split "123456" into "12-34-56"?
> 
> $ perl -lne 'print "$1-$2-$3" if /(\d\d)(\d\d)(\d\d)/'
> 123456
> 12-34-56
> $
> 
> This should start a good TIMTOWTDI thread :)

If you insist:

echo 123456 | perl -lne 'print join "-", /../g'

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Weird Money (was Re: YAPC::Europe)

2003-01-27 Thread Paul Johnson

Rob Thompson said:

Or rather, MS appended to his message:

> Overloaded with spam? With MSN 8, you can filter it out

That's pretty funny.  Just about everything I get in my hotmail account is
spam, so much so that even after being filtered through spamassassin it
goes into its own folder to be deleted en masse at my convenience.

And that address has never been publicly advertised by me anywhere, ever.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net





Re: [OT] Oldest machine still running perl

2003-01-20 Thread Paul Johnson
On Mon, Jan 20, 2003 at 11:01:45PM +, Greg McCarroll wrote:
> * the hatter ([EMAIL PROTECTED]) wrote:
> > > I will open the bidding with a 486DX2-66 Running Debian 2.2 (still
> > > working as a firewall/NAT)
> > 
> > I see your dx2-66, and raise(/lower) you my dx2-50.  Curses, if onlyI
> > hadn't found that machine in a skip a year or two back,
> 
> 
> Hmm, the 486 was around 93/94 wasnt it? if so i raise you an original
> indy which i am currently using as an X server and writing this email
> on. the indy was released about 92/93 IIRC. and yes it has perl on it.
> (its running debian if anyone is interested).

Until a couple of years ago I had an IBM AT which still ran the original
DOS port of perl on its powerful 6MHz 80286 processor with 512KB of RAM
and 10MB of disk.

More excitingly, I had a DECStation 5000/200 of 1990 vintage which would
run the latest perl, but because it was running Ultrix wouldn't do
dynamic loading, so I ran a staticly linked tkperl.

Unfortunately, both remained in England when I didn't.  The latter had a
rather wonderful monitor which, along with the main box and two
expansion boxes, provided heat for the entire room.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Tech meeting note

2003-01-13 Thread Paul Johnson
On Mon, Jan 13, 2003 at 02:26:03PM +, Mark Fowler wrote:

>  German Perl Workshop  5th-17th March

That'll be 5th-7th March.

Anyone going?  (Apart from Nicholas Clark of course.)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: psh v1.0 released.

2003-01-04 Thread Paul Johnson
On Sat, Jan 04, 2003 at 10:18:08AM +, Shevek wrote:

> On Fri, 3 Jan 2003, Chris Ball wrote:
> 
> > Gregor Purdy released v1.0 of psh - the Perl Shell - yesterday.
> 
> > So, what do we think?  Awful and icky and bloated, or does it possess
> > the pony-nature..?
> 
> The keys to acceptance of a shell are probably maturity and reliability
> nowadays.

For an interactive shell, command completion is right up there for me.
Why should I have to type something when the computer can work out what
I'm going to type?

Even after all these years I still think zsh is the best kept secret in
computing.  How do people live without advanced completion?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Parsing PHP code from Perl

2002-12-30 Thread Paul Johnson
On Mon, Dec 30, 2002 at 09:49:53AM -0600, Ed Summers wrote:

> Kris wrote a few weeks ago about parsing simple PHP from Perl, and got me to 
> thinking about a module that would allow you to include PHP files from Perl.  
> This led to PHP::Include [1] which was uploaded to CPAN yesterday.
> 
> At the moment it only allows you to include very simple PHP: scalar, array
> and hash assignments. But it could be useful for Perl applications that need 
> to share configuration data with PHP. The real work is done by Filter::Simple
> and Parse::RecDescent. PHP::Include was designed so that the more
> adeventurous/knowledgeable could extend the grammar to parse more of PHP.
> 
> One nice thing is that PHP::Include established the PHP top level namespace on
> CPAN; so there is a nice home for new modules that glue the two languages
> together if people are interested.
> 
> //Ed
> 
> [1] http://search.cpan.org/author/ESUMMERS/PHP-Include-0.01/

Is there any chance of a full blown Inline::PHP?

I have no idea how difficult this would be, or even if it is possible,
as all the PHP I know I learnt from the example in your docs ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: [JOB] Billing system, Birmingham

2002-12-23 Thread Paul Johnson
On Tue, Dec 24, 2002 at 01:30:45AM +, Earle Martin wrote:

> "We require Perl developers for this new team who will be responsible for a
> Billing System for a Utility company in the Midlands."
> 
> http://www.freelancers.net/job.html?ID=6563

"You must have the billing experience within the Utilities industry to
be considered for these positions."

Wow.  That must be some high powered stuff!  I wonder what advanced
algorithms and complicated maths they use that any half decent
programmer wouldn't be able to pick up in ten minutes?

Though maybe that is just my lack of billing experience in the utilities
industry speaking.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Ticketmaster

2002-12-17 Thread Paul Johnson
On Tue, Dec 17, 2002 at 10:31:34AM +, Alex McLintock wrote:

> Many of you will remember someone from Ticketmaster trying to find a perl 
> programmer for a short term contract at permie rates.
> Does anyone remember anything else bad about the company or the work they 
> needed?
> 
> (They were doing the ticketing system for the Athens Olympics)

I have the mail from [EMAIL PROTECTED] if you would like it.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Collapsing paths

2002-12-12 Thread Paul Johnson
On Thu, Dec 12, 2002 at 08:39:55PM +, Alex Hudson wrote:

> On Thu, 2002-12-12 at 19:21, Simon Wilcox wrote:
> 
> Maybe I'm barking up the wrong tree, but I don't think you can just
> 'throw away' bits of the directory path (i.e., ./somedir/../ != ./ ).
> 
> For example, on my system I can contrive a directory such that:
> 
> me$ cat ./one/../test/file
> foo
> me$ cat ./test/file 
> bar
> 
> [cut'n'pasted, not made up!]
> 
> Unless you were going to actually walk the directory path (much
> stattage), I'm not sure you can reduce directories with a simple
> algy-rhythm.
> 
> Given there's no pre-existing module, perhaps the reason is because to
> do it is wrong :o)

I wrote a module to do this six years ago to the day if I believe the
comment in the file.  500 lines doing all sorts of filesystem and path
stuff, before the stuff in the core was fully up to it.  It was part of
a build system I wrote, and it worked fine, but yes, those stats are
slow.

At the time I wasn't able to release it, but now I could.  However, I'd
want to rewrite a lot of it to use File::Spec, or somehow merge it with
that module, which is much improved over the last years, and I've not
really had the need nor the inclination to do that yet.

I do have some other modules that I keep thinking I should tidy up and
send out into the great big world, and they use this module, so I might
do something.  In the meantime, I could make this module available,
though it sounds like overkill for your needs.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Look ma, no barewords!

2002-12-09 Thread Paul Johnson

Kate L Pugh said:

>   [hummous: kake]$ perl -MData::Dumper -we 'use strict; my $foo = [ -foo
> ]; print Dumper $foo' $VAR1 = [
> '-foo'
>   ];
>   [hummous: kake]$
>
> Where's this documented?

I think the whys and wherefores of this have now been established.  This
is just a postscript to mention that I need to use this construct most
often when using the Tk and Pod::Usage modules and, if I may show my
prejudices for a moment, I find it to be ugly in the extreme, and I have
yet to find a compelling argument for its existence.

Actually, its possible that it might exist for a good reason, but don't
try telling me it's not ugly.

Wow, I didn't realise I felt that strongly about it.  I must have been
reading too much perl6-*  ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Informative CVs

2002-12-07 Thread Paul Johnson
This job ad on Perl Jobs made me smile.

  CVs with the following information will only be considered if they include
  the following information:
  - CV
  - ...

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Patching IPC::Open3

2002-12-04 Thread Paul Johnson

Adam Spiers said:

>   a) IPC::Open3 is a core module, so I have to be especially careful
>  about changing it.  Can anyone think of any problems with doing
> this?  (Yes I know I need tests.)

Provided it remains backwards compatible and doesn't introduce a
performance hit I don't see any problems.

>   b) How do I best go about feeding back changes to the core?  Please
>  don't say I have to subscribe to p5p ...

You don't need to subscribe, but that's where the discussion, if any, will
be.  You'll probably be CCed in on that, but you might like to check one
of the archives occasionally, or use the nntp server.

> Cheers,
>
> Adam
>
> --- /opt/perl-5.6.1/lib/5.6.1/i686-linux/IPC/Open3.pm 2001-02-23
> 02:57:55.0 + +++ ADM/lib/perl5/IPC/Open3.pm   2002-11-29
> 16:46:22.0 + @@ -9,7 +9,7 @@
>  use Carp;
>  use Symbol qw(gensym qualify);
>
> -$VERSION = 1.0103;
> +$VERSION = 1.0104;

I can't check what is in bleadperl at the moment, but 5.8.0 is already at
1.0104.  I'd patch against that at least.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: vim

2002-11-28 Thread Paul Johnson
On Thu, Nov 28, 2002 at 06:48:01PM +, Dirk Koopman wrote:

> Which brings to something that I have always been curious about, why
> isn't there an editor written in perl?

I seem to recall someone starting a vi clone in Perl.  Was it part of
ppt?

I don't know about emacs though.

Aren't there already enough editors in the world?  Maybe it's just me,
but it seems that writing an editor is about as interesting as writing
an accounting package.  Or a CGI script that accesses a database.

Fortunately, it seems there are enough people who disagree.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: vim

2002-11-28 Thread Paul Johnson
On Thu, Nov 28, 2002 at 05:36:19PM +0100, Michael Lamertz wrote:
> On Thu, Nov 28, 2002 at 03:27:21PM +, Jonathan Peterson wrote:
> > I'm playing with vim. Either it's standard perl syntax file doesn't 
> > support folding, or I can't get folding to work for some reason (setting 
> > fold method to syntax..).
> > 
> > Vague comments about remedying either situation appreciated.
> 
> I had problems with foldmethod=syntax too, as far as I remember.

I played with it when it was very new, and I think I got something
working, but I can't remember the details.

It's funny (or maybe it's not) but I thought I would make a lot of use
of folding, and was really looking forward to it.  Now it's there, the
only time I use it is in vimdiff, which has removed the only reason I
ever looked longingly at emacs.

> I had it in for a while, but did take it out lately since I started to
> get on my nerves to always need to open the folds before I could see my
> code.

Yep.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: REVIEW: Extending and Embedding Perl

2002-11-28 Thread Paul Johnson
On Thu, Nov 28, 2002 at 03:56:50PM +, S. Joel Bernstein wrote:
> At 28/11/2002 15:15 [], Mark Fowler wrote:
> >Back of book.  Also quotes from "Charles Bailey, Alasdair Allan, Abhijit
>   ^^^
> >Menon-Sen and Norman Gray.
>  ^ I don't know any of the other names, but that's Crab from #perl 
> on rhizomatic... - ask if he got a book?

Charles Bailey is a VMS type, who was the pumpking for a little while
back in the low 5s.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Penderel (Was IQfC)

2002-11-27 Thread Paul Johnson
On Wed, Nov 27, 2002 at 08:47:11PM +, Nicholas Clark wrote:
> On Mon, Nov 18, 2002 at 10:24:03AM +, Lusercop wrote:
> > On Mon, Nov 18, 2002 at 10:20:17AM +, Greg McCarroll wrote:
> > > It is probably just me, but I hate to see a computer not used to its
> > > full potential and penderel is sitting unloaded for much of the day.
> > 
> > You could do what I do with the unused CPU time on colon, and donate it
> > to one Nicholas Clark and his bleadperl smoketests. (obviously you wouldn't
> > necessarily want to do those, but something similar may be possible).
> 
> Smoking CPAN might be worthwhile. When I asked Jos, I think that his answer
> was that CPANPLUS has pretty much all the functionality needed build in.

Just be careful of the rootkits hidden in Makefile.PLs.

Oh, hold on.  Wrong thread.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: re IRC

2002-11-24 Thread Paul Johnson
On Sun, Nov 24, 2002 at 08:01:49PM -, Gareth Kirwan wrote:

> Problem being that I need a different style of replying between mailing
> lists and work conversations 

Yes, I get people at work telling me that they didn't realise I had
added anything to a message I sent them.  Can't I just put my reply at
the top, like everyone else? :-(

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: The Peon's Guide To Secure System Development

2002-11-24 Thread Paul Johnson
On Sun, Nov 24, 2002 at 10:13:48AM +, Dirk Koopman wrote:

> On a slightly serious note: has anyone successfully used any GUI
> framework on both Unix and Windows with perl? I have a very simple
> little terminal type prog that I want to have work on both. 
> 
> Apparently WxWindows works reasonably well, are there any others?

A long time ago in a galaxy far, far away, my company wanted a cross
platform (Unices and Windows) gui to plonk on a C++ back end.  Actually,
they just wanted guis, and spent a fortune getting an external company
to write a Motif gui.  Apart from that cost, I spent longer managing the
project than it would have taken for me to do it myself, and to prove it
when the Windows gui was required I wrote it in Perl/Tk, which also
worked on Unix.

This is how I was able to get Perl into the company - on the back of Tk.
Well, that and I wrote the build and testing systems in Perl.  The next
major project was done entirely in Perl.  I also looked into wxWindows
at the time, but it was very immature back then, and had no Perl
bindings.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: contracts

2002-11-19 Thread Paul Johnson
On Tue, Nov 19, 2002 at 09:54:04PM -0600, Nigel Hamilton wrote:

> This is also one of the few advantages of contracting ... you can
> negotiate to retain your IP ... and over time your professional library
> will grow (in theory)... which gives you more to offer future clients.

And means that you don't have to worry about contributing code to Perl
or any other project that strikes your fancy.  For me, that comes right
up there with staying out of company politics :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Weird Syntax

2002-11-14 Thread Paul Johnson

Dave Cross said:

> #! /usr/bin/perl
>
> use strict qw($x);
> use warnings;
>
> $x = 1;
>
> print $x;
>
> works without errors.
>
> I may have missed something obvious. It was early when I ran these tests
> :)

I think what you are missing is that C has done
nothing.  The program is running without strict vars (or strict anything).

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: Weird Syntax

2002-11-14 Thread Paul Johnson

Dave Cross said:
> I just saw a post in uk.comp.os.linux that used this syntax:
>
> use strict qw($var);
>
> to declare a variable. I was about to point out that the syntax was
> wrong but, on testing, I find that it works (it creates a package
> variable).

Does it?  Seems just to be an expensive noop.

Did you have warnings turned on?

As I recall, strict doesn't complain if you pass it something it doesn't
recognise.  This is so that new strictures can be more easily added.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: [JOB] I Need One

2002-11-06 Thread Paul Johnson
On Wed, Nov 06, 2002 at 10:26:14PM +, Nicholas Clark wrote:

> And why would you want to work here? I thought jobs were an equally endangered
> species both sides of the Atlantic.

http://jobs.perl.org/job/513

And that's in San Jose, which is one of the most expensive places to
live in the USA - and has too much traffic to boot.

PS. Gis a job.  Go on.  I can do that.  Go on.  Gis it!  (In Zürich please)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Weirdness

2002-11-03 Thread Paul Johnson
On Sun, Nov 03, 2002 at 11:34:53AM +, Nicholas Clark wrote:

[ question and explanation elided ]

> And the reason I know all this - blame Abigail.
> (a sig with **  something which has the value 1. ie 0 ** 0, which perl is
> treating as 1. I don't know enough serious maths to know if 0 ** 0 is well
> defined. See perl6-language for more maths)

0 ** x and x ** 0 have different limits as x approaches 0, so if I
recall correctly , 0 ** 0 is an indeterminate form, but it is generally
accepted (I think) that 1 is the most useful answer because that makes
little things like the binomial theorem work properly.

Disclaimer - it's many years since I did any real maths.

[ Now waiting for someone to say "it shows", and give a real answer. ]

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: webmail

2002-11-01 Thread Paul Johnson

Andy Wardley said:

> In Perl you have to care about the difference between $user->name() and
> $user->{ name }.  But TT hides all that from you.  I think that's the
> Right Way To Do It.  When you're doing "presentation" you shouldn't be
> worrying about different data types and other "programming" crap like
> that.  You want the name of the user and you don't (or shouldn't) care
> where it comes from or how it is calculated.  That's for the back-end
> code and data designers to worry about.

I agree that this is wrong.  In OO terms, it exposes the impementation to
the user.  It's wrong for templates, but it's also wrong for ordinary
classes.  If I decide that I want to change some part of the interface
from being a plain integer to calling a method, why should the users of
the class care.

Languages such as Eiffel have got this right, and yes Greg, Perl 6 will
too :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: webmail

2002-10-28 Thread Paul Johnson
On Mon, Oct 28, 2002 at 09:04:15PM +, Dave Hodgkinson wrote:

> What's the state of the art, TT-enabled webmail thingy? Collaborating
> with IMAP (in the mail folders sense) would be a plus...

When I looked and asked here a month or so ago there didn't seem an
obvious choice.  I wondered about acmemail and sparkle, but eventually
went for SquirrelMail, which is written in php.

For me, as a user, it seems OK but tends to eat whitespace when sending
messages.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: News broadcast this morning

2002-10-17 Thread Paul Johnson
On Thu, Oct 17, 2002 at 01:04:49PM +0100, Mark Fowler wrote:
> On Thu, 17 Oct 2002, Paul Johnson wrote:
> 
> > I've been thinking I should probably set up a white list, just to be on
> > the safe side.  Any mail that gets through Spamassassin, but isn't on
> > the white list goes to one of my mailboxes.  I don't suppose it's too
> > much work, but does anyone know of anything, preferably procmail
> > compatible, that just works?
> 
> Some people like Mail::Audit for this kind of thing.

:-)

So I've heard.  But I've been happily using procmail for years, so I've
not seen a need to change.  Maybe this is it, but procmail will quite
happily filter stuff through Perl too.

On Thu, Oct 17, 2002 at 02:22:16PM +0200, Michael Lamertz wrote:
> Well, that may make sense in the eyes of a terrified father, but you
> should overthing that, because it's a privacy issue.
> 
> My mother *NEVER* opened my letters as I would never look into the
> Mailbox of my wife, even though I'm root on all machines at home.

Terrified may be overstating it a little, but you are right about
privicy being an issue.  That's part of the reason why I would like to
do it right, including adding all addresses on outbound mail to the
white list.

At the moment, my children are all young enough that I want to know what
mail they are getting.  And my wife opens all my normal post anyway -
well, anything that looks interesting, the junk she leaves for me - so
that's not a major issue here either.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: News broadcast this morning

2002-10-17 Thread Paul Johnson
On Thu, Oct 17, 2002 at 11:50:50AM +0100, Greg McCarroll wrote:

> i must admit i'd be kind of worried if i had children and they had
> email accounts receiving spam advertising all the usual suspects
> from the internet porn & sex product/procedure industries

The mail for all my family goes through Spamassassin, and that takes
care of most of it, but three times now something has got through.  I
get more coming through, especially the German stuff, but I'm mostly
concerned about filtering it all for the family.

I've been thinking I should probably set up a white list, just to be on
the safe side.  Any mail that gets through Spamassassin, but isn't on
the white list goes to one of my mailboxes.  I don't suppose it's too
much work, but does anyone know of anything, preferably procmail
compatible, that just works?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: blocks going out of scope

2002-10-12 Thread Paul Johnson
On Sat, Oct 12, 2002 at 02:27:09PM +0100, Nicholas Clark wrote:

> If you're the programmer, you can do something at end of scope by placing
> a local object in the scope, and have its DESTROY method do cleanup.
> 
> Can anyone think of a reliable, non-source filter way of attaching such a
> destructor method onto the scope of your caller?

I've been asking myself similar questions recently, and I've not been
able to come up with anything that doesn't involve messing about with
the op tree.

It seems that what's needed is the equivalent of Perl 6's FIRST and LAST
blocks, coupled with the ability to atatch these to arbitrary blocks.

I have a patch against bleadperl which adds support for a C callback
when a CV is destroyed, ie just before the op tree is reclaimed.  From
there it is a simple matter to call a Perl function, and this is enough
to scratch my particular itch (code coverage of BEGIN blocks).  The
patch still needs a little work, or maybe a complete rework before I
decide whether to submit it.  I had wondered whether something more
general might be more useful, but I haven't really thought through all
the issues at a Perl level.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Books on london.pm.org (was Re: applying patterns)

2002-10-11 Thread Paul Johnson


Simon Wistow said:


> Where would we be if we'd not bothered writing some Matt's Scripts
> replacments on the assumption that nobody would pick them up. Or
> written an extensible MLM in Perl on the assumption that despite having
> whinged about it for ages nobody would actually care.


Oooh, did I miss something?  Has someone (plural?) written (present
tense?) a new MLM.  I have an idea that came to me in the shower one
morning, but you probably didn't want to know that.

Some of the mailing lists I'm on break threading by not passing through
the appropriate headers.  I had considered writing something to go through
my mailboxes and attenpt to put the threading back, based on subjects,
dates and content.  It doesn't seem like it would be too hard to get most
of the way there.

Then I thought about the mailing lists that do keep threading, but some of
the mail clients people use to send to the list don't.  Maybe the mailing
list software could attempt to restore the threading.

Then I wondered what the world would be like if Microsoft had closed its
doors in the early eighties.  How much time would have been saved by
people not staring at a BSOD, waiting for a reboot and then typing in
their XL figures again, or playing solitaire?  And would they have done
anything useful with it?  Would the world of computng have advanced
further, or might Microsoft have been replaced with something even worse?

Then I thought I really should go to work ...


-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: applying patterns

2002-10-11 Thread Paul Johnson


Randal L. Schwartz said:


> see http://www.stonehenge.com/books/


Has someone been stuffing the votes on the Ping review?


-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: Plea: A funky deparse?

2002-10-10 Thread Paul Johnson


Shevek said:

> On Thu, 10 Oct 2002, Rafiq Ismail wrote:
>
>> Does anyone know of a a way to isolate code fragments/methods of only
>> those fragments of codes which get invoked by a script.
>
> Isn't this traditionally the job of the code profiler?

Or more specifically, a code coverage tool.  And I just happen to have one
of those sitting in my CPAN directory :-)
Actually, Devel::Cover is probably not only overkill for this, but you'll
also have to work fairly hard to get what you want.
I have considered adding subroutine coverage a number of times, as the new
weakest form of coverage available.  Maybe I should actually do that.
In any case, hacking Devel::Coverage to bits will get you what you want.

Actually, what is it you want?  To automatically create a program/module
with only the bits you need?  To manually do the same?  Something else?  I
had assumed the former, but in that case, why?
-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: better way to split text into a hash ?

2002-10-09 Thread Paul Johnson


Dave Cross said:

> my %end_hash;
> @end_hash{@header} = split ' ', $text, 6;
>
> Hash slices rock.

It's just a shame there's no way of combining those two lines.

Apart from J

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: applying patterns

2002-10-08 Thread Paul Johnson


Shevek said:

> This is what TIEARRAY is for. It is purely, simply and totally an
> iterator  pattern.

What?  TIEARRAY was an iterator pattern before iterator patterns
existed?  How can that be?

Actually, I'm not sure which one came first because I rarely use ties
and I don't think I've ever used a tied array, so I can't remember when
they were introduced to Perl, and I never knowingly use a design
pattern.  At a guess, I'd say that the pattern was probably a little
earlier, but had little if anything to do with tied arrays.

Which got me to wondering.  How much do really good programmers use
design patterns?  Use them as in thinking "I have problem A, I can use
disign pattern B to solve it", rather than writing code which conforms
to a pattern without explicitly aiming to do so.

For that matter, how much do people who espouse patterns conciously use
them?  Maybe expert, or even good programmers are not the target
audience.

And how many people have actually read that book all the way through?
And of those, how many can remember the names of half the patterns?

And anyway, in my day "pattern" was spelt "recipe" :-)

Hmmm.  I wonder what brought all that on?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net







Re: Perl magazines

2002-10-07 Thread Paul Johnson

On Mon, Oct 07, 2002 at 05:30:03PM +0100, Greg McCarroll wrote:
> * Dave Cross ([EMAIL PROTECTED]) wrote:
> > On Mon, Oct 07, 2002 at 04:52:27PM +0100, Greg McCarroll 
>([EMAIL PROTECTED]) wrote:
> > > 
> > > I'd be willing to buy at least 2 subscriptions to TPR 
> > 
> > TPR _does_ have a similar call to arms <http://www.theperlreview.com/>.
> 
> When was this announced? I'd suggest if i didn't know about it, either
> a.) i got confused and forgetful (entirely possible), or b.) it wasn't
> announced widely (wildly?) enough.

It seems to be on use.perl, but I didn't know about it either.  I
subscribe to an inordinate number of Perl mailing lists and tend to
think that anything important will eventually get to one of them.  This
seems to have done so (three weeks later), but I would have missed the
Perl 6 Mini::Conference if I hadn't seen it on The Conway Channel.

> p.s. EVERYONE SHOULD SUBSCRIBE!

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: Straw poll

2002-10-06 Thread Paul Johnson

On Sun, Oct 06, 2002 at 12:02:43PM +0100, Lusercop wrote:
> On Sun, Oct 06, 2002 at 10:54:29AM +0100, Nicholas Clark wrote:
> > And if a talk introducing the perl debugger were given at a YAPC, how many
> > people would think it worthy of going to?
> 
> Yes. I'd much rather something introducing it. I have reasonable experience
> with GDB, but I suspect that seeing the comparisons would probably be a
> useful thing. I almost certainly wouldn't goto an advanced perl debugger
> talk, because I don't really know the basics.
> 
> ``The most effective debugging tool is still careful thought, coupled with 
>   judiciously placed print statements.''
>- Brian W. Kernighan, 1978
> 
> So telling us why the perl debugger is better is an extremely good start.

I imagine this is fairly typical.  Good Perl programmers, who are
confident with gdb, might have flirted with the Perl debugger but never
really got to grips with it.

I imagine this is because:

  - Perl just doesn't let you make the sort of mistakes that you
typically need a C debugger for.
  - It's fairly easy to get useful information without using the
debugger.
- print Dumper $x
- Some trick to get a stacktrace on warns and dies.
- With a PERLDB_OPTS incantation, that I always have to look up in
  the manpage, you can trace what's happening without having to go
  interactive.
  - With no compile/link cycle its fairly quick to use these techniques.
  - Because of various debugger bugs over the years, and the debugger's
incestuous relationship with perl, it's difficult to feel confident
that what is happening in the debugger is the same as what is
happening outside.

I suspect that most people would be able to learn all they needed by
themselves if they thought it was going to be a useful investment.

I've often thought it might be nice to really understand the debugger,
and I've even started a few times, but I've never had a really pressing
need to do so that I couldn't fulfil fairly easily in some other manner.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




  1   2   >