CONTACT
If you have questions about this data service, or wish to report a bug, please contact <% request.admin_name %> "<% request.contact_info.name %"|mailto:<% request.contact_info.email %>> (put your real contact info here).
END_END_END 'doc/doc_not_found.tt' => << 'END_END_END',
ERROR: documentation page for <% title %> not found.
END_END_END 'doc/index.tt' => << 'END_END_END',
This is an example data service, built using the Web::DataService framework. It provides information about the historical population of U.S. states, based on data from the Bureau of the Census.
You can use this code as a basis for building your own data services.
Operations
The following data service operations are available:
- Single state
-
Returns information about a single state.
- Multiple states
-
Returns information about a list of states matching the specified criteria.
- Regions
-
Returns the list of regions defined by this data service.
<% FORMATS(opt_extended=1) %>
<% VOCABULARIES(opt_extended=1, opt_all=1) %>
END_END_END 'doc/doc_header.tt' => << 'END_END_END', =encoding utf8
<% ds.title %>: <% doc_title %>
<% NAVTRAIL %>
END_END_END 'doc/formats/index.tt' => << 'END_END_END',
DESCRIPTION
This data service is capable of returning its results in a variety of formats. This capability provides great flexibility, allowing such diverse activities as:
Support for client applications written in Javascript
Downloads of data in text format for use in spreadsheets
Viewing of data in browser tabs.
Each format has a default vocabulary in which its data is expressed. The available formats and vocabularies are discussed below.
<% INCLUDE FORMATS opt_extended=1 %>
<% INCLUDE VOCABULARIES opt_extended=1 opt_all=1 %> END_END_END 'doc/formats/json_doc.tt' => << 'END_END_END', =head2 DESCRIPTION
This page describes the JSON response format in detail.
SYNOPSIS
The JSON (JavaScript Object Notation) format is selected by ending a URL path with the suffix .json
. This format is very flexible, and is intended for use by web applications built on top of this data service as well as for transmitting content to and from other databases. JSON responses are always encoded in UTF-8.
The body of a response in this format consists of a single JSON object, containing one or more of the following fields:
records
-
The value of this field is an array of objects, each representing a record from the database.
This field will always be present if the URL path and parameters are interpreted to be a valid query, but the array may be empty if the query does not match any records.
records_found
-
This field will be present if the parameter count was specified. Its value will be the number of records matched by the main query.
records_returned
-
This field will be present if the paramter count was specified. Its value will be the number of records actually returned. <%- IF request.default_limit %> This may be less than the total number of records found, because the size of the result set is limited by default to <% request.default_limit %>. You can override this using the limit parameter. <%- END %>
record_offset
-
This field will be present if the parameter count was specified, and if the parameter offset was specified with a value greater than zero. The value in the second column will be the number of records that were skipped at the beginning of the result set.
data_source
-
This field will be present if the parameter datainfo was specified. Its value will be the name of this data source.
documentation_url
-
This field will be present if the parameter datainfo was specified. Its value will be a URL that provides documentation about the URL path used to fetch this data. This URL will document both the parameters and the response fields. This information may be helpful in guiding the later interpretation of this data.
data_url
-
This field will be present if the parameter datainfo was specified. Its value will be the actual URL that was used to fetch this data. If this dataset is saved to disk, the included field will allow someone to later repeat this query.
access_time
-
This field will be present if the parameter datainfo was specified. Its value will be the date and time time (GMT) at which this data was accessed. If this dataset is saved to disk, the included field will enable it to be compared with other datasets on the basis of access time.
parameters
-
This field will be present if the parameter datainfo was specified. Its value will be an object whose fields represent the parameters and values that were used to generate this result. If this dataset is saved to disk, the parameter information may be helpful in documenting how the data was selected, what it includes, and what it does not include.
warnings
-
This field will be present if any warnings were generated during the execution of the query. Its value will be an array of strings, each representing a warning message.
errors
-
This field will be present if a fatal error condition was encountered. Its value will be an array of strings, each representing an error message. In general, if this field is present then none of the others will be.
status_code
-
This field will be present if the HTTP status code is anything other than 200. Its value will be one of the following:
- 400
-
One or more of the URL parameters was invalid. The reasons will be given by the field
errors
. This request should not be repeated without modification. - 401
-
This request requires authentication. Note that the authentication module has not yet been added to the data service, so you should not be seeing this yet.
- 404
-
The URL path was invalid. This request should not be repeated without modification.
- 500
-
An internal error occurred. If this condition persists, you should contact the server administrator. Otherwise, the request may be resubmitted later.
For example, consider the following URL path:
The body of the response is as follows:
{
"records": [
{
"name": "Wisconsin",
"abbrev": "WI",
"region": "MW",
"pop2010": 5686986
}
]
}
This body is made up of an object containing the field "records", whose value is an array. Each element of the array represents a single record fetched from the database. The definitions of the various fields can be found on the documentation page for this URL path: node:single#RESPONSE.
Many URL paths will, of course, return multiple records. For example:
{
"elapsed_time": 0.000283,
"records_found": 3,
"records_returned": 3,
"records": [
{
"name": "Illinois",
"abbrev": "IL",
"region": "MW",
"pop2010": 12830632
},
{
"name": "Minnesota",
"abbrev": "MN",
"region": "MW",
"pop2010": 5303925
},
{
"name": "Wisconsin",
"abbrev": "WI",
"region": "MW",
"pop2010": 5686986
}
]
}
This response body contains multiple records, but is otherwise structured identically. Note the presence of the count
parameter, which causes the inclusion of the fields elapsed_time
, records_found
, and records_returned
.
Finally, consider the following URL:
{
"status_code": 400,
"errors": [
"unknown parameter 'foo'"
],
"warnings": [
"the value of 'state' must be a valid state name or abbreviation"
]
}
This response body conveys both an error and a warning, along with a status code of 400 (Bad Request) which indicates a problem with the URL parameters. END_END_END 'doc/formats/text_doc.tt' => << 'END_END_END',
DESCRIPTION
This page describes the text response formats in detail.
SYNOPSIS
This service can produce responses in two different text formats: tab-separated and comma-separated. Both of these formats can be loaded into a spreadsheet, or copied into an e-mail message or other text document.
You may choose from any of the following three suffixes:
.csv
-
Generate a download file in comma-separated text format. Most browsers will save this file directly to disk; if you would rather see it immediately in a browser tab, then use the suffix
.txt
instead. .tsv
-
Generate a download file in tab-separated text format.
.txt
-
Display the results in a browser tab in comma-separated text format. You will then be able to save this file to disk using the "Save Page As..." menu item in your browser, which will produce the same result as if you had used the
csv
suffix.
Note that you should only use the .txt
suffix if your result set is of small to moderate size. If you try to display a large result set directly in a browser tab, it may take a long time to render and use up an enormous amount of memory.
In addition, you may choose to include one or more of the following URL parameters:
- datasource
-
If this parameter is specified, then extra header lines will be included at the beginning of the response. These lines will include information about the data source, the URL used to generate this response, and more. See below for more information.
- count
-
If this parameter is specified, then extra header lines will be included at the beginning of the response. These lines will specify the number of records found and the number returned, as well as the elapsed time to compute this result. See below for more information.
- header=no
-
If this parameter is specified, then no header material at all will be included. The first line of the file will be the first data record, if any. If no data records were found, the file will be empty. This parameter doesn't need any value.
- lb=cr
-
If this parameter is specified, then each line will be terminated by a single carriage return instead of the standard carriage return/line feed sequence.
The body of the response consists of a series of lines containing comma-separated or tab-separated values. The initial part of the file may contain some or all of the following lines:
Data Source:
-
This line will be present if the parameter datainfo was specified. The value in the second column will be the name of this data source.
Documentation URL:
-
This line will be present if the parameter datainfo was specified. The value in the second column will be a URL that provides documentation about the URL path used to fetch this data. This URL will document both the parameters and the response fields. This information may be helpful in guiding the later interpretation of this data.
Data URL:
-
This line will be present if the parameter datainfo was specified. The value in the second column will be the actual URL that was used to fetch this data. If this dataset is saved to disk, the included line will allow someone to later repeat this query.
Access Time:
-
This line will be present if the parameter datainfo was specified. The value in the second column will be the date and time time (GMT) at which this data was accessed. If this dataset is saved to disk, the included line will enable it to be compared with other datasets on the basis of access time.
Parameters:
-
This line will be present if the parameter datainfo was specified. It will be followed by one line per parameter, giving the parameter name and value(s) used to generate this result. If this dataset is saved to disk, the parameter information may be helpful in documenting how the data was selected, what it includes, and what it does not include.
Records Found:
-
This line will be present if the parameter count was specified. The value in the second column will be the number of records that matched the main query.
Records Returned:
-
This line will be present if the paramter count was specified. The value in the second column will be the number of records actually returned. <%- IF request.default_limit %> This may be less than the total number of records found, because the size of the result set is limited by default to <% request.default_limit %>. You can override this using the limit parameter. <%- END %>
Record Offset:
-
This line will be present if the parameter count was specified, and if the parameter offset was specified with a value greater than zero. The value in the second column will be the number of records that were skipped at the beginning of the result set.
Warning:
-
One or more of these lines will be present if any warnings were generated during the execution of the query. The warning message(s) will appear in the second column.
Records:
-
If any of the lines mentioned so far in this table appear in the output, this line will appear immediately before the data header line. It serves to mark off the supplementary header material from the data.
- data header
-
Unless the parameter header=no was specified, a data header line will always precede the first data line. This header line will contain the name of each column.
The data records will follow this header material, one record per line until the end of the file.
For example, the following URL will produce the following output, consisting of a single data record with accompanying header line:
"name","abbrev","region","pop2010"
"Wisconsin","WI","MW","5686986"
By contrast, the following URL includes some additional header information, terminated by a "Records:" line.
"Elapsed Time:","0.000152"
"Records Found:","3"
"Records Returned:","3"
"Records:"
"name","abbrev","region","pop2010"
"Illinois","IL","MW","12830632"
"Minnesota","MN","MW","5303925"
"Wisconsin","WI","MW","5686986"
This output includes several header lines, terminated by the "Records:" line. Following that is the data header, and then the data records.
The following URL returns an HTTP error response instead of a data response:
400 Bad Request
unknown parameter 'foo'
Warnings:
the value of 'state' must be a valid state name or abbreviation
Lastly, the following URL generates just the data records with no header information at all:
"Connecticut","CT","NE","3574097"
"Maine","ME","NE","1328361"
"Massachusetts","MA","NE","6547629"
"New Hampshire","NH","NE","1316472"
"Rhode Island","RI","NE","1052567"
"Vermont","VT","NE","625741"
END_END_END 'doc/doc_defs.tt' => << 'END_END_END', <%- # # This template belongs to the package Web::DataService, and contains # default definitions for generating documentation pages. # # You can edit this in order to modify the look of your documentation pages. # # ===========================
USE dumper;
SET block_done = { };
# Edit the following definitions to modify the labels used for navigation
# -----------------------------------------------------------------------
PROCESS doc_strings.tt;
IF ds.version; SET main_doc_label = "$main_doc_label (v. $ds.version)"; END;
msgval = {
format_param = ds.special_param('format')
vocab_param = ds.special_param('vocab')
show_param = ds.special_param('show')
};
MACRO sub_message(text) IF message.$text; message.$text; ELSE; text; "\n"; END;
MACRO sub_value(msg, value) GET message.$msg FILTER replace('%s', value);
#
# DOCSTRING : Include the documentation string for this node, if any.
# -------------------------------------------------------------------
BLOCK DOCSTRING; GET request.document_node or sub_message("MSG_DOCSTRING_MISSING"); END;
MACRO DOCSTRING PROCESS DOCSTRING;
#
# USAGE: Display usage examples for this URL path
# -----------------------------------------------
BLOCK USAGE;
IF block_done.usage; RETURN; ELSE; SET block_done.usage = 1; END;
SET usage_doc = request.document_usage;
IF usage_doc;
IF opt_noheader; "\n";
ELSE; "\n=head2 $section_label.usage\n\n";
END;
IF content; GET content FILTER trim; "\n\n";
ELSE; sub_message("MSG_USAGE_HEADER_OP"); "\n\n";
END;
usage_doc;
END;
END;
MACRO USAGE INCLUDE USAGE;
#
# PARAMETERS: Document the parameters corresponding to this URL path
# ------------------------------------------------------------------
BLOCK PARAMETERS;
IF block_done.params; RETURN; ELSE; SET block_done.params = 1; END;
"\n=head2 $section_label.params\n\n";
SET param_doc = request.document_params(ruleset);
IF content; GET content FILTER trim; "\n\n"; sub_message(param_doc);
ELSIF param_doc; sub_message("MSG_PARAM_HEADER_OP"); "\n\n"; param_doc;
ELSE; sub_message("MSG_PARAM_NONE_DEFINED");
END;
END;
MACRO PARAMETERS(ruleset) INCLUDE PARAMETERS;
#
# METHODS: Document the HTTP methods accepted by this URL path
# ------------------------------------------------------------
BLOCK METHODS;
IF block_done.methods; RETURN; ELSE; SET block_done.methods = 1; END;
SET method_list = request.document_http_methods or sub_method("MSG_METHOD_NONE_DEFINED");
"\n=head2 $section_label.methods\n\n";
IF content; GET content FILTER trim;
ELSIF request.node_has_operation; sub_message("MSG_METHOD_HEADER_OP");
ELSE; sub_message("MSG_METHOD_HEADER_NODE");
END;
GET " $method_list";
END;
MACRO METHODS INCLUDE METHODS;
#
# FORMATS: Document the formats allowed by this URL path
# ------------------------------------------------------
BLOCK FORMATS;
IF block_done.formats; RETURN; ELSE; SET block_done.formats = 1; END;
SET options = { };
IF opt_extended; options.extended = 1; END;
IF opt_all; options.path = '/'; END;
IF request.node_path == '/'; opt_all = 1; END;
SET format_doc = request.document_formats(options);
"\n=head2 $section_label.formats\n\n";
IF format_doc.match('^MSG_'); sub_message(format_doc);
ELSIF content; GET content FILTER trim; "\n\n$format_doc";
ELSIF opt_all;
sub_message("MSG_FORMAT_HEADER_ALL");
sub_message("MSG_FORMAT_HEADER_SUFFIX") IF ds.has_feature('format_suffix');
sub_message("MSG_FORMAT_HEADER_PARAM") IF ds.special_param('format');
"\n\n$format_doc";
ELSE;
sub_message("MSG_FORMAT_HEADER_SOME");
sub_message("MSG_FORMAT_HEADER_SUFFIX") IF ds.has_feature('format_suffix');
sub_message("MSG_FORMAT_HEADER_PARAM") IF ds.special_param('format');
IF not ds.has_feature('format_suffix');
default_value = request.default_format;
sub_value("MSG_FORMAT_HEADER_DEFAULT", default_value) IF default_value;
END;
"\n\n$format_doc";
END;
END;
MACRO FORMATS INCLUDE FORMATS;
#
# VOCABULARIES: Document the vocabularies allowed by this URL path
# ----------------------------------------------------------------
BLOCK VOCABULARIES;
IF block_done.vocabs; RETURN; ELSE; SET block_done.vocabs = 1; END;
SET options = { };
IF opt_extended; options.extended = 1; END;
IF opt_all; options.path = '/'; END;
IF request.node_path == '/'; opt_all = 1; END;
SET vocab_doc = request.document_vocabs(options);
IF vocab_doc;
"\n=head2 $section_label.vocabs\n\n";
IF content;
GET content FILTER trim; "\n\n$vocab_doc";
ELSIF opt_all;
sub_message("MSG_VOCAB_HEADER_ALL");
sub_message("MSG_VOCAB_HEADER_PARAM") IF ds.special_param('vocab');
"\n\n$vocab_doc";
ELSE;
sub_message("MSG_VOCAB_HEADER_SOME");
sub_message("MSG_VOCAB_HEADER_PARAM") IF ds.special_param('vocab');
"\n\n$vocab_doc";
END;
END;
END;
MACRO VOCABULARIES INCLUDE VOCABULARIES;
#
# RESPONSE: Document the response fields returned by this URL path
# ----------------------------------------------------------------
BLOCK RESPONSE;
IF block_done.response; RETURN; ELSE; SET block_done.response = 1; END;
"\n=head2 $section_label.response\n\n";
SET response_doc = request.document_response;
SET fixed = request.output_label;
SET optional = request.optional_output;
IF response_doc;
IF content; GET content FILTER trim;
ELSE;
sub_message("MSG_RESPONSE_HEADER");
IF fixed && optional;
sub_value("MSG_RESPONSE_HEADER_FIXED", fixed);
sub_message("MSG_RESPONSE_HEADER_OPT");
ELSIF optional;
sub_message("MSG_RESPONSE_HEADER_OPT_ONLY");
END;
"\n\n";
END;
GET response_doc;
INCLUDE FORMATS;
INCLUDE VOCABULARIES;
ELSE;
sub_message("MSG_RESPONSE_NONE_DEFINED");
END;
END;
MACRO RESPONSE INCLUDE RESPONSE;
#
# STANDARD: Include all of the standard blocks for an "operation" page
# --------------------------------------------------------------------
BLOCK STANDARD;
INCLUDE PARAMETERS;
INCLUDE METHODS;
INCLUDE RESPONSE;
END;
MACRO STANDARD INCLUDE STANDARD;
#
# TRAIL: Add a navigation trail to the page
# -----------------------------------------
BLOCK NAVTRAIL;
IF block_done.trail; RETURN; ELSE; SET block_done.trail = 1; END;
SET navtrail = "";
FOREACH item IN request.list_navtrail(main_doc_label);
IF navtrail; SET navtrail = "$navtrail E<GT> $item";
ELSE; SET navtrail = item; END;
END;
"\n=for wds_nav =head3 $main_doc_prefix$navtrail\n";
END;
MACRO NAVTRAIL INCLUDE NAVTRAIL;
#
# URL: Generate an example URL
# ----------------------------
BLOCK URL;
SET args = { };
args.operation = operation;
IF documentation; args.documentation = documentation; END;
IF format; args.format = format; END;
IF params; args.params = params; END;
IF fragment; args.fragment = fragment; END;
IF type; args.type = type; END;
dumper.dump(args);
# ds.generate_url(args);
END;
MACRO URL INCLUDE URL;
BLOCK DOC_URL;
SET args = { documentation = path };
IF format; args.format = format; END;
IF fragment; args.fragment = fragment; END;
IF type; args.type = type; END;
SET url = ds.generate_url(args);
IF title; "L<$title|$url>";
ELSE; "L<$url>"; END;
END;
MACRO DOC_URL(path) INCLUDE DOC_URL;
-%> END_END_END 'doc/special_doc.tt' => << 'END_END_END',
<% WRAPPER PARAMETERS(special) %> You can use any of the following special parameters with any request: <% END %> END_END_END 'doc/operation.tt' => << 'END_END_END',
<% DOCSTRING %>
<% USAGE %>
<% PARAMETERS %>
<% METHODS %>
<% RESPONSE %>
<% FORMATS %> END_END_END 'doc/doc_strings.tt' => << 'END_END_END', <%-
main_doc_label = "Main Documentation";
main_doc_prefix = "";
section_label = {
usage = "USAGE"
params = "PARAMETERS"
methods = "METHODS"
response = "RESPONSE"
formats = "FORMATS"
vocabs = "VOCABULARIES"
};
message = {
MSG_DOCSTRING_MISSING = "I<The documentation string for this node is missing.> "
MSG_USAGE_HEADER_OP = "Here are some examples of how to use this operation:"
MSG_PARAM_HEADER_OP = "You can use any of the following parameters with this operation:"
MSG_PARAM_NONE_DEFINED = "I<No parameters are defined.>"
MSG_FORMAT_HEADER_SOME = "The following response formats are available for this operation. "
MSG_FORMAT_HEADER_ALL = "The following response formats are available for this data service. Not all of these may be available for every operation. "
MSG_FORMAT_HEADER_SUFFIX = "You must select the desired format for a request by adding the appropriate suffix to the URI path. "
MSG_FORMAT_HEADER_PARAM = "You can select the desired format by using the parameter C<$msgval.format_param> with the appropriate format name. "
MSG_FORMAT_HEADER_DEFAULT = "The default format for this operation is C<%s>."
MSG_FORMAT_NONE_DEFINED = "I<No output formats are defined for this data service.> "
MSG_FORMAT_NONE_ALLOWED = "I<No output formats are configured for this operation.> "
MSG_VOCAB_HEADER_SOME = "The following response vocabularies are available for this operation. "
MSG_VOCAB_HEADER_ALL = "The following response vocabularies are available for this data service. "
MSG_VOCAB_HEADER_PARAM = "If you wish your responses to be expressed in a vocabulary other than the default for your selected format, you can use the C<$msgval.vocab_param> parameter with the appropriate vocabulary name. "
MSG_VOCAB_NONE_ALLOWED = "I<No output vocabularies are configured for this operation.> "
MSG_METHOD_NONE_DEFINED = "I<none are defined>"
MSG_METHOD_HEADER_OP = "You can use the following HTTP methods with this operation:"
MSG_METHOD_HEADER_NODE = "This data service accepts the following HTTP methods:"
MSG_RESPONSE_HEADER = "The response to an HTTP request on this path will consist of fields from the following list. "
MSG_RESPONSE_HEADER_FIXED = "The block C<%s> is always present. "
MSG_RESPONSE_HEADER_OPT = "The others may be selected using the parameter C<$msgval.show_param>. "
MSG_RESPONSE_HEADER_OPT_ONLY = "You can select which blocks will be present in the response using the parameter C<$msgval.show_param>. "
MSG_RESPONSE_NONE_DEFINED = "I<No response is defined for this operation.> "
};
-%> END_END_END 'data/population_data.txt' => << 'END_END_END', State Abbreviation Region 2010 Population 2000 Population 1990 Population 1950 Population 1900 Population 1790 Population Alabama AL SE 4779735 4447100 4040587 3061743 1828697 Alaska AK WE 710231 626932 550043 128643 63592 Arizona AZ WE 6329013 5130632 3665228 749587 122931 Arkansas AR MW 2915921 2673400 2350725 1909511 1311564 California CA WE 37253956 33871648 29760021 10586223 1485053 Colorado CO WE 5029196 4301261 3294394 1325089 539700 Connecticut CT NE 3574097 3405565 3287116 2007280 908420 237946 Delaware DE MA 897934 783600 666168 318085 184735 59096 DC DC MA 601723 572059 606900 802178 278718 Florida FL SE 18801311 15982378 12937926 2771305 528542 Georgia GA SE 9687653 8186453 6478216 3444578 2216331 82548 Hawaii HI WE 1360301 1211537 1108229 499794 154001 Idaho ID WE 1567582 1293953 1006749 588637 161772 Illinois IL MW 12830632 12419293 11430602 8712176 4821550 Indiana IN MW 6483800 6080485 5544159 3934224 2516462 Iowa IA MW 3046350 2926324 2776755 2621073 2231853 Kansas KS MW 2853118 2688418 2477574 1905299 1470495 Kentucky KY MW 4339362 4041769 3685296 2944806 2147174 73677 Louisiana LA SE 4533372 4468976 4219973 2683516 1381625 Maine ME NE 1328361 1274923 1227928 913774 694466 96540 Maryland MD MA 5773552 5296486 4781468 2343001 1188044 319728 Massachusetts MA NE 6547629 6349097 6016425 4690514 2805346 378787 Michigan MI MW 9883635 9938444 9295297 6371766 2420982 Minnesota MN MW 5303925 4919479 4375099 2982483 1751394 Mississippi MS SE 2967297 2844658 2573216 2178914 1551270 Missouri MO MW 5988927 5595211 5117073 3954653 3106665 Montana MT WE 989415 902195 799065 591024 243329 Nebraska NE MW 1826341 1711263 1578385 1325510 1066300 Nevada NV WE 2700551 1998257 1201833 160083 42335 New Hampshire NH NE 1316472 1235786 1109252 533242 411588 141885 New Jersey NJ MA 8791894 8414350 7730188 4835329 1883669 184139 New Mexico NM WE 2059180 1819046 1515069 681187 195310 New York NY MA 19378104 18976457 17990455 14830192 7268894 340120 North Carolina NC SE 9535475 8049313 6628637 4061929 1893810 393751 North Dakota ND MW 672591 642200 638800 619636 319146 Ohio OH MW 11536502 11353140 10847115 7946627 4157545 Oklahoma OK MW 3751354 3450654 3145585 2233351 7903912 Oregon OR WE 3831074 3421399 2842321 1521341 413536 Pennsylvania PA MA 12702379 12281054 11881643 10498012 6302115 434373 Rhode Island RI NE 1052567 1048319 1003464 791896 428556 68825 South Carolina SC SE 4625364 4012012 3486703 2117027 1340316 249073 South Dakota SD MW 814180 754844 696004 652740 401570 Tennessee TN SE 6346110 5689283 4877185 3291718 2020616 35691 Texas TX MW 25145561 20851820 16986510 7711194 3048710 Utah UT WE 2763885 2233169 1722850 688862 276749 Vermont VT NE 625741 608827 562758 377747 343641 85425 Virginia VA MA 8001024 7078515 6187358 3318680 1854184 7476103 Washington WA WE 6724540 5894121 4866692 2378963 518103 West Virginia WV MA 1852996 1808344 1793477 2005552 958800 Wisconsin WI MW 5686986 5363675 4891769 3434575 2069042 Wyoming WY WE 563626 493782 453588 290529 92531 END_END_END
};
}
NAME
wdsinstallfiles - helper script to create new Web::DataService applications
SYNOPSIS
wdsinstallfiles [options]
OPTIONS
-h, --help : print what you are currently reading
-p, --path : the path where application will be created
(current directory if not specified)
-x, --no-check : don't check for the latest version of Web::DataService
(checking version implies internet connection)
-v, --version : print the version of Web::DataService being used
DESCRIPTION
This script is designed to be run inside the main directory of a newly-created Dancer application. It adds the files necessary for the Web::DataService example application (see Web::DataService::Tutorial) which you can then use as a basis for your own project.
EXAMPLE
Here is an application created using dancer and wdsinstallfiles:
$ dancer -a dstest
+ dstest
+ dstest/bin
+ dstest/bin/app.pl
+ dstest/config.yml
+ dstest/environments
+ dstest/environments/development.yml
+ dstest/environments/production.yml
+ dstest/views
+ dstest/views/index.tt
+ dstest/views/layouts
+ dstest/views/layouts/main.tt
+ dstest/lib
+ dstest/lib/dstest.pm
+ dstest/public
+ dstest/public/css
+ dstest/public/css/style.css
+ dstest/public/css/error.css
+ dstest/public/images
+ dstest/public/500.html
+ dstest/public/404.html
+ dstest/public/dispatch.fcgi
+ dstest/public/dispatch.cgi
+ dstest/public/javascripts
+ dstest/public/javascripts/jquery.js
+ dstest/Makefile.PL
+ dstest/t
+ dstest/t/002_index_route.t
+ dstest/t/001_base.t
$ cd dstest
$ wdsinstallfiles
! ./config.yml exists, overwrite? [N/y/a]: a
+ ./config.yml
./bin
+ bin/dataservice.pl
./public
public/css
+ public/css/dsdoc.css
./lib
+ lib/PopulationData.pm
+ lib/Example.pm
./doc
+ doc/doc_footer.tt
+ doc/doc_not_found.tt
+ doc/index.tt
+ doc/doc_header.tt
doc/formats
+ doc/formats/index.tt
+ doc/formats/json_doc.tt
+ doc/formats/text_doc.tt
+ doc/doc_defs.tt
+ doc/special_doc.tt
+ doc/operation.tt
+ doc/doc_strings.tt
./data
+ data/population_data.txt
The application is ready to serve:
$ bin/dataservice.pl
>> Listening on 0.0.0.0:3000
== Entering the development dance floor ...
AUTHOR
This script has been written by Michael McClennen <mmcclenn@cpan.org>, based on the "dancer" script from the Dancer distribution.
SOURCE CODE
See Web::DataService for more information.
LICENSE
This module is free software and is published under the same terms as Perl itself.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 1129:
Expected text after =item, not a number
- Around line 1134:
Expected text after =item, not a number
- Around line 1139:
Expected text after =item, not a number