object - Working with Types in Perl -


i worked fortran since years , types within fortran of course.

now, since employed @ new company, have work perl.

since main work operate data within text file , have read through file, want generate "objects" or "types" data. in fortran further work easier :)

is possible perl generate types strict type schema can in fortran?

for example ... in fortran:

type demotype     integer     character(256) str end type 

then can work variables of type. type(demotype) demovar e.g.

is there chance work in perl?

sorry english ... native german speaking :)

there cpan modules can you. option: class::struct (which belongs standar perl distribution, no further installation required). example (taken module documentation):

use class::struct;  struct( rusage => {         ru_utime => 'timeval',  # user time used         ru_stime => 'timeval',  # system time used });  struct( timeval => [         tv_secs  => '$',        # seconds         tv_usecs => '$',        # microseconds ]);  # create object: $t = rusage->new(ru_utime=>timeval->new(), ru_stime=>timeval->new());   # $t->ru_utime , $t->ru_stime objects of type timeval. # set $t->ru_utime 100.0 sec , $t->ru_stime 5.0 sec. $t->ru_utime->tv_secs(100); $t->ru_utime->tv_usecs(0); $t->ru_stime->tv_secs(5); $t->ru_stime->tv_usecs(0); 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -