Hi friends, :)
In a shell script i found the following if condition.
echo -n "Which version of $1 do you want to restore ('0' to quit)? : "
read desired
if ${desired:=1} -ge $index ] ; then
echo "$0: Restore canceled by user: index value too big." >&2
exit 1
fi
Can... (1 Reply)
i have a paramter data_date in which i am passing a string value.i want to find out another paramter file_date from this.the logic is given below
if day of data_date = sunday or monday
then
file_date=data_date-1
else
file_date=data_date-2
i am passing data_date as 20061027.
how can i... (3 Replies)
Hi,
I am trying to execute this command, but is it not working, says "`;' unexpected"
eval $lgrep $SAM_CMD ; if ; then ; echo "No Error" ; fi
What i want is, return the command output, if it is non zero, say "No Error".
Thanks, John. (21 Replies)
Hi
I have to evaluate multiple conditions with an 'or'.
Here is an example:
if
when i use the above i get a error message
'
Please help me to know if i am missing something in the syntax.
how do i achieve multiple "or" in the same if condition.
Thanks. (11 Replies)
Executed the following if conditions .. and got different results .
only (( )) gave correct o/p with all scenarios .
Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition.
And why each condition gave different result.
1.... (2 Replies)
hi,
I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command
Here are my simple script
After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
Hi all
Unix newbie - please be gentle
Am modifying an existing script to error trap a variable with a length of 0
#!/bin/bash
ipfile='/var/data/bin/ipaddress'
] && ipold="$(< "$ipfile" )"
ipnew="$( wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //;s/<.*$//' )"
#... (6 Replies)
o/p of my command is given below
My requirement is
if Pnumber is 0 then
stabilization.Build.2013
else
stabilization.PBuild.2013.3 (11 Replies)
Discussion started by: nikhil jain
11 Replies
LEARN ABOUT DEBIAN
dbix::class::helper::row::tojson
DBIx::Class::Helper::Row::ToJSON(3pm) User Contributed Perl Documentation DBIx::Class::Helper::Row::ToJSON(3pm)NAME
DBIx::Class::Helper::Row::ToJSON - Remove the boilerplate from your TO_JSON functions
VERSION
version 2.013002
SYNOPSIS
package MyApp::Schema::Result::KittenRobot;
use base 'DBIx::Class::Core';
__PACKAGE__->load_components(qw{Helper::Row::ToJSON});
__PACKAGE__->table('KittenRobot');
__PACKAGE__->add_columns(
id => {
data_type => 'integer',
is_auto_increment => 1,
},
kitten => {
data_type => 'integer',
},
robot => {
data_type => 'text',
is_nullable => 1,
},
your_mom => {
data_type => 'blob',
is_nullable => 1,
is_serializable => 1,
},
);
1;
This helper adds a JSON method like the following:
sub TO_JSON {
return {
id => $self->id,
kitten => $self->kitten,
# robot => $self->robot, # <-- doesn't serialize text columns
your_mom => $self->your_mom, # <-- normally wouldn't but explicitly
# asked for in the column spec above
}
}
METHODS
_is_column_serializable
$self->_is_column_serializable('kitten')
returns true if a column should be serializable or not. Currently this marks everything as serializable unless "is_serializable" is set to
false, or "data_type" is a "blob", "text", or "ntext" columns. If you wanted to only have explicit serialization you might override this
method to look like this:
sub _is_column_serializable {
my ( $self, $column ) = @_;
my $info = $self->column_info($column);
return defined $info->{is_serializable} && $info->{is_serializable};
}
serializable_columns
$self->serializable_columns
simply returns a list of columns that TO_JSON should serialize.
TO_JSON
$self->TO_JSON
returns a hashref representing your object. Override this method to add data to the returned hashref:
sub TO_JSON {
my $self = shift;
return {
customer_name => $self->customer->name,
%{ $self->next::method },
}
}
AUTHOR
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-18 DBIx::Class::Helper::Row::ToJSON(3pm)