Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved from P::E::Types to MooseX::Types::NumUnit for eV stuff. Next w…

…ill be to use if for all units.
  • Loading branch information...
commit 6a459c563d58eb3a4d208d9edeba2d7c330675ad 1 parent e43c04e
@jberger authored
View
2  Cooke.pl
@@ -14,7 +14,7 @@
my $laser = Physics::UEMColumn::Laser->new(
width => 1e-3,
duration => 1e-12,
- energy => '4.75eV',
+ energy => '4.75 eV',
);
my $acc = Physics::UEMColumn::DCAccelerator->new(
View
4 lib/Physics/UEMColumn/Auxiliary.pm
@@ -32,8 +32,8 @@ use constant {
sub Ta() {
return (
- energy_fermi => '5.3eV',
- work_function => '4.25eV',
+ energy_fermi => '5.3 eV',
+ work_function => '4.25 eV',
);
}
View
4 lib/Physics/UEMColumn/Laser.pm
@@ -3,9 +3,9 @@ use Method::Signatures::Modifiers;
class Physics::UEMColumn::Laser {
- use Physics::UEMColumn::Types qw/ Energy /;
+ use MooseX::Types::NumUnit qw/num_of_unit/;
- has 'energy' => ( isa => Energy, is => 'ro', required => 1, coerce => 1);
+ has 'energy' => ( isa => num_of_unit('J'), is => 'ro', required => 1 );
has 'width' => ( isa => 'Num', is => 'rw', required => 1 );
has 'duration' => ( isa => 'Num', is => 'rw', required => 1 );
View
8 lib/Physics/UEMColumn/Photocathode.pm
@@ -3,12 +3,14 @@ use Method::Signatures::Modifiers;
class Physics::UEMColumn::Photocathode {
- use Physics::UEMColumn::Types qw/Energy/;
+ use MooseX::Types::NumUnit qw/num_of_unit/;
use Physics::UEMColumn::Pulse;
use Physics::UEMColumn::Auxiliary qw/:constants/;
- has 'energy_fermi' => ( isa => Energy, is => 'ro', required => 1, coerce => 1);
- has 'work_function' => ( isa => Energy, is => 'ro', required => 1, coerce => 1);
+ my $type_energy = num_of_unit( 'J' );
+
+ has 'energy_fermi' => ( isa => $type_energy, is => 'ro', required => 1 );
+ has 'work_function' => ( isa => $type_energy, is => 'ro', required => 1 );
has 'location' => ( isa => 'Num', is => 'ro', default => 0 );
method generate_pulse (Physics::UEMColumn::Column $column, Num $num) {
View
23 lib/Physics/UEMColumn/Types.pm
@@ -1,23 +0,0 @@
-package Physics::UEMColumn::Types;
-
-use strict;
-use warnings;
-
-use Physics::UEMColumn::Auxiliary ':constants';
-
-use MooseX::Types -declare => [ qw/
- Energy
-/ ];
-
-# import builtin types
-use MooseX::Types::Moose qw/Num Str/;
-
-subtype Energy,
- as Num;
-
-coerce Energy,
- from Str,
- via { my $in = $_; if ( $in =~ s/ *eV// ) { qe * $in } else { $in } };
-
-1;
-
Please sign in to comment.
Something went wrong with that request. Please try again.