[Mojolicious] New Twitter Account

2018-11-19 Thread sri
We now have a dedicated Mojolicious Twitter account where the whole team 
can tweet.

https://twitter.com/perlmojo

P.S.: For the cat memes i'm afraid you will have to keep following me!

--
sebastian

-- 
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] Using 'state' in a helper

2018-11-19 Thread Viktor Nacht
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+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

2018-11-19 Thread Dan Book
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+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.


Re: [Mojolicious] $c->req->env Empty

2018-11-19 Thread Alexander Karelas
Dear Mr Henq,

Please see a fresh new thread on this mailing list, that I'll be posting
in a few minutes, with a subject line of "Apache Config for Mojo CGI
setup - opinions?".

- Alexander


On 17/11/18 2:39 μ.μ., henq wrote:
> Alexander, do you have a link to the post?   I have a couple of Mojo
> lite apps that get a handful request per day max, and response time is
> not important. I'd rather make them run under CGI than having to deal
> with the hassle of keeping a daemon running, setting up reverse proxy
> and so on. But I have problems with getting internal links working
> when app is not at / level, but in subdirectory.  
>
> On Saturday, November 10, 2018 at 8:53:02 AM UTC+1, Alexander Karelas
> wrote:
>
> I have set-up Mojolicious on CGI, it requires a trick that I think
> wasn't included in full in the Wiki or in the documentation. I
> will post it on Monday from work.
>
> Basically you need to rewrite the browser URL to
> /cgi-bin/path/to/my_app.pl/path/of/users/browser
>  (that is, one path
> appended to the other)
>
> - Alex
>
>>
> -- 
> 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] Apache Config for Mojo CGI setup - opinions?

2018-11-19 Thread Alexander Karelas
I have made some webapps that I use internally. I use them so rarely
(just a couple of page views per week each) that I thought it wasn't
worth having a hypnotoad running for each and waste resources (RAM
mainly), especially since the number of these webapps might increase a
lot in the future, and I don't care about response time (2 seconds is
fine) so I thought I'd set them up as CGI sites.

With some experimentation, I ended up with this Apache conf file the
VirtualServer (for Apache v2.4). It routes arbitrary URLs to the right
route handler.

What do you think of it? Is it secure (suppose an evil user has access
to it)? Can it be improved? Can it be simplified, maybe? Is this useful
material for the mojo Wiki / POD?

I'm interested in your opinions, because my experience with Apache is
not that big.


*  DocumentRoot /opt/mysite/html
  ScriptAlias /cgi-bin/ /opt/mysite/cgi-bin/

  
  RewriteEngine On
  RewriteBase /
  RewriteRule (.*) /cgi-bin/my_app.pl/$1 [L]
  Require all granted
  

  # for the case when the user types manually
/cgi-bin/local/bin/some-command.pl
  # i.e. the only CGI script that's allowed to run is my_app.pl
  
  Require all denied
  

  
  Require all granted
  Options ExecCGI
  SetHandler cgi-script
  
*

-- 
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: Apache Config for Mojo CGI setup - opinions?

2018-11-19 Thread Alexander Karelas
I should note that the entire webapp (the templates/ subdir, the public/
subdir, etc) resides in the cgi-bin/ directory. my_app.pl happens to be
a Mojolicious::Lite app in this case.

- Alex


On 20/11/18 6:22 π.μ., Alexander Karelas wrote:
>
> I have made some webapps that I use internally. I use them so rarely
> (just a couple of page views per week each) that I thought it wasn't
> worth having a hypnotoad running for each and waste resources (RAM
> mainly), especially since the number of these webapps might increase a
> lot in the future, and I don't care about response time (2 seconds is
> fine) so I thought I'd set them up as CGI sites.
>
> With some experimentation, I ended up with this Apache conf file the
> VirtualServer (for Apache v2.4). It routes arbitrary URLs to the right
> route handler.
>
> What do you think of it? Is it secure (suppose an evil user has access
> to it)? Can it be improved? Can it be simplified, maybe? Is this
> useful material for the mojo Wiki / POD?
>
> I'm interested in your opinions, because my experience with Apache is
> not that big.
>
>
> *  DocumentRoot /opt/mysite/html
>   ScriptAlias /cgi-bin/ /opt/mysite/cgi-bin/
>
>   
>   RewriteEngine On
>   RewriteBase /
>   RewriteRule (.*) /cgi-bin/my_app.pl/$1 [L]
>   Require all granted
>   
>
>   # for the case when the user types manually
> /cgi-bin/local/bin/some-command.pl
>   # i.e. the only CGI script that's allowed to run is my_app.pl
>   
>   Require all denied
>   
>
>   
>   Require all granted
>   Options ExecCGI
>   SetHandler cgi-script
>   
> *
>

