Bug 10085

Summary: Unapi does not function under Plack
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: Architecture, internals, and plumbingAssignee: Jared Camins-Esakov <jcamins>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: blocker    
Priority: P5 - low CC: chris, jonathan.druart
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10085: unapi does not function under Plack
Bug 10085: unapi does not function under Plack
Bug 10085: unapi does not function under Plack

Description Jared Camins-Esakov 2013-04-20 02:43:15 UTC
$cgi is not set. Everything breaks spectacularly.
Comment 1 Jared Camins-Esakov 2013-04-20 02:55:59 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2013-04-20 06:26:39 UTC
Comment on attachment 17565 [details] [review]
Bug 10085: unapi does not function under Plack

Review of attachment 17565 [details] [review]:
-----------------------------------------------------------------

::: opac/unapi
@@ -158,3 @@
>  
>      if (defined $id) {
>          print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' );

WTF ... how did this ever work???
Comment 3 Chris Cormack 2013-04-20 06:28:15 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2013-04-22 10:16:41 UTC
QA comment:
Remove some global variables. Work as expected with and without Plack.
Marked as Passed QA.
Comment 5 Jonathan Druart 2013-04-22 10:17:02 UTC
Created attachment 17578 [details] [review]
Bug 10085: unapi does not function under Plack

The following errors appear when trying to use unapi under Plack (among
others):
Variable "$cgi" is not available at /home/jcamins/kohaclone/opac/unapi line 160.
Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 173.
Variable "$format_info" is not available at /home/jcamins/kohaclone/opac/unapi line 174.
Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 185.

To test:
1) Try to view /cgi-bin/koha/unapi under Plack
2) There is no step 2. Plack crashes.
3) Apply patch.
4) Try to view /cgi-bin/koha/unapi again, and note that it doesn't crash

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

I'm puzzled how this ever worked anyway, accidentally i'm guessing,
this tidies up some lazy coding

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 6 Jared Camins-Esakov 2013-04-23 12:38:46 UTC
This patch has been pushed to master and 3.12.x.
Comment 7 Chris Cormack 2013-04-27 06:09:05 UTC
Pushed to 3.10.x will be in 3.10.6