Giter Club home page Giter Club logo

Comments (25)

miyagawa avatar miyagawa commented on August 15, 2024

It is a warning not error, right?

What do you see if you run the script with Carp::Always loaded?

from starman.

Perlover avatar Perlover commented on August 15, 2024

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?)

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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 [email protected] wrote:

Sorry, yes, warning i think


Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-23676534
.

Tatsuhiko Miyagawa

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

Yes, you can run it with perl -MCarp::Always -S starman ...

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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

from starman.

Perlover avatar Perlover commented on August 15, 2024

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.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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?

from starman.

Perlover avatar Perlover commented on August 15, 2024

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

from starman.

Perlover avatar Perlover commented on August 15, 2024
[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.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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?

from starman.

Perlover avatar Perlover commented on August 15, 2024

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.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

No, i add use warnings by manually. I like use this because i can catch more errors.

🤦

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.

from starman.

Perlover avatar Perlover commented on August 15, 2024

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.

from starman.

Perlover avatar Perlover commented on August 15, 2024

Don't do it to the code you don't own.

I do it in only my code

from starman.

Perlover avatar Perlover commented on August 15, 2024

I USE use warnings IN ONLY MY SOURCES.
I do it some years.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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.

from starman.

Perlover avatar Perlover commented on August 15, 2024

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.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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.

from starman.

Perlover avatar Perlover commented on August 15, 2024

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.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

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 :)

from starman.

Perlover avatar Perlover commented on August 15, 2024

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

from starman.

Perlover avatar Perlover commented on August 15, 2024

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

from starman.

ap avatar ap commented on August 15, 2024
    setting import_warnings => 1;
}

And

import_warnings => sub {
    my ($setting, $value) = @_;
    $^W = $value ? 1 : 0;
},

*facepalm* What were they thinking?

from starman.

ap avatar ap commented on August 15, 2024

Anyway so this is maybe a Dancer bug but not a Starman bug.

from starman.

miyagawa avatar miyagawa commented on August 15, 2024

It's crazy, but at least is deprecated in the latest Dancer and is renamed to global_warnings.

from starman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.