[Mojolicious] Is it possible to make Mojolicious::Plugin::DefaultHelpers::redirect_to method act same as nginx proxy_pass module?

2022-02-07 Thread Pavel Serikov
I need to redirect requests to particular IP address depending on requested url. E.g. example.com/foo -> 172.22.0.6:80 example.com/bar -> 172.22.0.7:80 etc. Is it possible with Mojolicious out-of-the-box? -- You received this message because you are subscribed to the Google Groups

Re: [Mojolicious] Undefined address for Socket::pack_sockaddr_in

2019-12-11 Thread Pavel Serikov
среда, 11 декабря 2019 г., 1:26:09 UTC+3 пользователь Veesh Goldman написал: > > can you show the command you used to start the server? > > On Wed, Dec 11, 2019 at 12:08 AM Pavel Serikov > wrote: > >> I got a strange error when make GET request to Mojo server using curl: &g

[Mojolicious] Undefined address for Socket::pack_sockaddr_in

2019-12-10 Thread Pavel Serikov
I got a strange error when make GET request to Mojo server using curl: Undefined address for Socket::pack_sockaddr_in at > /usr/lib/perl5/core_perl/Socket.pm line 851. > Same error I got when running server under morbo and under daemon mode. What's wrong? Notice: mojo server is running in

[Mojolicious] Re: Understanding interaction between Minion and websocket through events

2018-05-02 Thread Pavel Serikov
ically. понедельник, 30 апреля 2018 г., 14:49:32 UTC+3 пользователь Pavel Serikov написал: > > Hi there, > > I wrote demo app, https://github.com/pavelsr/minion_ws_demo > App must notify user through websocket when minion job is finished. > > But it doesn't work as expec

[Mojolicious] Understanding interaction between Minion and websocket through events

2018-04-30 Thread Pavel Serikov
Hi there, I wrote demo app, https://github.com/pavelsr/minion_ws_demo App must notify user through websocket when minion job is finished. But it doesn't work as expected. Could someone help to figure out what is wrong? You can write a review directly in commit

Re: [Mojolicious] Re: How do you handle Hypnotoad in Docker containers?

