mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 09:13:08 +00:00
Remove trailing spaces in file docs/source/developers/guides/code/code_standard.rst
This commit is contained in:
parent
2002a81708
commit
97041f92d4
@ -20,7 +20,7 @@ How to install ``perltidy`` tool:
|
||||
* **[RHEL]** ::
|
||||
|
||||
yum install perltidy.noarch
|
||||
|
||||
|
||||
* **[UBUNTU]** ::
|
||||
|
||||
apt-get install perltidy
|
||||
@ -31,15 +31,15 @@ Code Standard Example:
|
||||
::
|
||||
|
||||
#! /usr/bin/perl
|
||||
|
||||
|
||||
# This is a perl program example to demo the recommended
|
||||
# style to write perl code
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
=head3 subroutine_example
|
||||
Descriptions:
|
||||
This a subroutine to demo how to write perl code
|
||||
@ -51,46 +51,46 @@ Code Standard Example:
|
||||
0 - success
|
||||
0 - fail
|
||||
=cut
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub subroutine_example {
|
||||
my ($param1, $param2, $param3) = @_;
|
||||
|
||||
|
||||
print "In the subroutine subroutine_example.\n";
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Declare variables
|
||||
my $a_local_scale;
|
||||
my @a_local_array;
|
||||
my %a_local_hash;
|
||||
|
||||
|
||||
$a_local_scale = 1;
|
||||
|
||||
|
||||
@a_local_array = ("a", "b", "c");
|
||||
|
||||
|
||||
%a_local_hash = (
|
||||
"v1" => 1,
|
||||
"v2" => 2,
|
||||
"v3" => 3,
|
||||
);
|
||||
|
||||
|
||||
# Demo how to check the key of hash
|
||||
if (%a_local_hash and
|
||||
defined($a_local_hash{v1}) and
|
||||
defined($a_local_hash{v2}) and
|
||||
defined($a_local_hash{v3})) {
|
||||
|
||||
|
||||
# Calculate the sum of values
|
||||
my $sum_of_values = $a_local_hash{v1}
|
||||
+ $a_local_hash{v2}
|
||||
+ $a_local_hash{v3};
|
||||
|
||||
|
||||
print "The sum of values: $sum_of_values.\n";
|
||||
}
|
||||
|
||||
|
||||
# Demo how to check whether the array is empty
|
||||
if (@a_local_array) {
|
||||
print "Has element in array: " . join(',', @a_local_array) . "\n";
|
||||
@ -102,8 +102,8 @@ Code Standard Example:
|
||||
# None of above
|
||||
print "Get into the default path.\n";
|
||||
}
|
||||
|
||||
|
||||
# Call the subroutine subroutine_example()
|
||||
subroutine_example($a_local_scale, \@a_local_array, %a_local_hash);
|
||||
|
||||
|
||||
exit 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user