CGI-Application-Framework

 view release on metacpan or  search on metacpan

CAF_MB_Installer.pm  view on Meta::CPAN

            print "Make sure this path is writeable by your webserver:\n\t$server_path\n";
            next;
        }

        print "making path writeable by webserver: $server_path\n" if $verbose;
        chown $uid, $gid, $server_path
            or warn "Could not make the following path writeable by the webserver - you'll have to do it manually:\n\t$server_path\n";

        # Make writeable
        my $current_mode = (stat $server_path)[2];
        chmod $current_mode | 0600, $server_path;
    }
}

sub find_caf_cgi_files      {  shift->_find_file_by_type('.*',                'caf_cgi'     ) }
sub find_caf_config_files   {  shift->_find_file_by_type('conf',              'caf_config'  ) }
sub find_caf_htdoc_files    {  shift->_find_file_by_type('(html?)|(css)',     'caf_htdoc'   ) }
sub find_caf_image_files    {  shift->_find_file_by_type('(png)|(jpg)|(gif)', 'caf_image'   ) }
sub find_caf_project_files  {  shift->_find_file_by_type('.*',                'caf_project' ) }
sub find_caf_server_files   {  shift->_find_file_by_type('.*',                'caf_server'  ) }
sub find_caf_sql_files      {  shift->_find_file_by_type('.*',                'caf_sql'     ) }

CAF_MB_Installer.pm  view on Meta::CPAN

# caf_install_example_files is adapted from ExtUtils::Install::install,
# with the following changes:
#  - removed all the arcane bits about packlists and archlibs and whatnot
#  - allows you to specify a user and group for ownership of the resulting files and directories
#  - doesn't try to make the files read only - instead it respsects the current user's umask
#    (note that umask might not be correct if the user is installing on behalf of a different user,
#     e.g. a web virtual host user with a restrictive group)
#

sub forceunlink {
    chmod 0666, $_[0];
    unlink $_[0] or Carp::croak("Cannot forceunlink $_[0]: $!")
}

sub caf_install_example_files {
    my ($self,$from_to,$verbose,$user,$group) = @_;

    $verbose ||= 0;

    my $is_vms   = $^O eq 'VMS';

CAF_MB_Installer.pm  view on Meta::CPAN

                # that respect the users umask

                # However, if the original file was executable, make
                # the new file executable too

                my $executable = (stat $sourcefile)[2] & 0111;

                if ($executable) {
                    my $mode = (stat $targetfile)[2];
                    $mode = $mode | $executable;
		            chmod $mode, $targetfile;
		            print "chmod($mode, $targetfile)\n" if $verbose>1;
                }

                # MAG - allow changing ownership of installed files
                if ($user && $group) {
                    chown $user, $group, $targetfile;
                    print "chown($user, $group, $targetfile)\n" if $verbose>1;
                }

            }
            else {

lib/CGI/Application/Framework.pm  view on Meta::CPAN

databases you create for other projects.

Create a directory to contain the SQLite databases:

    $ mkdir /home/rdice/Framework/sqlite

Change its permissions so that it is writeable by the group the
webserver runs under:

    # chown .web /home/rdice/Framework/sqlite
    # chmod g+w /home/rdice/Framework/sqlite

Add the group "sticky" bit so that files created in this directory
retain the group permissions:

    # chmod g+s /home/rdice/Framework/sqlite

Now import the example database shema.

SQLite does not come with a command line shell.  Instead, use the
dbish program which is installed as part of the C<DBI::Shell> module.

    dbish --batch dbi:SQLite:dbname=/home/rdice/Framework/sqlite/sqlite_db < caf_example.sqlite

This will create the C<example> database and one table with a
few pre-populated rows, C<users>, and a bunch of other empty tables.

lib/CGI/Application/Framework.pm  view on Meta::CPAN



# ------------------------------------------------------------------
# These methods are new and unique to CGI::Application::Framework
# ------------------------------------------------------------------
sub _make_run_mode_tag {

    my $self   = shift;
    my %params = @_;

    my $whichmode = undef;

    if ( $params{whichmode} eq 'COMEFROM' ) {
        $whichmode = 'come_from_' . $self->mode_param();
    } elsif ( $params{whichmode} eq 'CURRENT' ) {
        $whichmode = 'current_' . $self->mode_param();
    } elsif ( $params{whichmode} eq 'SUBMITTO' ) {
        $whichmode = $self->mode_param();
    } else {
        $self->log_confess("Unsupported run mode [$params{whichmode}] ");
    }

    return
        '<input type=hidden name="'
        . $whichmode
        . '" value="'
        . $self->query->escapeHTML($params{modevalue})
        . '">';
}

sub _param_read_and_set {

    my $self = shift;
    my $param = shift;

lib/CGI/Application/Framework.pm  view on Meta::CPAN


    # Add the public configuration params to all templates
    $template->param(scalar $self->conf->context);

    $params->{'SESSION_STATE'} = $self->_make_hidden_session_state_tag;

    if ( $params->{'run_mode_tags'} ) {
    	foreach my $tag ( keys %{$params->{'run_mode_tags'}} ) {
            $params->{$tag} = $self->_make_run_mode_tag
             (
              whichmode => $params->{'run_mode_tags'}->{$tag}->[0],
              modevalue => $params->{'run_mode_tags'}->{$tag}->[1],
              );
        }
    }
}

# -------------------------------------------------------------------
# _framework_template_pre_process is called right after a template is
# rendered. It is called with the $template object as its first parameter,
# and a reference to the output text as its second parameter.



( run in 0.448 second using v1.01-cache-2.11-cpan-496ff517765 )