Bonjour
Je fais une appliction web avec le framework dancer pour upload un agenda.
Code perl : 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
 
29 #upload an ics file as thunderbird does
 30  #first a get request and follow a put request
 31 get '/put_agenda' => sub {};
 32 put '/put_agenda' => sub {
 33 #any('get','put')=> '/put_agenda' => sub { 
 34       if (request->is_put()) {
 35         print STDERR "\nIt is a Put request\n";
 36         my $file = request->upload("*.ics");
 37         #my $file = request->uploads;
 38         print STDERR Dumper($file);
 39         if (defined($file)) {
 40             print STDERR "filename = ".$file->{filename}."\n";
 41             print STDERR "tempname = ".$file->{tempname}."\n";
 42         }   
 43       } 
 44 };

lorsque je crée un événement sous thunderbird, j'obtiens
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
[2519]  core @0.000123> request: GET /put_agenda from 172.16.5.105 in /usr/share/perl5/Dancer/Handler.pm l. 52
[2519]  core @0.000317> [hit #5]trying to match `/put_agenda' against /^\/$/ in /usr/share/perl5/Dancer/Route.pm l. 78
[2519]  core @0.000414> [hit #5]trying to match `/put_agenda' against /^\/([^\/]+)$/ in /usr/share/perl5/Dancer/Route.pm l. 78
[2519]  core @0.000497> [hit #5]  --> got 1 in /usr/share/perl5/Dancer/Route.pm l. 95
[2519]  core @0.000573> [hit #5]  --> named tokens are: file in /usr/share/perl5/Dancer/Route.pm l. 123
[2519]  core @0.000876> [hit #5]response: 200 in /usr/share/perl5/Dancer/Handler.pm l. 167
[2519]  core @0.000150> request: PUT /put_agenda from 172.16.5.105 in /usr/share/perl5/Dancer/Handler.pm l. 52
[2519]  core @0.000426> [hit #6]trying to match `/put_agenda' against /^\/put_agenda$/ in /usr/share/perl5/Dancer/Route.pm l. 78
[2519]  core @0.000609> [hit #6]  --> got 1 in /usr/share/perl5/Dancer/Route.pm l. 95
 
It is a Put request
$VAR1 = undef;
[2519]  core @0.001767> [hit #6]response: 200 in /usr/share/perl5/Dancer/Handler.pm l. 167
Comment connaitre le nom du fichier agenda cée,
merci par avance.