App-Context

 view release on metacpan or  search on metacpan

lib/App/Context/Cmd.pm  view on Meta::CPAN

}

sub _print_usage {
    print STDERR "--------------------------------------------------------------------\n";
    print STDERR "Usage: $0 [options] [<Service>] <name> [<method> [<args>]] [:returntype]\n";
    print STDERR "       --app=<tag>             default basename of options file (when file not specified)\n";
    print STDERR "       --prefix=<dir>          base directory of installed software (i.e. /usr/local)\n";
    print STDERR "       --debug_options         debug the option parsing process\n";
    print STDERR "       --perlinc=<dirlist>     directories to add to \@INC to find perl modules\n";
    print STDERR "       --import=<filelist>     additional config files to read\n";
    print STDERR "       --context_class=<class> class, default=App::Context::Cmd\n";
    print STDERR "       --debug=<level>         set debug level and scope, default=0\n";
    print STDERR "       --help or -?            print this message\n";
    print STDERR "--App::Context::Cmd-------------------------------------------------\n";
    print STDERR "       --service=<svc>         default curr service (default=SessionObject)\n";
    print STDERR "       --name=<name>           default curr name    (default=default)\n";
    print STDERR "       --method=<method>       default curr method  (default=content)\n";
    print STDERR "       --args=<args>           default curr args    (default=)\n";
    print STDERR "       --returntype=<type>     default curr return type (default=default)\n";
    print STDERR "       --session_class=<class> default=App::Session\n";
    print STDERR "       --conf_class=<class>    default=App::Conf::File\n";
    print STDERR "       --so_<var>=<value>      set SessionObject default value\n";
    print STDERR "--App::Conf::File---------------------------------------------------\n";
    print STDERR "       --debug_conf            debug the configuration process\n";
    print STDERR "       --conf_type=<type>      type of data (name of Serializer) in conf_file\n";
    print STDERR "       --conf_file=<file>      file name for full config file\n";
    print STDERR "       --conf_serializer_class=<class> class, default=App::Serializer\n";
    print STDERR "--Examples----------------------------------------------------------\n";
    print STDERR "       --debug=1                                      (global debug)\n";
    print STDERR "       --debug=1,App::Context                     (debug class only)\n";
    print STDERR "       --debug=3,App::Context,App::Session        (multiple classes)\n";
    print STDERR "       --debug=6,App::Repository::DBI.get_rows      (indiv. methods)\n";
    print STDERR "--------------------------------------------------------------------\n";
    exit(1);
}

#############################################################################
# user()
#############################################################################

=head2 user()

The user() method returns the username of the authenticated user.
The special name, "guest", refers to the unauthenticated (anonymous) user.

    * Signature: $username = $context->user();
    * Param:  void
    * Return: string
    * Throws: <none>
    * Since:  0.01

    Sample Usage: 

    $username = $context->user();

=cut

sub user {
    &App::sub_entry if ($App::trace);
    my $self = shift;
    my $user = $self->{user} || getlogin || (getpwuid($<))[0] || "guest";
    &App::sub_exit($user) if ($App::trace);
    $user;
}

1;



( run in 0.771 second using v1.01-cache-2.11-cpan-140bd7fdf52 )