Method #2 translation=$(trans -s en -t fr -b "$line")
Perhaps method #2 uses an API and Google sees it as a separate thing? Anyways, it's always worked for me. I must caution you that you cannot safely translate in bulk more often than every 12 seconds. You may get away with it for several rounds, but you will inevitably be banned. You have this set to 2 seconds. It bans me when I follow your default.
For something like this, I would highly recommend Perl; it's much more powerful and was made to handle all kinds of file formats that awk and sed can't do. Awk and sed cannot even do a REGEX look-behind.
I've been at the computer for hours, so I'm taking a break. I'll test your fixes when I'm refreshed (tonight or tomorrow).
What is the correct format for a single command that would combine portions of 2 different lines in the command history? I'm using a C shell. Here's a simplified command history to clarify:
4 rm file1
5 ls -ld file2 file3 file4
6 cat file 5
With the above history, what would be the... (5 Replies)
I would like to change the lines:
originalline1
originalline2
to:
originalline1new
originalline1newline
originalline2new
originalline2newline
To do this, id like to combine the commands:
sed 's/^/&new/g' file > newfile1
and
sed '/^/ a\\
newline\\
\\ (2 Replies)
Hello all,
I am trying to list and count all the files of a particular type in any given directory. I can use the commands separately but when I combine them they do not give an output.
The command for counting the files is ls -1 | wc -l and for listing all the file of particular type say... (2 Replies)
Is there anyway to achieve "find /home -name "*.bashrc" 2>/dev/null" and "PS1="\n>"" in the same command? I just wanna add a line to the previous command to change the PS1 variable to ">". (1 Reply)
Hi Guys,
I am looking to optimze these 5 SSH lines to a single SSH to get my machine to not hang! lol!
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} top -b > util/{}.top &' >> r_query_info
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} uname -r... (5 Replies)
hey can anyone tell me how can i combine these two commands so that it is executed only once, but gives me both the results.
IDLE=`sar 30 6 | grep Average | awk '{print $1 $5}' `
sar 30 120 | awk '{print $1" "$5}' >> mailx -m -s "$MSG" xyz@abc.com. (5 Replies)
Hi,
I have a directory with some XML files in it. I can use wildcards to get the list of XMLs I want
say I have following XMLs in same dir
Employee1.xml
Employee2.xml
Employee3.xml
and
Salary1.xml
Salary2.xml
Salary3.xml
apart from other .txt .dat files etc
I want to write a unix... (7 Replies)
I have a directory of 3000 files without extensions (Solaris 5.10).
I would like to iterate the file names through the 'file' command and output their mime types (most are pdf or jpg, but a very few might be psd or swf which show simply as 'data')
So, I would like the output of the 'ls'... (2 Replies)
Hello all,
I need to send an attachment and text in the body, both in the same Email.
Below are two cammand that send the required data in separate Emails. I need to combine them so that I get just 1 Email containing the attachment & text in the body.
uuencode ${filename} "${file_}" |... (6 Replies)
Discussion started by: Junaid Subhani
6 Replies
LEARN ABOUT DEBIAN
method::signatures::modifiers
Method::Signatures::Modifiers(3pm) User Contributed Perl Documentation Method::Signatures::Modifiers(3pm)NAME
Method::Signatures::Modifiers - use Method::Signatures from within MooseX::Declare
SYNOPSIS
use MooseX::Declare;
use Method::Signatures::Modifiers;
class Foo
{
method bar (Int $thing) {
# this method is declared with Method::Signatures instead of MooseX::Method::Signatures
}
}
# -- OR --
use MooseX::Declare;
class My::Declare extends MooseX::Declare
{
use Method::Signatures::Modifiers;
}
# ... later ...
use My::Declare;
class Fizz
{
method baz (Int $thing) {
# this method also declared with Method::Signatures instead of MooseX::Method::Signatures
}
}
DESCRIPTION
Allows you to use Method::Signatures from within MooseX::Declare, both for the "method" keyword and also for any method modifiers
("before", "after", "around", "override", and "augment"). Typically method signatures within MooseX::Declare are provided by
MooseX::Method::Signatures. Using Method::Signatures instead provides several advantages:
o MooseX::Method::Signatures has a known bug with Perl 5.12.x which does not plague Method::Signatures.
o Method::Signatures may provide substantially better performance when calling methods, depending on your circumstances.
o Method::Signatures error messages are somewhat easier to read (and can be overridden more easily).
However, Method::Signatures cannot be considered a drop-in replacement for MooseX::Method::Signatures. Specifically, the following
features of MooseX::Method::Signatures are not available to you (or work differently) if you substitute Method::Signatures:
Types for Invocants
MooseX::Method::Signatures allows code such as this:
method foo (ClassName $class: Int $bar) {
}
Method::Signatures does not allow you to specify a type for the invocant, so your code would change to:
method foo ($class: Int $bar) {
}
"where" Constraints
MooseX::Method::Signatures allows code like this:
# only allow even integers
method foo (Int $bar where { $_ % 2 == 0 }) {
}
Method::Signatures does not currently allow this, although it is a planned feature for a future release.
Parameter Aliasing (Labels)
MooseX::Method::Signatures allows code like this:
# call this as $obj->foo(bar => $baz)
method foo (Int :bar($baz)) {
}
This feature is not currently planned for Method::Signatures.
Placeholders
MooseX::Method::Signatures allows code like this:
method foo (Int $bar, $, Int $baz)) {
# second parameter not available as a variable here
}
This feature is not currently planned for Method::Signatures.
Traits
In MooseX::Method::Signatures, "does" is a synonym for "is". Method::Signatures does not honor this.
Method::Signatures supports several traits that MooseX::Method::Signatures does not.
MooseX::Method::Signatures supports the "coerce" trait. Method::Signatures does not currently support this, although it is a planned
feature for a future release, potentially using the "does coerce" syntax.
BUGS, CAVEATS and NOTES
Note that although this module causes all calls to MooseX::Method::Signatures from within MooseX::Declare to be completely replaced by
calls to Method::Signatures (or calls to Method::Signatures::Modifiers), MooseX::Method::Signatures is still loaded by MooseX::Declare.
It's just never used.
The "compile_at_BEGIN" flag to Method::Signatures is ignored by Method::Signatures::Modifiers. This is because parsing at compile-time can
cause method modifiers to be added before the methods they are modifying are composed into the Moose classes. Parsing of methods at run-
time is compatible with MooseX::Method::Signatures.
THANKS
This code was written by Buddy Burden (barefootcoder).
The import code for replacing MooseX::Method::Signatures is based on a suggestion from Nick Perez.
LICENSE
Copyright 2011 by Michael G Schwern <schwern@pobox.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
SEE ALSO
MooseX::Declare, Method::Signatures, MooseX::Method::Signatures.
perl v5.14.2 2012-06-03 Method::Signatures::Modifiers(3pm)