Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5494f687

Von Sven Schöling vor mehr als 13 Jahren hinzugefügt

  • ID 5494f687372570c9d1c5eb5c6aad73767e50820a
  • Vorgänger a064deaf
  • Nachfolger 3b9a5301

$::cgi entfernt.

Verfahren:
- Für alle Vorkommen von "my $cgi = $::cgi;":
ersetzt durch my $cgi = $::request->{cgi}->new({}) ersetzt

- Wenn in einer Datei alle my $cgi rausgefallen sind auch use CGI entfernt.

- Initialisierung von $::cgi in scripts und Dispatcher entfernt und in dei
Initialisierung von $::request eingebaut.

- cgi aus der Liste der kanonischen globals genommen.

Zu CGI:
- CGI::func und CGI->func sind beides valide Werte, sind aber intern buggy wie
Hölle. CGI:: erzeugt ein Dummyobjekt mit CGI->new, und klobbert damit
cookies. CGI-> ist noch schlimmer und ruft ${CGI}->{.cookies} auf.
- CGI->new({}) ist schneller als CGI->new(''), deshalb habe ich diese version genommen.
Auf meinem Rechner schafft die erste Version etwa 32k/s, die zweite 28k/s.
- CGI kompiliert benötigte Funktionen beim ersten Aufruf über AUTOLOAD.
- cookie benötigen ein $cgi Objekt.

Unterschiede anzeigen:

