Gotcha. Did you do the test that has the module just print a variable by name?
IE
print "ID - $school_id \n"; # from within the module

That is to see if it has to with refs or all variables.

IE the module isn't seeing the refs ($$f) obviously but can it see the actual non ref 
version?

If it can see the real version then it's a ref issue if not it's an all variables 
issue.
Knowing that will help narrow the problem down.

Dan

-----Original Message-----
From: Joe Mecklin [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 13, 2003 1:20 PM
To: [EMAIL PROTECTED]
Subject: RE: reference problem (i think)


Dan,

here is the output with your additions.  

BEFORE :: ID - 101
NM - Arapaho Elementary
AD - 1300 Cypress Dr.

#       this is the call to clear_input in ISD.pm
$fields = school_id, school_name, school_address
@field = school_id school_name school_address
$f = school_id = ..
$f = school_name = ..
$f = school_address = ..

AFTER :: ID - 101
NM - Arapaho Elementary
AD - 1300 Cypress Dr.

#       this is the output to clear_input2 in school_data (all code in
the same file)
$fields = school_id, school_name, school_address
@field = school_id school_name school_address
$f = school_id = .101.
$f = school_name = .Arapaho Elementary.
$f = school_address = .1300 Cypress Dr.. 

both routines are carbon copies of each other.  i used "our" simply to see if it might 
affect how the data got passed to ISD.  no effect.  but while writing this, i changed 
them back to "my" and the clear_input2 call no longer displayed the values.  God keep 
me from being bored with simplicity *g*.

also, while the ultimate goal is to null the variables, currently all i'm doing is 
printing out the values of the variables being referred to in the arguments being 
passed to clear_input() and clear_input2(), on the premise if i can't read the 
existing data in those variables, i won't be able to write new data to those variables.

and thanks for all your help so far, i do appreciate it.

joe


