From gary at devgurus.com Sun Feb 16 16:40:34 2014 From: gary at devgurus.com (Gary Smith) Date: Mon, 17 Feb 2014 11:40:34 +1100 Subject: [Melbourne-pm] Bareword found where operator expected Message-ID: <53015A82.1000900@devgurus.com> Hi All, I'm seeing an error in a file here but I think it may be related to the development environment rather than the file. The reason I say that is because the error only occurs in the environment that I have created (with perlbrew) for myself. The production environment doesn't exhibit the same error and I also use this same code on a Debian VM without issue. Perl version is 5.16.3 The environment is Catalyst/Pg/Starman. Here is the error output: Bareword found where operator expected at /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ \s* ( [\s\d\w]{3,} ) \s* $/ux" (Missing operator before ux?) Error while loading /home/gary/myapp/myapp.psgi: syntax error at /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ \s* ( [\s\d\w]{3,} ) \s* $/ux" Can't use global $1 in "my" at /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" BEGIN not safe after errors--compilation aborted at /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. Compilation failed in require at /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. Here is the relevant code lines 59 & 60 in Lookup.pm: if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) \s* $/ux) { my $value = $1; I know that the code is fine as it has been working fine for many months and still works fine on the production and Debian servers. I don't know what in my environment would cause the error. It appears to be saying that it doesn't like the regex, but there doesn't appear to be any syntax issues there. Regards, Gary -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam at nipl.net Sun Feb 16 22:57:52 2014 From: sam at nipl.net (Sam Watkins) Date: Mon, 17 Feb 2014 17:57:52 +1100 Subject: [Melbourne-pm] Bareword found where operator expected In-Reply-To: <53015A82.1000900@devgurus.com> References: <53015A82.1000900@devgurus.com> Message-ID: <20140217065752.GD17867@opal.nipl.net> I don't know what your /u u modifier is meant to be, but it doesn't work for me and causes that error in perl v5.10. So I guess that 'u' modifier is your problem. Sam On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote: > Hi All, > > I'm seeing an error in a file here but I think it may be related to > the development environment rather than the file. The reason I say > that is because the error only occurs in the environment that I have > created (with perlbrew) for myself. The production environment > doesn't exhibit the same error and I also use this same code on a > Debian VM without issue. > > Perl version is 5.16.3 > > The environment is Catalyst/Pg/Starman. > > Here is the error output: > > Bareword found where operator expected at > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ > \s* ( [\s\d\w]{3,} ) \s* $/ux" > (Missing operator before ux?) > Error while loading /home/gary/myapp/myapp.psgi: syntax error at > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ > \s* ( [\s\d\w]{3,} ) \s* $/ux" > Can't use global $1 in "my" at > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" > BEGIN not safe after errors--compilation aborted at > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. > Compilation failed in require at > /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. > Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. > BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. > > > Here is the relevant code lines 59 & 60 in Lookup.pm: > > if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) > \s* $/ux) { > my $value = $1; > > > I know that the code is fine as it has been working fine for many > months and still works fine on the production and Debian servers. I > don't know what in my environment would cause the error. It appears > to be saying that it doesn't like the regex, but there doesn't > appear to be any syntax issues there. > > Regards, > > Gary > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From myfwhite at gmail.com Sun Feb 16 23:03:27 2014 From: myfwhite at gmail.com (Myf White) Date: Mon, 17 Feb 2014 18:03:27 +1100 Subject: [Melbourne-pm] Bareword found where operator expected In-Reply-To: <20140217065752.GD17867@opal.nipl.net> References: <53015A82.1000900@devgurus.com> <20140217065752.GD17867@opal.nipl.net> Message-ID: I think the /u modifier for unicode was introduced in 5.14 Kind Regards, Myf White *Email:* myfwhite at gmail.com On Mon, Feb 17, 2014 at 5:57 PM, Sam Watkins wrote: > I don't know what your /u > u modifier is meant to be, but it doesn't work for me and causes that > error in perl v5.10. > > So I guess that 'u' modifier is your problem. > > Sam > > On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote: > > Hi All, > > > > I'm seeing an error in a file here but I think it may be related to > > the development environment rather than the file. The reason I say > > that is because the error only occurs in the environment that I have > > created (with perlbrew) for myself. The production environment > > doesn't exhibit the same error and I also use this same code on a > > Debian VM without issue. > > > > Perl version is 5.16.3 > > > > The environment is Catalyst/Pg/Starman. > > > > Here is the error output: > > > > Bareword found where operator expected at > > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ > > \s* ( [\s\d\w]{3,} ) \s* $/ux" > > (Missing operator before ux?) > > Error while loading /home/gary/myapp/myapp.psgi: syntax error at > > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ > > \s* ( [\s\d\w]{3,} ) \s* $/ux" > > Can't use global $1 in "my" at > > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" > > BEGIN not safe after errors--compilation aborted at > > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. > > Compilation failed in require at > > /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. > > Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. > > BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. > > > > > > Here is the relevant code lines 59 & 60 in Lookup.pm: > > > > if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) > > \s* $/ux) { > > my $value = $1; > > > > > > I know that the code is fine as it has been working fine for many > > months and still works fine on the production and Debian servers. I > > don't know what in my environment would cause the error. It appears > > to be saying that it doesn't like the regex, but there doesn't > > appear to be any syntax issues there. > > > > Regards, > > > > Gary > > > _______________________________________________ > > Melbourne-pm mailing list > > Melbourne-pm at pm.org > > http://mail.pm.org/mailman/listinfo/melbourne-pm > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From benhare at gmail.com Mon Feb 17 17:03:08 2014 From: benhare at gmail.com (Ben Hare) Date: Tue, 18 Feb 2014 11:33:08 +1030 Subject: [Melbourne-pm] Bareword found where operator expected In-Reply-To: References: <53015A82.1000900@devgurus.com> <20140217065752.GD17867@opal.nipl.net> Message-ID: On 17 February 2014 17:33, Myf White wrote: > I think the /u modifier for unicode was introduced in 5.14 > > Kind Regards, > Myf White > > Email: myfwhite at gmail.com > > > On Mon, Feb 17, 2014 at 5:57 PM, Sam Watkins wrote: >> >> I don't know what your /u >> u modifier is meant to be, but it doesn't work for me and causes that >> error in perl v5.10. >> app using wrong ( older ) perl? Ben. >> So I guess that 'u' modifier is your problem. >> >> Sam >> >> On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote: >> > Hi All, >> > >> > I'm seeing an error in a file here but I think it may be related to >> > the development environment rather than the file. The reason I say >> > that is because the error only occurs in the environment that I have >> > created (with perlbrew) for myself. The production environment >> > doesn't exhibit the same error and I also use this same code on a >> > Debian VM without issue. >> > >> > Perl version is 5.16.3 >> > >> > The environment is Catalyst/Pg/Starman. >> > >> > Here is the error output: >> > >> > Bareword found where operator expected at >> > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >> > \s* ( [\s\d\w]{3,} ) \s* $/ux" >> > (Missing operator before ux?) >> > Error while loading /home/gary/myapp/myapp.psgi: syntax error at >> > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >> > \s* ( [\s\d\w]{3,} ) \s* $/ux" >> > Can't use global $1 in "my" at >> > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" >> > BEGIN not safe after errors--compilation aborted at >> > /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. >> > Compilation failed in require at >> > /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. >> > Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. >> > BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. >> > >> > >> > Here is the relevant code lines 59 & 60 in Lookup.pm: >> > >> > if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) >> > \s* $/ux) { >> > my $value = $1; >> > >> > >> > I know that the code is fine as it has been working fine for many >> > months and still works fine on the production and Debian servers. I >> > don't know what in my environment would cause the error. It appears >> > to be saying that it doesn't like the regex, but there doesn't >> > appear to be any syntax issues there. >> > >> > Regards, >> > >> > Gary >> >> > _______________________________________________ >> > Melbourne-pm mailing list >> > Melbourne-pm at pm.org >> > http://mail.pm.org/mailman/listinfo/melbourne-pm >> >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm > > > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm -- Benjamin J. Hare Web Design, Software & Hosting Solutions ABN: 22-48-55-71-887 Phone: +61-415-607-197 Web: http://www.benhare.com Email: ben at benhare.com From toby.corkindale at strategicdata.com.au Mon Feb 17 17:53:29 2014 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Tue, 18 Feb 2014 12:53:29 +1100 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter Message-ID: <5302BD19.4050705@strategicdata.com.au> Hi, Did anyone else read the article (blog post) linked from the Perl Weekly on website sessions? http://perlgeek.de/blog-en/misc/2014-running-a-public-website-sessions.html I thought it was hopeless. All the problems faced by the author were due to poor architecture or poor quality of Perl modules. Obviously, the author not having su or sudo access to the user the site was running as, is a massive failure of competency. The site was running as Apache server-side-includes, which is about as old a design as you can have. Having to upload secret CGI scripts to the server so as to be able to have them run system() commands to clean out folders is ridiculous! (But I understand that if you're desperate and that's the only access you have, you'll make do with it..) But beyond that -- the clear source of their problem was that they were running a web session module that: * Created a file per session * Never expired old sessions The author mentions that the disk was filled by 3 million individual small session files. There were 100k individual visitors per month. Even if you kept sessions around for 30 days, that'd be a manageable quantity. It's pretty self-evident that if you never, ever expire sessions, then you'll run out of storage sooner or later. The author's eventual solution was to move to 256 (!) individual sqlite databases for session storage, sharding the data set by the leading IP octet of visitors. (Using a single sqlite database gave rise to performance issues due to DB locking) *sigh* And I wonder if they've started expiring old sessions too, or not? (And thus just put the problem off for a bit longer) Anyway, the point of all this was: Why are people (who are notable enough to get their blog posts re-shared widely) using such poor quality modules, and having to build workarounds for them? (CGI::Session is the top hit on cpan) It's helpful to hear how they solved it, but why did they have to? Every single person who builds a website will need to re-solve the problem. They shouldn't have to! You get somewhat better quality modules if you use one of the Perl web stacks, Dancer, Catalyst, etc. However, even the standard session stores for Catalyst::Session::Store (File and DBI/DBIC) don't do automatic expiry as far as I can tell. (I didn't investigate Dancer or Mojolicious) Why aren't we doing this stuff better on Perl? OK, ending rant now. -Toby From gary at devgurus.com Mon Feb 17 17:55:02 2014 From: gary at devgurus.com (Gary Smith) Date: Tue, 18 Feb 2014 12:55:02 +1100 Subject: [Melbourne-pm] Bareword found where operator expected In-Reply-To: References: <53015A82.1000900@devgurus.com> <20140217065752.GD17867@opal.nipl.net> Message-ID: <5302BD76.8090700@devgurus.com> Yep - that's what is happening. I have 5.16.3 installed with perlbrew and everything in my environment tells me that it's being used. But when the main script runs it's managing to use the system perl in /usr/bin which is 5.10. gary at intertradedocs:~$ perl -E 'say join $/, @INC' /home/gary/perl5/lib/perl5/x86_64-linux /home/gary/perl5/lib/perl5 /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3 . gary at intertradedocs:~$ which perl /home/gary/perl5/perlbrew/perls/perl-5.16.3/bin/perl Gary On 18/02/2014 12:03 pm, Ben Hare wrote: > On 17 February 2014 17:33, Myf White wrote: >> I think the /u modifier for unicode was introduced in 5.14 >> >> Kind Regards, >> Myf White >> >> Email: myfwhite at gmail.com >> >> >> On Mon, Feb 17, 2014 at 5:57 PM, Sam Watkins wrote: >>> I don't know what your /u >>> u modifier is meant to be, but it doesn't work for me and causes that >>> error in perl v5.10. >>> > app using wrong ( older ) perl? > > Ben. > > >>> So I guess that 'u' modifier is your problem. >>> >>> Sam >>> >>> On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote: >>>> Hi All, >>>> >>>> I'm seeing an error in a file here but I think it may be related to >>>> the development environment rather than the file. The reason I say >>>> that is because the error only occurs in the environment that I have >>>> created (with perlbrew) for myself. The production environment >>>> doesn't exhibit the same error and I also use this same code on a >>>> Debian VM without issue. >>>> >>>> Perl version is 5.16.3 >>>> >>>> The environment is Catalyst/Pg/Starman. >>>> >>>> Here is the error output: >>>> >>>> Bareword found where operator expected at >>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >>>> \s* ( [\s\d\w]{3,} ) \s* $/ux" >>>> (Missing operator before ux?) >>>> Error while loading /home/gary/myapp/myapp.psgi: syntax error at >>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >>>> \s* ( [\s\d\w]{3,} ) \s* $/ux" >>>> Can't use global $1 in "my" at >>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" >>>> BEGIN not safe after errors--compilation aborted at >>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. >>>> Compilation failed in require at >>>> /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. >>>> Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. >>>> BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. >>>> >>>> >>>> Here is the relevant code lines 59 & 60 in Lookup.pm: >>>> >>>> if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) >>>> \s* $/ux) { >>>> my $value = $1; >>>> >>>> >>>> I know that the code is fine as it has been working fine for many >>>> months and still works fine on the production and Debian servers. I >>>> don't know what in my environment would cause the error. It appears >>>> to be saying that it doesn't like the regex, but there doesn't >>>> appear to be any syntax issues there. >>>> >>>> Regards, >>>> >>>> Gary >>>> _______________________________________________ >>>> Melbourne-pm mailing list >>>> Melbourne-pm at pm.org >>>> http://mail.pm.org/mailman/listinfo/melbourne-pm >>> _______________________________________________ >>> Melbourne-pm mailing list >>> Melbourne-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/melbourne-pm >> >> >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary at devgurus.com Mon Feb 17 18:19:01 2014 From: gary at devgurus.com (Gary Smith) Date: Tue, 18 Feb 2014 13:19:01 +1100 Subject: [Melbourne-pm] Bareword found where operator expected In-Reply-To: <5302BD76.8090700@devgurus.com> References: <53015A82.1000900@devgurus.com> <20140217065752.GD17867@opal.nipl.net> <5302BD76.8090700@devgurus.com> Message-ID: <5302C315.9070705@devgurus.com> Ben provided the answer. I just hadn't looked hard enough. My local starman was using /usr/bin/perl. Gary On 18/02/2014 12:55 pm, Gary Smith wrote: > Yep - that's what is happening. I have 5.16.3 installed with perlbrew > and everything in my environment tells me that it's being used. But > when the main script runs it's managing to use the system perl in > /usr/bin which is 5.10. > > gary at intertradedocs:~$ perl -E 'say join $/, @INC' > /home/gary/perl5/lib/perl5/x86_64-linux > /home/gary/perl5/lib/perl5 > /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux > /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 > /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux > /home/gary/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3 > . > gary at intertradedocs:~$ which perl > /home/gary/perl5/perlbrew/perls/perl-5.16.3/bin/perl > > Gary > > > On 18/02/2014 12:03 pm, Ben Hare wrote: >> On 17 February 2014 17:33, Myf White wrote: >>> I think the /u modifier for unicode was introduced in 5.14 >>> >>> Kind Regards, >>> Myf White >>> >>> Email:myfwhite at gmail.com >>> >>> >>> On Mon, Feb 17, 2014 at 5:57 PM, Sam Watkins wrote: >>>> I don't know what your /u >>>> u modifier is meant to be, but it doesn't work for me and causes that >>>> error in perl v5.10. >>>> >> app using wrong ( older ) perl? >> >> Ben. >> >> >>>> So I guess that 'u' modifier is your problem. >>>> >>>> Sam >>>> >>>> On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote: >>>>> Hi All, >>>>> >>>>> I'm seeing an error in a file here but I think it may be related to >>>>> the development environment rather than the file. The reason I say >>>>> that is because the error only occurs in the environment that I have >>>>> created (with perlbrew) for myself. The production environment >>>>> doesn't exhibit the same error and I also use this same code on a >>>>> Debian VM without issue. >>>>> >>>>> Perl version is 5.16.3 >>>>> >>>>> The environment is Catalyst/Pg/Starman. >>>>> >>>>> Here is the error output: >>>>> >>>>> Bareword found where operator expected at >>>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >>>>> \s* ( [\s\d\w]{3,} ) \s* $/ux" >>>>> (Missing operator before ux?) >>>>> Error while loading /home/gary/myapp/myapp.psgi: syntax error at >>>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^ >>>>> \s* ( [\s\d\w]{3,} ) \s* $/ux" >>>>> Can't use global $1 in "my" at >>>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1" >>>>> BEGIN not safe after errors--compilation aborted at >>>>> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73. >>>>> Compilation failed in require at >>>>> /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308. >>>>> Compilation failed in require at /home/gary/myapp/myapp.psgi line 4. >>>>> BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4. >>>>> >>>>> >>>>> Here is the relevant code lines 59 & 60 in Lookup.pm: >>>>> >>>>> if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} ) >>>>> \s* $/ux) { >>>>> my $value = $1; >>>>> >>>>> >>>>> I know that the code is fine as it has been working fine for many >>>>> months and still works fine on the production and Debian servers. I >>>>> don't know what in my environment would cause the error. It appears >>>>> to be saying that it doesn't like the regex, but there doesn't >>>>> appear to be any syntax issues there. >>>>> >>>>> Regards, >>>>> >>>>> Gary >>>>> _______________________________________________ >>>>> Melbourne-pm mailing list >>>>> Melbourne-pm at pm.org >>>>> http://mail.pm.org/mailman/listinfo/melbourne-pm >>>> _______________________________________________ >>>> Melbourne-pm mailing list >>>> Melbourne-pm at pm.org >>>> http://mail.pm.org/mailman/listinfo/melbourne-pm >>> >>> _______________________________________________ >>> Melbourne-pm mailing list >>> Melbourne-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/melbourne-pm >> > > > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby.corkindale at strategicdata.com.au Mon Feb 17 19:59:28 2014 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Tue, 18 Feb 2014 14:59:28 +1100 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter In-Reply-To: References: <5302BD19.4050705@strategicdata.com.au> Message-ID: <5302DAA0.7090707@strategicdata.com.au> On 18/02/14 14:22, Tim Connors wrote: [snip] > (I still don't get the point of databases. perl storables were always > good enough for me and my tens of millions of objects in galaxy simulations) How did you manage multiple processes simultaneously wanting access to update different parts of the same file? How did you handle cases where you wanted a process to guarantee that either all of none of its changes were stored, but never some? (Whilst still allowing simultaneous access by multiple processes) From toby.corkindale at strategicdata.com.au Mon Feb 17 20:19:42 2014 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Tue, 18 Feb 2014 15:19:42 +1100 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter In-Reply-To: References: <5302BD19.4050705@strategicdata.com.au> <5302DAA0.7090707@strategicdata.com.au> Message-ID: <5302DF5E.3050604@strategicdata.com.au> On 18/02/14 15:06, Tim Connors wrote: > On Tue, 18 Feb 2014, Toby Corkindale wrote: > >> On 18/02/14 14:22, Tim Connors wrote: >> [snip] >>> (I still don't get the point of databases. perl storables were always >>> good enough for me and my tens of millions of objects in galaxy simulations) >> >> How did you manage multiple processes simultaneously wanting access to update >> different parts of the same file? >> >> How did you handle cases where you wanted a process to guarantee that either >> all of none of its changes were stored, but never some? (Whilst still allowing >> simultaneous access by multiple processes) > > Filesystem is a database, and atomic renames :P So a file per row? That must perform amazingly when you want to do something like this across a million tiny files: SELECT SUM(x) WHERE y > z I guess you have to open every single file in order to flock() them so you get an internally consistent view. How many file handles are your processes allowed? From ben at vinnerd.com Tue Feb 18 00:44:51 2014 From: ben at vinnerd.com (Ben Vinnerd) Date: Tue, 18 Feb 2014 08:44:51 +0000 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter In-Reply-To: <5302BD19.4050705@strategicdata.com.au> References: <5302BD19.4050705@strategicdata.com.au> Message-ID: On 18 February 2014 01:53, Toby Corkindale < toby.corkindale at strategicdata.com.au> wrote: > You get somewhat better quality modules if you use one of the Perl web > stacks, Dancer, Catalyst, etc. However, even the standard session stores > for Catalyst::Session::Store (File and DBI/DBIC) don't do automatic expiry > as far as I can tell. (I didn't investigate Dancer or Mojolicious) > You should have in investigated Mojo :) It uses client based sessions, so the session data is stored on the client encrypted and signed to prevent tampering. No database required. http://mojolicio.us/perldoc/Mojolicious/Guides/Growing#Sessions You can expire a session as you would usually by setting the cookies expires attribute. Can be modified by the client, but you encode the expiry date in the session too (encrypted and signed, remember), or you could even change the "secret" in the application every so often to make it even more secure. Whether you trust it or not is a different matter though. Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From brong at fastmail.fm Tue Feb 18 02:25:14 2014 From: brong at fastmail.fm (Bron Gondwana) Date: Tue, 18 Feb 2014 21:25:14 +1100 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter In-Reply-To: <5302DF5E.3050604@strategicdata.com.au> References: <5302BD19.4050705@strategicdata.com.au> <5302DAA0.7090707@strategicdata.com.au> <5302DF5E.3050604@strategicdata.com.au> Message-ID: <1392719114.3886.84732937.723E5756@webmail.messagingengine.com> On Tue, Feb 18, 2014, at 03:19 PM, Toby Corkindale wrote: > On 18/02/14 15:06, Tim Connors wrote: > > On Tue, 18 Feb 2014, Toby Corkindale wrote: > > > >> On 18/02/14 14:22, Tim Connors wrote: > >> [snip] > >>> (I still don't get the point of databases. perl storables were always > >>> good enough for me and my tens of millions of objects in galaxy simulations) > >> > >> How did you manage multiple processes simultaneously wanting access to update > >> different parts of the same file? > >> > >> How did you handle cases where you wanted a process to guarantee that either > >> all of none of its changes were stored, but never some? (Whilst still allowing > >> simultaneous access by multiple processes) > > > > Filesystem is a database, and atomic renames :P > > So a file per row? > That must perform amazingly when you want to do something like this > across a million tiny files: > SELECT SUM(x) WHERE y > z > > I guess you have to open every single file in order to flock() them so > you get an internally consistent view. How many file handles are your > processes allowed? Nah, just flock a single global lock file for writes. Bron ( think inside the box ) -- Bron Gondwana brong at fastmail.fm From kahlil.hodgson at dealmax.com.au Tue Feb 18 14:27:18 2014 From: kahlil.hodgson at dealmax.com.au (Kahlil Hodgson) Date: Wed, 19 Feb 2014 09:27:18 +1100 Subject: [Melbourne-pm] An article on session storage in perl weekly newsletter In-Reply-To: References: <5302BD19.4050705@strategicdata.com.au> Message-ID: On Tue, Feb 18, 2014 at 7:44 PM, Ben Vinnerd wrote: > It uses client based sessions, so the session data is stored on the client > encrypted and signed to prevent tampering. No database required. > Catalyst plugin to do the same. http://search.cpan.org/~lbrocard/Catalyst-Plugin-CookiedSession-0.35/lib/Catalyst/Plugin/CookiedSession.pm Never used it though. Kal Kahlil (Kal) Hodgson GPG: C9A02289 Head of Technology (m) +61 (0) 4 2573 0382 DealMax Pty Ltd (w) +61 (0) 3 9008 5281 Suite 1415 401 Docklands Drive Docklands VIC 3008 Australia "All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer." -- IBM maintenance manual, 1925 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mithunr2003 at gmail.com Sat Feb 22 01:22:12 2014 From: mithunr2003 at gmail.com (Mithun Radhakrishnan) Date: Sat, 22 Feb 2014 14:52:12 +0530 Subject: [Melbourne-pm] LWP not giving the expected response Message-ID: Hi Mongers, I am not getting the proper response from the below URL when used with LWP request. However curl gives proper response. Do I need to add any thing extra in the code. The same perl code works perfectly with other URLs. http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk.com/service/getLookupData/category [perl at localhost ~]$ *curl -i http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk.com/service/getLookupData/category * *HTTP/1.1 200 OK* Content-Type: application/json;charset=UTF-8 Date: Sat, 22 Feb 2014 09:12:43 GMT Server: Apache-Coyote/1.1 transfer-encoding: chunked Connection: keep-alive [{"category_id":0,"category_name":"Development","category_description":"Software Development"},{"category_id":1,"category_name":"Pursuit","category_description":"Pursuit"},{"category_id":2,"category_name":"Information Gathering","category_description":"Information Gathering"},{"category_id":3,"category_name":"Documentation","category_description":"Documentation"}] [perl at localhost ~]$ *./mytest/Tool-link/get.pl * Request URL : http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk.com/service/getLookupData/category Request Method :GET *Response Status :400* Response Content :Apache Tomcat/7.0.42 - Error report

