Is there a way to get the command line arguments.
I am using getopt(3) but if the arguments are more than one for a particular option than it just ignores the second argument. For eg
./a.out -x abc def
now abd will be got with -x using getopt "( x : )" and string abc\0def will get stored... (7 Replies)
how to parse the command line argument to look for '@' sign and the following with '.'.
In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format.
rmjoe123@hotmail.com has '@' sign and followed by a '.'
to be more... (1 Reply)
Hi,
My perl script takes few switches which i'm parsing through GetOpt::Long module.
My script looks like something :
myscript.pl --file="foo" --or --file="bar"
The --file switch takes 2 arguments foo and bar.
The 2 values of file are separated by --or switch. I want to ensure that... (1 Reply)
Looking for a little help parsing some command line arguments in a bash script I am working on, this is probably fairly basic to most, but I do not have much experience with it.
At the command line, when the script is run, I need to make sure the argument passed is a file, it exists in the... (3 Replies)
I have a simple script that builds a complex program call which passes a number of parameters to the program. I'm trying to enhance the script to include the value of the command line parameter in the name of a file being created. The problem I'm having is that the parameter may include a forward... (11 Replies)
Hi,
I've a python script called aaa.py and passing an command line option " -a" to the script like, ./aaa.py -a
& Inside the script if the -a option is given I do some operation if not something else.
code looks like
./aaa.py -a
.
.
if options.a
---some operation---
if not options.a... (1 Reply)
I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere.
I can not supply any sample file as it contains private data but you can download your own contacts using this script:
#!/bin/sh
# imports... (9 Replies)
below is the output xml string from some other command and i will be parsing it using awk
cat /tmp/alerts.xml
<Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Hi all
I need to put a command line parser together to parse numeric fields and ranges passed to a script. I'm looking for a bash function that is as elegant and simple as possible.
So the input would be of the following form -
1,2,8-12
This would return -
1,2,8,9,10,11,12
Input can... (7 Replies)
I would like to take a fasta file formated like
>0001
agttcgaggtcagaatt
>0002
agttcgag
>0003
ggtaacctga
and use command line perl to move the all sample gt 8 in length to a new file. the result would be
>0001
agttcgaggtcagaatt
>0003
ggtaacctga
cat ${sample}.fasta | perl -lane... (2 Replies)
Discussion started by: jdilts
2 Replies
LEARN ABOUT MOJAVE
moose::autobox
Moose::Autobox(3) User Contributed Perl Documentation Moose::Autobox(3)NAME
Moose::Autobox - Autoboxed wrappers for Native Perl datatypes
SYNOPOSIS
use Moose::Autobox;
print 'Print squares from 1 to 10 : ';
print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
DESCRIPTION
Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH & CODE for use with autobox. It does this using a hierarchy of roles in a
manner similar to what Perl 6 might do. This module, like Class::MOP and Moose, was inspired by my work on the Perl 6 Object Space, and the
'core types' implemented there.
A quick word about autobox
The autobox module provides the ability for calling 'methods' on normal Perl values like Scalars, Arrays, Hashes and Code references. This
gives the illusion that Perl's types are first-class objects. However, this is only an illusion, albeit a very nice one. I created this
module because autobox itself does not actually provide an implementation for the Perl types but instead only provides the 'hooks' for
others to add implementation too.
Is this for real? or just play?
Several people are using this module in serious applications and it seems to be quite stable. The underlying technologies of autobox and
Moose::Role are also considered stable. There is some performance hit, but as I am fond of saying, nothing in life is free. Note that this
hit only applies to the use of methods on native Perl values, not the mere act of loading this module in your namespace.
If you have any questions regarding this module, either email me, or stop by #moose on irc.perl.org and ask around.
Adding additional methods
Moose::Autobox asks autobox to use the Moose::Autobox::* namespace prefix so as to avoid stepping on the toes of other autobox modules.
This means that if you want to add methods to a particular perl type (i.e. - monkeypatch), then you must do this:
sub Moose::Autobox::SCALAR::bar { 42 }
instead of this:
sub SCALAR::bar { 42 }
as you would with vanilla autobox.
METHODS
mixin_additional_role ($type, $role)
This will mixin an additional $role into a certain $type. The types can be SCALAR, ARRAY, HASH or CODE.
This can be used to add additional methods to the types, see the examples/units/ directory for some examples.
TODO
More docs
More tests
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
with contributions from:
Anders (Debolaz) Nor Berle
Matt (mst) Trout
renormalist
COPYRIGHT AND LICENSE
Copyright 2006-2008 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.18.2 2013-10-27 Moose::Autobox(3)