This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix several problems in the MY_CXT example in perlxs.pod
authorTony Cook <tony@develop-help.com>
Mon, 12 Aug 2013 03:21:18 +0000 (13:21 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 12 Aug 2013 03:21:18 +0000 (13:21 +1000)
- duplicate declaration of name for newMouse

- missing OUTPUT clauses

- use of a member of the context object that doesn't exist in
  get_mouse_name()

- incorrect type assigned to RETVAL in get_mouse_name

- inconsistent indentation

- B<> to mark a heading instead of =headN

dist/ExtUtils-ParseXS/lib/perlxs.pod

index 5952c95..12e2227 100644 (file)
@@ -1898,7 +1898,6 @@ Below is an example module that makes use of the macros.
 
     int
     newMouse(char * name)
 
     int
     newMouse(char * name)
-        char * name;
         PREINIT:
           dMY_CXT;
         CODE:
         PREINIT:
           dMY_CXT;
         CODE:
@@ -1910,24 +1909,28 @@ Below is an example module that makes use of the macros.
               RETVAL = ++ MY_CXT.count;
               strcpy(MY_CXT.name[MY_CXT.count - 1], name);
           }
               RETVAL = ++ MY_CXT.count;
               strcpy(MY_CXT.name[MY_CXT.count - 1], name);
           }
+        OUTPUT:
+          RETVAL
 
     char *
     get_mouse_name(index)
 
     char *
     get_mouse_name(index)
-      int index
-      CODE:
-        dMY_CXT;
-        RETVAL = MY_CXT.lives ++;
-        if (index > MY_CXT.count)
-          croak("There are only 3 blind mice.");
-        else
-          RETVAL = newSVpv(MY_CXT.name[index - 1]);
+          int index
+        PREINIT:
+          dMY_CXT;
+        CODE:
+          if (index > MY_CXT.count)
+            croak("There are only 3 blind mice.");
+          else
+            RETVAL = MY_CXT.name[index - 1];
+        OUTPUT:
+          RETVAL
 
     void
     CLONE(...)
        CODE:
 
     void
     CLONE(...)
        CODE:
-       MY_CXT_CLONE;
+         MY_CXT_CLONE;
 
 
-B<REFERENCE>
+=head3 MY_CXT REFERENCE
 
 =over 5
 
 
 =over 5