SL/Auth.pm
my $self = shift;
my $cgi = $main::cgi;
$cgi ||= CGI->new('');
$session_id = $cgi->cookie($self->get_session_cookie_name());
$session_id = $::request->{cgi}->cookie($self->get_session_cookie_name());
$session_id =~ s|[^0-9a-f]||g;
$self->{SESSION} = { };
SL/Controller/Base.pm
my $self = shift;
my $url = $self->url_for(@_);
print $::cgi->redirect($url);
print $::request->{cgi}->redirect($url);
}
sub render {
SL/Controller/DebugMenu.pm
sub action_reload {
my ($self, %params) = @_;
print $::cgi->redirect('controller.pl?action=FrameHeader/header');
print $::request->{cgi}->redirect('controller.pl?action=FrameHeader/header');
exit;
}
......
my ($self, %params) = @_;
$::lxdebug->level_by_name($::form->{level}, !$::lxdebug->level_by_name($::form->{level}));
print $::cgi->redirect('controller.pl?action=FrameHeader/header');
print $::request->{cgi}->redirect('controller.pl?action=FrameHeader/header');
return;
}
SL/Dispatcher.pm
$self->unrequire_bin_mozilla;
$::cgi = CGI->new('');
$::locale = Locale->new($::lx_office_conf{system}->{language});
$::form = Form->new;
$::instance_conf = SL::InstanceConfiguration->new;
$::request = { };
$::request = { cgi => CGI->new({}) };
my $session_result = $::auth->restore_session;
$::auth->create_or_refresh_session;
......
} or do {
if ($EVAL_ERROR ne END_OF_REQUEST) {
print STDERR $EVAL_ERROR;
$::form->{label_error} = $::cgi->pre($EVAL_ERROR);
$::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR);
eval { show_error('generic/error') };
}
};
......
1;
} or do {
$::form->{label_error} = $::cgi->pre($EVAL_ERROR);
$::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR);
show_error('generic/error');
};
......
1;
} or do {
$::form->{label_error} = $::cgi->pre($EVAL_ERROR);
$::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR);
show_error('generic/error');
};
SL/Form.pm
my $self = shift;
if (@_) {
map({ print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
map({ print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
} else {
for (sort keys %$self) {
next if (($_ eq "header") || (ref($self->{$_}) ne ""));
print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
}
}
$main::lxdebug->leave_sub();
......
my $self = shift;
my %params = @_;
my $cgi = $main::cgi;
$cgi ||= CGI->new('');
my $cgi = $::request->{cgi};
my $session_cookie;
if (defined $main::auth) {
......
my ($self) = @_;
my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
my $cgi = $main::cgi || CGI->new('');
my $output = $cgi->header('-charset' => $db_charset);
my $output = $::request->{cgi}->header('-charset' => $db_charset);
$main::lxdebug->leave_sub();
......
die "Headers already sent" if $self->{header};
$self->{header} = 1;
my $cgi = $main::cgi || CGI->new('');
return $cgi->redirect($new_uri);
return $::request->{cgi}->redirect($new_uri);
}
sub set_standard_title {
bin/mozilla/admin.pl
#======================================================================
use DBI;
use CGI;
use Encode;
use English qw(-no_match_vars);
use Fcntl;
......
$::lxdebug->enter_sub;
my $session_result = shift;
$cgi = $::cgi;
$form = $::form;
$locale = $::locale;
$auth = $::auth;
bin/mozilla/ap.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$main::auth->assert('general_ledger');
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$main::auth->assert('general_ledger');
bin/mozilla/ar.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my ($title, $readonly, $exchangerate, $rows);
my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project);
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my ($transdate, $closedto);
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my ($customer, $department);
my ($jsscript, $button1, $button2, $onload);
bin/mozilla/dn.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$main::auth->assert('dunning_edit');
bin/mozilla/do.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
bin/mozilla/fu.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my @report_params = qw(created_for subject body reference follow_up_date_from follow_up_date_to itime_from itime_to due_only all_users done not_done);
bin/mozilla/gl.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$form->{title} = $locale->text('Journal');
......
my @columns = qw(
gldate transdate id reference description
notes source debit debit_accno
notes source debit debit_accno
credit credit_accno debit_tax debit_tax_accno
credit_tax credit_tax_accno projectnumbers balance employee
);
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$form->{debit_1} = 0 if !$form->{"debit_1"};
$form->{totaldebit} = 0;
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my $follow_ups_block;
if ($form->{id}) {
bin/mozilla/io.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my $numrows = shift;
......
my $form = $main::form;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
_check_io_auth();
bin/mozilla/ir.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$main::auth->assert('vendor_invoice_edit');
bin/mozilla/is.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
$main::auth->assert('invoice_edit');
......
my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
$form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
$TMPL_VAR{currencies} = NTI($::cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
$TMPL_VAR{currencies} = NTI($::request->{cgi}->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
'-values' => \@values, '-labels' => \%labels)) if scalar @values;
push @custom_hiddens, "forex";
push @custom_hiddens, "exchangerate" if $form->{forex};
bin/mozilla/login.pl
$::lxdebug->enter_sub;
my $session_result = shift;
$cgi = $::cgi;
$form = $::form;
$auth = $::auth;
bin/mozilla/oe.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
check_oe_access();
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
check_oe_access();
bin/mozilla/rp.pl
}
my $projectnumber =
NTI($main::cgi->popup_menu('-name' => "project_id",
NTI($::request->{cgi}->popup_menu('-name' => "project_id",
'-values' => \@project_values,
'-labels' => \%project_labels));
......
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my $report = SL::ReportGenerator->new(\%myconfig, $form);
bin/mozilla/sepa.pl
my $form = $main::form;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
$form->{title} = $vc eq 'customer' ? $::locale->text('List of bank collections') : $locale->text('List of bank transfers');
......
my $form = $main::form;
my $myconfig = \%main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my $cgi = $::request->{cgi};
my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
if (!$myconfig->{company}) {
bin/mozilla/vk.pl
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $cgi = $main::cgi;
my ($customer, $department);
......
# Nichts führt, daher diese Zwischenlösung
&check_name('customer', no_select => 1);
# $form->{customer_id} wurde schon von check_name gesetzt
$form->{customername} = $form->{customer};
};
......
if ( $subtotals2{qty} != 0 ) {
$subtotals2{sellprice} = $subtotals2{sellprice_total} / $subtotals2{qty};
$subtotals2{lastcost} = $subtotals2{lastcost_total} / $subtotals2{qty};
$subtotals2{lastcost} = $subtotals2{lastcost_total} / $subtotals2{qty};
} else {
$subtotals2{sellprice} = 0;
$subtotals2{lastcost} = 0;
scripts/console
$::lxdebug = LXDebug->new(file => $debug_file);
$::locale = Locale->new($::lx_office_conf{system}->{language});
$::cgi = CGI->new qw();
$::form = Form->new;
$::auth = SL::Auth->new;
$::instance_conf = SL::InstanceConfiguration->new;
$::request = { };
$::request = { cgi => CGI->new({}) };
die 'cannot reach auth db' unless $::auth->session_tables_present;
scripts/rose_auto_create_model.pl
my %package_names = SL::DB::Helper::Mappings->get_package_names;
our $form;
our $cgi;
our $auth;
our %lx_office_conf;
......
$::lxdebug = LXDebug->new();
$::locale = Locale->new("de");
$::form = new Form;
$::cgi = new CGI('');
$::auth = SL::Auth->new();
$::user = User->new($login);
%::myconfig = $auth->read_user($login);
$::request = { };
$::request = { cgi => CGI->new({}) };
$form->{script} = 'rose_meta_data.pl';
$form->{login} = $login;
scripts/task_server.pl
$::lxdebug = LXDebug->new;
$::locale = Locale->new($::lx_office_conf{system}->{language});
$::cgi = CGI->new qw();
$::form = Form->new;
$::auth = SL::Auth->new;
$::request = { };
$::request = { cgi => CGI->new({}) };
die 'cannot reach auth db' unless $::auth->session_tables_present;
t/structure/globals.t
my (@globals, $testcount);
BEGIN {
@globals = qw(lxdebug auth myconfig form cgi lx_office_conf locale dispatcher instance_conf request);
@globals = qw(lxdebug auth myconfig form lx_office_conf locale dispatcher instance_conf request);
$testcount = scalar(@Support::Files::testitems);
}

Auch abrufbar als: Unified diff