Re: [Mojolicious] LWP::UserAgent::Cached substitute?
I'm not sure why you say it wouldn't be usable with Mojolicious. Mojolicious doesn't care what other modules you use. LWP won't be capable of non-blocking queries like Mojo::UserAgent will of course, but that's usually not important for the command line. If you want to do it with Mojo::UserAgent try https://metacpan.org/pod/Mojo::UserAgent::Role::Cache. -Dan On Tue, Nov 20, 2018 at 8:44 PM wrote: > Hi folks, > > First time poster. > > I have some command line apps that use LWP with LWP::UserAgent::Cached > for the local file-based cache to get() and later parse pages. I need to > use this local page cache so that I don't hit the web server repeatedly for > unchanged pages. I was hoping to use Mojolicious, but prefer not to try > to re-implement this caching. > > It doesn't appear that LWP::UserAgent::Cached would be usable with > Mojolicious, and don't see anything readily available as an alternative. > > Any advice? > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mojolicious+unsubscr...@googlegroups.com. > To post to this group, send email to mojolicious@googlegroups.com. > Visit this group at https://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] LWP::UserAgent::Cached substitute?
Hi folks, First time poster. I have some command line apps that use LWP with LWP::UserAgent::Cached for the local file-based cache to get() and later parse pages. I need to use this local page cache so that I don't hit the web server repeatedly for unchanged pages. I was hoping to use Mojolicious, but prefer not to try to re-implement this caching. It doesn't appear that LWP::UserAgent::Cached would be usable with Mojolicious, and don't see anything readily available as an alternative. Any advice? -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Using 'state' in a helper
*facepalm* The stash, of course. Thank you. :) On Monday, November 19, 2018 at 6:01:26 PM UTC-8, Dan Book wrote: > > A 'state' variable lasts for the rest of that process, but is only > available to the scope it's declared in. If you want per-connection (or > more precisely per request), I recommend storing it in the stash, like: > > helper foo => sub { > my $c = shift; > return $c->stash->{'myapp.foo'} //= ...; > }; > > -Dan > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Using 'state' in a helper
Hi, not sure if this is what you need, but I wrote an example on how to trigger some state machine with a post request, and later be able to check some status with other requests: https://github.com/dmanto/mojo-stateful-server-experiment/blob/master/stateful.pl Hope it can help BR, Daniel El lunes, 19 de noviembre de 2018, 23:01:26 (UTC-3), Dan Book escribió: > > A 'state' variable lasts for the rest of that process, but is only > available to the scope it's declared in. If you want per-connection (or > more precisely per request), I recommend storing it in the stash, like: > > helper foo => sub { > my $c = shift; > return $c->stash->{'myapp.foo'} //= ...; > }; > > -Dan > > On Mon, Nov 19, 2018 at 8:18 PM Viktor Nacht > wrote: > >> Does using state inside a helper last for the duration of the connection, >> or something longer lasting like a process, worker, etc? >> >> I want to create (and return) a current DateTime object and make it >> accessible to multiple helpers and templates during a connection. >> >> I saw this Gist, but I'm not sure it pertains to per-connection: >> >> https://gist.github.com/s1037989/179d53b86e46ae788f62 >> >> V >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to mojolicious...@googlegroups.com . >> To post to this group, send email to mojol...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Re: Improved version / Was: [Re: Apache Config for Mojo CGI setup - opinions?]
And of course, you can SetEnv all the MOJO environment variables you want (eg MOJO_MODE to production) https://httpd.apache.org/docs/2.4/mod/mod_env.html#SetEnv On 20/11/18 8:21 π.μ., Alexander Karelas wrote: > > I even tried curl with /../other.pl and /cgi-bin/../other.pl, and > these still went through my_app.pl, so we're fine I think! > > - Alex > > > On 20/11/18 8:11 π.μ., Alexander Karelas wrote: >> >> Thanks to Dan Book, I searched a bit more. Plain ScriptAlias didn't >> do the trick, but ScriptAliasMatch worked beautifully on both CentOS >> and Ubuntu (provided you enable the cgi module of Apache, of course, >> which I hadn't done before, and mysteriously wasn't getting an error >> for unknown Apache directives): >> >> This apache config seems a lot simpler and more secure, I think, >> therefore better. >> >> >> *** >> ** ServerName apache-dev.lxd** >> ** DocumentRoot /opt/mysite/html* >> >> * ScriptAliasMatch "^/cgi-bin/(.*)" "/opt/mysite/cgi-bin/my_app.pl/$1"** >> ** >> ** ** >> ** RewriteEngine On** >> ** RewriteBase /** >> ** RewriteRule (.*) /cgi-bin/$1 [L]** >> ** Require all granted** >> ** ** >> ** >> ** ** >> ** Require all granted** >> ** ** >> >> * >> >> -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Re: Improved version / Was: [Re: Apache Config for Mojo CGI setup - opinions?]
I even tried curl with /../other.pl and /cgi-bin/../other.pl, and these still went through my_app.pl, so we're fine I think! - Alex On 20/11/18 8:11 π.μ., Alexander Karelas wrote: > > Thanks to Dan Book, I searched a bit more. Plain ScriptAlias didn't do > the trick, but ScriptAliasMatch worked beautifully on both CentOS and > Ubuntu (provided you enable the cgi module of Apache, of course, which > I hadn't done before, and mysteriously wasn't getting an error for > unknown Apache directives): > > This apache config seems a lot simpler and more secure, I think, > therefore better. > > > *** > ** ServerName apache-dev.lxd** > ** DocumentRoot /opt/mysite/html* > > * ScriptAliasMatch "^/cgi-bin/(.*)" "/opt/mysite/cgi-bin/my_app.pl/$1"** > ** > ** ** > ** RewriteEngine On** > ** RewriteBase /** > ** RewriteRule (.*) /cgi-bin/$1 [L]** > ** Require all granted** > ** ** > ** > ** ** > ** Require all granted** > ** ** > > * > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.