user-pic

Myoungjin Jeon

  • About: JG's blog for perl (-;
  • Commented on No semicolon after return values
    I used to use the statement without explicit return for constants and subroutines which has error message as their return value. sub readOnly ( $; ) { shift->read_write } or sub validate ( $;$ ) { my $error; ... $error;...
  • Commented on Just want to know WNOHANG...
    use POSIX qw(:sys_wait_h); will increase about 1MiB of memory in my system. This may be or may not be considerable. but I guess using several modules would result in 3~5MiB increase without any useful things. It's an method to avoid...
  • Commented on Just want to know WNOHANG...
    I realized that an installer can do this. but sometimes I put this kind of script in a archive or USB like using a PortableApps and in that case, this ensure the correct value of constant. thank you for reply....
  • Posted Just want to know WNOHANG... to Myoungjin Jeon
    package MyApp;
    
    our $WNOHANG_VALUE ||= `$^X -MPOSIX=:sys_wait_h -e "print WNOHANG;"`;
    sub WNOHANG () { $WNOHANG_VALUE }
    
    !!'^^';
    

    sigh maybe useful for a long-time running program if you are…

Subscribe to feed Recent Actions from Myoungjin Jeon

  • Gabor Szabo commented on No semicolon after return values

    Acme::ReturnValue might give you a few ideas beyond 1, not 1;

  • Uriel Lizama commented on No semicolon after return values

    Although I see the point, I believe in keeping a constant style throughout your code, so if you end all your statements with ';' this should be consistent with all statements.

    This is the same problem I have with languages like JavaScript which allow you to do things like:

    if( true ){
    //something
    }


    and


    if(true)
    //something


    If you decide in a way to do it, you should stick to it, otherwise it can generate confusion in the long term.

  • Steven Haryanto commented on No semicolon after return values

    Interesting thought. I personally always add a semicolon for the last statement of the block (though I also seldom use explicit 'return'). Unless they are inline, e.g.:

    for (...) { stmt; last-stmt }

    Dunno. These are just habits, I guess.

Subscribe to feed Responses to Comments from Myoungjin Jeon

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.