[12526] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6126 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 25 11:07:20 1999

Date: Fri, 25 Jun 99 08:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 25 Jun 1999     Volume: 8 Number: 6126

Today's topics:
    Re: [Q]: Get different hashes from a sub? <rootbeer@redcat.com>
    Re: Aliasing subroutines and other naming tricks <aqumsieh@matrox.com>
    Re: Aliasing subroutines and other naming tricks <rootbeer@redcat.com>
    Re: Automatic exit from perl script <rootbeer@redcat.com>
        Calling Oracle Stored Procedures from PERL <timothy@metropolis.co.za>
    Re: Can't retain a directory change from within a scrip (Larry Rosler)
        Cross-platform spawn required donath@my-deja.com
    Re: Escape Newline ? <rootbeer@redcat.com>
    Re: Escape Newline ? (Marcel Grunauer)
    Re: gathering output from program <rootbeer@redcat.com>
    Re: How can I use Perl variables in Javascript ? (David Glasser)
    Re: how do I save an MD5 checksum? <rootbeer@redcat.com>
    Re: How to access MS Access using perl/cgi/unix <olivier.maas@at-lci.com>
    Re: Kicking off remote program <rootbeer@redcat.com>
    Re: Matching regular expressions <aqumsieh@matrox.com>
        Mr. Christiansen <lcoates@bu.edu>
    Re: Newbie -> trying to wirte a Cgi for FTP-access ... <rootbeer@redcat.com>
    Re: perl 5.005_3 on hp/ux 10.20 <Martin.Jost@icn.siemens.de>
    Re: perl to executable <rootbeer@redcat.com>
        Printing to file / sed and diff cmbnews@my-deja.com
    Re: Printing to file / sed and diff <rootbeer@redcat.com>
    Re: Printing to file / sed and diff (Larry Rosler)
    Re: problem passing array back <rootbeer@redcat.com>
    Re: problems with chmod function (Larry Rosler)
    Re: Reading Excel Sheets <olivier.maas@at-lci.com>
    Re: Regex question (i think) <rootbeer@redcat.com>
    Re: Regex question (i think) <hvermeulen@correctnl.com>
    Re: Statistics for comp.lang.perl.misc (Kevin Reid)
    Re: Strange error with form variable and filename <rootbeer@redcat.com>
    Re: Using Tk or Win32::GUI in Win32 <ibelgaufts@gfc-net.de>
    Re: validating a regexp from a CGI form jhefferon@my-deja.com
    Re: validating a regexp from a CGI form <rootbeer@redcat.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 25 Jun 1999 06:33:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: [Q]: Get different hashes from a sub?
Message-Id: <Pine.GSO.4.02A.9906250628450.6929-100000@user2.teleport.com>

On 24 Jun 1999, Jih-Shin Suen wrote:

> I try to use same sub to print different hashes' data to different
> output files.
> But don't know how.

What, exactly, is the problem? Are you having trouble with printing,
hashes, data, files, or something else?

> my @Outfiles = (dose,paq,lasermaxp);

You probably want qw//. See the perlop manpage.

