File: simple1

package info (click to toggle)
libclass-methodmaker-perl 2.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 524 kB
  • sloc: perl: 1,849; objc: 492; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (9)
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
use strict;

  package MyClass;

  use Class::MethodMaker
    [ scalar => [qw/ name /],
      new    => [qw/ new  /],
    ];

  package main;

  my $m = MyClass->new;
  my $n;
  $\ = "\n";

  print $m->name_isset ? "true" : "false";     # false

  $m->name("foo");
  $n = $m->name;
  print defined $n ? "->$n<-" : "*undef*";     # ->foo<-
  print $m->name_isset ? "true" : "false";     # true

  $m->name(undef);
  $n = $m->name;
  print defined $n ? "->$n<-" : "*undef*";     # *undef*
  print $m->name_isset ? "true" : "false";     # true

  $m->name_reset;
  $n = $m->name;
  print defined $n ? "->$n<-" : "*undef*";     # *undef*
  print $m->name_isset ? "true" : "false";     # false