File: Anon.pm

package info (click to toggle)
libgraph-easy-perl 0.76-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,264 kB
  • sloc: perl: 23,869; makefile: 7
file content (124 lines) | stat: -rw-r--r-- 1,865 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#############################################################################
# (c) by Tels 2004. Part of Graph::Easy. An anonymous group.
#
#############################################################################

package Graph::Easy::Group::Anon;

use Graph::Easy::Group;
use warnings;

@ISA = qw/Graph::Easy::Group/;
$VERSION = '0.76';

use strict;

sub _init
  {
  my $self = shift;

  $self->SUPER::_init(@_);

  $self->{name} = 'Group #' . $self->{id};
  $self->{class} = 'group.anon';

  $self->{att}->{label} = '';

  $self;
  }

sub _correct_size
  {
  my $self = shift;

  $self->{w} = 3;
  $self->{h} = 3;

  $self;
  }

sub attributes_as_txt
  {
  my $self = shift;

  $self->SUPER::attributes_as_txt( {
     node => {
       label => undef,
       shape => undef,
       class => undef,
       } } );
  }

sub as_pure_txt
  {
  '( )';
  }

sub _as_part_txt
  {
  '( )';
  }

sub as_graphviz_txt
  {
  my $self = shift;

  my $name = $self->{name};

  # quote special chars in name
  $name =~ s/([\[\]\(\)\{\}\#])/\\$1/g;

  '"' .  $name . '"';
  }

sub text_styles_as_css
  {
  '';
  }

sub is_anon
  {
  # is an anon group
  1;
  }

1;
__END__

=head1 NAME

Graph::Easy::Group::Anon - An anonymous group of nodes in Graph::Easy

=head1 SYNOPSIS

	use Graph::Easy::Group::Anon;

	my $anon = Graph::Easy::Group::Anon->new();

=head1 DESCRIPTION

A C<Graph::Easy::Group::Anon> represents an anonymous group of nodes,
e.g. a group without a name.

The syntax in the Graph::Easy textual description language looks like this:

	( [ Bonn ] -> [ Berlin ] )

This module is loaded and used automatically by Graph::Easy, so there is
no need to use it manually.

=head1 EXPORT

None by default.

=head1 SEE ALSO

L<Graph::Easy::Group>.

=head1 AUTHOR

Copyright (C) 2004 - 2006 by Tels L<http://bloodgate.com>.

See the LICENSE file for more details.

=cut