>         open($FileH_Out, $file_out) || die ("!!! Can't output to $file_out !
> "); 

You probably should include the $! variable in your error message. And I'm
not sure that you're doing the right thing with your parameters to open,
so look in perlfunc for that. You may be trying to have multiple
filehandles, but I can't see why.

>         local $" = ', ';

It's often better to use join than to set this special variable.

Good luck with your project!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 08:26:30 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Aliasing subroutines and other naming tricks
Message-Id: <x3y9098cvpm.fsf@tigre.matrox.com>


Brundle <brundlefly76@hotmail.com> writes:

> 2 questions:
> 
> I need to create an alias for a subroutine, so I can have it point to
> either of two subroutines:

Use anonymous subs ...

% perl -w
my $sub1 = sub { print "SUB1\n" };
my $sub2 = sub { print "SUB2\n" };

my $sub = $sub1;
&$sub;

$sub = $sub2;
&$sub
__END__
SUB1
SUB2

> Here's another one:
> 
> I want to do some trickery where I can alias a string for a namespace,
> so I can create objects base on variables (its late I know Im not making
> this too clear):
> 
> Instead of:
> 
> if($string eq 'FOO'){
> 	$object=new FOO;
> }
> 
> I want to say:
> $object=new $string;	# Where string is 'FOO' and I create new FOO object

$object = eval "new $string";

HTH,
Ala



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

Date: Fri, 25 Jun 1999 06:53:44 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Aliasing subroutines and other naming tricks
Message-Id: <Pine.GSO.4.02A.9906250650310.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Brundle wrote:

> I need to create an alias for a subroutine, so I can have it point to
> either of two subroutines:

I think you want a coderef, really.

    my $deliver = $use_ftp ? \&deliver_ftp : \&deliver_smtp;

    &$deliver(qw/some parameters here/);

> I want to do some trickery where I can alias a string for a namespace,
> so I can create objects base on variables (its late I know Im not making
> this too clear):
> 
> Instead of:
> 
> if($string eq 'FOO'){
> 	$object=new FOO;
> }
> 
> I want to say:
> $object=new $string;	# Where string is 'FOO' and I create new FOO object

Could you perhaps want something like this?

    my $object = $string->new();

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 06:09:10 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Automatic exit from perl script
Message-Id: <Pine.GSO.4.02A.9906250608270.6929-100000@user2.teleport.com>

On 24 Jun 1999, Matthew Fleming wrote:

> Just wondering if there is a module I could include that would make it
> possible for my perl script to quit after a certain period of
> inactivity (e.g., no keystrokes) from the user.

Maybe you want to see what the FAQ says about timing out. Do you know how
to find that? 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 05:01:36 +0100
From: Tim Stevens <timothy@metropolis.co.za>
Subject: Calling Oracle Stored Procedures from PERL
Message-Id: <3772FF20.60120617@metropolis.co.za>

Hi All

I would like to know whether it is possible to call Oracle stored
procedures with OraPerl.

If not, should I use DBD::DBI?

Any advice would be appreciated



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

Date: Fri, 25 Jun 1999 07:24:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can't retain a directory change from within a script!
Message-Id: <MPG.11dd30f81610769f989c44@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <MPG.11dd73de5ebdb056989680@news.demon.co.uk> on Fri, 25 Jun 
1999 12:09:58 +0100, Paul D Enderson <techsup@datascan.co.uk> says...
 ...
> Is there a way of retaining the modified directory variable once I have 
> quit the script?

perlfaq8:

I {changed directory, modified my environment} in a perl
script. How come the change disappeared when I exited
the script? How do I get my changes to be visible?

Unix

In the strictest sense, it can't be done -- the script executes as a
different process from the shell it was started from. Changes to a
process are not reflected in its parent, only in its own children 
created after the change. There is shell magic that may allow you to 
fake it by eval()ing the script's output in your shell; check out the
comp.unix.questions FAQ for details. 

> Any help would be greatly appreciated. Please CC to my 
> email address:
> 
> 	techsup(at)datascan.co.uk

Sure.  But why didn't you print it out here instead of using that silly 
(at)?  It's there in your headers, so my newsreader did it right:

Reply-To: techsup@datascan.co.uk

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 25 Jun 1999 12:50:42 GMT
From: donath@my-deja.com
Subject: Cross-platform spawn required
Message-Id: <7kvtuu$346$1@nnrp1.deja.com>

What is really needed is a Spawn module that will behave identically
when run in Unix and NT.  The underlying code will use the proper system
libraries on whatever OS it's running for performing the task, but the
results would be the same.  It should return a PID, handle pipes,
simulate forking on NT, all the functionality that make forking on Unix
so powerful.  Does anyone know of such a on-going project, or is it time
to start one???

Regards,
Clarence Donath


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 07:27:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Escape Newline ?
Message-Id: <Pine.GSO.4.02A.9906250724490.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Helmut Jarausch wrote:

> Is there any (elegant) method to escape a newline?

I think you want to write a literal string on multiple lines and then
combine the lines into a single line within a variable. Here are a few
(not quite identical) ways.

    my $string = join ' ', split /\n\s+/,
        "here are
        some pieces
        to concatenate.";

    (my $string = "some
        multi-line
        string") =~ tr/\n//d;

    my $string = join ' ', qw{
        As much as you want to
        put in the qw{} braces
        (but you may get warnings
        if you use commas,
	so be cautious)
    };

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 13:53:29 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Escape Newline ?
Message-Id: <37768805.18264763@enews.newsguy.com>

On Fri, 25 Jun 1999 14:21:50 +0200, Helmut Jarausch
<jarausch@igpm.rwth-aachen.de> wrote:

>Sorry for that probably simple question!

Well... there *is* the Perl documentation...

>Unfortunately this doesn't work!  Since I don't want extremely long
>lines in the source,
>the only solution I have come up so far is (ugly)
>$Help="1st part of line ".
>"second part ".
>"last part
>before this there is a newline";

Use <<HERE documents.

my $help=<<"EOT";
1st part of line 
second part 
last part
before this there is a newline
EOT

If you run into problems with <<HERE documents, read "perlfaq4: Why
don't my <<HERE documents work?"

Marcel



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

Date: Fri, 25 Jun 1999 06:05:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: gathering output from program
Message-Id: <Pine.GSO.4.02A.9906250603560.6929-100000@user2.teleport.com>

On Thu, 24 Jun 1999 amidalla@my-deja.com wrote:

> why doesn't this work??

Because there's something wrong with it.

Hint: If you want people to help you figure out why your program is doing
what it's doing, it helps to say what it actually is doing, and what you'd
want it to do. 

> my ultimate goal is to see if the process (looper.exe) has run to
> completion.  

Do you mean that you want the exit status? Check out the entries for open
and close in the perlfunc manpage.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 09:39:42 -0400
From: glasser@iname.com (David Glasser)
Subject: Re: How can I use Perl variables in Javascript ?
Message-Id: <1dty80m.1t3nts8s5ulh0N@usol-209-186-16-211.uscom.com>

Andrew Johnson <andrew-johnson@home.com> wrote:

> In article <1dtxbfs.1mtqzwa5umw4gN@usol-209-186-16-69.uscom.com>,
>  David Glasser <glasser@iname.com> wrote:
> [snip] 
> ! This won't work either, because Nina was using <<EndOfHTML, which won't
> ! interpret the variable anyway.
> 
> #!/usr/bin/perl -w
> use strict;
> my $var = q[It won't?];
> print<<EndOfHTML;
> $var
> Why do you think that?
> EndOfHTML
> __END__

Er, of course, yes.  Sorry about that.  I've gotten in the habit of
explicitly quoting all my heredocs with "" or '' (or whatever else I
want to use) just so I don't mix that up, and here I've gone and
blathered incorrectly on clpm.

For what it's worth, I still prefer my strategy, with the modification
that the rest uses <<'EndOfHTML', not <<EndOfHTML; this will make sure
that you don't interpolate anywhere that you don't want to.

-- 
David Glasser: glasser@iname.com


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

Date: Fri, 25 Jun 1999 07:30:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how do I save an MD5 checksum?
Message-Id: <Pine.GSO.4.02A.9906250729030.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, kev wrote:

> I'm using an MD5 checksum to determine whether a web page has changed
> since my web client prog last visited it.
> The checksum can contain some weird characters which I'd like to escape
> before putting it in a file. 

Well, if you want to. Files should be able to hold arbitrary data.

> What is the usual method for doing this?

Define the word "escape" and you'll probably see the answer yourself. But
maybe you want unpack("H*", $data) - see the perlfunc manpage to find out. 

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 15:22:44 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: Re: How to access MS Access using perl/cgi/unix
Message-Id: <377382A4.7E0DA5AF@at-lci.com>



Bruce Chao a icrit :

> Hi,
>
> Is there any way that I can connect to MS Access
> from a Netscape Server on Unix platform using /Perl/Cgi???
>
> Thanks!

Try that, but not sure...

use Win32::OLE;
   $application=Win32::OLE->new('Access.Application', 'Quit') || warn
"Impossible de cr&eacute;er un objet OLE";

$cheminbase="C:\\Temp\\test.mdb";
$Base=$application->OpenCurrentDatabase("$cheminbase");

 $Recset=$application->CurrentDb->OpenRecordset("FOOTest");
print "open rec ok<BR>";

 $Recset->AddNew;
 $Recset->Fields(1)->{'Value'}=localtime(time);

$Recset->Update;

 $application->CurrentDb->Close(1);
 $application->Quit();
 DESTROY ($application);

blue skies and soft landings
olivier



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

Date: Fri, 25 Jun 1999 06:22:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Kicking off remote program
Message-Id: <Pine.GSO.4.02A.9906250617200.6929-100000@user2.teleport.com>

On Thu, 24 Jun 1999, SfpcC wrote:

> I want to be able to kick off either a .bat job or .pl program from
> one NT server to another (also WinNT).

It sounds as if you want one machine to ask another to run a program. You
could use one of the existing protocols to ask this, or you could design
your own. You should probably check out the docs, FAQs, and newsgroups
about the protocols your machines already support. Do you already know how
to find these? Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 08:55:20 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Matching regular expressions
Message-Id: <x3y674ccudj.fsf@tigre.matrox.com>


=?iso-8859-1?Q?Bj=F6rn?= Teegen <bjoern.teegen@gmx.de> writes:

> Does anyone know the algortihm(s) that perl uses for matching regular
> expressions?

Yes ... not me .. but yes. Actually, the author or Perl's regexp
engine lurks around this newsgroup. So you might be in luck!

I'm not sure what kind of info you're looking for, but for a good
start, you should read The Owl, aka "Mastering Regular Expressions",
by Jeffrey Friedl, published by O'Reilly.

HTH,
Ala



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

Date: Fri, 25 Jun 1999 09:36:57 -0400
From: "Laran Coates" <lcoates@bu.edu>
Subject: Mr. Christiansen
Message-Id: <7l00m6$qi3$1@holly.prod.itd.earthlink.net>

I am trying to write a script to generate pages based on form input.  I know
that this is one of the more common utilities on the web.  However, I'm
still new to perl and am having quite a bit of trouble writing this script.

I ultimately want the script to generate the page and then email it to an
address included in the form. Ultimately I would like to to have the script
write the page to the server and modify the linking page.

I got a response to a previous message similar to this one from someone who
said that this sort of thing was way too complicated for a newbie but not
too bad for an experienced programmer.  He suggested that I have someone
write the script for me.  I'd prefer writing it myself.  I want to learn the
language and there's only one way to do it.  I'm a bit concerned about some
of the potential problems mentioned in the response to my previous post.
The problems concerned spamming as a result of a bug in the script.  I'm
finding that just the page generating portion of the script is giving me
quite a bit of trouble by itself.

I got in touch with you personally because you clearly know what's going on
in the world of perl and I wanted your advice on how I should proceed.
Should I continue writing the script myself?  If so, do you have any
particularly good suggestions for resources where I can get advice on how to
proceed with the script and get some help debugging it.  In addition, what
are your comments on the safety concerns and potential problems mentioned by
the person who replied to my previous post? Otherwise, how much do you think
it would cost to get someone to write something like what I described?  And
where would I find them?

All help is appreciated.

Thanks in advance.

Sincerely,

Laran Coates
lcoates@interactioninc.com
781.246.1545
Webmaster
Interaction Inc.
27 Water St. Wuite 405
Wakefield, MA
01880





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

Date: Fri, 25 Jun 1999 06:25:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newbie -> trying to wirte a Cgi for FTP-access ...
Message-Id: <Pine.GSO.4.02A.9906250623480.6929-100000@user2.teleport.com>

On Thu, 24 Jun 1999 o_klaus@my-deja.com wrote:

> I was going to write a Cgi 

You don't want to make a Common Gateway Interface. You want to make a CGI
program - a program which runs under the Common Gateway Interface.

> 	Login to any specified FTP-Server
> 	and copying a specified file to
> 	another FTP server.

Maybe you want the Net::FTP module. Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 14:32:34 +0200
From: Martin Jost <Martin.Jost@icn.siemens.de>
To: Jim Nicholson <jnich@pdd.att.com>
Subject: Re: perl 5.005_3 on hp/ux 10.20
Message-Id: <377376E2.2C2E78E@icn.siemens.de>

Jim Nicholson wrote:
> 
> I'm trying to build the latest stable perl on a 715 with 10.20 installed
> (using the hp-supplied ANSI compiler, not the k&r one). Make dies in the
> miniperl tests with the following:
[...]
Sorry doesn't ring a bell
 
> Has anyone succeeded in getting a perl more recent than 5.004 to compile
> under HP/UX?

Yes, I've build 5.005_03 and _02  succesfully on HPUX 10.20. (No big
problems)
What about compiler-patches (new versions of the compiler from the
application CD) ?

Martin


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

Date: Fri, 25 Jun 1999 06:35:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl to executable
Message-Id: <Pine.GSO.4.02A.9906250634180.6929-100000@user2.teleport.com>

On Thu, 24 Jun 1999, Timotheus Itoi wrote:

> Is there a freeware that converts .pl to .exe like perl2exe does?

You could rename the file - that's nearly like perl2exe does. But do you
know how to find what the FAQ says about compiling Perl? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 13:30:49 GMT
From: cmbnews@my-deja.com
Subject: Printing to file / sed and diff
Message-Id: <7l00aa$3v4$1@nnrp1.deja.com>

I have a section of code that looks similar to the following:

print "before the sed and diff\n";
system("sed \"$preprocess\" $file1 > $tmpfile");
system("sed \"$preprocess\" $file2 | diff $tmpfile -");
print "after the sed and diff\n";

The problem is that if I redirect the output of my program to a file
the order of the print lines in relation to the output from the system
commands is not guaranteed.
I get the same problem if I explicitly open a file and print to it for
the print lines and redirect to the file using >> for the system lines.

Is there anything I can do to guarantee that my output goes to file in
the correct order, or is there anyway I can use sed and diff within
perl instead of using system commands, as this would ensure the correct
order.

Any help appreciated,
Catharine


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 07:46:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Printing to file / sed and diff
Message-Id: <Pine.GSO.4.02A.9906250745460.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 cmbnews@my-deja.com wrote:

> The problem is that if I redirect the output of my program to a file
> the order of the print lines in relation to the output from the system
> commands is not guaranteed.

See the $| variable in the perlvar manpage. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 07:50:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Printing to file / sed and diff
Message-Id: <MPG.11dd36f19681b8b0989c45@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7l00aa$3v4$1@nnrp1.deja.com> on Fri, 25 Jun 1999 13:30:49 
GMT, cmbnews@my-deja.com <cmbnews@my-deja.com> says...
> I have a section of code that looks similar to the following:
> 
> print "before the sed and diff\n";
> system("sed \"$preprocess\" $file1 > $tmpfile");
> system("sed \"$preprocess\" $file2 | diff $tmpfile -");
> print "after the sed and diff\n";

 ...

> Is there anything I can do to guarantee that my output goes to file in
> the correct order,

Look at the very first question in perlfaq5:  "How do I flush/unbuffer 
an output filehandle? Why must I do this"

>     or is there anyway I can use sed and diff within
> perl instead of using system commands, as this would ensure the correct
> order.

The functionality of sed is readily achievable using Perl regexes.  But 
diff is harder.  Search this newsgroup for recent postings, and CPAN.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 25 Jun 1999 06:47:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: problem passing array back
Message-Id: <Pine.GSO.4.02A.9906250644080.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 okurios@my-deja.com wrote:

> I am trying to pass an array to a subroutine in a module and get it
> back.

You probably want to pass a reference to the sub. You seem to be doing
that in the code you're posting, but (at three screenfuls) it's far too
long for me to want to dig through it. If you can make an example that's
no more than about ten lines of code, someone here will almost certainly
be able to help you. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 07:09:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problems with chmod function
Message-Id: <MPG.11dd2d64d2c83af7989c43@nntp.hpl.hp.com>

In article <7kvc8n$u51$1@nnrp1.deja.com> on Fri, 25 Jun 1999 07:48:41 
GMT, Ronny <ronald_f@my-deja.com> says...
 ...
>      Assume that $mode contains 0775, than we
> have:
>   $s_bit == 0
>   $u_bit == 7
>   $g_bit == 7
>   $o_bit == 5
> So you pass to chmod basically "0775". But chmod expects the argument as
> a number, so it does something equivalent to "0775"+0, which is 775
> and not 0775. If you use
>   $perm = oct "0.$s_bit.$u_bit.$u_bit.$o_bit";
> this should work. Also,
>   chmod ($mode & 07777,$filename)
> should deliver the same result.

Perhaps it should.  But it doesn't.

Did you try it before posting your conjecture?  All you had to do first 
was to type this:

    perl -e 'print "0775" & 07777, "\n"'

The result is 775, not 509.

If by 'Assume that $mode contains 0775' you meant '$mode = 0775', that 
is different, but in either case, the '& 07777' does nothing.  It does 
not convert a string to an octal number, as 'oct' does.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 25 Jun 1999 15:04:08 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
To: "baga@gmx.net" <baga@gmx.net>
Subject: Re: Reading Excel Sheets
Message-Id: <37737E47.8431B3E5@at-lci.com>

 "baga@gmx.net" a icrit :

> Hello!
>
> I want to read out special fields of an excel sheet with a perl
> program. Does someone know if that is possible or not?
>
> Thanks,
>   Hans : baga@gmx.net

use Win32::OLE;
$fichier="c:\\temp\\res.xls";

   # application Excel
   $application=Win32::OLE->new('Excel.Application', 'Quit') || warn
"Impossible to create objet OLE";


   #######
   #Open du file
   #######
   $workbook=$application->Workbooks->open("$fichier");

   #######
   #acces to sheet "Langues"
   #######
   $worksheet=$workbook->Worksheets("Langues");

#access to 1 line, 2 rows under cell named "Coin1"
        $Arajouter=$worksheet->Range("Coin1")->Offset(1,2)->{'Value'};
  #access to cell A3
$Arajouter=$worksheet->Range("A3")->{'Value'};

#changing sheet...
   $worksheet=$workbook->Worksheets("toto");
$Arajouter=$worksheet->Range("A3")->{'Value'};

#close with saving (Close(0) is without save)
$application->ActiveWorkbook->Close(1);
   $application->Quit();
   DESTROY ($application) ;



>



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

Date: Fri, 25 Jun 1999 07:10:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Regex question (i think)
Message-Id: <Pine.GSO.4.02A.9906250702480.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Henry Vermeulen wrote:

> /<(*?)\@(*?)>/i;

That's not what you think. (And what did you think the /i was doing for
you?) Maybe you need to check your code more carefully before you post it.
But you could also see what fred and barney think about having more than
one at-sign in e-mail addresses. Here's their address.

    <"fred@barney"@redcat.com (Yes, "fred@barney" is correct!)>

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 16:23:38 +0200
From: Henry Vermeulen <hvermeulen@correctnl.com>
Subject: Re: Regex question (i think)
Message-Id: <377390EA.91DB3FDE@correctnl.com>

The regexp was more a way trying, not tested in any way.
It should provide enough ideas to get the job done.
And about the /i,  Yes, that didn't make sense.
copy/paste a regexp from a script i was working on, less typing.
I had to remove it. Sorry for that.

By the way, never thought about fred and barney.
Looks quit tough to deal with but can be done with a 'if then' i think.

Henry






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

Date: Fri, 25 Jun 1999 09:25:37 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <1dtt1ve.zw2ye01v7nqmsN@[192.168.0.1]>

David Cassell <cassell@mail.cor.epa.gov> wrote:

> Bart Lateur wrote:
> > [a lot of interesting suggestions]
> 
> A simpler heuristic for Abigail's posts:
> If the line is not "RTFM", "RTFFAQ", or "Abigail" then
> it's quoted.
> 
> David, ducking rapidly...

Additional rule: If the line either eq '-- ' or contains more than 50%
punctuation, it's part of the signature.

Kevin, grinning while typing...

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.


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

Date: Fri, 25 Jun 1999 06:37:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Strange error with form variable and filename
Message-Id: <Pine.GSO.4.02A.9906250636420.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Kenny Weng wrote:

> When I use a filename passed from a form variable the
> script dos NOT write og create this file.

Are you checking the return value from open(), and seeing what $! is
trying to tell you? See the perlfunc and perlvar manpages. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 16:10:32 +0200
From: =?iso-8859-1?Q?J=FCrgen?= Ibelgaufts <ibelgaufts@gfc-net.de>
Subject: Re: Using Tk or Win32::GUI in Win32
Message-Id: <37738DD8.C61AB565@gfc-net.de>

Hello,

ActiveState do also have Tk binaries for Windows. I built Perl and Tk myself
with a C compiler on Win-NT, but this does not matter since ActiveState Perl+Tk
are from the same source tree and should show identical results.

Take Tk rather than Win32::GUI since Tk programs are fully portable between
different operating systems and there are tons of existing books and tutorials
and manpages about Tk.

Really: Tk is the best I've ever seen for GUI programming, it is so easy to
learn that you don't even need any GUI builders.

Regards

Juergen

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

"R.Joseph" schrieb:
> 
> I recently downloaded ActivePerl from ActiveState.com.  I got it
> working fine, but it says in the documentation that there is a way to
> use the Tk module to do GUI programming in Win!  Also, I downloaded a
> module called Win32::GUI.  I was able to produce a MsgBox call with it
> and get it to actually DO a message box...but that was about it =).
> Any help on this wierd yet interesting subject is greatly appreciated!
> 
> --
> R.Joseph
> http://www.24-7design.com
> http://bowdown.to
> 
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 12:54:49 GMT
From: jhefferon@my-deja.com
Subject: Re: validating a regexp from a CGI form
Message-Id: <7kvu6l$35l$1@nnrp1.deja.com>

In article <377c900f.4443048@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:
> jhefferon@my-deja.com wrote:
>
> >  "$dirname/$fn" =~ /$searchstring/
> >for each directory, file pair.  I see in the error_log that a lot of
> >users are trying regexp's like "*.txt", which of course bombs the
above
> >line and they get a terminated return page.
>
> Try eval(). Actually, try something like:
>
> 	$sub = eval "sub { /$regexp/ }";
>
> If $sub is undefined afterwards, it failed.
>
Thank you, you are right.  But, sorry for the naive question, isn't
this insecure in that if someone passes me a CGI parameter that
looks something like "/; do something malicious; /" then the subroutine
will cause trouble?  Or do I have this completely wrong?  Sorry; I'm
new at Perl.

Thanks again,
Jim Hefferon


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 07:40:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: validating a regexp from a CGI form
Message-Id: <Pine.GSO.4.02A.9906250732100.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 jhefferon@my-deja.com wrote:

> > 	$sub = eval "sub { /$regexp/ }";
> >
> > If $sub is undefined afterwards, it failed.
> >
> Thank you, you are right.  But, sorry for the naive question, isn't
> this insecure in that if someone passes me a CGI parameter that
> looks something like "/; do something malicious; /" then the subroutine
> will cause trouble?  

Not a naive question at all - You're right: that code isn't safe to use on
data from untrusted sources. This is much safer. It won't execute any
untrustworthy code, but it has no protection against a "neverending"
pattern.

    sub bad_pattern ($) {
	my $pat = shift;
	eval { '' =~ /$pat/ };
	$@;
    }

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 6126
**************************************

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