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

2014-11-29 Thread Pavel Serikov
Hello everyone, I'm writing test application with OAuth2 using Mojolicious::Plugin::Oauth2 asynchronius request to API and I've got a strange error [error] Can't locate object method "delay" via package > "Mojolicious::Controller" at oauth

[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 . I've tried to include it manually as in synopsis assuming that it is

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

2014-11-30 Thread Pavel Serikov
Hi Alex, The output is 4.63 воскресенье, 30 ноября 2014 г., 14:23:31 UTC+3 пользователь Alex Alex написал: > > Maybe u r using an outdated version? > > Give us an output of: > perl -MMojolicious -e 'print Mojolicious->VERSION. "\n"' > > Dear Sebastian, > > Could you please help me to unde

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

2014-11-30 Thread Pavel Serikov
Hi Alex, The output is 4.63 -- 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 mojol

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

2014-11-30 Thread Pavel Serikov
Thank you. I've updated version and now everything works fine :) -- 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

[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 achie

[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 $s

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

2015-04-20 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 $na

[Mojolicious] Is there any way to access all request parameters in Mojolicious::Lite ?

2015-05-28 Thread Pavel Serikov
Hello everyone, Is it possible to get all POST params im Mojolicious::Lite like in Mojolicious ? Like this: my $param = $self->req->params->to_hash; I tried this way

Re: [Mojolicious] Is there any way to access all request parameters in Mojolicious::Lite ?

2015-05-28 Thread Pavel Serikov
> > From Mojolicious or Mojolicious::Lite works the same. > > On Thu, May 28, 2015 at 7:45 PM, Pavel Serikov > wrote: > >> Hello everyone, >> >> Is it possible to get all POST params im Mojolicious::Lite >> <https://metacpan.org/pod/Mojolicious::Lite&g

[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=Moscow&format=json' )->res->json->{response}->{GeoObjectCollectio

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

2015-06-27 Thread Pavel Serikov
ня 2015 г., 12:53:27 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" > wrote: > >> Hello dear colleagues, >> >> Can

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 JSO

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

2015-07-15 Thread Pavel Serikov
To follow redirects, set > https://metacpan.org/pod/Mojo::UserAgent#max_redirects > > On Sat, Jun 27, 2015 at 6:15 PM, Stefan Adams > wrote: > >> >> On Sat, Jun 27, 2015 at 5:10 AM, Pavel Serikov > > wrote: >> >>> Yeah, it's working :) >>&g

[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 . If I use browser (just to verify that API url works correctly) - it works. E.g. this url http://klishe.ru/wp-js

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

2015-07-16 Thread Pavel Serikov
> > Your URL parameters are not being url encoded as required. Use a Mojo::URL > instead: > > my $url = > Mojo::URL->new('http://klishe.ru/wp-json/posts')->query('filter[post_status]' > => 'publish', ...); > > > On Wed, Jul 15, 2015

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

2015-07-16 Thread Pavel Serikov
ователь Stefan Adams написал: > > > On Thu, Jul 16, 2015 at 2:56 AM, Pavel Serikov > 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 wr

[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 $params

[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 l

[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 6

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 > wrote: > >> I created "public" folder into my project and put js and css files into >> it. >> But f

[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 -> ru

[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}}, $sel

[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] Is Mojo::DOM cut url parameters?

2015-12-29 Thread Pavel Serikov
Hello, I exctracted all url from page via my @a = $body->find("a[href]")->each; # $body = Mojo::DOM object for (@a) { say $_->attr("href"); } And for result is: http:///userfiles.php Why is it cut ?userId=6211 and how to get it? -- You received this message because you are subscribed to

[Mojolicious] Possible bug of hypnotoad (or problem with nginx or css relative path)

2016-01-13 Thread Pavel Serikov
Hello colleagues, I have a quite unpleasant problem: Glypicons can't be loaded on production instance though at localhost it's working fine. In Chrome console I see that server request files by *http://domain_name/fonts/glyphicons-halflings-regular.ttf* address, but in fact file stored at *pu

[Mojolicious] Re: Possible bug of hypnotoad (or problem with nginx or css relative path)

2016-01-13 Thread Pavel Serikov
Seems like it really was a bug of hypnotoad. I updated Mojolicious to latest version (6.39) and now everything works fine! :) Case closed. среда, 13 января 2016 г., 15:19:13 UTC+3 пользователь Pavel Serikov написал: > > Hello colleagues, > > I have a quite unpleasant problem: Glypic

[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 = $self

[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: pavel@pavel-VBox-Lubuntu:~/projects/

[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] Re: How to use production.log under command line ?

2016-03-24 Thread Pavel Serikov
/MyApp get -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

[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 'Clien

[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 possi

[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 = Mojo::UserAgent

[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

Re: [Mojolicious] Convert code to non-blocking

2016-04-05 Thread Pavel Serikov
ied api_func1(sub => { *my $json = shift;* $c->render(json => $json); }) But same error. вторник, 5 апреля 2016 г., 19:19:47 UTC+4 пользователь Dominique Dumont написал: > > On Tuesday 05 April 2016 08:14:36 Pavel Serikov wrote: > > But I got a syntax error at string mar

Re: [Mojolicious] Convert code to non-blocking

2016-04-07 Thread Pavel Serikov
вторник, 5 апреля 2016 г., 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

[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 = shif

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

2016-06-21 Thread Pavel Serikov
m? понедельник, 20 июня 2016 г., 21:43:25 UTC+3 пользователь Stefan Adams написал: > > > On Fri, Jun 17, 2016 at 3:48 AM, Pavel Serikov > wrote: > >>package MyApp::I18N::ru; >>use Mojo::Base 'MyApp::I18N'; > > > Can't locate MyApp/I18N.pm in @

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

[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 e

[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', 'http://*:'.

[Mojolicious] Is there any way to execute helper outside the route?

2017-01-28 Thread Pavel Serikov
It's better to explain the problem on example. I'm writing bot for Telegram and want to implement getting updates via WebHook and polling (via Mojo:: IOLoop) both. helper answer => sub { my ($c, $update) = shift; ... if ($update->{message}{text} eq "something") { $api->sendMessage ({ chat_i

[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* l

[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

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

2017-03-10 Thread Pavel Serikov
You are absolutely right, it's mine inattention :) Question closed. пятница, 10 марта 2017 г., 15:03:06 UTC+3 пользователь Luc Didry написал: > > vendredi 10 mars 2017, 03:48:27 CET Pavel Serikov wrote: > > Hello everyone, > > > > I'm trying to imple

[Mojolicious] Looking for particular Mojolicious method

2017-03-13 Thread Pavel Serikov
Usually I'm releasing my Mojo apps as packages, e.g. *App::MojoApp*. Also I'm creating a *mojoapp* CLI tool (like this ) which does Mojolicious::Commands->start_app(App::MojoApp*)* for easy running app from any place. Would like to

[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 пользователь sr

[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
Better to explain the problem by code :) Just a small annotation: I'm writing a wrapper under Config:: JSON module. When calling ->new constructor of Config::JSON it's required to pass obligatory parameter, pathToFi

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 > wrote: > >> $self->tokensfile = Config::JSON->new(pathToFile => $self-> >> pathToTokensFile

[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' ?

[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 fea

[Mojolicious] Re: modest snippets in templates

2017-04-10 Thread Pavel Serikov
You can include chunks of html code even without perlish variables, same way as with variables http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Partial-templates понедельник, 10 апреля 2017 г., 1:08:53 UTC+3 пользователь iaw4 написал: > > > dear M experts---I would like to embed pre

[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 w

[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 v

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&

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 resta

[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

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

2018-05-02 Thread Pavel Serikov
started automatically. понедельник, 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

[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 dock

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

2019-12-11 Thread Pavel Serikov
> $result ); }; среда, 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 M

[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 "Mojolicio