Closed Perlover closed 11 years ago
It is a warning not error, right?
What do you see if you run the script with Carp::Always loaded?
Sorry, yes, warning i think I didn't run a script with Carp::Always Should i do it? Can you write example of running (perl's -M optoin?)
are you running the script with perl -w
or something? The particular code
doesn't enable warnings and shouldn't raise them.
I could fix it, but your other warning might be related to that as well, so i need to confirm.
On Mon, Sep 2, 2013 at 1:03 PM, Perlover notifications@github.com wrote:
Sorry, yes, warning i think
— Reply to this email directly or view it on GitHubhttps://github.com/miyagawa/Starman/issues/82#issuecomment-23676534 .
Tatsuhiko Miyagawa
Yes, you can run it with perl -MCarp::Always -S starman ...
Because Starman::Server doesn't have use warnings
enabled (it's a separate discussion whether it should or not), i don't think you should see that warnings when running in a regular perl mode.
You will only see it if you run starman under global -w
option (which is not recommend in recent perl).
I had run with Carp::Always:
Starting TubeStore starman service (starman): Use of uninitialized value $opt in lc at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 70.
Starman::Server::run('Starman::Server=HASH(0x264dbb8)', 'CODE(0x264dac8)', 'HASH(0x2646a10)') called at /usr/local/lib/perl5/site_perl/5.16.2/Plack/Handler/Starman.pm line 18
Plack::Handler::Starman::run('Plack::Handler::Starman=HASH(0x2646ad0)', 'CODE(0x264dac8)') called at /usr/local/lib/perl5/site_perl/5.16.2/Plack/Loader.pm line 84
Plack::Loader::run('Plack::Loader=HASH(0x16b53c8)', 'Plack::Handler::Starman=HASH(0x2646ad0)') called at /usr/local/lib/perl5/site_perl/5.16.2/Plack/Runner.pm line 277
Plack::Runner::run('Plack::Runner=HASH(0x1403b88)') called at /usr/local/bin/starman line 38
And i didn't run perl -w
- i have only use warnings
statements in each my sources.
And how do you run the starman process?
starman -l 0:5000 -e 'sub { [200,[],["Hi"]] }'
does this give you the warning?
Are you using some crazy source code filtering that adds use warnings
to every .pm files?
And i had run by same way:
prog="starman"
exec="perl -MCarp::Always -S $prog"
eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
PLACK_ENV=production;
min_servers=30;
max_servers=100;
min_spare_servers=30;
max_spare_servers=60;
$exec --listen XX.XX.XX.XX:NNNN \
--min_servers=$min_servers \
--max_servers=$max_servers \
--min_spare_servers=$min_spare_servers \
--max_spare_servers=$max_spare_servers \
--disable-keepalive \
--backlog 1024 \
--pid /home/tubestore/tubestore/run/services/$prog.pid \
--error-log /home/tubestore/tubestore/logs/starman/error.log \
--access-log /home/tubestore/tubestore/logs/starman/access.log \
--daemonize --app /home/tubestore/perl5/bin/tubestore.psgi \
--preload-app
Where XX.XX.XX.XX:NNNN - IP & port
[tubestore@AH08 ~]$ starman -l 0:5000 -e 'sub { [200,[],["Hi"]] }'
2013/09/03-18:45:06 Starman::Server (type Net::Server::PreFork) starting! pid(4831)
Resolved [*]:5000 to [0.0.0.0]:5000, IPv4
Binding to TCP port 5000 on host 0.0.0.0 with IPv4
Setting gid to "501 501 501"
^C2013/09/03-18:45:08 Server closing!
Can't call method "child_finish_hook" on an undefined value at /usr/local/lib/perl5/site_perl/5.16.2/Net/Server/PreFork.pm line 199 during global destruction.
Can you answer my question whether you see the warnings with starman -l 0:5000 -e 'sub { [200,[],["Hi"]] }'
?
If you replace your tubestore.psgi
with that simple .psgi file, does that still give you warnings?
Are you using some crazy source code filtering that adds use warnings to every .pm files?
No, i add use warnings
by manually. I like use this because i can catch more errors.
No, i add use warnings by manually. I like use this because i can catch more errors.
:facepalm:
Don't do it to the code you don't own.
Or, if you do it, do it at your own risk, and don't report that warnings that come out of it as a bug.
Can you answer my question whether you see the warnings with
No, i don't see warnings
I copied a full output that i saw there.
If you replace your tubestore.psgi with that simple .psgi file, does that still give you warnings?
I will try. There server under load and i cannot right now test it. I will write.
Don't do it to the code you don't own.
I do it in only my code
I USE use warnings
IN ONLY MY SOURCES.
I do it some years.
OK then, i asked if you use filters to add warnings to every file, and your answer "i do it manually" sounds like you did it to .pm files in my code. That was confusing.
Or, if you do it, do it at your own risk, and don't report that warnings that come out of it as a bug.
I don't understand
I catch warnings from your sources and reported about it. And the $opt was undefined.
But please notice i didn't use perl -w
for starting of Starman
And i didn't changed your sources and didn't add there use warnings
and didn't use source filters.
And the $opt was undefined.
But warnings are not enabled there and it shouldn't happen. That's why I'm asking if you're using -w
(that enables warnings globally) or some magic code filter that adds use warnings
to every file loaded.
I understood you So one question is opened - who turns on warnings ;-) Ok, if i will know something i will let to know about it.
Do you have $^W = 1;
somewhere in your code?
If so, stop doing so or make that local $^W = 1
.
If one of your dependent modules does it, report to the upstream to get it fixed :)
I think i know who it does I use Dancer
There is (./Dancer/Config.pm) :
sub load_default_settings {
$SETTINGS->{server} ||= $ENV{DANCER_SERVER} || '0.0.0.0';
$SETTINGS->{port} ||= $ENV{DANCER_PORT} || '3000';
$SETTINGS->{content_type} ||= $ENV{DANCER_CONTENT_TYPE} || 'text/html';
$SETTINGS->{charset} ||= $ENV{DANCER_CHARSET} || '';
$SETTINGS->{startup_info} ||= $ENV{DANCER_STARTUP_INFO} || 1;
$SETTINGS->{daemon} ||= $ENV{DANCER_DAEMON} || 0;
$SETTINGS->{apphandler} ||= $ENV{DANCER_APPHANDLER} || 'Standalone';
$SETTINGS->{warnings} ||= $ENV{DANCER_WARNINGS} || 0;
$SETTINGS->{auto_reload} ||= $ENV{DANCER_AUTO_RELOAD} || 0;
$SETTINGS->{traces} ||= $ENV{DANCER_TRACES} || 0;
$SETTINGS->{logger} ||= $ENV{DANCER_LOGGER} || 'file';
$SETTINGS->{environment} ||=
$ENV{DANCER_ENVIRONMENT}
|| $ENV{PLACK_ENV}
|| 'development';
setting $_ => {} for keys %MERGEABLE;
setting template => 'simple';
setting import_warnings => 1;
}
And
import_warnings => sub {
my ($setting, $value) = @_;
$^W = $value ? 1 : 0;
},
It manipulatres ^W
P.S. I use old version Dancer (1.91) - my fork with my patches ( https://github.com/Perlover/Dancer/tree/my/current ) I am not sure that now Dancer 1.* has this config but i think problem from him
setting import_warnings => 1; }
And
import_warnings => sub { my ($setting, $value) = @_; $^W = $value ? 1 : 0; },
facepalm\ What were they thinking?
Anyway so this is maybe a Dancer bug but not a Starman bug.
It's crazy, but at least is deprecated in the latest Dancer and is renamed to global_warnings
.
Hello,
Now i see a following warning (in terminal) when i start Starman process: Use of uninitialized value $opt in lc at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 70
When i had Starman version 0.4001 i got same error:
Use of uninitialized value $opt in lc at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 69.
In previous versions i didn't see like these warnings