Re: [Mojolicious] newbie question about routing

2019-01-02 Thread Stefan Adams
Hi!  Welcome to the group and to Mojolicious!

For your specific question, see Mojolicious::Routes::Route->to
 and the
bottom part of the Optional Placeholders

section of the Routing Guide
, specifically:

# /   -> {controller => 'foo',   action => 'bar'}# /users
-> {controller => 'users', action => 'bar'}# /users/list ->
{controller => 'users', action => 'list'}
$r->get('/:controller/:action')->to('foo#bar');

Special stash values like controller and action can also be placeholders,
which is very convenient especially during development, but should only be
used very carefully, because every controller method becomes a potential
route. All uppercase methods as well as those starting with an underscore
are automatically hidden from the router and you can use "hide" in
Mojolicious::Routes
 to add additional
ones.

To know more, please definitely read the Tutorial
 and all of the Guides
.  But if you have any more
questions, please don't hesitate to ask for Support
.

On Wed, Jan 2, 2019 at 4:54 AM  wrote:

> Hi. I want to route a request to a controller that's dynamically
> constructed, base on a place holder in the url. To illustrate, I want do
> something like the following:
>
> use Mojo::Base 'Mojolicious';
>
> sub startup {
>
> my $r = $self->routes;
>
>my $route = $r->get('/:customer/boxs/:id');
>
>
> [ somehow, extract the :customer holder into a variable $customer, then ]
>
>$route->(
>
> controller => "$customer::boxs',
>
> action => 'get_list',
>
> );
>
> }
>
>
> I tried but can't seem to find way to this, and I'm not sure if this is
> possible?
> Some pointer is appreciated. Thanks.
>
>
>
> --
> 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] newbie question about routing

2019-01-02 Thread hwmbo . lord
Hi. I want to route a request to a controller that's dynamically 
constructed, base on a place holder in the url. To illustrate, I want do 
something like the following:

use Mojo::Base 'Mojolicious';

sub startup {

my $r = $self->routes;

   my $route = $r->get('/:customer/boxs/:id');
 

[ somehow, extract the :customer holder into a variable $customer, then ]

   $route->(

controller => "$customer::boxs',

action => 'get_list',

);

}


I tried but can't seem to find way to this, and I'm not sure if this is 
possible?
Some pointer is appreciated. Thanks. 

 

-- 
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] Newbie question

2018-04-08 Thread Jan Eskilsson
Hi All

I'm not using Mojolicious::Lite but the full version and i have some
trouble to understand what i do wrong.

In my controller i do
  $self->render(mytest => 'my test');

In my template i do
  <%= $mytest %>

And the response i get
   Global symbol "$mytest" requires explicit package name (did you forget
to declare "my $mytest"?) at template stockitems/search.html.ep line 5.

for what i can see there is no real diffrence between this and the welcome
process :-(

Thank you in advance.


Best Regards
Jan

-- 
Titles mean nothing.  The one with a servant's heart is the leader.

Please consider the environment before you print this email.

All incoming and outgoing emails and any attachments are subjected to a
virus scanner and are believed to be free of any virus, or any other defect
which might affect any computer or IT system into which they are received
and opened. Therefore, it is the responsibility of the recipient to ensure
that they are virus free and no responsibility is accepted by Jan Eskilsson
 for any loss or damage arising in any way from receipt or use thereof.

-- 
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] Newbie question : How to run a bash script from inside a Mojolicious application ?

2017-10-25 Thread pascal marachian
Hi,

I am a newbie using Mojolicious. I would want to run a bash script from 
inside a Mojolicious application.
Perl system() or backticks didn't seem to work and I didn't find any 
information on the documentation.
So is it possible, and, if possible, how to do it ?
Thanks

-- 
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.