AMF-Perl

 view release on metacpan or  search on metacpan

doc/code.html  view on Meta::CPAN


class cpuUsage:
    
    def getCpuUsage(self, arg):
    
        child = os.popen("uptime")
        output = child.read()
        tokens = output.split()
        
        #Remove commas.
        map(lambda x: x.replace(',', ''),  tokens)
        
        array = []
        hash = {'Name' : 'L 1', 'Value' : tokens[9]}
        array.append(hash)
        hash = {'Name' : 'L 5', 'Value' : tokens[10]}
        array.append(hash)
        hash = {'Name' : 'L 15', 'Value' : tokens[11]}
        array.append(hash)
        return array

doc/cpu.pl  view on Meta::CPAN

    my $self={};
    bless $self, $proto;
    return $self;
}

sub getCpuUsage
{
    my $output = `uptime`;
    my @tokens = split /\s+/, $output;
    #Remove commas.
    @tokens = map {s/,//g; $_} @tokens;
    
    my @array;
    my %hash = ("Name" => 'L 1', "Value" => $tokens[10]);
    push @array, \%hash;
    my %hash1 = ("Name" => 'L 5', "Value" => $tokens[11]);
    push @array, \%hash1;
    my %hash2 = ("Name" => 'L 15', "Value" => $tokens[12]);
    push @array, \%hash2;
    return \@array;
    }

doc/examples/cpu/cpu.pl  view on Meta::CPAN

    bless $self, $proto;
    return $self;
}

sub getCpuUsage
{
    my ($self, $arg1, $arg2) = @_;
    my $output = `uptime`;
    my @tokens = split /\s+/, $output;
    #Remove commas.
    @tokens = map {s/,//g; $_} @tokens;

    my @array;
    my %hash = ("Name" => 'L 1', "Value" => $tokens[10]);
    push @array, \%hash;
    my %hash1 = ("Name" => 'L 5', "Value" => $tokens[11]);
    push @array, \%hash1;
    my %hash2 = ("Name" => 'L 15', "Value" => $tokens[12]);
    push @array, \%hash2;
    return \@array;
}

doc/examples/petmarket/petmarket/api/catalogservice.pm  view on Meta::CPAN

    my @result;

    my @catids;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT a.catid  FROM category a, category_details b WHERE a.catid=b.catid AND b.name like '%$query%'");
    foreach my $rowRef (@$ary_ref)
    {
        my ($catid) = @$rowRef;
        push @catids, $catid;
    }

    @catids = map {"'$_'"} @catids;
    my $catIdList = join ",", @catids;

    my $productQuery = "SELECT DISTINCT a.productid, b.name, a.catid, c.name FROM product a, product_details b, category_details c WHERE a.productid=b.productid AND a.catid=c.catid AND (b.name like '%$query%'";
    $productQuery .= " OR a.catid IN ($catIdList)" if $catIdList;
	$productQuery .= ")";

    $ary_ref = $self->dbh->selectall_arrayref($productQuery);
    foreach my $rowRef (@$ary_ref)
    {
        my ($productid, $productName, $catid, $catName) = @$rowRef;

doc/examples/petmarket/petmarket/api/userservice.pm  view on Meta::CPAN

}

sub updateUser
{
    my ($self, $userObject) = @_;

    return 0 unless $self->authenticate($userObject->{"email"}, $userObject->{"password"});

    my $setString = "";

    my @setStringArray = map {"$_='".$userObject->{$_}."'"} @userFields;
    $setString = join ",", @setStringArray;

    $self->dbh->do("UPDATE user_details SET $setString");

    return $userObject;
}

1;

lib/AMF/Perl/App/Executive.pm  view on Meta::CPAN


# was this defined in the methodTable -- required to enable AMF::Perl service approach
    if (exists ($self->{_classConstruct}->methodTable->{$method}))
    {
# create a shortcut to the methodTable
        my %methodrecord = %{$self->{_classConstruct}->methodTable->{$method}};

# check to see if this method name is aliased
        if (exists ($methodrecord{'alias'}))
        {
# map the _methodname to the alias
            $method = $methodrecord{'alias'};
        }

        if (exists($methodrecord{'instance'}))
        {
# check the instance names to see if they match.  If so, then let this happen
            if (!exists($methodrecord{'instance'}) || $self->{_instanceName} != $methodrecord{'instance'})
            {	
# if they don't match then print STDERR  with this error
            print STDERR  "Access error for " . $self->{_headerFilter} . ".\n";



( run in 0.296 second using v1.01-cache-2.11-cpan-49f99fa48dc )