On Mon, 2003-01-13 at 12:42, Dan Muey wrote:
> What is the output of the code I sent when you use 'clear_input2'?
> 
> If it makes the variables blank then the module code works ok and we 
> need to figure out why your module can't use refs or otherwise access 
> your variables. Then we need to determin if it's all variables or just 
> refs.
> 
> If not then we also need to get the rigfht code for the original 
> purpose.
> 
> This should give us some helpful info :
> 
> #!/usr/bin/perl
>  
>  $school_id = "SKOOL ID";
>  $school_name = "SKOOL NM";
>  $school_address = "SKOOL AD";
>  
>  Print "BEFORE :: ID - $school_id \n NM - $school_name \n AD -
>  $school_address \n";
>  # put the code here instead and have it do this in the routine 
> print "TEST $test_var \n"; # this will let us know if it can access the variable 
>directly or not
>  #&ISD::clear_input(FIELDS => "school_id, school_name, school_address");
>  
>  Print "AFTER :: ID - $school_id \n NM - $school_name \n AD -
>  $school_address \n";
>  
>  exit;
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Joe Mecklin [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 13, 2003 12:34 PM
> To: Dan Muey
> Subject: RE: reference problem (i think)
> 
> 
> Dan,
> 
> here is the output with your additions.
> 
> BEFORE :: ID - 101
> NM - Arapaho Elementary
> AD - 1300 Cypress Dr.
> 
> #     this is the call to clear_input in ISD.pm
> $fields = school_id, school_name, school_address
> @field = school_id school_name school_address
> $f = school_id = ..
> $f = school_name = ..
> $f = school_address = ..
> 
> AFTER :: ID - 101
> NM - Arapaho Elementary
> AD - 1300 Cypress Dr.
> 
> #     this is the output to clear_input2 in school_data (all code in the
> same file)
> $fields = school_id, school_name, school_address
> @field = school_id school_name school_address
> $f = school_id = .101.
> $f = school_name = .Arapaho Elementary.
> $f = school_address = .1300 Cypress Dr..
> 
> both routines are carbon copies of each other.  i used "our" simply to 
> see if it might affect how the data got passed to ISD.  no effect.  
> but while writing this, i changed them back to "my" and the 
> clear_input2 call no longer displayed the values.  God keep me from 
> being bored with simplicity *g*.
> 
> and thanks for all your help so far, i do appreciate it.
> 
> joe
> 
> 
> On Mon, 2003-01-13 at 12:09, Dan Muey wrote:
> > Try just this :
> > 
> > #!/usr/bin/perl
> > 
> > use ISD; # or whatever you need to be able to use you module
> > 
> > $school_id = "SKOOL ID";
> > $school_name = "SKOOL NM";
> > $school_address = "SKOOL AD";
> > 
> > Print "BEFORE :: ID - $school_id \n NM - $school_name \n AD -
> > $school_address \n";
> > 
> > &ISD::clear_input(FIELDS => "school_id, school_name, 
> > school_address");
> > 
> > Print "AFTER :: ID - $school_id \n NM - $school_name \n AD -
> > $school_address \n";
> > 
> > exit;
> > 
> > Run that code and send me the output. I've never seen that use of
> > 'our' where did you get that from? ( It could be totally legit I've just never 
>seen it. )
> > 
> > Dan
> > 
> > -----Original Message-----
> > From: Joe Mecklin [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 13, 2003 12:05 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: reference problem (i think)
> > 
> > 
> > yes, the variables exist in the calling program (school_data), 
> > defined
> > at the beginning of the program (my $school_id, my $school_name, etc).
> > if i pass the actual variable, i get the stored value ("135" in the 2nd printout 
>listing.  i've tried using "my" and "our", to no effect.
> > 
> > this is part of an html form; the variables are defined as ""
> > initially, but receive the new chosen value each time the page is 
> > refreshed (hence the "135" below).
> > 
> > in "school_data", the relevant parts are (currently):
> > our $school_id;
> > our $school_name;
> > our $school_address;
> > 
> > <intermediate setup code>
> > 
> > &ISD::clear_input(FIELDS => "school_id, school_name, 
> > school_address");
> > 
> > <rest of code>
> > 
> > with the results listed below.
> > 
> > 
> > 
> > 
> > On Mon, 2003-01-13 at 11:49, Dan Muey wrote:
> > > Are there actually variables earlier in the script?
> > > 
> > > $school_id = "SKOOL ID";
> > > $school_name = "SKOOL NM";
> > > $school_address = "SKOOL AD";
> > > 
> > > Print "ID - $school_id \n NM - $school_name \n AD - 
> > > $school_address \n";
> > > 
> > > Run that then the code you have now and see what you get. Also 
> > > print "\$f = $f = .$$f." may be better as -$$f- instead of .$$f. 
> > > just incase it's trying to use a var named $f. instead of $f.
> > > 
> > > Dan
> > > -----Original Message-----
> > > From: Joe Mecklin [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, January 13, 2003 11:44 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: reference problem (i think)
> > > 
> > > 
> > > thanks Dan, but no go.  here is the current incarnation, based on
> > > your
> > > suggestion:
> > > 
> > > sub clear_input
> > > {
> > > 
> > >     no strict 'refs';
> > > 
> > >     my %options =   @_; 
> > >     my $fields  =   $options{FIELDS};
> > >     my (@field) =   split /, /, $fields;
> > > 
> > >     print "\$fields = $fields <br />";
> > >     print "\@field = @field <br />";
> > >     foreach $f (@field)
> > >     {
> > >         print "\$f = $f = .$$f. <br />";
> > >     }
> > > }
> > > 
> > > and this is the current output:
> > > 
> > > $fields = school_id, school_name, school_address
> > > @field = school_id school_name school_address
> > > $f = school_id = ..
> > > $f = school_name = ..
> > > $f = school_address = ..
> > > 
> > > i still don't get the value of $school_id, etc.  yet if i pass 
> > > $school_id as an argument i do get the current value of that var, 
> > > only like this (changing only school_id to $school_id):
> > > 
> > > $fields = 135, school_name, school_address
> > > @field = 135 school_name school_address
> > > $f = 135 = ..
> > > $f = school_name = ..
> > > $f = school_address = ..
> > > 
> > > any other suggestions/insights/directions, please?
> > > 
> > > 
> > > 
> > > 
> > > On Mon, 2003-01-13 at 11:07, Dan Muey wrote:
> > > 
> > > > foreach $f(@fields) {
> > > > 
> > > >         $$f = ""; # or use undef, whatever
> > > > }
> > > > 
> > > > If strict refs is in use this won't work unless you turn them 
> > > > off
> > > > do the $$f = ""; bit then turn them back on if stricy refs was in 
> > > > use
> > > > 
> > > > So actually ( or somehting like it, I'm in a hurry and may have
> > > > been sloppy )...
> > > > 
> > > > foreach $f(@fields) {
> > > > 
> > > >         no strict 'refs';
> > > >         $$f = "";
> > > >         if(strict refs were on before) { use strict 'refs'; } }
> > > > 
> > > > ...Would be better, not sure exactly how to tell if 'strict refs 
> > > > were on before' but I'm sure there's a way.
> > > > 
> > > > Dan
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> > > additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to