Re: Getting the schema for a DB table

2014-05-27 Thread Sam Kington
On 26 May 2014, at 17:45, Simon Wistow wrote: > On Sun, May 25, 2014 at 07:38:54PM +0200, Thomas Klausner said: >> If you want a hash of the current DB schema, take a look at >> DBIx::SchemaChecksum >> >> Not sure if this is what you're after, but I hope it helps.. > > It would be perfect ... e

Regex to match odd numbers

2014-05-27 Thread David Cantrell
As part of the nasty mess that is CPANdeps, I have this line of code: $record->{is_dev_perl} = ( $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i ) ? 1 : 0; I'd like to not have to remember to add 23 to the list in a year or so's time. Can anyone think of a nice way of matching any

Re: Regex to match odd numbers

2014-05-27 Thread Joel Bernstein
Surely you only need to examine the right-most digit to know if the number is odd? Your special requirement to (AIUI) consider 0..7 as even isn't difficult to add. /joel On 27 May 2014 16:22, David Cantrell wrote: > As part of the nasty mess that is CPANdeps, I have this line of code: > > $rec

Re: Regex to match odd numbers

2014-05-27 Thread Abigail
On Tue, May 27, 2014 at 04:22:07PM +0100, David Cantrell wrote: > As part of the nasty mess that is CPANdeps, I have this line of code: > > $record->{is_dev_perl} = ( > $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i > ) ? 1 : 0; > > I'd like to not have to remember to add 23 to th

Re: Regex to match odd numbers

2014-05-27 Thread Gareth Harper
$record->{perl} =~ /(^[0-9]*[13579]|rc|patch))/i ? On 27 May 2014 16:22, David Cantrell wrote: > As part of the nasty mess that is CPANdeps, I have this line of code: > > $record->{is_dev_perl} = ( > $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i > ) ? 1 : 0; > > I'd like to no

Re: Regex to match odd numbers

2014-05-27 Thread Dirk Koopman
On 27/05/14 16:22, David Cantrell wrote: As part of the nasty mess that is CPANdeps, I have this line of code: $record->{is_dev_perl} = ( $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i ) ? 1 : 0; I'd like to not have to remember to add 23 to the list in a year or so's time. Can

Re: Regex to match odd numbers

2014-05-27 Thread Mike Whitaker
On 27 May 2014, at 16:22, David Cantrell wrote: > As part of the nasty mess that is CPANdeps, I have this line of code: > > $record->{is_dev_perl} = ( > $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i > ) ? 1 : 0; > > I'd like to not have to remember to add 23 to the list in a yea

Re: Regex to match odd numbers

2014-05-27 Thread Gareth Harper
Apologies, didn't see the 7 upward (and missed the 5\.) . This can almost certainly look nicer or smaller with a negative assertion or something. However this should do the job. $record->{perl} =~ /(^5\.(7|9|[1-9][0-9]*[13579])|rc|patch)/i On 27 May 2014 16:53, Gareth Harper wrote: > $rec

Re: Regex to match odd numbers

2014-05-27 Thread Dirk Koopman
On 27/05/14 16:54, Dirk Koopman wrote: $bool = ($record->{perl} > 7) & 1; # for example? Clearly, I getting too old for this. Or my prevarication level too high...

Re: Regex to match odd numbers

2014-05-27 Thread Abigail
On Tue, May 27, 2014 at 04:22:07PM +0100, David Cantrell wrote: > As part of the nasty mess that is CPANdeps, I have this line of code: > > $record->{is_dev_perl} = ( > $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i > ) ? 1 : 0; > > I'd like to not have to remember to add 23 to th

Re: Regex to match odd numbers

2014-05-27 Thread Sam Kington
> As part of the nasty mess that is CPANdeps, I have this line of code: > > $record->{is_dev_perl} = ( > $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i > ) ? 1 : 0; > > I'd like to not have to remember to add 23 to the list in a year or so's > time. Can anyone think of a nice way o

Re: Regex to match odd numbers

2014-05-27 Thread Jasper
Something like the prime regex would work: ('1' x $foo) =~ /^(11)*1$/ On 27 May 2014 16:43, Joel Bernstein wrote: > Surely you only need to examine the right-most digit to know if the number > is odd? Your special requirement to (AIUI) consider 0..7 as even isn't > difficult to add. > > /joel

Re: Regex to match odd numbers

2014-05-27 Thread Jasper
>From 7 upwards is ('1' x $foo) =~ /^(11){3,}1$/ or something, I'm not even bothering to test this :S On 27 May 2014 17:08, Jasper wrote: > Something like the prime regex would work: > > ('1' x $foo) =~ /^(11)*1$/ > > > On 27 May 2014 16:43, Joel Bernstein wrote: > >> Surely you only need to

Re: Regex to match odd numbers

2014-05-27 Thread Jasper
I'm furiously trying to think of an even stupider way of doing this... On 27 May 2014 17:09, Jasper wrote: > From 7 upwards is > > ('1' x $foo) =~ /^(11){3,}1$/ > > or something, I'm not even bothering to test this :S > > > On 27 May 2014 17:08, Jasper wrote: > >> Something like the prime rege

Re: Regex to match odd numbers

2014-05-27 Thread Abigail
On Tue, May 27, 2014 at 04:54:47PM +0100, Dirk Koopman wrote: > On 27/05/14 16:22, David Cantrell wrote: >> As part of the nasty mess that is CPANdeps, I have this line of code: >> >> $record->{is_dev_perl} = ( >>$record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patch)/i >> ) ? 1 : 0; >> >> I

Re: Regex to match odd numbers

2014-05-27 Thread Alex Balhatchet
Odd numbers end in [13579] so... m{5 [.] \d* [13579]}gmsx ... ? - Alex

Re: Regex to match odd numbers

2014-05-27 Thread Alex Balhatchet
And obviously I answered before letting your email sink in... "odd number from 7 upwards"! But still, my solution should just about work if you change \d* to \d+ and do the 9 manually :-) - Alex On 27 May 2014 16:42, Alex Balhatchet wrote: > Odd numbers end in [13579] so... m{5 [.] \d* [13579]}g

Re: Regex to match odd numbers

2014-05-27 Thread Dirk Koopman
On 27/05/14 17:21, Abigail wrote: On Tue, May 27, 2014 at 04:54:47PM +0100, Dirk Koopman wrote: On 27/05/14 16:22, David Cantrell wrote: As part of the nasty mess that is CPANdeps, I have this line of code: $record->{is_dev_perl} = ( $record->{perl} =~ /(^5\.(7|9|11|13|15|17|19|21)|rc|patc

Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Tue, May 27, 2014 at 02:42:21PM +0100, Sam Kington said: > What's wrong with dependencies? It just takes a few minutes to > install, disc is cheap, and it's not like any of the rest of your code > is going to magically start loading these new modules and being all > bloaty and insecure or wha

Re: Getting the schema for a DB table

2014-05-27 Thread Thomas Klausner
Hi! On Tue, May 27, 2014 at 06:33:16PM +0100, Simon Wistow wrote: > On Tue, May 27, 2014 at 02:42:21PM +0100, Sam Kington said: > > What's wrong with dependencies? It just takes a few minutes to > > install, disc is cheap, and it's not like any of the rest of your code > > is going to magically

Re: Regex to match odd numbers

2014-05-27 Thread Mark Fowler
On Tuesday, May 27, 2014, Sam Kington wrote: > > Sounds like you want something like > > / ( ^ 5[.] ( [79] | \d+ [13579] ) ) /x > This is where I mention that \d matches characters other than [0-9] unless you have the /a flag in effect (thanks Unicode!) Mark

Re: Getting the schema for a DB table

2014-05-27 Thread Tom Hukins
On Tue, May 27, 2014 at 08:20:02PM +0200, Thomas Klausner wrote: > I've never had problems with installing deps since cpanm came out. > > I usually do something like > cpanm --installdeps . -n -L local That's fortunate. In recent months I've encountered problems taking this approach with a cl

Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Mon, May 26, 2014 at 05:45:26PM +0100, me said: > If you're already using Moose I'm sure it's fantastic but adding ~120 > dependencies (of which ~30 are core admittedly) for something I could > probably write in nearly as many lines of code[*] probably isn't going > to fly unfortunately. Wei

Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Tue, May 27, 2014 at 08:20:02PM +0200, Thomas Klausner said: > Hi! Wotcha! > Well, we use DBIx::SchemaChecksum in some utility scripts that are > invoked maybe once a day per hand (and quite often less than that). > > So neither process size nor start up time was an issue when writing it.