From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 11 April 2006 16:25
To: Brian Raven
Cc: [email protected]
Subject: Re: messy regex

 
> hi brian --   
>  
> i tend to reserve the use of the DATA handle to configuration-ish
purposes
> and to other uses that are integral to the operation of the code (or
of a
> module) rather than for testing.   see, e.g., ``perldoc SelfLoader''.

>  
> some reasons for this...
>  
> firstly, there does not seem to be (or i have not yet found) a neat,
simple
> way to fall back to use of the DATA filehandle in the absence of a
file
> name specified on the command line.   matters are further complicated
> by the difference between the ``lexical scalar reference'' filehandle,
which 
> i prefer, and the ``package global'' nature of the DATA filehandle.   

my $datafd = IO::Handle->new_from_fd(*DATA, "r") or die "...";

>  
> secondly, if you have a mechanism, neat or not, for automatic fallback

> to built-in test data in the absence of ``real-world'' data (almost
always, in 
> my experience, contained in a separate file), it is extremely easy --
at least
> for me -- to get confused about just what data you are really working
with.   
> after about the second or third time i discovered that, because the
data file 
> was in a different directory or for some other reason inaccessible, i
had been 
> exercising some mickey-mouse, built-in data over and over again
instead 
> of gnarly, real-world data, i started to avoid the built-in test data
technique.   
>  
> and thirdly...   i think there was a third reason, but i can't think
of it 
> right now, so...   

Personally I rarely use __DATA__ in "real" scripts. The point I was
trying to make was that when posting example code to a forum such as
this, it is easier for the recipient(s) if the test data is included
after the __DATA__ tag. In that way it only requires a single cut &
paste in order to try it.

HTH

-- 
Brian Raven 


=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to