2017-05-26 Thread Pavel Serikov
Oh, sorry, forgot about -w lib. Now it works, thanks a lot. пятница, 26 мая 2017 г., 17:08:54 UTC+3 пользователь zakame написал: > > On 05/26/2017 10:06 PM, Pavel Serikov wrote: > > Thanks for tip about docker-restart. > > But is it possible to avoid `docker-compose r

Re: [Mojolicious] Re: How do you handle Hypnotoad in Docker containers?

2017-05-26 Thread Pavel Serikov
n 05/26/2017 09:23 PM, Pavel Serikov wrote: > > I have a similar issue, but with morbo: web server doesn't watch for > changes. > So I'd like to renew discussion about dockerizing mojolicious apps. > > Below is my docker-compose.yml file > > version: '2' > > serv

[Mojolicious] Re: How do you handle Hypnotoad in Docker containers?

2017-05-26 Thread Pavel Serikov
I have a similar issue, but with morbo: web server doesn't watch for changes. So I'd like to renew discussion about dockerizing mojolicious apps. Below is my docker-compose.yml file version: '2' services: web: image: pavelsr/kayako-dashboard-dev container_name: kayako-dashboard

[Mojolicious] Re: Watch change of attribute in Mojo::Base -based class using Scalar::Watcher or any other module

2017-04-10 Thread Pavel Serikov
Already discussed this question on stack http://stackoverflow.com/questions/43326596/watch-change-of-attribute-inside-perl-class so now it's closed :) понедельник, 10 апреля 2017 г., 1:25:07 UTC+3 пользователь Pavel Serikov написал: > > Hi guys, > > Could you please share wit

[Mojolicious] Watch change of attribute in Mojo::Base -based class using Scalar::Watcher or any other module

2017-04-09 Thread Pavel Serikov
Hi guys, Could you please share with me a chunk of code how do you watch attributes change? I found good module, Scalar::Watcher , but I can't get it work inside a class: package Cat; use Mojo::Base -base; use Scalar::Watcher qw(when_modified); use

[Mojolicious] Inheriting "live" attribute values of parent class with Mojo::Base

2017-04-06 Thread Pavel Serikov
Question in comment to code :) package Cat; use Mojo::Base -base; has 'token' => '12345'; has 'Tiger' => sub { Cat::Tiger-> new }; package Cat::Tiger; use Mojo::Base 'Cat'; package main; my $c = Cat->new(token=>'54321'); warn Dumper $c->Tiger->token; # how to make '54321' instead of '12345'

Re: [Mojolicious] Can attributes of Mojo::Base -based class be changed inside this class ? (got Can't modify non-lvalue subroutine call error)

2017-04-05 Thread Pavel Serikov
Many thanks, Stefan, it works! среда, 5 апреля 2017 г., 16:29:27 UTC+3 пользователь Stefan Adams написал: > > > On Wed, Apr 5, 2017 at 6:29 AM, Pavel Serikov <pavel.p...@gmail.com > > wrote: > >> $self->tokensfile = Config::JSON->new(pathToFile => $self-&

[Mojolicious] Re: Looking for particular Mojolicious method

2017-03-13 Thread Pavel Serikov
Hi Sebastian, Thanks for a quick feedback. Could you please explain more why it's a bad idea to implement hypnotoad and morbo commands ? And what is the recommendation in my case, do not release mojolicious apps as packages, right ? понедельник, 13 марта 2017 г., 15:33:21 UTC+3 пользователь

[Mojolicious] Problem with implementing custom command in Mojolicious::Lite app

2017-03-10 Thread Pavel Serikov
Hello everyone, I'm trying to implement custom command in my app like described in cookbook

[Mojolicious] Is there any way to customize hypnotoad listen port NOT from external config file ?

2017-02-16 Thread Pavel Serikov
I'm writing a script which will manage ports of my mojo apps. E.g. I want to manage server.pl app: my $hypnotoad = Mojo::Server::Hypnotoad->new; $hypnotoad->configure('server.conf'); $hypnotoad->run('server.pl'); If I need to specify port other than 8080 - I need to setup it in *server.conf*

[Mojolicious] Remove unwanted output

2016-11-11 Thread Pavel Serikov
Hello everyone, I have a simple perl script *runserver.pl *which runs mojo application from class : #!/usr/bin/env perl use Mojolicious::Commands; use Net::EmptyPort qw(empty_port); my $port = empty_port(3000); Mojolicious::Commands->start_app('API::Google::Server', 'daemon', '-l',

[Mojolicious] Best way to automatically generate documentation for Mojolicious helpers

2016-07-22 Thread Pavel Serikov
Usually I use autopod for auto-generation of documentation for perl modules. But it doesn't work for Mojolicious helpers, autopod simply doesn't see them. Is there any ready-to-use solution? (Mojolicious::Plugin::... or anything

Re: [Mojolicious] Mojolicious::Plugin::I18N usage

2016-06-22 Thread Pavel Serikov
Problem solved :) I just forgot to put I18N folder at MyApp folder at root of project. вторник, 21 июня 2016 г., 11:05:36 UTC+3 пользователь Pavel Serikov написал: > > Hi Stefan, > > Thank you for answer. According source code > <https://github.com/sharifulin/mojolicious-plugi

Re: [Mojolicious] Mojolicious::Plugin::I18N usage

2016-06-21 Thread Pavel Serikov
написал: > > > On Fri, Jun 17, 2016 at 3:48 AM, Pavel Serikov <pavel.p...@gmail.com > > wrote: > >>package MyApp::I18N::ru; >>use Mojo::Base 'MyApp::I18N'; > > > Can't locate MyApp/I18N.pm in @INC (you may need to install the >> MyApp::I18N m

[Mojolicious] Mojolicious::Plugin::I18N usage

2016-06-17 Thread Pavel Serikov
Hi all, I made one-file Mojolicious app (*test.pl*) to test Mojolicious::Plugin::I18N, but test fails. package main; use Mojo::Base -strict; use Test::More; use Test::Mojo; { package MyApp::Controller::Test; use Mojo::Base 'Mojolicious::Controller'; sub info { my $self =

Re: [Mojolicious] Convert code to non-blocking

2016-04-07 Thread Pavel Serikov
16 г., 19:46:33 UTC+4 пользователь David Stevenson написал: > > What are you trying to pass to api_func1? An anonymous function? > > So did you mean api_func1(sub{…}) > > as opposed to > > api_func1(sub =>{…}); # Extra => ? > > > On 5 Apr 2016, at 16

[Mojolicious] Re: Convert code to non-blocking

2016-04-05 Thread Pavel Serikov
I misprinted, at blocking Test.pm there is return $ua->get($api_url => form => \%hash)->res->*json* But it doesn't affect on problem. вторник, 5 апреля 2016 г., 19:14:37 UTC+4 пользователь Pavel Serikov написал: > > I want to make non-blocking requests to API via Mojo

[Mojolicious] Convert code to non-blocking

2016-04-05 Thread Pavel Serikov
I want to make non-blocking requests to API via Mojo::UserAgent and allow to render result of request without waiting result of previous request. Code of working with API made in separate module (listing below). How to convert code to non-blocking way? *$cat Test.pm* ... my $ua =

[Mojolicious] Best way to serve README.md

2016-03-28 Thread Pavel Serikov
I want that my README.md will be available under */**readme* route. How to do that? I checked the docs about ways of serving static files, but problem that I need to process markdown to html firstly. It's

[Mojolicious] Using into Mojolicious app code that will never exit - how to?

2016-03-24 Thread Pavel Serikov
I want to output my log via websocket using File::Tail. Below is my code: use Mojolicious::Lite; use Mojo::EventEmitter; use File::Tail; helper events => sub { state $events = Mojo::EventEmitter->new }; get '/' => 'log'; websocket '/ws' => sub { my $c = shift; app->log->info(sprintf

[Mojolicious] Re: How to use production.log under command line ?

2016-03-24 Thread Pavel Serikov
-m production >> /update?filter=opened" ? >> >> For more information: mojo get --help >> >> >> >> On Wednesday, March 23, 2016 at 12:09:37 PM UTC+1, Pavel Serikov wrote: >>> >>> I'm calling one of route of my Mojolicious::Lite app via cron,

[Mojolicious] How to use production.log under command line ?

2016-03-23 Thread Pavel Serikov
I'm calling one of route of my Mojolicious::Lite app via cron, using command-line interface , like this: */5 * * * * perl /home/lab/MyApp get /update?filter=opened inside MyApp there is some logging strings like app->log->info('Variable a:'.$a);

[Mojolicious] Problem in render via command line ("Mojo::IOLoop already running" error)

2016-02-04 Thread Pavel Serikov
Having route like this in my code: get '/json_url' => sub { my $self = shift; my $res = $self->ua->get($api_url => form => \%hash)->res; $self->render(json => $res ); }; But when I try to get json via command line and grab it to file I got a 500 Error:

[Mojolicious] How to use Mojo::IOLoop timer at helpers?

2016-01-22 Thread Pavel Serikov
I need to send one request, then wait 10 seconds, then send another request, then render result. Assume that I need to use Mojo::IOLoop for that (please correct me if there are other options). If I do it inside route everything works fine: get '/a' => sub { my $self = shift; my $req1 =

[Mojolicious] How to test CRUD app using Test::Mojo ?

2015-11-18 Thread Pavel Serikov
How to capture output of one route and then use it in test for another route? E.g. this algorithm of test: 1) got *$object_id* as result of post_ok (CREATE, post '/api/:coll' route) 2) use this *$object_id* in put_ok

[Mojolicious] Good way to use result of rendering one route in another route at Mojolicious::Lite?

2015-11-14 Thread Pavel Serikov
E.g I want to use json which is the result of rendering one route in forming output of another route. To make code in my CRUD app less and more reusable. Something like this: get '/api/:coll/:id' => sub { ... if ($self->param("coll") eq "lists") { ... push @{$o->{items}},

[Mojolicious] Continiuos Intergation for Mojolicious projects

2015-10-29 Thread Pavel Serikov
Hi all, What CI tool are you using? I'm looking for tool with simple web interface that allow me to manage deployment process. My typical scenario: Push to Github repository -> Triggered by webhook main server do automatic git fetch -> run tests -> if tests paased ok run git checkout ->

[Mojolicious] Mojolicious::Lite doesn't serve static files from '/public' directory automatically

2015-10-21 Thread Pavel Serikov
I created "public" folder into my project and put js and css files into it. But for some reason morbo doesn't serve them, it's shown 404 code in browser console network tab. Is documentation outdated? I have Mojolicious v

Re: [Mojolicious] Mojolicious::Lite doesn't serve static files from '/public' directory automatically

2015-10-21 Thread Pavel Serikov
n compare that (which works) with yours (which > doesn't). > > $ mojo generate app > > On Wed, Oct 21, 2015 at 3:58 PM, Pavel Serikov <pavel.p...@gmail.com > > wrote: > >> I created "public" folder into my project and put js and css files into >>

[Mojolicious] Re: Mojolicious::Lite websocket doens't work

2015-10-20 Thread Pavel Serikov
Dear Sebastian, thank you for your reply. I used your example and modified mine (result ) for using with Mojo::EventEmitter, now everything works fine. Could you please also explain, what do I need to store in database (pub/sub backend

[Mojolicious] Mojolicious::Lite websocket doens't work

2015-10-19 Thread Pavel Serikov
Hi everyone, I need a simple app which got POST request and send its content through websocket to all connected browser clients. I wrote a code, #!/usr/bin/env perl use Mojolicious::Lite; use feature 'say'; my $clients = {}; my $curr_msg = {}; post '/' => sub { my $self = shift; my

Re: [Mojolicious] Mojo::UserAgent log and timeouts

2015-07-16 Thread Pavel Serikov
]' = 'publish', ...); On Wed, Jul 15, 2015 at 7:35 AM, Pavel Serikov pavel.p...@gmail.com javascript: wrote: Hi guys, Here is a description of new problem which I don't understand how to solve. I need to use Mojo::UserAgent to parse data from Wordpress site via WP-API http://wp-api.org

Re: [Mojolicious] Mojo::UserAgent log and timeouts

2015-07-16 Thread Pavel Serikov
: On Thu, Jul 16, 2015 at 2:56 AM, Pavel Serikov pavel.p...@gmail.com javascript: wrote: If I change to *filter[posts_per_page]' = '150'* in script above - it works. Does the Mojo::UserAgent have any log to see what's wrong and what's an error message? I'm seeing two errors: Maximum

[Mojolicious] Mojo::UserAgent log and timeouts

2015-07-15 Thread Pavel Serikov
Hi guys, Here is a description of new problem which I don't understand how to solve. I need to use Mojo::UserAgent to parse data from Wordpress site via WP-API http://wp-api.org/. If I use browser (just to verify that API url works correctly) - it works. E.g. this url

Re: [Mojolicious] Mojo::UserAgent doesn't work?

2015-07-15 Thread Pavel Serikov
redirects, set https://metacpan.org/pod/Mojo::UserAgent#max_redirects On Sat, Jun 27, 2015 at 6:15 PM, Stefan Adams s103...@gmail.com javascript: wrote: On Sat, Jun 27, 2015 at 5:10 AM, Pavel Serikov pavel.p...@gmail.com javascript: wrote: Yeah, it's working :) But *warn Dumper ($ua-get

Re: [Mojolicious] Mojo::UserAgent doesn't work?

2015-06-27 Thread Pavel Serikov
UTC+3 пользователь Sergey Andreev написал: Did you got json from another app? Try curl or wget same url, for me your script return json. On Jun 27, 2015 4:44 PM, Pavel Serikov pavel.p...@gmail.com javascript: wrote: Hello dear colleagues, Can someone tell me why this script doesn't work

Re: [Mojolicious] Mojo::UserAgent doesn't work?

2015-06-27 Thread Pavel Serikov
Yeah, it's working :) But *warn Dumper ($ua-get('http://geocode-maps.yandex.ru/1.x/?geocode=Москваformat=json')-res-json) *doesn't. $VAR1 = undef So problem is in res-json method? суббота, 27 июня 2015 г., 12:59:51 UTC+3 пользователь Bernhard Graf написал: You simply didn't get a JSON

[Mojolicious] Mojo::UserAgent doesn't work?

2015-06-27 Thread Pavel Serikov
Hello dear colleagues, Can someone tell me why this script doesn't work? #!/usr/bin/env perl use Mojo::UserAgent; use feature 'say'; use utf8; my $ua = Mojo::UserAgent-new; say $ua-get('http://geocode-maps.yandex.ru/1.x/?geocode=Moscowformat=json'

[Mojolicious] How to upload files on server using Mojo::UserAgent::Transactor?

2015-04-21 Thread Pavel Serikov
Greetings, I need to upload files on server using Mojo Can anyone explain me how to do it on simple example below? I run with morbo on http://127.0.0.1:3000 this app: #!/usr/bin/env perl use Mojolicious::Lite; post '/' = sub { my $self = shift; my $upload = $self-param('model'); my

[Mojolicious] What it the right syntax for checking POST requests from command line (after -c key) ?

2015-04-16 Thread Pavel Serikov
Hello collegues, I need to check my API from command line, but I haven't found any manual how to do it correctly. Let me explain problem on example: I have POST handler: #!/usr/bin/env perl use Mojolicious::Lite; post '/' = sub { my $self = shift; warn $self-param(email); ... # warn

[Mojolicious] How to use string as a subroutine ref in Mojo?

2014-12-12 Thread Pavel Serikov
Hi everyone, I need to pass as input parameter of one function name of other function which must be executed in some cases. But cause of Mojolicious uses 'strict refs' I have no idea how to do it :( Can you please advice me something? For better understanding problem let me give an example:

Re: [Mojolicious] How to use string as a subroutine ref in Mojo?

2014-12-12 Thread Pavel Serikov
Hi Sebastian, Thank you very much. Actually working solution is: my $a = test; sub test { print Hello World!\n; } my $b = \$a; $b-(); I hope that this code is considered as good style :) And the real question that needs to be answered first is What are you actually trying to achieve?.

[Mojolicious] Re: Can't locate object method delay via package Mojolicious::Controller

2014-11-30 Thread Pavel Serikov
Dear Sebastian, Could you please help me to understood where is the problem? I've read docs again and found that *delay()* method refers to DefaultHelpers http://mojolicio.us/perldoc/Mojolicious/Plugin/DefaultHelpers#delay. I've tried to include it manually as in synopsis assuming that it