App-RecordStream
view release on metacpan or search on metacpan
Getopt::Long::Configure(qw( require_order pass_through ));
GetOptions(
'h|help' => sub { print usage(); exit },
'l|list-commands' => sub { print "$_\n" for known_ops(); exit },
'version' => \&version,
);
# Does the first argument start with a slash (/) or a dot-slash (./)?
my $looks_like_a_file = (@ARGV and $ARGV[0] =~ m{^[.]?/});
# Run a Perl script in this process with our bundled libraries available.
if ($initial_dashdash or $looks_like_a_file) {
my $file = shift @ARGV or die usage();
trace("Running file: $file");
my $rv = do $file;
if (not defined $rv) {
# Pass through compile/runtime errors unmodified
die $@ if $@;
die "Couldn't read file $file: $!\n" if $!;
}
doc/recs-annotate.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-assert.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-eval.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-grep.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-join.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-substream.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
doc/recs-xform.pod view on Meta::CPAN
Special Syntax
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \/
This is exactly the same as a key spec that is always prefaced with a @, see
'man recs' for more info on key specs
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of $r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
lib/App/RecordStream.pm view on Meta::CPAN
=head2 From CPAN
You can also install recs from L<CPAN|http://cpan.org> as App::RecordStream:
cpanm --interactive App::RecordStream
Using L<cpanm> in interactive mode will prompt you for optional feature
support. Other CPAN clients such as L<cpan> and L<cpanp> also work fine, but
you can't opt to use any optional features (just like cpanm in non-interactive
mode). A kitchen-sink install of App::RecordStream looks like:
cpanm --with-recommends --with-all-features App::RecordStream
If you don't have L<cpanm> itself, you can install it easily with:
curl -fsSL https://cpanmin.us | perl - App::cpanminus
=head1 DESCRIPTION
The recs system consists of three basic sets of commands:
lib/App/RecordStream/Executor.pm view on Meta::CPAN
Use {{search_string}} to look for a string in the keys of a record, use /
to nest keys. You can nest into arrays by using an index. If you are
vivifying arrays (if the array doesn't exist, prefix your key with # so
that an array rather than a hash will be created to put a / in your key,
escape it twice, i.e. \\/
This is exactly the same as a key spec that is always prefaced with a @,
see 'man recs' for more info on key specs
__FORMAT_TEXT__
For example: A record that looks like:
{ "foo" : { "bar 1" : 1 }, "zoo" : 2}
Could be accessed like this:
# value of zoo # value of \$r->{foo}->{bar 1}: (comma separate nested keys)
{{zoo}} {{foo/ar 1}}
# Even assign to values (set the foo key to the value 1)
{{foo}} = 1
# And auto, vivify
lib/App/RecordStream/Manual/Story.pm view on Meta::CPAN
recs-frommultire --re 'latency=TIME: (\d*)' --re 'method,url="([^" ]*) ([^" ?]*)' access.log
The first option specifies one field, named "latency" which is the only capture
group of the first regular expression. The second option specifies two fields,
named "method" and "url" which are the two capture groups of the second regular
expression. The final argument is the file to parse. Each regular expression is
run against each line. When a field would be duplicated, all matches so far are
flushed as a record.
The output from recs-frommultire looks like:
{"url":"/view_image.cgi","method":"GET","latency":"0"}
{"url":"/x.gif","method":"GET","latency":"0"}
{"url":"/dbfiles/get.cgi/data.xml","method":"GET","latency":"1"}
{"url":"/helpdesk.html","method":"GET","latency":"1"}
=head1 recs-xform - arbitrary manipulation of records
JSON is mostly human readable and as you can see each record has three fields,
"url", "method", and "latency". Unfortunately "url" isn't quite as we want it.
( run in 0.449 second using v1.01-cache-2.11-cpan-64827b87656 )