Result:
found 674 distributions and 1899 files matching your query ! ( run in 0.500 )


PApp

 view release on metacpan or  search on metacpan

PApp/XML.pm  view on Meta::CPAN


use base 'Exporter';

$VERSION = 2.3;
@EXPORT_OK = qw(
      xml_quote xml_attr xml_unquote xml_tag xml_cdata
      xml_check xml_encoding xml2utf8 pod2xml
      xml_include expand_pi xml_errorparser
);

=head2 Functions for XML-Generation

PApp/XML.pm  view on Meta::CPAN

interpreted by an XML parser (quotes ', ", <, & and > to avoid ]]>). Example:

   print xml_quote q( <xx> & <[[]]> );
   => &lt;xx> &amp; &lt;[[]]&gt;

=item xml_cdata $string

Does the same thing as C<xml_quote>, but using CDATA constructs, rather
than quoting individual characters. Example:

   print xml_cdata q(hi ]]> there);
   => <![CDATA[hi ]]]]><![CDATA[> there ]]>

=item xml_unquote $string

Unquotes (and returns) an XML string (by resolving it's entities and

PApp/XML.pm  view on Meta::CPAN

   s/>/&gt;/g;
   #s/]]>/]]&gt;/g; # avoids problems when ]] and > are quoted in seperate calls
   $_;
}