-- 
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] Apache Config for Mojo CGI setup - opinions?

2018-11-19 Thread Dan Book
Even simpler, I think, is to alias everything to your one script, so you
don't have to worry about what else might be in that directory.

ScriptAlias "/cgi-bin/" "/opt/mysite/cgi-bin/my_app.pl"

https://httpd.apache.org/docs/2.4/mod/mod_alias.html#scriptalias talks
about some strategies for this.

-Dan

On Mon, Nov 19, 2018 at 11:22 PM Alexander Karelas 
wrote:

> I have made some webapps that I use internally. I use them so rarely (just
> a couple of page views per week each) that I thought it wasn't worth having
> a hypnotoad running for each and waste resources (RAM mainly), especially
> since the number of these webapps might increase a lot in the future, and I
> don't care about response time (2 seconds is fine) so I thought I'd set
> them up as CGI sites.
>
> With some experimentation, I ended up with this Apache conf file the
> VirtualServer (for Apache v2.4). It routes arbitrary URLs to the right
> route handler.
>
> What do you think of it? Is it secure (suppose an evil user has access to
> it)? Can it be improved? Can it be simplified, maybe? Is this useful
> material for the mojo Wiki / POD?
>
> I'm interested in your opinions, because my experience with Apache is not
> that big.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *  DocumentRoot /opt/mysite/html   ScriptAlias /cgi-bin/
> /opt/mysite/cgi-bin/  RewriteEngine
> On   RewriteBase /   RewriteRule (.*) /cgi-bin/my_app.pl/$1
>  [L]   Require all granted  # for
> the case when the user types manually /cgi-bin/local/bin/some-command.pl
>    # i.e. the only CGI script that's allowed to run
> is my_app.pl )">   Require all denied   
>Require all granted   Options
> ExecCGI   SetHandler cgi-script*
>
> --
> 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] Re: Apache Config for Mojo CGI setup - opinions?

2018-11-19 Thread Alexander Karelas
Something strange:

On a fresh CentOS 7, this conf works (i.e. mapping to
/cgi-bin/my_app.pl/further/path actually executes /cgi-bin/my_app.pl)

But on a fresh Ubuntu 18.04, it doesn't (I get a 404 Not Found because
script /cgi-bin/my_app.pl/further/path does not exist).

Don't know how to fix this on Ubuntu.

- Alex


On 20/11/18 6:22 π.μ., Alexander Karelas wrote:
>
> I have made some webapps that I use internally. I use them so rarely
> (just a couple of page views per week each) that I thought it wasn't
> worth having a hypnotoad running for each and waste resources (RAM
> mainly), especially since the number of these webapps might increase a
> lot in the future, and I don't care about response time (2 seconds is
> fine) so I thought I'd set them up as CGI sites.
>
> With some experimentation, I ended up with this Apache conf file the
> VirtualServer (for Apache v2.4). It routes arbitrary URLs to the right
> route handler.
>
> What do you think of it? Is it secure (suppose an evil user has access
> to it)? Can it be improved? Can it be simplified, maybe? Is this
> useful material for the mojo Wiki / POD?
>
> I'm interested in your opinions, because my experience with Apache is
> not that big.
>
>
> *  DocumentRoot /opt/mysite/html
>   ScriptAlias /cgi-bin/ /opt/mysite/cgi-bin/
>
>   
>   RewriteEngine On
>   RewriteBase /
>   RewriteRule (.*) /cgi-bin/my_app.pl/$1 [L]
>   Require all granted
>   
>
>   # for the case when the user types manually
> /cgi-bin/local/bin/some-command.pl
>   # i.e. the only CGI script that's allowed to run is my_app.pl
>   
>   Require all denied
>   
>
>   
>   Require all granted
>   Options ExecCGI
>   SetHandler cgi-script
>   
> *
>

-- 
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] Improved version / Was: [Re: Apache Config for Mojo CGI setup - opinions?]

2018-11-19 Thread Alexander Karelas
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.