Menu

#39 Provide a more concise way to construct status objects

Alpha
closed
None
2014-06-02
2014-05-25
Smith Farm
No

ATM status objects must be constructed verbosely by calling App::CELL::Status->new( ... ) -- think about alternative ways to construct status objects. For example, the $CELL singleton could be used like this:

$status = $CELL->status_info( 'FOOBAR_MESSAGE', args => [ ... ] );
return $CELL->status_err( 'FOO_ERROR_45534', args => [ ... ] );

Discussion

  • Smith Farm

    Smith Farm - 2014-06-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,6 @@
    -$status->code returns code string, but it could also be run as App::CELL::Status->code( 'FOOBAR_MESSAGE', level => 'info' ) which would mean less typing.
    +ATM status objects must be constructed verbosely by calling App::CELL::Status->new( ... ) -- think about alternative ways to construct status objects. For example, the $CELL singleton could be used like this:
    
    -Another idea would be to use the $CELL singleton like so: 
    +   $status = $CELL->status_info( 'FOOBAR_MESSAGE', args => [ ... ] );
    +   return $CELL->status_err( 'FOO_ERROR_45534', args => [ ... ] );
    
    -   $CELL->status( 'FOOBAR_MESSAGE', 'info', args => [ ... ] );
    
    • status: open --> closed
     
  • Smith Farm

    Smith Farm - 2014-06-02

    as of 0.154 we have a "constructor factory" in CELL.pm that makes status_$level functions so we can do, e.g.

    return $CELL->status_err( 'FOO_ERROR' );
    return $CELL->status_warn( 'FOO_WARNING' );
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.