Hi! I'm writing a script which extracts data from a database, and creates a
new database in a different format. The idea is to allow investigators to
extract clinical study data into a format they can analyze. I've written
the program so that it can generate many different types of sql like formats
(right now, SAS and SQL, and MDB). I did this by what I thought was a
fairly clever usage of the package system. I have a variable called
"$output_type", which contains the type of output I want. I then call
various functions like "$output_type->preprint($out)", or
"$output_type->dbquote($value, $dtype)", etc.
I then have (below the end of the main program), added things like:
....program....
package sas;
use strict;
use warnings;
sub preprint {
...
}
sub dbquote {
...
}
package sql;
use strict;
use warnings;
sub preprint {
...
}
sub dbquote {
...
}
This actually works very well, and I'm rather proud of it, as this is the
first time I've really done something like this. However, there is one fly
in the ointment.
There are certain variables that I want to use in many subprocedures in
these various packages, so I figured that I could just write "my $TEMPDIR =
..." after the use warnings;, and then I'd be able to use them in the sub
procedures. After all -- this works when I'm not doing many packages.
However, I can't get the value to be used! When referenced from within a
sub (like, say, sub dbquote), it evaluates to undef, _not_ to "c:/temp", as
I have defined it to be.
I then tried, just for the heck of it, changing the 'my' declarations into
'our' declarations. But this didn't help.
Can anyone explain what I'm doing wrong?
Thanks muchly,
Ricky Morse
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm