[22231] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4452 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 23 06:05:39 2003

Date: Thu, 23 Jan 2003 03:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 23 Jan 2003     Volume: 10 Number: 4452

Today's topics:
    Re: @INC Error (Jay Tilton)
    Re: APL's relation to perl <mkent@acm.org>
    Re: Can I store an array into a DataBase? (Stefan Adams)
    Re: commands after system call and before die? (qanda)
    Re: consolidating some regex's <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: convert PDF to text <avishal@vsnl.net>
    Re: Converting a string to a valid date.. (Anno Siegel)
    Re: Getting Values Out of An Object:  How Do I Do This? <avishal@vsnl.net>
        having problems with logonasuser module <jiler@attbi.com>
    Re: help w simple (I think) syntax err (Jay Tilton)
    Re: how to make my perl cgi program run in IE <wsegrave@mindspring.com>
    Re: In the following code snippet, how do I reference a <avishal@vsnl.net>
    Re: In the following code snippet, how do I reference a <tassilo.parseval@post.rwth-aachen.de>
    Re: Inlining object methods via preprocessor for effici (Rich Wales)
    Re: OT: I've got wild staring eyes, and I've got a stro (Tad McClellan)
    Re: Perl monitoring tool <richard@zync.co.uk>
    Re: Problem printing January "The Perl Journal" <bernard.el-hagin@DODGE_THISlido-tech.net>
        Question about "our" (YiWei)
    Re: Question about "our" <ubl@schaffhausen.de>
    Re: Regex to find all words containing a single vowel? <bart.lateur@pandora.be>
    Re: Security with uploaded zip files (Mark)
    Re: Still a little variable trouble. <goldbb2@earthlink.net>
    Re: Still a little variable trouble. <goldbb2@earthlink.net>
    Re: To extract a specific portion of a text file (Tad McClellan)
    Re: Writing gaming "macro" programs <goldbb2@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 23 Jan 2003 06:36:10 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: @INC Error
Message-Id: <3e2f88d6.1300247@news.erols.com>

"matt" <urzaserra@home.com> wrote:

: When i try to run the script below i get this error
: 
: Can't locate /my domain name.com/cgi-bin/data folder/iConfig.pm in @INC

[snip]

: rleevant parts of scripts
: 
: require "/onlinewebpromotion.com/cgi-bin/data folder/iConfig.pm";
: require "/onlinewebpromotion.com/cgi-bin/data folder/iSubs.pm";
: 
: I know that i have the file location right because when enter the filenam
: directly and comes up with an internal server error.

Are you perhaps confusing a filename with a URL?

require() only handles the local filesystem.  It has nothing to do
with the web or the webserver.



------------------------------

Date: Thu, 23 Jan 2003 02:03:16 -0500
From: "Mike Kent" <mkent@acm.org>
Subject: Re: APL's relation to perl
Message-Id: <pan.2003.01.23.07.03.15.520236@acm.org>

On Wed, 22 Jan 2003 09:50:51 +0100, Michele Dondi wrote:

> [followup crossposted to sci.math - should be of interest there]
> 
> On 21 Jan 2003 12:02:04 -0800, genericax@hotmail.com (Sara) wrote:
> 
>>Michele Dondi <bik.mido@tiscalinet.it> wrote in message 
  news:<lhqo2vs8j5hlt7v0lmgvdonu1mopji0vm7@4ax.com>...
>>> On 17 Jan 2003 11:07:57 -0800, genericax@hotmail.com (Sara) wrote:
>>> 
>>> >I WISH! APL is (was) one of the best linear variable programming
>>> >languages in existence. Imagine a primitive function (domino) to
>>> >invert an arbitry matrix (of ANY number of dimensions even!). How many
>>>                                             ^^^^^^^^^^

APL complains when you ask it to invert an array of dimension other 
than two.

>>> <OT>
>>> I don't know APL, I am only a beginner in Perl, and OTOH I'm not an
>>> expert in (multi)linear algebra either, but AFAIK there's no (+ I
>>> can't devise a) generally accepted/acceptable notion of multiplication
>>> (and thus inversion) of "ANY number of dimension"-al matrices, 

I think this is wrong; does the following not define a bilinear
multiplication between certain n- and k-dimensional "matrices"?  
It is a straightforward extension of how you go from inner product
of vectors, to linear transform  of vector by matrix, to product
of matrices:

	Let A_n, A_k be "matrices" of dimensions n, k respectively
	with the n-th axis of A_n having the same length as the
	first axis of A_k.  Let I_n and I_k be the sets of all
	tuples of coordinates of elements of A_n, A_k respectively
	and let J_n and J_k be the sets of (n-1)- and (k-1)-tuples
        obtained by dropping the last element of each tuple in I_n
	and the first element of I_k respectively.  Then if j, j'
	are in J_n, J_k respectively, each specifies a vector v, v' 
	of A_n, A_k respectively ... the items having coordinates
	matching j in all but the last position and j' in all but
	the first, and (j, j') specifies a single cell in an (n+k-2)
	dimensional "matrix".  Let the value in this cell be the 
	inner product v.v'.  This "matrix" is the product A_n*A_k.
	"matrix".

This definition looks strangely familiar ...

Now if n, k are equal, the dimension of A_n*A_k is 2n-2,
which shows (one reason) why n=2 is special. 

In any case ... APL was constructed by a mathematician, for the 
purpose of precisely describing algorithms and computations to
other mathematicians (K.E. Iverson, 1962,  "A Programming Language", 
NY: Wiley), and was made into an executable notation several years
later.  




------------------------------

Date: 22 Jan 2003 21:48:11 -0800
From: stefan@borgia.com (Stefan Adams)
Subject: Re: Can I store an array into a DataBase?
Message-Id: <dcc927de.0301222148.317eb323@posting.google.com>

francescomoi@europe.com (Francesco Moi) wrote in message news:<5b829932.0301221420.2d28a58c@posting.google.com>...
> 
> I'm working with Perl and MySQL, and I would like to store an
> array (@my_array) into a DataBase, so that I can handle it.
> 

I am wanting to do pretty much the same thing right now.

My general intuition tells me that I need to redesign my database with
another table and I can make an array that way:

Using 1 table:
table1:
   list          |
   --------------+-...
   this,and,that |
   some,more     |

Ideally, this would give me a list containing the items this,and,that
and another list containing the items some,more.
But we all know that databases don't work that way.  You could split
on comma.  But then you're like not utilizing the functionality of the
database and are effectively creating a flat text file.

Using 2 tables:
table1:
   id    |
   ------+...
   1     |
   2     |
table2:
   id    | item   |
   ------+--------+...
   1     | this   |
   1     | and    |
   1     | that   |
   2     | some   |
   2     | more   |
Now you can select item from table2 join table1 using (id) where id=2
and chuck those items into an array then.
I believe this is what they call "normalizing"?
You might ask what the point of table 1 is...  That way you can have
single value entries in table1 and multiple value entries in table2.

So, I think I intend to eventually do that, but for me, I need to
store a complex data structure with many nested hashes and arrays and
my head hurts just thinking about the database schema I'd have to
design.  Therefore, in the interim, I have decided that I would just
make a column that's huge (text / mediumtext) and use Data::Dumper to
store the data structure as a string.  Luckily I don't have a huge
need to select on the values in the data structure or else this design
would not work for me.  Actually, I take that back.  I don't "have the
need" because I've coded my program in such a way that it sucks in all
the data, turns that string column back into its data structure and I
search from there.  Given the proper DB schema, I wouldn't have to do
that and I could just do some selects and joins.
And now, I'm not utilizing the functionality of the database...  :)

Anyway, just my thoughts; you can do with it what you want under the
same terms as Perl itself.
Never read the terms so not sure if that makes sense...  :)

SA


------------------------------

Date: 22 Jan 2003 23:34:40 -0800
From: fumail@freeuk.com (qanda)
Subject: Re: commands after system call and before die?
Message-Id: <62b4710f.0301222334.60491522@posting.google.com>

Bart Lateur <bart.lateur@pandora.be> wrote in message news:<ga6t2vknh76v67h00llu37mmprav144rpm@4ax.com>...
> qanda wrote:
> 
> ># Another system call that fails.
> >open( XYZ, "<xyz" ) or $ec = 6 &&
> >	die "Could not open xyz - exiting!\n";
> 
> You have a precedence problem: the die() happens before the assignment.
> Use "and" not "&&". I think it'll work well, then.

Thanks all, I was trying to find out if (in general) I could do some
operation after a system call but before the corresponding die, this
answers my question, thanks again.


------------------------------

Date: Thu, 23 Jan 2003 08:49:17 +0100
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: consolidating some regex's
Message-Id: <hh7v2vofunin0m53aptedq4b11vgec4vf1@4ax.com>

On 22 Jan 2003 22:13:59 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

[...]

>Well, "unless !/.../" is the same as "if /.../".  Avoid negation.
>Double negation is never necessary.  

[...]


Or, to drive the point home, double negation is never not unnecessary.


;-)



Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


------------------------------

Date: Thu, 23 Jan 2003 11:41:58 +0530
From: Vishal Agarwal <avishal@vsnl.net>
Subject: Re: convert PDF to text
Message-Id: <b0o0im$h30$1@news.vsnl.net.in>

Netscape User wrote:

> is there some way to convert a PDF to a text file?
> sometimes I can see some words in a pdf file using a text editor, but it
> looks like a form of binary.
> what method is used?
> who do you decode it?

consider using 'pdf2text' on linux

on a windows machine, download a similar utility from 
http://www.pdfzone.com/toolbox/PDF2Text.html

vishal
p.s. please do a simple google search before posting on the newsgroup
 


------------------------------

Date: 23 Jan 2003 11:03:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Converting a string to a valid date..
Message-Id: <b0oi56$9vo$2@mamenchi.zrz.TU-Berlin.DE>

John W. Krahn <krahnj@acm.org> wrote in comp.lang.perl.misc:

[...]

> my %shortmonths =
>     qw( Jan  1 Feb  2 Mar  3 Apr  4 May  5 Jun  6
>         Jul  7 Aug  8 Sep  9 Oct 10 Nov 11 Dec 12 );

 ...or let Perl generate the consecutive numbers:

    my %shortmonths;
    @shortmonths{ qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)} =
        1 .. 12;

Anno


------------------------------

Date: Thu, 23 Jan 2003 11:31:28 +0530
From: Vishal Agarwal <avishal@vsnl.net>
Subject: Re: Getting Values Out of An Object:  How Do I Do This?  Thanks!
Message-Id: <b0nvv1$h0m$1@news.vsnl.net.in>

opensourcedrm wrote:

> Suppose I have this:
> 
> $data = [
>           {
>             first => 'Jonathan',
>             last => 'Eisenzopf',
>             email => 'eisen@pobox.com'
>           },
>           {
>             first => 'Larry',
>             last => 'Wall',
>             email => 'larry@wall.org'
> }
> ];
> 
> How do I get the value Jonathan?
> 
> Is it $data->first ?
> 
> Thanks for your help!

Obviously, you assume that the first names are unique (which may not be what 
you want). Anyway, this is how you 'may' achieve what you want (considering 
TMTOWDI):

foreach my $person (@$data) {
     print $$person{last} if ($$person{first} eq 'Jonathan');
}

Perhaps a 'better' way of doing it (in my opinon) is:

my $data = {
    "Jonathan" => {last => "Eisenzopf", email => 'eisen@pobox.com'},
    "Larry"    => {last => "Wall", email => 'larry@wall.org'},
};

my ($last_name) = $$data{'Jonathan'}{last};
print "$last_name";


Note, here too, we are assuming that the first names are unique.



------------------------------

Date: Thu, 23 Jan 2003 02:30:50 GMT
From: "jiler" <jiler@attbi.com>
Subject: having problems with logonasuser module
Message-Id: <utIX9.5238$AV4.1547@sccrnsc01>

All,

    I am trying to find an easy way to locally change the adminsitrator
password on a lot of PC's without having to visit each one. I already have a
script that does this remotely from my own Pc but for other reasons we also
need the local PC to be able to change it. The PC's are Win2k and NT. On
Win2k there is no problem, I can just use the runas utility, however, NT is
where the problem arises. We were thinking of tossing a command that will
change it into a logon script but we need to come up with a way to elevate
user permissions to pull this off.
    I am attempting to use the LogonAsUser Win32::AdminMisc module but it
doesn't seem to be working. I also have seen threads where people have had
problems getting this module to work but nobody seems to know much about it
to help.
    What I am doing is trying to log the user on with an elevated username
and then running net user to change the password. I have compiled this into
an .exe but when I run it locally on the PC I get error 5 access is denied
error message. Does anyone have any suggestions as to how I can beat this
problem?

Thanks!




------------------------------

Date: Thu, 23 Jan 2003 02:27:01 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: help w simple (I think) syntax err
Message-Id: <3e2f4e23.499161384@news.erols.com>

"Dick Penny" <penny1482@attbi.com> wrote:

: I get the following syntax err with the following snippet. How should I code
: to avoid error?  I cannot figure it out. Is it even correct?  I do NOT have
: a function pi().  

Yes, you do.

It is exported by one of the modules being use()d.

:Obviously I am using strict, warnings, & math. 
                                          ^^^^
Lowercase is for pragmas.  AFAIK, there is no math pragma.

Perhaps you mean Math::Trig, or Math::Complex.

: -------error
: Ambiguous use of -pi resolved as -&pi()

I guess there's room to get "-pi" confused with the -p operator.

Disambiguate it by saying "- pi/2" or "-pi()/2".



------------------------------

Date: Wed, 22 Jan 2003 22:21:57 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <b0nqqo$6av$1@slb2.atl.mindspring.net>

"Eric" <me@nosmap.com> wrote in message
news:rAGX9.1785$QV3.171677@news2.west.cox.net...
> I'm a total newbie to CGI stuff and was trying to replicate a very simple
> script I found on a web tutorial. Since I dont have Perl installed,

<Off-topic stuff snipped>

> Thanks,
>
> Eric
>
> "William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
<snip>

Clarification: Your Perl cgi program will not execute in IE. The advice I
gave the OP is still recommended.

> > IndigoPerl, available free from www.indigostar.com, is a nice
> pre-configured
> > Perl and Apache installation for your Windows system. Just download and
> > install it, start up Apache, and point your browser to http://localhost.
> If
> > you get the success page, you're ready to go.
> >
> > Now drop a copy of your Perl script into the folder
c:\indigoperl\cgi-bin
> > and point your browser to http://localhost/cgi-bin/your_script_name.pl.
> > Please ensure your Perl script looks something like:
> >
> > #!perl -w
> > # usage -  e.g., in c:\indigoperl\cgi-bin, type ..\bin\perl -c
> > your_script_name.pl
> > # I've put the path to the script above so I don't have to type it
> > # when I'm testing in the "MS-DOS Prompt" window
> > # remove these comments, if you like, replacing them with what you
prefer
> > use strict;
> > use CGI qw(-no_xhtml :standard);
> > print header, start_html;
> > # more code here
> > print end_html;

Please let us know how this works for you.

Cheers.

Bill Segraves






------------------------------

Date: Thu, 23 Jan 2003 11:13:08 +0530
From: Vishal Agarwal <avishal@vsnl.net>
Subject: Re: In the following code snippet, how do I reference a variable?
Message-Id: <b0nusk$grp$1@news.vsnl.net.in>

opensourcedrm wrote:

> #!/usr/bin/perl
> 
> use strict 'vars';
> use warnings;
> 
> my $VAR1 = [{'0' => 'album04'},{'1' => 'album03'},{'2' =>
> 'album02'},{'3' => 'album01'}];
> 
> 
> How do I reference album04?
> 
> $VAR->[{0}] doesn't seem to be working...
> 
> Thanks!

Hi,

You may reference 'album04' as follows:
my ($val) = $$VAR1[0]{0}

Note, $VAR1 is just an address of the data-structure defined by you. Now, 
what you want is, a scalar value, thus use '$' before $VAR1 (i.e. $$VAR1). 
Further, you want the first array element ({'0' => 'album04'}); which makes 
it $$VAR1[0]. Next, you want to fetch the hash value of that array element 
-> $$VAR1[0]{0}.

-vishal






------------------------------

Date: 23 Jan 2003 05:53:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: In the following code snippet, how do I reference a variable?
Message-Id: <b0o005$3th$1@nets3.rz.RWTH-Aachen.DE>

Also sprach opensourcedrm:

> #!/usr/bin/perl
> 
> use strict 'vars';

  use strict;

That implies 'subs', 'vars' and 'refs' and should be the default for any
script with more than, say, 20 lines. If you really need one of these
unsafe operations, switch it off with "no strict 'refs'" or so in the
respective block.

> use warnings;
> 
> my $VAR1 = [{'0' => 'album04'},{'1' => 'album03'},{'2' =>
> 'album02'},{'3' => 'album01'}];
> 
> 
> How do I reference album04?
> 
> $VAR->[{0}] doesn't seem to be working...

You seem to be on war with references. Have you already read perlref.pod
and perldsc.pod? After that you will be comfortable with creating nested
data-structures and dereferencing elements.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Thu, 23 Jan 2003 03:47:32 +0000 (UTC)
From: richw@richw.org (Rich Wales)
Subject: Re: Inlining object methods via preprocessor for efficiency (!?)
Message-Id: <20030123033140.E12771.richw@jessejames.Stanford.EDU>

Earlier, I wrote:

    > I wrote an object-oriented Perl program some time ago
    > which needed to run as fast as possible.

I should probably have said something like "as fast as reasonably
possible for a clearly written Perl program".

Understandably, something written in Perl isn't going to be nearly
as fast as C or C++, but my hope was that a Perl version would (or,
at least, could) be easier to understand and maintain -- especially
considering things like string handling, dynamically expanding
arrays, and hashes, which are really painful in C but elementary
operations in Perl.

And yes, I realize that OO inherently adds some overhead, but the
application in question was a complicated algorithm that, in my
opinion, needed to be written in OO fashion in order to reduce the
likelihood of subtle, hard-to-find bugs.

As for the inline object method issue, I guess I'll try rewriting
them in the conventional way (not inlined via the preprocessor),
and then work with the Perl profiler some more to see how much of
a difference it makes.  Alternatively, I may be able to restructure
the code so that more of the program logic is inside the methods,
so that there'll hopefully be less need to refer to the detailed
contents of an object outside of its implementation.

Rich Wales            richw@richw.org            http://www.richw.org


------------------------------

Date: Wed, 22 Jan 2003 20:37:52 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: OT: I've got wild staring eyes, and I've got a strong urge to fly ...
Message-Id: <slrnb2ulc0.8u5.tadmc@magna.augustmail.com>

Jay Tilton <tiltonj@erols.com> wrote:
> "Richard Gration" <richard@zync.co.uk> wrote:
>: In article <slrnb2tg78.76k.tadmc@magna.augustmail.com>, "Tad McClellan"
>: <tadmc@augustmail.com> wrote:

>: > Is there anybody in there? Just nod if you can hear me.
>: 
>: Just wondering if the above is a deliberate quote? :-)

> Pink Floyd cribbed Tad's work.
> 
> So did the Beatles.


So did The Bearded Rockers from the Great State:

   Message-ID: <c7plm7.4pm.ln@magna.metronet.com>



I show no mercy. I take no prisoners.

Even The Bard himself is not immune from my tender attentions:

   Message-Id: <slrna5l59o.7h9.tadmc@tadmc26.august.net>


:-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 23 Jan 2003 10:22:02 +0000
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: Perl monitoring tool
Message-Id: <20030123.102101.1784639529.1732@richg.zync>

In article <c0bf346e.0301221520.5061efe@posting.google.com>, "Joseph"
<sjoseph@micronpc.com> wrote:


> Hi, I'm looking for some monitoring tools written in PERL to monitor
> Oracle database. Basically, it should page/email DBA's in case of any
> errors occur on database. Does anyone have any idea about this. If not
> I'm planning to write some tool to do the same. Do you have any resource
> so that I can get some help.  Please let me know.
> Thanks - Joseph

This isn't a totally perl solution, but you might want to check out
ftp://ftp.cerias.purdue.edu/pub/tools/unix/netutils/nocol/README.NOCOL

S'very good, we used it at the ISP I used to work at. It uses DBI to
monitor databases.

Rich


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


------------------------------

Date: Thu, 23 Jan 2003 08:19:46 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Problem printing January "The Perl Journal"
Message-Id: <b0o8j2$7fd$2@korweta.task.gda.pl>

In article <cavn0ltlzkn.fsf@pcocd2.intel.com>, Justin Masters - remove
at to reply wrote:
> I am a subscriber to The Perl Journal.  I downloaded my January copy, and
> cannot print it out.  I attempted to contact Kevin Carlson (listed on The Perl
> Journal homepage) and he has not responded after 2-3 weeks.  
> 
> Does anybody know why it's not printable?  I'd like to take it with me to read
> without lugging a computer around with me.

[...]


What is your Perl question?


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


------------------------------

Date: 23 Jan 2003 00:44:56 -0800
From: iteve@etang.com (YiWei)
Subject: Question about "our"
Message-Id: <7641127.0301230044.67b096ab@posting.google.com>

Hello everyone,I'm learning Perl now and I'm having problems with the
keyword "our".
    It was said that the "our" keyword can avoid using fully qualified
name when the strict pragma is used.But I can't see any practical use
of it.
    Does it only help to save some key strokes?How should I take
advantage of it?Please tell me some useful techniques,thanks in
advance!


------------------------------

Date: Thu, 23 Jan 2003 09:51:32 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Question about "our"
Message-Id: <b0odmi$g31$1@news.dtag.de>

YiWei wrote:
> Hello everyone,I'm learning Perl now and I'm having problems with the
> keyword "our".
>     It was said that the "our" keyword can avoid using fully qualified
> name when the strict pragma is used.But I can't see any practical use
> of it.
>     Does it only help to save some key strokes?How should I take
> advantage of it?Please tell me some useful techniques,thanks in
> advance!

The our keyword makes it possible to use an unqualified package global 
under strict just like c<use vars> does. However, with our you can limit 
the "space" where you can use the package global to a lexical scope.

->malte



------------------------------

Date: Thu, 23 Jan 2003 02:27:09 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Regex to find all words containing a single vowel?
Message-Id: <vkku2v4qcdoenpiacm7sd8l2a21nvmtcvg@4ax.com>

Martin wrote:

>> So you think "lazy" only has one vowel and "quick" has two? How odd. I
>> would have thought the reverse.
>
>Eh? Yes lazy has one vowel (a) and quick has two (ui). What's odd about that?
>Are you thinking of syllables?

No, I'm thinking of sounds. The "y" in "lazy" is no different than the
"i" in "pit".

OTOH, the "u" in "quick" sounds like a "w".

-- 
	Bart.


------------------------------

Date: Thu, 23 Jan 2003 16:58:05 GMT
From: mark@REMOVETHISkeyfutures.com (Mark)
Subject: Re: Security with uploaded zip files
Message-Id: <3e301e14.1526880@news.tiscali.co.uk>

Jay, thanks for this thought, it makes life easier. 

Why did I post this to a perl group?

The file is being unzipped by a perl script and though I am not aware
of any direct security issues related to unzipping files with perl,
other perl programers might be. 

It is likely that other perl programers have been faced with similar
issues and I could benefit from their experience, as I have done from
your replies. 

Thank you. 
Mark

On Wed, 22 Jan 2003 22:33:42 GMT, tiltonj@erols.com (Jay Tilton)
wrote:

>mark@REMOVETHISkeyfutures.com (Mark) wrote:
>
>: My client needs to upload large quantities of files on to his
>: e-learning website. I have built him a 'multipart form-data' form so
>: that he can zip the files and upload them all in one go. 
>:
>: Though the form is held in a password protected directory the ability
>: to upload zip files obviously posses a serious security threat.
>: Therefore before decompressing the zip, it will be viewed and if it
>: contains any dodgy file extensions it will be deleted. 
>
>The exact opposite is a saner approach.  
>
>Look for what is explicitly permitted instead of looking for what is
>explicitly forbidden.
>
>Instead of proceeding if no file matches a blacklist, proceed only if
>all files match a whitelist.
>
>Did you have a Perl question?
>



------------------------------

Date: Wed, 22 Jan 2003 21:55:41 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Still a little variable trouble.
Message-Id: <3E2F59AD.BA1F3FAB@earthlink.net>

Richard S Beckett wrote:
[snip]
> Yes. Because I was having trouble getting some subroutines that were
> called by the main subroutine to recognise the variables that were
> defined in the main subroutine, I put the called subroutines into the
> main subroutine,

Ick.  This can produce "variable will not stay shared" warnings, which
indicate that you've got closures being produced when you least expected
it.  That is:

   sub foo {
      my $x = shift;
      sub bar { print $x, "\n" }
      bar();
   }
   foo(42); foo('frobnitz');

Will print out 42, twice.

> as a short term fix, but thinking about it, as these subroutines are
> only called from the main subroutine anyway, I suppose it's not that
> bad a thing, really.

It's only "not a bad thing", if the main subroutine is only called once,
ever.  Which kinda defeats the purpose of having it as a subroutine.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: Wed, 22 Jan 2003 21:57:08 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Still a little variable trouble.
Message-Id: <3E2F5A04.683B9D55@earthlink.net>

Ben Morrow wrote:
[snip]
>  -command => sub { text_sub($text_area) }

Tk allows you to avoid creating a new closure, by letting you do:

   -command => [ \&text_sub, $text_area ]

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: Wed, 22 Jan 2003 20:21:12 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: To extract a specific portion of a text file
Message-Id: <slrnb2ukco.8u5.tadmc@magna.augustmail.com>

John Smith <clearguy02@yahoo.com> wrote:

> My sincere apolozies to the typos.


I doubt that the typos were offended.


> I giving my file one more time (extract.txt)
> ----------------------------------------------------------
> Component    : Main TestPiece
>     Language        : C++
>    Creation Date   : 20-03-2002
>       Test Key :                       test_hello_there
>                                        test_log_long_one
>                                        test_short_my_song
>       Code key :		       test_bob_smith             
>                                        test_dave_smith
>                                        test_harry_smith


> Now when I run your code, I am getting the below output:
> ---------------------
> Test Key :                             test_hello_there
>                                        test_log_long_one
>                                        test_short_my_song
>                                        test_dave_smith
>                                        test_harry_smith
> -------------------------------------------------------
> 
> I don't want the last two lines, which the values for the Code Key
> field. I was trying different ways in oyur piece of code, but in vain.


If you show us what you tried, then we can help you fix it.


> How could I get the right output with only first "Test KEy" and only
> its values.


Use the 2nd "better solution" code that I've already given you.

Didn't it work? 

It should...



Add this statement somewhere in David's code 
(correct location left as an exercise for the reader):

       last if /^\s*Code key/;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 22 Jan 2003 21:37:18 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Writing gaming "macro" programs
Message-Id: <3E2F555E.77BDA418@earthlink.net>

Robert Parks wrote:
> 
> Hi would like write a macro program to play a windows game.  I will
> need to be able to do the following:
> - enter key strokes
> - move mouse
> - click
> - check pixels
> 
> Anyone know of a perl module that would facilitate these activities?

Win32::GuiTest, perhaps?

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4452
***************************************


home help back first fref pref prev next nref lref last post