HTTP Status 400 -


type Status report

message

description The request sent by the client was syntactically incorrect.


Apache Tomcat/7.0.42

[perl at localhost ~]$ cat ./mytest/Tool-link/get.pl #!/usr/bin/env perl use LWP::UserAgent; use HTTP::Request; use Data::Dumper; my $method = 'GET'; my $uri = ' http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk.com/service/getLookupData/category '; #$uri = 'http://www.thomas-bayer.com/sqlrest/PRODUCT/49'; my $ua = LWP::UserAgent->new; my $request = HTTP::Request->new( $method, $uri ); my $response = $ua->request($request); print "Request URL\t:", $response->request->url, "\n"; print "Request Method\t:", $response->request->method, "\n"; print "Response Status\t:", $response->code, "\n"; print "Response Content\t:", $response->content, "\n"; #print Dumper($response); [perl at localhost ~]$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddick at iinet.net.au Sat Feb 22 01:36:32 2014 From: ddick at iinet.net.au (David Dick) Date: Sat, 22 Feb 2014 20:36:32 +1100 Subject: [Melbourne-pm] LWP not giving the expected response In-Reply-To: References: Message-ID: <53086FA0.9040601@iinet.net.au> On 02/22/2014 08:22 PM, Mithun Radhakrishnan wrote: > > Hi Mongers, > > I am not getting the proper response from the below URL when used with > LWP request. However curl gives proper response. Do I need to add any > thing extra in the code. The same perl code works perfectly with other > URLs. > > http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk.com/service/getLookupData/category your perl code would work fine for most sites. This particular site seems to blow up unless you add the following line to your code. $ua->default_header('Accept' => '*/*'); Some websites behave oddly. Some more so. Dave From mithunr2003 at gmail.com Sat Feb 22 01:59:48 2014 From: mithunr2003 at gmail.com (Mithun Radhakrishnan) Date: Sat, 22 Feb 2014 15:29:48 +0530 Subject: [Melbourne-pm] LWP not giving the expected response In-Reply-To: <53086FA0.9040601@iinet.net.au> References: <53086FA0.9040601@iinet.net.au> Message-ID: Thanks Dave. That was super cool.. I spent almost a day for finding the solution to this. :) Regards Mithun On Sat, Feb 22, 2014 at 3:06 PM, David Dick wrote: > On 02/22/2014 08:22 PM, Mithun Radhakrishnan wrote: > >> >> Hi Mongers, >> >> I am not getting the proper response from the below URL when used with >> LWP request. However curl gives proper response. Do I need to add any >> thing extra in the code. The same perl code works perfectly with other >> URLs. >> >> http://cgjobjarservice-axzz2sbpnu.elasticbeanstalk. >> com/service/getLookupData/category >> > > your perl code would work fine for most sites. This particular site seems > to blow up unless you add the following line to your code. > > $ua->default_header('Accept' => '*/*'); > > Some websites behave oddly. Some more so. > > Dave > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From melbourne-pm at mjch.net Sun Feb 23 18:17:49 2014 From: melbourne-pm at mjch.net (Malcolm Herbert) Date: Mon, 24 Feb 2014 13:17:49 +1100 Subject: [Melbourne-pm] LWP not giving the expected response In-Reply-To: References: Message-ID: <20140224021748.GA27541@deimos.ergonaut.org> On Sat, Feb 22, 2014 at 02:52:12PM +0530, Mithun Radhakrishnan wrote: |I am not getting the proper response from the below URL when used with |LWP request. However curl gives proper response. Do I need to add any |thing extra in the code. The same perl code works perfectly with other |URLs. While we're on LWP oddities, I've found a situation where something within Perl[1] will attempt a TCP6 connection to a remote host if it has an AAAA record which fails utterly as although I have local IPv6 links on my host, it's not set up on my system to route IPv6 at all ... Unfortunately the only way I seem to have been able to get around this was to implement the same thing in Python, which wasn't pretty ... :) Is there any way to tell Perl not to use IPv6? Or should I just remove it completely? Regards, Malcolm [1] not sure whether to finger LWP directly for this or not, it was just where I bumped into it -- Malcolm Herbert mjch at mjch.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From lsharpe at silverspringnet.com Sun Feb 23 18:33:36 2014 From: lsharpe at silverspringnet.com (Leigh Sharpe) Date: Mon, 24 Feb 2014 02:33:36 +0000 Subject: [Melbourne-pm] LWP not giving the expected response In-Reply-To: <20140224021748.GA27541@deimos.ergonaut.org> Message-ID: <20B5983F08A5E54D9C19A4A2C362817666A201DB@SFO-EXMB-03.silverspringnet.com> Is it only LWP that does this? I would have thought it would be up to the OS. In which case, you can always fiddle with /etc/gai.conf Leigh. On 24/02/14 1:17 PM, "Malcolm Herbert" wrote: >On Sat, Feb 22, 2014 at 02:52:12PM +0530, Mithun Radhakrishnan wrote: >|I am not getting the proper response from the below URL when used with >|LWP request. However curl gives proper response. Do I need to add any >|thing extra in the code. The same perl code works perfectly with other >|URLs. > >While we're on LWP oddities, I've found a situation where something >within Perl[1] will attempt a TCP6 connection to a remote host if it has >an AAAA record which fails utterly as although I have local IPv6 links >on my host, it's not set up on my system to route IPv6 at all ... > >Unfortunately the only way I seem to have been able to get around this >was to implement the same thing in Python, which wasn't pretty ... :) > >Is there any way to tell Perl not to use IPv6? Or should I just remove it >completely? > >Regards, >Malcolm > >[1] not sure whether to finger LWP directly for this or not, it was just >where I bumped into it > >-- >Malcolm Herbert >mjch at mjch.net