sub xml_cdata {
   local $_ = shift;
   s/]]>/]]]]><![CDATA[>/g;
   "<![CDATA[$_]]>";
}
sub xml_attr {

PApp/XML.pm  view on Meta::CPAN

         ignore_elements=> [qw(script)],
         
         text_h		=> [sub {
            if ($_[1] >= $errofs) {
               $err->("<error>$errmsg, source<pre>\n"
                      . (xml_cdata substr $xml, $errofs >= 160 ? $errofs - 160 : 0, $errofs >= 160 ? 160 : $errofs)
                      . "&#xf7;"
                      . (xml_cdata substr $xml, $errofs, 160)
                      . "\n</pre></error>");
               $errofs = 1e99;
            } else {
               $delayed and $err->();
            }

PApp/XML.pm  view on Meta::CPAN

   sub view_head4 { title_tag head4 => $_[1]->title->present ($_[0]) => $_[1]->content->present ($_[0]) }

   sub view_over       { stag over  => indent => $_[1]->indent, $_[1]->content->present ($_[0]) }
   sub view_begin      { stag begin => format => $_[1]->format, $_[1]->content->present ($_[0]) }

   sub view_verbatim   { stag verbatim => PApp::XML::xml_cdata $_[1] }
   sub view_textblock  { stag para     => $_[1] }
   
   sub view_seq_code   { stag code => $_[1] } 
   sub view_seq_bold   { stag bold => $_[1] }
   sub view_seq_italic { stag italic => $_[1] }

 view all matches for this distribution


PDL-Cluster

 view release on metacpan or  search on metacpan

GENERATED/PDL/Cluster.pm  view on Meta::CPAN


  Signature: (
   double data(d,n);
   int    mask(d,n);
   int    clusterids(n);
   double [o]cdata(d,k);
   int    [o]cmask(d,k);
   ; char *ctrMethodFlag;
)

=for ref

GENERATED/PDL/Cluster.pm  view on Meta::CPAN


  Signature: (
   double data(d,n);
   int    mask(d,n);
   int    clusterids(n);
   double [o]cdata(d,k);
   int    [o]cmask(d,k);
   )

Really just a wrapper for getclustercentroids(...,"a").

=cut

sub getclustermean {
  my ($data,$mask,$cids,$cdata,$cmask) = @_;
  return getclustercentroids($dat,$mask,$cids,$cdata,$cmask,'a');
}
#line 468 "Cluster.pm"



GENERATED/PDL/Cluster.pm  view on Meta::CPAN


  Signature: (
   double data(d,n);
   int    mask(d,n);
   int    clusterids(n);
   double [o]cdata(d,k);
   int    [o]cmask(d,k);
   )

Really just a wrapper for getclustercentroids(...,"m").

=cut

sub getclustermedian {
  my ($data,$mask,$cids,$cdata,$cmask) = @_;
  return getclustercentroids($dat,$mask,$cids,$cdata,$cmask,'m');
}
#line 497 "Cluster.pm"



GENERATED/PDL/Cluster.pm  view on Meta::CPAN


  Signature: (
   double data(d,n);
   int    mask(d,n);
   double clusterwts(k,n);
   double [o]cdata(d,k);
   int    [o]cmask(d,k);
   )


Find cluster centroids by weighted sum.  This can be considered an
expensive generalization of the getclustermean() and getclustermedian()
functions.  Here, the input PDLs $data() and $mask(), as well as the
output PDL $cdata() are as for getclustermean().  The matrix $clusterwts()
determines the relative weight of each data row in determining the
centroid of each cluster, potentially useful for "fuzzy" clustering.
The equation used to compute cluster means is:

 $cdata(d,k) = sum_{n} $clusterwts(k,n) * $data(d,n) * $mask(d,n)

For centroids in the same range as data elements, $clusterwts()
should sum to 1 over each column (k):

 all($clusterwts->xchg(0,1)->sumover == 1)

GENERATED/PDL/Cluster.pm  view on Meta::CPAN

a uniform distribution over cluster elements:

 $clusterwts = zeroes($k,$n);
 $clusterwts->indexND(cat($clusterids, xvals($clusterids))->xchg(0,1)) .= 1;
 $clusterwts /= $clusterwts->xchg(0,1)->sumover;
 getclusterwsum($data,$mask, $clusterwts, $cdata=zeroes($d,$k));

Similarly, getclustermedian() can be simulated by setting $clusterwts() to
1 for cluster medians and otherwise to 0.  More sophisticated centroid
discovery methods can be computed by this function by setting
$clusterwts(k,n) to some estimate of the conditional probability

GENERATED/PDL/Cluster.pm  view on Meta::CPAN

  Signature: (
   double data(d,n);
   int    mask(d,n);
   double weight(d);
   int    rowids(nr);
   double cdata(d,k);
   int    cmask(d,k);
   int    [o]clusterids(nr);
   double [o]cdist(nr);
   ; 
   char *distFlag;

GENERATED/PDL/Cluster.pm  view on Meta::CPAN



Assigns each specified data row to the nearest cluster centroid.
Data elements are given by $data() and $mask(), feature weights are
given by $weight(), as usual.  Cluster centroids are defined by
by $cdata() and $cmask(), and the indices of rows to be attached
are given in the vector $rowids().  The output vector $clusterids()
contains for each specified row index the identifier of the nearest
cluster centroid.  The vector $cdist() contains the distance to
the best clusters.

 view all matches for this distribution


PDL-IO-Image

 view release on metacpan or  search on metacpan

Image.pd  view on Meta::CPAN

        dims[0] = 3;
        dims[1] = cu;
        pal_pdl = PDL->pdlnew();
        pal_pdl->datatype = PDL_B;
        PDL->setdims (pal_pdl, dims, 2);
        PDL->allocdata (pal_pdl);
        pdata = (PDL_Byte *) pal_pdl->data;
        RGBQUAD *pal = FreeImage_GetPalette(self->dib);
        for (i = 0; i < cu; i++) {
          pdata[i*3]     = (PDL_Byte) pal[i].rgbRed;
          pdata[i*3 + 1] = (PDL_Byte) pal[i].rgbGreen;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 4;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                RGBQUAD *bits = (RGBQUAD*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Byte) bits[x+x1].rgbRed;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 3;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                RGBTRIPLE *bits = (RGBTRIPLE*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Byte) bits[x+x1].rgbtRed;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 3;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              red_mask   = FreeImage_GetRedMask(self->dib);
              green_mask = FreeImage_GetGreenMask(self->dib);
              blue_mask  = FreeImage_GetBlueMask(self->dib);
              if ( (red_mask == FI16_565_RED_MASK) && (green_mask == FI16_565_GREEN_MASK) && (blue_mask == FI16_565_BLUE_MASK) ) {

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                BYTE *bits = FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = (PDL_Byte) bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                BYTE *bits = FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = (PDL_Byte) ((bits[(x+x1)/2] >> 4*(1-(x+x1)%2)) & 0x0F);

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_B;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Byte *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                BYTE *bits = FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = (PDL_Byte) ((bits[(x+x1)/8] >> (7-(x+x1)%8)) & 0x01);

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_US;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Ushort *) bmp_pdl->data;

              for(y = 0; y < hp; y++) {
                PDL_Ushort *bits = (PDL_Ushort*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_S;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Short *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                PDL_Short *bits = (PDL_Short*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_LL;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_LongLong *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                DWORD *bits = (DWORD*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = (PDL_LongLong)bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_L;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Long *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                PDL_Long *bits = (PDL_Long*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_F;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Float *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                PDL_Float *bits = (PDL_Float*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[0] = wp;
              dims[1] = hp;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_D;
              PDL->setdims (bmp_pdl, dims, 2);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Double *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                PDL_Double *bits = (PDL_Double*)FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x] = bits[x+x1];

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 3;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_US;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Ushort *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                FIRGB16 *bits = (FIRGB16*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Ushort) bits[x+x1].red;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 4;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_US;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Ushort *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                FIRGBA16 *bits = (FIRGBA16*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Ushort) bits[x+x1].red;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 3;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_F;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Float *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                FIRGBF *bits = (FIRGBF*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Float) bits[x+x1].red;

Image.pd  view on Meta::CPAN

              dims[1] = hp;
              dims[2] = 4;
              bmp_pdl = PDL->pdlnew();
              bmp_pdl->datatype = PDL_F;
              PDL->setdims (bmp_pdl, dims, 3);
              PDL->allocdata (bmp_pdl);
              pdata = (PDL_Float *) bmp_pdl->data;
              for(y = 0; y < hp; y++) {
                FIRGBAF *bits = (FIRGBAF*) FreeImage_GetScanLine(self->dib, h-y-1-y1);
                for(x = 0; x < wp; x++) {
                  pdata[y*wp + x]         = (PDL_Float) bits[x+x1].red;

 view all matches for this distribution


PDL-IO-Matlab

 view release on metacpan or  search on metacpan

matio-1.5.0/src/mat4.c  view on Meta::CPAN

        if ( stride[0]*(edge[0]-1)+start[0]+1 > matvar->dims[0] )
            err = 1;
        else if ( stride[1]*(edge[1]-1)+start[1]+1 > matvar->dims[1] )
            err = 1;
        if ( matvar->isComplex ) {
            mat_complex_split_t *cdata = data;
            long nbytes = edge[0]*edge[1]*Mat_SizeOf(matvar->data_type);

            ReadDataSlab2(mat,cdata->Re,class_type,matvar->data_type,
                    matvar->dims,start,stride,edge);
            fseek(mat->fp,matvar->internal->datapos+nbytes,SEEK_SET);
            ReadDataSlab2(mat,cdata->Im,class_type,
                matvar->data_type,matvar->dims,start,stride,edge);
        } else {
            ReadDataSlab2(mat,data,class_type,matvar->data_type,
                    matvar->dims,start,stride,edge);
        }
    } else {
        if ( matvar->isComplex ) {
            int i;
            mat_complex_split_t *cdata = data;
            long nbytes = Mat_SizeOf(matvar->data_type);

            for ( i = 0; i < matvar->rank; i++ )
                nbytes *= edge[i];

            ReadDataSlabN(mat,cdata->Re,class_type,matvar->data_type,
                matvar->rank,matvar->dims,start,stride,edge);
            fseek(mat->fp,matvar->internal->datapos+nbytes,SEEK_SET);
            ReadDataSlab2(mat,cdata->Im,class_type,
                matvar->data_type,matvar->dims,start,stride,edge);
        } else {
            ReadDataSlabN(mat,data,class_type,matvar->data_type,
                matvar->rank,matvar->dims,start,stride,edge);
        }

 view all matches for this distribution


PDL

 view release on metacpan or  search on metacpan

lib/PDL/Core.pm  view on Meta::CPAN

         set_c($new, [0], $value);
      } else {
         $new->setdims([]);
         if ($value) {
           $new->update_data_from( pack $pack[$new->get_datatype], $value );
         } else { # do nothing if 0 - allocdata already memsets to 0
           $new->make_physical;
         }
      }
   }
   elsif (blessed($value)) { # Object

 view all matches for this distribution


PDLA-Core

 view release on metacpan or  search on metacpan

Basic/Gen/PP/PdlParObj.pm  view on Meta::CPAN

	for(@{$this->{IndObjs}}) {
		push @c,$index if $_->name eq $ind; $index ++;
	}
	my $pdl = $this->get_nname;
	return (join '',map {"$pdl->dims[$_] = $size;\n"} @c).
		"PDLA->resize_defaultincs($pdl);PDLA->allocdata($pdl);".
		$this->get_xsdatapdecl(undef,1);
}

sub do_pdlaccess {
	my($this) = @_;

 view all matches for this distribution


PDLA

 view release on metacpan or  search on metacpan

Basic/Gen/PP/PdlParObj.pm  view on Meta::CPAN

	for(@{$this->{IndObjs}}) {
		push @c,$index if $_->name eq $ind; $index ++;
	}
	my $pdl = $this->get_nname;
	return (join '',map {"$pdl->dims[$_] = $size;\n"} @c).
		"PDLA->resize_defaultincs($pdl);PDLA->allocdata($pdl);".
		$this->get_xsdatapdecl(undef,1);
}

sub do_pdlaccess {
	my($this) = @_;

 view all matches for this distribution


PGXN-API

 view release on metacpan or  search on metacpan

lib/PGXN/API/Indexer.pm  view on Meta::CPAN

has libxml   => (is => 'ro', isa => 'XML::LibXML', lazy => 1, default => sub {
    XML::LibXML->new(
        recover    => 2,
        no_network => 1,
        no_blanks  => 1,
        no_cdata   => 1,
    );
});

has index_dir => (is => 'ro', isa => 'Str', lazy => 1, default => sub {
    my $dir = catdir +PGXN::API->instance->doc_root, '_index';

 view all matches for this distribution


PLJava

 view release on metacpan or  search on metacpan

basiclib/XML/Smart.pm-txt  view on Meta::CPAN


#############
# SET_CDATA #
#############

sub set_cdata {
  my $this = shift ;
  $this->set_node_type('cdata',@_) ;
}

##############
# SET_BINARY #
##############

basiclib/XML/Smart.pm-txt  view on Meta::CPAN


=head2  set_auto

Define the key to be handled automatically. Soo, data() will define automatically if it's a node, content or attribute.

I<** This method is useful to remove set_node(), set_cdata() and set_binary() changes.>

=head2  set_auto_node

Define the key as a node, and data() will define automatically if it's CDATA or BINARY.

I<** This method is useful to remove set_cdata() and set_binary() changes.>

=head2  set_binary(BOOL)

Define the node as a BINARY content when TRUE, or force to B<not> handle it as a BINARY on FALSE.

basiclib/XML/Smart.pm-txt  view on Meta::CPAN


Original content of foo (the base64 data):

  <h1>test \x03</h1>

=head2  set_cdata(BOOL)

Define the node as CDATA when TRUE, or force to B<not> handle it as CDATA on FALSE.

Example of CDATA node:

 view all matches for this distribution


PMLTQ-Command-printtrees

 view release on metacpan or  search on metacpan

xt/author/treebanks/pdt_small_trees/resources/adata_30_schema.xml  view on Meta::CPAN

  <import schema="wdata_30_schema.xml" type="bool.type"/>

  <derive type="m-node.type">
    <structure name="m-node">
      <member name="id" as_attribute="1" role="#ID" required="1">
        <cdata format="PMLREF"/>
      </member>
    </structure>
  </derive>

  <root name="adata" type="a-adata.type"/>

xt/author/treebanks/pdt_small_trees/resources/adata_30_schema.xml  view on Meta::CPAN


  <type name="a-meta.type">
    <structure>
      <member name="annotation_info">
        <structure name="a-annotation-info">
          <member name="version_info"><cdata format="any"/></member>
          <member name="desc"><cdata format="any"/></member>
        </structure>
      </member>
    </structure>
  </type>

  <type name="a-root.type">
    <structure role="#NODE" name="a-root">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="s.rf"><cdata format="PMLREF"/></member>
      <member name="afun"><constant>AuxS</constant></member>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
      <member name="sentence" required="0"> <!-- for searching in PML-TQ only (not in the distributed data) -->
        <cdata format="any"/>
      </member>

    </structure>
  </type>

  <type name="a-node.type">
    <structure role="#NODE" name="a-node">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="m.rf" role="#KNIT" type="m-node.type">
        <cdata format="PMLREF"/>
      </member>
      <member name="afun" type="a-afun.type" required="1"/>
      <member name="is_member" type="bool.type"/>
      <member name="is_parenthesis_root" type="bool.type"/>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
    </structure>
  </type>

 view all matches for this distribution


PMLTQ-Commands

 view release on metacpan or  search on metacpan

xt/author/treebanks/pdt_test/resources/adata_30_schema.xml  view on Meta::CPAN

  <import schema="wdata_30_schema.xml" type="bool.type"/>

  <derive type="m-node.type">
    <structure name="m-node">
      <member name="id" as_attribute="1" role="#ID" required="1">
        <cdata format="PMLREF"/>
      </member>
    </structure>
  </derive>

  <root name="adata" type="a-adata.type"/>

xt/author/treebanks/pdt_test/resources/adata_30_schema.xml  view on Meta::CPAN


  <type name="a-meta.type">
    <structure>
      <member name="annotation_info">
        <structure name="a-annotation-info">
          <member name="version_info"><cdata format="any"/></member>
          <member name="desc"><cdata format="any"/></member>
        </structure>
      </member>
    </structure>
  </type>

  <type name="a-root.type">
    <structure role="#NODE" name="a-root">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="s.rf"><cdata format="PMLREF"/></member>
      <member name="afun"><constant>AuxS</constant></member>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
      <member name="sentence" required="0"> <!-- for searching in PML-TQ only (not in the distributed data) -->
        <cdata format="any"/>
      </member>

    </structure>
  </type>

  <type name="a-node.type">
    <structure role="#NODE" name="a-node">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="m.rf" role="#KNIT" type="m-node.type">
        <cdata format="PMLREF"/>
      </member>
      <member name="afun" type="a-afun.type" required="1"/>
      <member name="is_member" type="bool.type"/>
      <member name="is_parenthesis_root" type="bool.type"/>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
    </structure>
  </type>

 view all matches for this distribution


PMLTQ-PML2BASE

 view release on metacpan or  search on metacpan

lib/PMLTQ/PML2BASE.pm  view on Meta::CPAN

#
# - every structure/container/ has a unique idx (Number) and carries attributes as columns
#
# - container has a '#content' column
#
# - cdata/constant/choice attributes are stored in the respective columns
#
# - structure/container members are in a separate table where they have a unique idx,
#   referred to by the member column
#
# - unordered-list/alt members are stored in a separate table, whose columns

lib/PMLTQ/PML2BASE.pm  view on Meta::CPAN

# - the table names should be derived from PML type names in a canonical way,
#   one per PML schema type decl
#
# Possible modifications:
#
# a) cast all cdata structure members also into separate tables and thus
#    keep varchar data in separate tables
#
# b) cast node attributes to a separate table, separating the tree structure
#    from node data, making the tree-structure table very thin
#    in fact: this is necessary, since nodes can be of different types
#
# c) use cdata format information to determine the table column format
#
#  some hacks:
#
#  - updating refs in strips .rf suffix if the member is a PMLREF but
#    not if it is a list of PMLREFs

 view all matches for this distribution


PMLTQ-Suggest

 view release on metacpan or  search on metacpan

t/treebanks/pdt_test/resources/adata_30_schema.xml  view on Meta::CPAN

  <import schema="wdata_30_schema.xml" type="bool.type"/>

  <derive type="m-node.type">
    <structure name="m-node">
      <member name="id" as_attribute="1" role="#ID" required="1">
        <cdata format="PMLREF"/>
      </member>
    </structure>
  </derive>

  <root name="adata" type="a-adata.type"/>

t/treebanks/pdt_test/resources/adata_30_schema.xml  view on Meta::CPAN


  <type name="a-meta.type">
    <structure>
      <member name="annotation_info">
        <structure name="a-annotation-info">
          <member name="version_info"><cdata format="any"/></member>
          <member name="desc"><cdata format="any"/></member>
        </structure>
      </member>
    </structure>
  </type>

  <type name="a-root.type">
    <structure role="#NODE" name="a-root">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="s.rf"><cdata format="PMLREF"/></member>
      <member name="afun"><constant>AuxS</constant></member>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
      <member name="sentence" required="0"> <!-- for searching in PML-TQ only (not in the distributed data) -->
        <cdata format="any"/>
      </member>

    </structure>
  </type>

  <type name="a-node.type">
    <structure role="#NODE" name="a-node">
      <member name="id" role="#ID" as_attribute="1" required="1"><cdata format="ID"/></member>
      <member name="m.rf" role="#KNIT" type="m-node.type">
        <cdata format="PMLREF"/>
      </member>
      <member name="afun" type="a-afun.type" required="1"/>
      <member name="is_member" type="bool.type"/>
      <member name="is_parenthesis_root" type="bool.type"/>
      <member name="ord" role="#ORDER" required="1"><cdata format="nonNegativeInteger"/></member>
      <member name="clause_number"><cdata format="nonNegativeInteger"/></member>
      <member name="children" role="#CHILDNODES">
        <list type="a-node.type" ordered="1"/>
      </member>
    </structure>
  </type>

 view all matches for this distribution


PMLTQ

 view release on metacpan or  search on metacpan

doc/pmltq_doc.xml  view on Meta::CPAN

                  relation from a referring node (the one containing the
                  reference) to the referenced node (the one whose ID the
                  reference contains).</para>

                  <para>The name of the relation is an attribute path to a PML
                  reference (declared in the PML schema as <literal>&lt;cdata
                  format="PMLREF"/&gt;</literal>).</para>

                  <para>For example, nodes of the type
                  <literal>t-node</literal> in PDT 2.0 are structures declares
                  as follows: <programlisting>  &lt;type name="t-node.type"&gt;
    &lt;structure role="#NODE" name="t-node"&gt;
      ...
      &lt;member name="a"&gt;
        &lt;structure&gt;
          &lt;member name="lex.rf"&gt;
            &lt;cdata format="PMLREF"/&gt;
          &lt;/member&gt;
          &lt;member name="aux.rf"&gt;
            &lt;list ordered="0"&gt;
              &lt;cdata format="PMLREF"/&gt;
            &lt;/list&gt;
          &lt;/member&gt;
        &lt;/structure&gt;
      &lt;/member&gt;
      ...

 view all matches for this distribution


POE-Filter-SSL

 view release on metacpan or  search on metacpan

lib/POE/Filter/SSL.pm  view on Meta::CPAN

      if $self->{unblessed}->{debug};
   my @return = ();
   $self->doSSL();
   if ($self->{accepted}) {
      if (defined($self->{sendbuf})) {
         foreach my $cdata (@{$self->{sendbuf}}) {
            $self->writeToSSL($cdata);
         }
         delete($self->{sendbuf});
      }
   }
   foreach my $data (@$chunks) {

 view all matches for this distribution


POE-XUL

 view release on metacpan or  search on metacpan

lib/POE/XUL/CDATA.pm  view on Meta::CPAN

################################################################
sub update_CM
{
    my( $self ) = @_;
    return unless $POE::XUL::Node::CM;
    $POE::XUL::Node::CM->after_cdata_change( $self );
}


################################################################
sub nodeValue

lib/POE/XUL/CDATA.pm  view on Meta::CPAN

=head1 SYNOPSIS

    use POE::XUL::Node;
    use POE::XUL::CDATA;

    my $cdata = POE::XUL::CDATA->new( $raw_data );
    $node->appendChild( $cdata );

    Script( <<JS );
        function something() {
            // JS code here
        }

lib/POE/XUL/CDATA.pm  view on Meta::CPAN

response and C<eval()>ed multiple times if it the child of a Script node. 
This may or may not be what you want.
 
=head2 nodeValue

    $cdata->nodeValue( $raw_data );
    $data = $cdata->nodeValue;

=head2 appendData

    $cdata->appendData( $more_js );

=head2 deleteData

    $cdata->deleteData( $offset, $count );

=head2 insertData

    $cdata->insertData( $offset, $more_data );

=head2 replaceData

    $cdata->insertData( $offset, $count, $more_data );

=head2 substringData

    my $data = $cdata->substringData( $offset, $count );

=head2 as_xml

    my $xml = $cdata->as_xml;

=head2 children

Returns an empty array.

 view all matches for this distribution


PRANG

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/00-load.t
t/01-meta.t
t/10-attributes.t
t/11-elements.t
t/12-warnings.t
t/13-cdata.t
t/20-validating.t
t/21-emitting.t
t/22-round-tripping.t
t/23-cookbook.t
t/24-parse-methods.t

 view all matches for this distribution


Palm-Ztxt

 view release on metacpan or  search on metacpan

makeztxt-1.62/libztxt/ztxt_generate_db.c  view on Meta::CPAN

  int           x;
  char          *y;
  long          offset;
  RecordEntryType *dbRecordEntries;
  int           sub;
  long          recdata_offset;
  long          anno_totalsize;
  anno_node     *anno;
  int           crc;


makeztxt-1.62/libztxt/ztxt_generate_db.c  view on Meta::CPAN

  /* Add annotation records */
  anno_totalsize = 0;
  if (db->num_annotations > 0)
    {
      /* Add annotation index */
      recdata_offset =
        (data_offset + sizeof(zTXT_record0) + db->comp_size
         + ((sizeof(UInt32) + MAX_BMRK_LENGTH) * db->num_bookmarks));
      dbRecordEntries->localChunkID = htonl(recdata_offset);
      dbRecordEntries->attributes = dmRecAttrDirty;
      x = htonl(0x00424200 + curr_record);
      y = (char *)&x;
      dbRecordEntries->uniqueID[0] = y[1];
      dbRecordEntries->uniqueID[1] = y[2];
      dbRecordEntries->uniqueID[2] = y[3];
      dbRecordEntries++;
      curr_record++;

      anno = db->annotations;
      recdata_offset =
        (data_offset + sizeof(zTXT_record0) + db->comp_size
         + ((sizeof(UInt32) + MAX_BMRK_LENGTH) * db->num_bookmarks)
         + ((sizeof(UInt32) + MAX_BMRK_LENGTH) * db->num_annotations));
      while (anno)
        {
          /* Add record entry for each annotation */
          dbRecordEntries->localChunkID = htonl(recdata_offset
                                                + anno_totalsize);
          dbRecordEntries->attributes = dmRecAttrDirty;
          x = htonl(0x00424200 + curr_record);
          y = (char *)&x;
          dbRecordEntries->uniqueID[0] = y[1];

 view all matches for this distribution


Panda-Install

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/07-cplus.t
t/08-misc.t
t/09-payload.t
t/10-bin_share.t
t/11-nonxs.t
t/testmod/data/ccdat/ccdata1.bin
t/testmod/data/ccdat/ccdata2.bin
t/testmod/data/data.txt
t/testmod/data/db.db
t/testmod/file1.c
t/testmod/file1.h
t/testmod/file2.cc

 view all matches for this distribution


Parallel-DataPipe

 view release on metacpan or  search on metacpan

t/Parallel-DataPipe.t  view on Meta::CPAN



sub test_scalar_values {
    print "\n***Testing if conveyor works ok with simple scalar data...\n";
    my @data = 1..10000;
    my @cdata = @data;
    my @processed_data = Parallel::DataPipe::run {
        input => \@data,
        process => sub { $_*2 },
    };

    ok(@data==0,'length of input queue is empty');
    ok(@cdata==@processed_data,'length of processed scalar data');
    ok(join(",",map $_*2, @cdata) eq join(",",sort {$a <=> $b} @processed_data),"processed scalar data values");
    #printf "processed data:%s\n",join ",",@processed_data;
    ok(zombies() == 0,'no zombies');
}

sub test_serialized_data {

 view all matches for this distribution


Paranoid

 view release on metacpan or  search on metacpan

lib/Paranoid/IO/FileMultiplexer/Block.pm  view on Meta::CPAN

    my $file    = $$self{file};
    my $bsize   = $$self{blockSize};
    my $minp    = $$self{minPos};
    my $maxp    = $$self{maxPos};
    my $rv      = PTRUE_ZERO;
    my $cdata   = defined $content ? ( length $content ) . ' bytes' : undef;
    my $blkLeft;

    subPreamble( PDLEVEL3, '$;$$$', $cdata, $start, $length, $offset );

    # NOTE:  This method intentionally allows writes of a length greater than
    # the block size, but it will only write content from within the block
    # boundaries.

 view all matches for this distribution


Parse-NetApp-ASUP

 view release on metacpan or  search on metacpan

examples/7.2.3/asup02.txt  view on Meta::CPAN

Sat Mar 17 21:00:00 CDT [kern.uptime.filer:info]:   9:00pm up 651 days, 48 mins, 20520080417 NFS ops, 0 CIFS ops, 54 HTTP ops, 0 FCP ops, 0 iSCSI ops
Sat Mar 17 22:00:00 CDT [kern.uptime.filer:info]:  10:00pm up 651 days,  1:48 20520632047 NFS ops, 0 CIFS ops, 54 HTTP ops, 0 FCP ops, 0 iSCSI ops
Sat Mar 17 23:00:00 CDT [kern.uptime.filer:info]:  11:00pm up 651 days,  2:48 20522847930 NFS ops, 0 CIFS ops, 54 HTTP ops, 0 FCP ops, 0 iSCSI ops
Sun Mar 18 00:00:00 CDT [kern.uptime.filer:info]:  12:00am up 651 days,  3:48 20523240863 NFS ops, 0 CIFS ops, 54 HTTP ops, 0 FCP ops, 0 iSCSI ops

<perf-info><object-info><objectname>system</objectname><counters><counter-info><name>nfs_ops</name><desc>NFS operations per second</desc><privilege-level>basic</privilege-level><properties>rate</properties><unit>per_sec</unit></counter-info><counter-...

 view all matches for this distribution


Parse-STDF

 view release on metacpan or  search on metacpan

lib/libstdf.pm  view on Meta::CPAN


# ------- FUNCTION WRAPPERS --------

package libstdf;

*cdata = *libstdfc::cdata;
*memmove = *libstdfc::memmove;
*stdf_version = *libstdfc::stdf_version;
*rec_to_mir = *libstdfc::rec_to_mir;
*rec_to_sdr = *libstdfc::rec_to_sdr;
*rec_to_pcr = *libstdfc::rec_to_pcr;

 view all matches for this distribution


Payvment-Facebook-API

 view release on metacpan or  search on metacpan

lib/Payvment/Facebook/API.pm  view on Meta::CPAN

}

sub _generate_product_xml_body {
	my ( $self, %options ) = @_;
	print { $options{filehandle} } "<product>\n" . "<name>"
	  . _cdata( $options{"name"} )
	  . "</name>\n"
	  . "<description>"
	  . _cdata( $options{"description"} )
	  . "</description>\n"
	  . "<price>"
	  . _escapexml( $options{"price"} )
	  . "</price>\n"
	  . "<currency>"

lib/Payvment/Facebook/API.pm  view on Meta::CPAN

	  . _escapexml( $options{"weight"} )
	  . "</weight>\n"
	  . "<weight_unit>"
	  . _escapexml( $options{"weight_unit"} )
	  . "</weight_unit>\n" . "<sku>"
	  . _cdata( $options{"sku"} )
	  . "</sku>\n"
	  . "<images>"
	  . $self->_print_images( 'images' => $options{'images'} )
	  . "</images>"

	  . "<new_state>"
	  . _escapexml( $options{"new_state"} )
	  . "</new_state>\n"
	  . "<tags>"
	  . _cdata( $options{"tags"} )
	  . "</tags>\n"
	  . "<is_taxable>"
	  . _escapexml( $options{"is_taxable"} )
	  . "</is_taxable>\n"
	  . "<categories>"

	  . $self->_print_categories( 'categories' => $options{'categories'} )
	  . "</categories>"
	  . "<client_category_name>"
	  . _cdata( $options{"client_category_name"} )
	  . "</client_category_name>\n"
	  ."<shipping_method>UPS</shipping_method>"
	  . "</product>\n";

}

lib/Payvment/Facebook/API.pm  view on Meta::CPAN

	$var =~ s/>/&gt;/isg;
	$var =~ s/&/&amp;/isg;
	return $var;
}

sub _cdata {
	my ($var) = @_;
	return "<![CDATA[" . _escapexml($var) . "]]>";
}

#notes: Generate XML. Product, UpdateInventory,Product Status, Order.  - SubmitXML to Paymemnt

 view all matches for this distribution


Pcore

 view release on metacpan or  search on metacpan

share/data/mime.yaml  view on Meta::CPAN

  mbk:
  - application/vnd.mobius.mbk
  mbox:
  - application/mbox
  mc1:
  - application/vnd.medcalcdata
  mcd:
  - application/vnd.mcd
  mcurl:
  - text/vnd.curl.mcurl
  mdb:

 view all matches for this distribution


Perinci-CmdLine-Classic

 view release on metacpan or  search on metacpan

lib/Perinci/CmdLine/Classic/Role/Help.pm  view on Meta::CPAN

        } else {
            $ct .= ($ct ? "\n" : "") . $pn .
                " " . __("<subcommand> [options]");
        }
    } else {
        my $usage = $r->{_help_clidocdata}{usage_line};
        $usage =~ s/\[\[prog\]\]/$pn/;
        $usage =~ s/\[options\]/__("[options]")/e;
        $ct .= ($ct ? "\n" : "") . $usage;
    }
    $self->_help_add_heading($r, __("Usage"));

lib/Perinci/CmdLine/Classic/Role/Help.pm  view on Meta::CPAN

}

sub help_section_options {
    my ($self, $r) = @_;

    my $opts = $r->{_help_clidocdata}{opts};
    return unless keys %$opts;

    my $verbose = $r->{_help_verbose};
    my $info = $r->{_help_info};
    my $meta = $r->{_help_meta};

lib/Perinci/CmdLine/Classic/Role/Help.pm  view on Meta::CPAN

sub help_section_examples {
    my ($self, $r) = @_;

    my $verbose = $r->{_help_verbose};
    my $meta = $r->{_help_meta};
    my $egs = $r->{_help_clidocdata}{examples};
    return unless $egs && @$egs;

    $self->_help_add_heading($r, __("Examples"));
    my $pn = $self->_color(
        'program_name', $self->get_program_and_subcommand_name($r));

lib/Perinci/CmdLine/Classic/Role/Help.pm  view on Meta::CPAN

            unless $res->[0] == 200;
        $r->{_help_meta} = $res->[2]; # cache here
    }

    # get cli opt spec
    unless ($r->{_help_clidocdata}) {
        require Perinci::Sub::To::CLIDocData;
        my $res = Perinci::Sub::To::CLIDocData::gen_cli_doc_data_from_meta(
            meta => $r->{_help_meta}, meta_is_normalized => 1,
            common_opts  => $self->common_opts,
            per_arg_json => $self->per_arg_json,
            per_arg_yaml => $self->per_arg_yaml,
        );
        die [500, "Can't gen_cli_doc_data_from_meta: $res->[0] - $res->[1]"]
            unless $res->[0] == 200;
        $r->{_help_clidocdata} = $res->[2]; # cache here
    }

    # ux: since --verbose will potentially show lots of paragraph text, let's
    # default to 80 and not wider width, unless user specifically requests
    # column width via COLUMNS.

 view all matches for this distribution


Perinci-CmdLine-Help

 view release on metacpan or  search on metacpan

lib/Perinci/CmdLine/Help.pm  view on Meta::CPAN

        my $sum = $args{program_summary} // $meta->{summary};
        last unless $sum;
        push @help, $progname, " - ", $sum, "\n\n";
    }

    my $clidocdata;

    # usage
    push @help, "Usage:\n";
    {
        for (sort {

lib/Perinci/CmdLine/Help.pm  view on Meta::CPAN

            (lang => $args{lang}) x defined($args{lang}),
            (mark_different_lang => $args{mark_different_lang}) x defined($args{mark_different_lang}),
        );
        die [500, "gen_cli_doc_data_from_meta failed: ".
                 "$res->[0] - $res->[1]"] unless $res->[0] == 200;
        $clidocdata = $res->[2];
        my $usage = $clidocdata->{usage_line};
        $usage =~ s/\[\[prog\]\]/$progname/;
        local $Text::Wrap::break = '(?=\s)\X|(?<=\\|)';
        push @help, Text::Wrap::wrap("  ", "    ", "$usage\n");
    }

lib/Perinci/CmdLine/Help.pm  view on Meta::CPAN

    }

    # example
    {
        # XXX categorize too, like options
        last unless @{ $clidocdata->{examples} };
        push @help, "\nExamples:\n";
        my $i = 0;
        my $egs = $clidocdata->{examples};
        for my $eg (@$egs) {
            $i++;
            my $cmdline = $eg->{cmdline};
            $cmdline =~ s/\[\[prog\]\]/$progname/;
            push @help, "\n" if $eg->{summary} && $i > 1;

lib/Perinci/CmdLine/Help.pm  view on Meta::CPAN


    # options
    {
        require Data::Dmp;

        my $opts = $clidocdata->{opts};
        last unless keys %$opts;

        # find all the categories
        my %options_by_cat; # val=[options...]
        for my $optkey (keys %$opts) {
            for my $cat (@{ $opts->{$optkey}{categories} }) {
                push @{ $options_by_cat{$cat} }, $optkey;
            }
        }

        my $cats_spec = $clidocdata->{option_categories};
        for my $cat (sort {
            ($cats_spec->{$a}{order} // 50) <=> ($cats_spec->{$b}{order} // 50)
                || $a cmp $b }
                         keys %options_by_cat) {
            # find the longest option

 view all matches for this distribution


Perinci-CmdLine-POD

 view release on metacpan or  search on metacpan

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN


    join "", @res;
}

sub _list_config_params {
    my ($clidocdata, $filter) = @_;

    my $opts = $clidocdata->{opts};
    my %param2opts;
    for (keys %$opts) {
        my $ospec = $opts->{$_};
        next unless $ospec->{common_opt} && $ospec->{common_opt_spec}{is_settable_via_config};
        next if $filter && !$filter->($ospec);

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

    # script has its metadata in its main:: instead of from a module, so let's
    # put it there
    local %main::SPEC = %{ $dump_res->[3]{'func.meta'} }
        if $dump_res->[3]{'func.meta'};

    # generate clidocdata(for all subcommands; if there is no subcommand then it
    # is stored in key '')
    my %clidocdata; # key = subcommand name
    my %urls; # key = subcommand name

    {
        require Perinci::Sub::To::CLIDocData;

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

            per_arg_json => $cli->{per_arg_json},
            per_arg_yaml => $cli->{per_arg_yaml},
        );
        die "Can't gen_cli_doc_data_from_meta: $res->[0] - $res->[1]"
            unless $res->[0] == 200;
        $clidocdata{''} = $res->[2];

        if ($cli->{subcommands}) {
            if (ref($cli->{subcommands}) eq 'CODE') {
                die "Script '$args{script}': sorry, coderef 'subcommands' not ".
                    "supported yet";

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

                    per_arg_json => $cli->{per_arg_json},
                    per_arg_yaml => $cli->{per_arg_yaml},
                );
                die "Can't gen_cli_doc_data_from_meta (subcommand $sc_name): $res->[0] - $res->[1]"
                    unless $res->[0] == 200;
                $clidocdata{$sc_name} = $res->[2];
            }
        }
    }

    my $gen_sc = $args{gen_subcommand};

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

    my $has_examples;
    {
        my @sectpod;

        my @examples;
        for my $sc_name (sort keys %clidocdata) {
            if ($cli->{subcommands}) {
                next unless length $sc_name;
                if (defined $gen_sc) { next unless $sc_name eq $gen_sc }
            }
            my $i = 1;
            for my $eg (@{ $clidocdata{$sc_name}{examples} }) {
                # add pointer to subcommand, we need it later to show result
                $eg->{_sc_name} = $sc_name;
                $eg->{_i} = $i;
                push @examples, $eg;
                $i++;

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

        }

        if ($cli->{subcommands}) {
            # 2a. show per-subcommand usage lines, if there are subcommands
            if ($gen_scs) {
                for my $sc_name (sort keys %clidocdata) {
                    next unless length $sc_name;
                    if (defined $gen_sc) { next unless $sc_name eq $gen_sc }
                    my $subcmd_usage = $clidocdata{$sc_name}->{'usage_line.alt.fmt.pod'};
                    $subcmd_usage =~ s/\[\[prog\]\]/$program_name $sc_name/g;
                    push @usage, "$subcmd_usage\n\n";
                }
            } else {
                push @usage, "B<$program_name> [I<options>] [I<subcommand>] [I<arg>]...\n\n";
            }
            push @usage, "\n\n";
        } else {
            # 2b. show main usage line
            my $main_usage = $clidocdata{''}->{'usage_line.alt.fmt.pod'};
            $main_usage =~ s/\[\[prog\]\]/$program_name/g;
            push @usage, "$main_usage\n\n";
        }

        $resmeta->{'func.usage'} = join('', @usage);

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN


        my @sectpod;
        my %sc_spec_refs; # key=ref address, val=first subcommand name

        my $i = -1;
        for my $sc_name (sort keys %clidocdata) {
            next unless length $sc_name;
            $i++;
            my $sc_spec = $cli->{subcommands}{$sc_name};

            my $spec_same_as;

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN


        push @{ $resmeta->{'func.sections'} }, {name=>'SUBCOMMANDS', content=>join("", @sectpod), ignore=>1};
        push @pod, "=head1 SUBCOMMANDS\n\n", @sectpod;
    }

    my @sc_names = grep { length } sort keys %clidocdata;

    # section: OPTIONS
    {
        my @sectpod;
        push @sectpod, "C<*> marks required options.\n\n";

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

            # first display options tagged with 'common' as well as common
            # option (non-function argument option, like --format or
            # --log-level). these are supposed to be the same across
            # subcommands.
            {
                my $opts = $clidocdata{ $sc_names[0] }{opts};
                my @opts = sort {
                    (my $a_without_dash = $a) =~ s/^-+//;
                    (my $b_without_dash = $b) =~ s/^-+//;
                    lc($a) cmp lc($b);
                } grep {$check_common_arg->($opts, $_)} keys %$opts;

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

                        $sc_spec_refs{"$sc_spec"} = $sc_name;
                    }
                    next if defined $spec_same_as;
                    next if $sc_spec->{is_alias};

                    my $opts = $clidocdata{$sc_name}{opts};
                    my @opts = sort {
                        (my $a_without_dash = $a) =~ s/^-+//;
                        (my $b_without_dash = $b) =~ s/^-+//;
                        lc($a) cmp lc($b);
                    } grep {!$check_common_arg->($opts, $_)} keys %$opts;

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

                    push @sectpod, "=back\n\n";
                }
            }
        } else {
            my $k = defined $gen_sc ? $gen_sc : '';
            my $opts = $clidocdata{$k}{opts};
            # find all the categories
            my %options_by_cat; # val=[options...]
            for my $optkey (keys %$opts) {
                for my $cat (@{ $opts->{$optkey}{categories} }) {
                    push @{ $options_by_cat{$cat} }, $optkey;
                }
            }
            my $cats_spec = $clidocdata{$k}{option_categories};
            for my $cat (sort {
                ($cats_spec->{$a}{order} // 50) <=> ($cats_spec->{$b}{order} // 50)
                    || $a cmp $b }
                             keys %options_by_cat) {
                push @sectpod, "=head2 $cat\n\n"

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

                # first list the options tagged with 'common' and common options
                # (non-function argument options, like --format or --log-level)
                # which are supposed to be the same across subcommands.
                push @sectpod, "=head2 Common for all subcommands\n\n" if $gen_scs;
                my $param2opts = _list_config_params(
                    $clidocdata{$sc_names[0]},
                    sub { grep { $_ eq 'common' } @{ $_[0]->{tags} // []} || !$_[0]->{arg} });
                for (sort keys %$param2opts) {
                    push @sectpod, " $_ (see $param2opts->{$_})\n";
                }
                push @sectpod, "\n";

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

                        my $sc_spec = $cli->{subcommands}{$sc_name};
                        next if $sc_spec->{is_alias};
                        my $sc_name_e = $sc_name =~ /\A\S+\z/ ? $sc_name : "'$sc_name'";
                        push @sectpod, "=head2 Configuration for subcommand $sc_name_e\n\n";
                        $param2opts = _list_config_params(
                            $clidocdata{$sc_name},
                            sub { !(grep { $_ eq 'common' } @{ $_[0]->{tags} // []}) && $_[0]->{arg} });
                        for (sort keys %$param2opts) {
                            push @sectpod, " $_ (see $param2opts->{$_})\n";
                        }
                        push @sectpod, "\n";
                    }
                }
            } else {
                my $param2opts = _list_config_params($clidocdata{''});
                for (sort keys %$param2opts) {
                    push @sectpod, " $_ (see $param2opts->{$_})\n";
                }
                push @sectpod, "\n";
            }

lib/Perinci/CmdLine/POD.pm  view on Meta::CPAN

    # section: SEE ALSO
    {
        my @sectpod;

        my %seen_urls;
        for my $sc_name (sort keys %clidocdata) {
            my $meta = $metas{$sc_name};
            next unless $meta->{links};
            for my $link0 (@{ $meta->{links} }) {
                my $link = ref($link0) ? $link0 : {url=>$link0};
                my $url = $link->{url};

 view all matches for this distribution


Perinci-Sub-To-CLIDocData

 view release on metacpan or  search on metacpan

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

    };
    $ggls_res->[0] == 200 or return $ggls_res;

    my $langprop_args = {lang=>$lang, mark_different_lang=>$mark_different_lang};
    my $args_prop = $meta->{args} // {};
    my $clidocdata = {
        option_categories => {},
        example_categories => {},
    };

    # a mapping from arg spec keys to %opts keys, so we can create a POD link

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

                    # --help or -v, they are put at the end. so if an argument
                    # option does not have category, we'll put it in the "main"
                    # category.
                    local $arg_spec->{tags} = ['category0:main']
                        if !$arg_spec->{tags} || !@{$arg_spec->{tags}};
                    _add_category_from_spec($clidocdata->{option_categories},
                                            $opt, $arg_spec, "options", 1);
                }
                _add_default_from_arg_spec($opt, $arg_spec);

            } else {

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

                    description =>
                        $rimeta->langprop($langprop_args, 'description'),
                    (default => $spec->{default}) x !!(exists($spec->{default}) && !$show_neg),
                };

                _add_category_from_spec($clidocdata->{option_categories},
                                        $opt, $spec, "options", 1);

            }

            $opts{$optkey} = $opt;

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

                next OPT1;
            }
        }

    } # GEN_LIST_OF_OPTIONS
    $clidocdata->{opts} = \%opts;

    #use DDC; dd \%arg_spec_to_opts;
    #use DDC; dd \%ospec_to_opts;

  GEN_USAGE_LINE: {

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

            push @{ $plain_opts[ $opt_locations{$key} ] }, $plain_opt;
            push @{ $pod_opts  [ $opt_locations{$key} ] }, $pod_opt;
            #use Data::Dmp; print "key: $key, ospec: $ospec, ospecmeta: ", dmp($ospecmeta), ", argprop: ", dmp($argprop), ", copt: ", dmp($copt), "\n";
        }

        $clidocdata->{compact_usage_line} = "[[prog]]".
            (keys(%args_prop) || keys(%$common_opts) ? " [options]" : ""). # XXX translatable?
            (@plain_args ? " ".join(" ", @plain_args) : "");
        $clidocdata->{usage_line} = "[[prog]]".
            (@plain_opts+@plain_args ? " ".
             join(" ",
                  (map { "[". join("|", @$_) . "]" } @plain_opts),
                  (@plain_opts && @plain_args ? ("--") : ()),
                  @plain_args,
              ) : "");
        $clidocdata->{'usage_line.alt.fmt.pod'} = "B<[[prog]]>".
            (@pod_opts+@pod_args ? " ".
             join(" ",
                  (map { "[". join("|", @$_) . "]" } @pod_opts),
                  (@pod_opts && @pod_args ? ("--") : ()),
                  @pod_args,

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

                summary      => $rimeta->langprop($langprop_args, 'summary'),
                description  => $rimeta->langprop($langprop_args, 'description'),
                example_spec => $eg,
            };
            # XXX show result from $eg
            _add_category_from_spec($clidocdata->{example_categories},
                                    $egdata, $eg, "examples", $has_cats);
            push @examples, $egdata;
        }
    }
    $clidocdata->{examples} = \@examples;

    [200, "OK", $clidocdata];
}

1;
# ABSTRACT: From Rinci function metadata, generate structure convenient for producing CLI documentation (help/usage/POD)

lib/Perinci/Sub/To/CLIDocData.pm  view on Meta::CPAN

This document describes version 0.305 of Perinci::Sub::To::CLIDocData (from Perl distribution Perinci-Sub-To-CLIDocData), released on 2022-11-14.

=head1 SYNOPSIS

 use Perinci::Sub::To::CLIDocData qw(gen_cli_doc_data_from_meta);
 my $clidocdata = gen_cli_doc_data_from_meta(meta => $meta);

Sample function metadata (C<$meta>):

 {
   args => {

 view all matches for this distribution


Perinci-Sub-To-FishComplete

 view release on metacpan or  search on metacpan

lib/Perinci/Sub/To/FishComplete.pm  view on Meta::CPAN

            per_arg_json => $args{per_arg_json},
            per_arg_yaml => $args{per_arg_yaml},
        );
    };
    $gcd_res->[0] == 200 or return $gcd_res;
    my $clidocdata = $gcd_res->[2];

    my $cmdname = $args{cmdname};
    if (!$cmdname) {
        ($cmdname = $0) =~ s!.+/!!;
    }

    my @cmds;
    my $prefix = "complete -c ".shell_quote($cmdname);
    push @cmds, "$prefix -e"; # currently does not work (fish bug)
    for my $opt0 (sort keys %{ $clidocdata->{opts} }) {
        my $ospec = $clidocdata->{opts}{$opt0};
        my $req_arg;
        for my $opt (split /, /, $opt0) {
            $opt =~ s/^--?//;
            $opt =~ s/=(.+)// and $req_arg = $1;

 view all matches for this distribution


( run in 0.500 second using v1.01-cache-2.11-cpan-454fe037f31 )