Bonjour
Je tente via une fonction d'intégrer un style CSS dans mon script CGI dont voici le code:
J'appelle la fonction au démarrage du script, mais j'ai un trou de mémoire pour renseigner le champ suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 #!"C:\xampp\perl\bin\perl.exe" use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); $CGI::POST_MAX=1024*100; $CGI::DISABLE_UPLOADS=1; my $cgi=new CGI; # variables layout my $charset=''; my $lang=''; my $title=''; my $distribution=''; my $resource_type=''; my $description=''; my $keywords=''; my $shortcut_icon=''; &style_sheet; # css layout sub style_sheet { print <<EOS; <style type="text/css" media="screen"> body { color:#666666; } </style> EOS } # skeleton layout print $cgi->header(-charset=>$charset), $cgi->start_html( -lang=>$lang, -title=>$title, -meta=>{ 'distribution'=>$distribution, 'resource-type'=>$resource_type, 'description'=>$description, 'keywords'=>$keywords}, -head=>[Link({-rel=>'shortcut icon',-href=>$shortcut_icon})], -style=>{-type=>'text/css',-media=>'screen',-code=>$style_sheet}), $cgi->end_html();
Cela m'indique le message d'erreur suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part -code=>$style_sheet
Un petite aide serait la bienvenue, en vous remerciant par avanceGlobal symbol "$style_sheet" requires explicit package name at C:/xampp/cgi-bin/generic.cgi line 46.
Partager