[15540] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2950 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 4 16:13:25 2000

Date: Thu, 4 May 2000 11:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957463817-v9-i2950@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 4 May 2000     Volume: 9 Number: 2950

Today's topics:
    Re: How single-line switch (/s) works in regexps? <lr@hpl.hp.com>
    Re: How to find a matching ")"? <lr@hpl.hp.com>
    Re: How to print '%' character with printf ? <lr@hpl.hp.com>
        How to strip Carriage Returns in a variable? <alan@igs.net>
    Re: How to strip Carriage Returns in a variable? <billy@arnis-bsl.com>
    Re: if file already exists then remove... <lr@hpl.hp.com>
        LWP POST syntax @{@$%??} dplynn@dmrtc.net
    Re: Newbie question (probably somthing simple) (Neil Kandalgaonkar)
    Re: Newbie question (probably somthing simple) <jonny@jonnysoft.co.uk>
    Re: Newbie question (probably somthing simple) <jonny@jonnysoft.co.uk>
    Re: newbie: can't open text file in windows (path to fi <lr@hpl.hp.com>
    Re: newbie: can't open text file in windows (path to fi <russ@css2.com>
    Re: newbie: can't open text file in windows (path to fi <russ@css2.com>
    Re: newbie: can't open text file in windows <russ@css2.com>
    Re: Perl & delivering Databases? <remove_seal97@dds.nl>
    Re: Perl & delivering Databases? ammar_aganovic@my-deja.com
    Re: problem with "system" and file copy (Teodor Zlatanov)
    Re: Problems with Installing JPL (Java-Perl Lingos) on  johnpe@my-deja.com
        Refresh problem <bmc@yeah-right.com>
    Re: reg expressions assistance <lauren_smith13@hotmail.com>
    Re: Tanspose rows to columns <bmb@ginger.libs.uga.edu>
    Re: Transpose rows to columns <Vincent.Murphy@Baltimore.Com>
    Re: Transpose rows to columns jimbob4334@my-deja.com
    Re: Where is a clear, complete explanation of using per <samay1NOsaSPAM@hotmail.com.invalid>
    Re: Why won't Perl's 'use' includes the directory where (Teodor Zlatanov)
        Win32::OLE::Variant Converting VB to Perl question (2nd <michaelr@apgtest.com>
        Win32::OLE::Variant Converting VB to Perl question. <michaelr@apgtest.com>
    Re: Win32::OLE::Variant Converting VB to Perl question. <michaelr@apgtest.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 4 May 2000 10:38:14 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How single-line switch (/s) works in regexps?
Message-Id: <MPG.137b555f21bc509d98a9fb@nntp.hpl.hp.com>

In article <u9ya5qfrmr.fsf@wcl-l.bham.ac.uk> on 04 May 2000 13:04:44 
+0100, nobull@mail.com <nobull@mail.com> says...

 ...

> Given a prefix of string and a pattern is it possible to test if is
> necessary to read in more to know if (or what) the pattern will match
> in that prefix.
> 
> eg. 
> 
>   ("foo" . $unread) =~ /f/ # Matches
>   ("foo" . $unread) =~ /o+/ # Matches but we dont know how many
>   ("foo" . $unread) =~ /od/ # Don't know if is maches
>   ("foo" . $unread) =~ /d/ # Doesn't match

Your example code bears little relation to your question.  In these 
examples, the scalar to be matched is computed by concatenation before 
the matching operation is begun.

Perhaps what you mean is something like this:

    'foo' =~ /o+/ && "foo$unread" =~ /o+/

though the first operation (with constant values) doesn't make much 
sense in the example.

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


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

Date: Thu, 4 May 2000 10:04:11 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to find a matching ")"?
Message-Id: <MPG.137b4d64921e307398a9f7@nntp.hpl.hp.com>

In article <slrn8h2u01.vi1.sjlen@zero-pps.localdomain> on 4 May 2000 
15:06:07 GMT, Steve <sjlen@ndirect.co.uk> says...

 ...

> push (@the_names, $_);
> 
> This will put the names into an array. Then print them out:
> 
> while (<@the_names>)
>   {
>    print "$_ \n";
>   }   

Huh?  You do know that <...> is the operator to read a line from a 
filehandle, don't you?

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


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

Date: Thu, 4 May 2000 10:47:55 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to print '%' character with printf ?
Message-Id: <MPG.137b57a8793198b298a9fc@nntp.hpl.hp.com>

In article <391177B8.71FB022C@orga.com> on Thu, 04 May 2000 15:14:32 
+0200, Ulrich Ackermann <uackermann@orga.com> says...
> Daniel Courivaud wrote:
> > found nothing in perldoc and faqs. I want to print a string containing
> > '%' character:
> > 50 % of the files
> > and I try many things like  __    printf(" %i \% of the
> > files",$percentage);  __  but none of them are working.
> 
> if you do not insist on using the printf function, why not format your
> value with sprintf (e.g. my $percentage = 45.67; $percentage = sprintf
> "%.d", $percentage;) and then use the print-function (print"
> $percentage\% of the files\n";).
> 
> But I can not tell you, why your fprint-version did not work. :-(

For the same reason as the original poster's version failing.

In the format string, there is no backslash ahead of the '%', and even 
if there were it wouldn't work, because that isn't the escape convention 
for [s]printf.

perldoc -f sprintf

 ...

Perl's sprintf permits the following universally-known conversions:

   %%   a percent sign 

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


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

Date: Thu, 4 May 2000 11:16:35 -0400
From: "Alan Honsinger" <alan@igs.net>
Subject: How to strip Carriage Returns in a variable?
Message-Id: <8es49h$edr$1@news.igs.net>

Hi,

Was wondering how I could strip carriage returns (^M) from a variable.

Thanks,

Alan




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

Date: Thu, 04 May 2000 15:53:13 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: How to strip Carriage Returns in a variable?
Message-Id: <8es6d0$63j$1@nnrp1.deja.com>

In article <8es49h$edr$1@news.igs.net>,
  "Alan Honsinger" <alan@igs.net> wrote:
> Hi,
>
> Was wondering how I could strip carriage returns (^M) from a variable.
>

IMHO:

$variable =~ tr/\r//d;

Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 4 May 2000 09:50:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: if file already exists then remove...
Message-Id: <MPG.137b4a346d204f3198a9f5@nntp.hpl.hp.com>

In article <8eqs28$bur$1@charm.magnus.acs.ohio-state.edu> on 4 May 2000 
03:50:32 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler 
> <lr@hpl.hp.com>],
> who wrote in article <MPG.137a59ae938d81ad98a9eb@nntp.hpl.hp.com>:
> > I doubt that Perl's bug rate is higher than those.
> 
> ????  Frankly speaking, I'm stunned.  C++ - I do not know.  But
> comparing Perl with C...

I really don't know either.  The language is much easier to compile, but 
then there is optimization.

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


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

Date: Thu, 04 May 2000 17:54:02 GMT
From: dplynn@dmrtc.net
Subject: LWP POST syntax @{@$%??}
Message-Id: <8esdfg$eo6$1@nnrp1.deja.com>

Greetings!

	I'm a newbie to perl, bought the 'dummies book', etc... but I'm stuck
on syntax with lists, etc...
Specifically, I'm try to POST to a form with a lot of variables, and an
upload file.

use LWP;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Request::Common qw(POST);

<snip .. got cookies to work here :-) >
my $req = POST $myURL,Content_Type => 'form-data',
        		Content => [ func => 'll',
				     versionFile => [$document],
				     objAction => 'create2'
 ...long list of form variables ...
];
</snip>

When this is all spelled out, (iaw lwpcook), things work great.
As a check, I do a print $req->as_string to look at the output.

But, the form variables that I'm filling might change in the future, and
I want to try to deal with that by storing the form variables in a CSV
file (or dynamically parsing them:-)), and loop thru an ASCII file
containing actual form data.  So, as interim step, I decided to try to
figure out what the POST syntax would be.

I'm shooting for a final statement that looks something like:

my $req = POST $myurl, [Content_Type => 'form-data', %Content];

where %Content is a list that is built up with
<snip>
$Content{'objAction'} = 'create2';
$Content{'versionFile'} = [$document];   # really in the dark about this
line
$Content{'func'} = 'll';
etc...
</snip>

But, when I do a print $req->as_string,
I don't get the same results as above.  Then, I start fiddling with the
syntax, and, well..., you can probably guess the rest. :-(

I think there's two questions that need to be answered:
a.  The upload file [$document].. syntax may not be right (or is it a
push(...);?
b.  the my req$ = POST ... syntax.

Any help would be greatly appreciated.  Thanx.
/dave/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 4 May 2000 15:37:33 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Newbie question (probably somthing simple)
Message-Id: <8es5ft$cjp$1@newsflash.concordia.ca>

In article <39119170.A3A1F@mdot.state.mi.us>,
Tom Franklin  <wtfranklin@toast.net> wrote:

>an NT machine running Netscape
>Enterprise web server. 

My sympathies.

>From the command line, I can type "hello" and it will fire up the
>infamaous Hello World script from a file called hello.pl. I can do this
>from any directory, so I KNOW I have the associations set correctly. So,
>here's my problem. I can't call the file from my browser. I've set up a
>"shell cgi" directory under Netscape server and activated the MIME type
>pl as "magnus-internal/shellcgi" with "pl" as the suffix. When I type
>the URL http://myservername/shellcgi/hello, I get a:
>
>Not Found

Does it work with "hello.pl" ?  Usually webservers do not engage in guessing 
games like certain shells.

BTW, this question is more of a web server config issue. 
Try the comp.infosystems.www.* groups.


-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Thu, 04 May 2000 13:41:55 +0100
From: Jonathan Barker <jonny@jonnysoft.co.uk>
To: wtfranklin@toast.net
Subject: Re: Newbie question (probably somthing simple)
Message-Id: <39117012.E51095FD@jonnysoft.co.uk>

I use ActivePerl and Apache. It works fine.

I have the Apache httpd.conf if you want it...

Tom Franklin wrote:

> I installed a copy of Active Perl on an NT machine running Netscape
> Enterprise web server. I followed all the instructions as far as "file
> associations". I added the directories to BOTH the perl.exe file AND the
> script directory to the PATH, and added a "PATHEXT" for .pl extentions.
> From the command line, I can type "hello" and it will fire up the
> infamaous Hello World script from a file called hello.pl. I can do this
> from any directory, so I KNOW I have the associations set correctly. So,
> here's my problem. I can't call the file from my browser. I've set up a
> "shell cgi" directory under Netscape server and activated the MIME type
> pl as "magnus-internal/shellcgi" with "pl" as the suffix. When I type
> the URL http://myservername/shellcgi/hello, I get a:
>
> Not Found
>
> The requested object does not exist on this server. The link you
> followed is either outdated, inaccurate, or the server has been
> instructed not to let you have it.
>
> When I check the error log I see:
>
> [04/May/2000:10:55:01] warning (  409): send-cgi:failed to get
> associated file for (c:/netscape/suitespot/httpd/shellcgi/hello) Error 2
>
> [04/May/2000:10:55:01] failure (  409): for host 162.108.33.13 trying to
> GET /shellcgi/hello, shellcgi-send reports: can't find file association
> of c:/netscape/suitespot/httpd/shellcgi/hello for execution.
>
> I have set security permissions for the perl directory, AND the shellcgi
> directory to FULL for the user that the web server runs under (even
> though I only need R and X...but I was grasping at straws here).
>
> ANYBODY have ANY suggestions?
>
> Thanx in advance





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

Date: Thu, 04 May 2000 13:42:41 +0100
From: Jonathan Barker <jonny@jonnysoft.co.uk>
To: wtfranklin@toast.net
Subject: Re: Newbie question (probably somthing simple)
Message-Id: <39117040.39A8C609@jonnysoft.co.uk>

I use ActivePerl and Apache. It works fine.

I have the Apache httpd.conf if you want it...

Tom Franklin wrote:

> I installed a copy of Active Perl on an NT machine running Netscape
> Enterprise web server. I followed all the instructions as far as "file
> associations". I added the directories to BOTH the perl.exe file AND the
> script directory to the PATH, and added a "PATHEXT" for .pl extentions.
> From the command line, I can type "hello" and it will fire up the
> infamaous Hello World script from a file called hello.pl. I can do this
> from any directory, so I KNOW I have the associations set correctly. So,
> here's my problem. I can't call the file from my browser. I've set up a
> "shell cgi" directory under Netscape server and activated the MIME type
> pl as "magnus-internal/shellcgi" with "pl" as the suffix. When I type
> the URL http://myservername/shellcgi/hello, I get a:
>
> Not Found
>
> The requested object does not exist on this server. The link you
> followed is either outdated, inaccurate, or the server has been
> instructed not to let you have it.
>
> When I check the error log I see:
>
> [04/May/2000:10:55:01] warning (  409): send-cgi:failed to get
> associated file for (c:/netscape/suitespot/httpd/shellcgi/hello) Error 2
>
> [04/May/2000:10:55:01] failure (  409): for host 162.108.33.13 trying to
> GET /shellcgi/hello, shellcgi-send reports: can't find file association
> of c:/netscape/suitespot/httpd/shellcgi/hello for execution.
>
> I have set security permissions for the perl directory, AND the shellcgi
> directory to FULL for the user that the web server runs under (even
> though I only need R and X...but I was grasping at straws here).
>
> ANYBODY have ANY suggestions?
>
> Thanx in advance





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

Date: Thu, 4 May 2000 10:29:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbie: can't open text file in windows (path to file)
Message-Id: <MPG.137b536ebe0fb48a98a9f9@nntp.hpl.hp.com>

In article <39115D95.EDC3E4EA@supermedia.pl> on Thu, 04 May 2000 
13:23:01 +0200, Jonathan Kazmierczak <johny@supermedia.pl> says...
> > script is in c:\inetpub\wwwroot\cgi-bin and I use
> > http://localhost/cgi-bin/test/pl to run it. The html is returned okay.

 ...

> > $worked = open(oFile,">>mylog.log");
> 
> Here you have error: current directory in Windows is c:\inetpub\wwwroot.
> You must specified full path:
> $worked = open(oFile,'>>c:\inetpub\wwwroot\cgi-bin\mylog.log');

It is most unlikely that the webserver will allow writing by a CGI 
program into the cgi-bin directory, which is intended to hold programs 
only.

When the original poster prints a diagnostic based on the value of 
$worked, it should include the value of $!, which is the reason for the 
failure, assuming no other system requests have intervened.  Because one 
usually wants the program to terminate informatively immediately when 
the open() fails, this is a more natural approach:

    use CGI::Carp 'fatalsToBrowser'; # At the top of the program.

    open OFILE, '>>c:/some/appropriate/directory/mylog.log' or
        die "Couldn't open 'mylog.log'. $!\n";

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


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

Date: Thu, 04 May 2000 17:44:17 GMT
From: "Russell England" <russ@css2.com>
Subject: Re: newbie: can't open text file in windows (path to file)
Message-Id: <RFiQ4.1648$tQ3.230172@news3.cableinet.net>

That worked great, I was using double quotes and \.

Now I want to store the file name in a variable, but it doesn't work:

$logfile = 'c:\inetpub\wwwroot\cgi-bin\mylog.log';
open(oFile,'>>$logfile');


"Jonathan Kazmierczak" <johny@supermedia.pl> wrote in message
news:39117EF6.2A2B7EBA@supermedia.pl...
> > I just tried that but it didn't work. Is the ':' or '\' a special
character?
>
> '\' is a mask character. But it works only in double quotas.
>
> > > $worked = open(oFile,'>>c:\inetpub\wwwroot\cgi-bin\mylog.log');
>
> is equal to
> $worked = open(oFile,">>c:\\inetpub\\wwwroot\\cgi-bin\\mylog.log");
>
> Johny.
>
>




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

Date: Thu, 04 May 2000 17:51:47 GMT
From: "Russell England" <russ@css2.com>
Subject: Re: newbie: can't open text file in windows (path to file)
Message-Id: <TMiQ4.1661$tQ3.231499@news3.cableinet.net>

Just figured it out, the $ should be in double quotes.

This works:

$logfile = 'c:\inetpub\wwwroot\cgi-bin\mylog.log';
open(oFile,">>$logfile");

Thanks again


"Russell England" <russ@css2.com> wrote in message
news:RFiQ4.1648$tQ3.230172@news3.cableinet.net...
> That worked great, I was using double quotes and \.
>
> Now I want to store the file name in a variable, but it doesn't work:
>
> $logfile = 'c:\inetpub\wwwroot\cgi-bin\mylog.log';
> open(oFile,'>>$logfile');
>
>
> "Jonathan Kazmierczak" <johny@supermedia.pl> wrote in message
> news:39117EF6.2A2B7EBA@supermedia.pl...
> > > I just tried that but it didn't work. Is the ':' or '\' a special
> character?
> >
> > '\' is a mask character. But it works only in double quotas.
> >
> > > > $worked = open(oFile,'>>c:\inetpub\wwwroot\cgi-bin\mylog.log');
> >
> > is equal to
> > $worked = open(oFile,">>c:\\inetpub\\wwwroot\\cgi-bin\\mylog.log");
> >
> > Johny.
> >
> >
>
>




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

Date: Thu, 04 May 2000 17:49:44 GMT
From: "Russell England" <russ@css2.com>
Subject: Re: newbie: can't open text file in windows
Message-Id: <YKiQ4.1656$tQ3.231310@news3.cableinet.net>

That's great thanks, it now shows all errors to the browser.

Cheers

Russ


"Jeff Zucker" <jeff@vpservices.com> wrote in message
news:39117F0E.B53433AB@vpservices.com...
> Russell England wrote:
> >
> > My first script and I can't get it to work. The open file doesn't seem
to
> > work.
>
> > #!/usr/bin/perl
>
> Broken record:  use -w and "use strict" to spot problems before they
> occur.
>
> > use CGI qw(:standard);
>
> Add "use CGI::Carp qw(fatalsToBrowser)" to allow (many) errors to be
> sent to your browser so you can see what is going on when something
> fails.
>
> > $worked = open(oFile,">>mylog.log");
>
> Perl has a very nice feature that tells you if an open works or if not
> why it fails.  In fact, it is the only thing that can tell you why your
> open isn't working, we can't guess from here.  Change that line to:
>
> $worked = open(oFile,">>mylog.log") or die $!;
>
> The chances are that "mylog.log" is in some other directory than your
> script is operating in (scripts can operate different places than you
> think they might depending on server settings) so you'll probably need
> to sepcify a full absolute file (not url) path to that file.
>
> --
> Jeff




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

Date: Thu, 4 May 2000 17:50:30 +0200
From: "Martijn Tonies" <remove_seal97@dds.nl>
Subject: Re: Perl & delivering Databases?
Message-Id: <8es697$spk$1@porthos.nl.uu.net>

My guess is that your first plan would be slow... very slow... What about a
3-tier solution here?

Build a server application that connects to the database from localhost and
build a client app that connects to the server app...

Martijn Tonies

--

For Delphi Components and InterBase tools:
http://www.upscene.com


<ammar_aganovic@my-deja.com> wrote in message
news:8epqus$i1p$1@nnrp1.deja.com...
> I need to make a database residing on MySQL available to custom
> developed software which would be able to access the database directly.
> The most elegant solution would be to simply add a System DSN in ODBC
> sources with MySQL driver, and access the database through DSN. The
> problem is the proveider would not let a user to connect from host
> other then localhost (security reasons). So I need to improvise.
>
> I am thinking of delivering a DB through HTTP. I though a perl script
> would be able to read the MySQL tables, and output them to for example
> access file. The file would be then send via http protocol, and the
> software at the client side would then process the access db, make the
> changes, modify the access file and send back. Or I could even do some
> streaming (both Client & Server side). I thought of using Perl & Delphi
> to accomplish that, but would be very gratefull if U could help me with
> some modules & units I could search for.
>
>
>
> P.S. does anyone know how to drive a ODBC connection through secure
> channel? I did manage to use a portmapper (or something like that) to
> reroute the connection through previously established secure line (with
> TTerm & TTsh), but I found no way to automatise the process.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Thu, 04 May 2000 16:18:25 GMT
From: ammar_aganovic@my-deja.com
Subject: Re: Perl & delivering Databases?
Message-Id: <8es7rt$7mv$1@nnrp1.deja.com>



> I guess I am still lost as to why you need to do all that rather than
> operating on the original database directly.

as I already stated, the provider locked all DBs for local use only,
and doesen't seem to be changing his mind 'bout it (www.superb.net)

any provider that might help me?

ammar


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 4 May 2000 12:11:17 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: problem with "system" and file copy
Message-Id: <3911a125$1_1@news.iglou.com>

<39116BE8.A6E0CB57@rchland.ibm.com>:Paul R. Andersen (andersen+@rchland.ibm.com):comp.lang.perl.misc:Thu, 04 May 2000 07:24:09 -0500:quote:
: Perl does not understand the ~, it is csh, or ksh, or bash, or whatever
: shell you are running that handles the tilde.  Perl cannot.  I wrote a
: routine that processes file names and converts the tilde and other
: shorthand notations to real names.  That works great, especially with Tk
: where I can let the users enter as they are used to.
: 
: Andreas Boerner wrote:
: 
: > I have a problem with copy and a system call:
: >
: > The following perl routine however does not work:
: >
: > use strict;
: > my $command;
: > my $rc;
: >
: > $command = "cp ~/dir1/*.c ~dir2";
: > print $command;
: > $rc = system($command);
: > print "rc=$rc\n";
: >
: > it produces the following output:
: >
: > command=cp ~/dir1/*.c ~/dir2
: > cp: cannot access ~/dir1/*.c
: > rc=512

From perldoc -f system

       system LIST

       system PROGRAM LIST
               Does exactly the same thing as `exec LIST', except
               that a fork is done first, and the parent process
               waits for the child process to complete.  Note
               that argument processing varies depending on the
               number of arguments.  If there is more than one
               argument in LIST, or if LIST is an array with more
               than one value, starts the program given by the
               first element of the list with arguments given by
               the rest of the list.  If there is only one scalar
               argument, the argument is checked for shell
               metacharacters, and if there are any, the entire
               argument is passed to the system's command shell
               for parsing (this is `/bin/sh -c' on Unix
               platforms, but varies on other platforms).  If
               there are no shell metacharacters in the argument,
               it is split into words and passed directly to
               `execvp', which is more efficient.


The reason why this is confusing is that some Unix systems (I know
RedHat Linux does, for example) have bash as /bin/sh.  So sometimes
the example above will work, and sometimes it won't.

I would use glob (perldoc -f glob) as it uses /bin/csh, which will
understand tilde notation, wildcards, etc.  You can do your own,
as Paul suggested, but it's easier to use the built-in functions.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


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

Date: Thu, 04 May 2000 16:10:03 GMT
From: johnpe@my-deja.com
Subject: Re: Problems with Installing JPL (Java-Perl Lingos) on Win NT
Message-Id: <8es7ca$71b$1@nnrp1.deja.com>

I called ActiveState's Perl Clinic and got the message that JPL is
still not supported on Win32 platform.  The JPL is bundled with Unix
version of Perl Resource Kit, not the win32 version. At this time, it
seems that JPL on win32 is just an item on the wishlist.

In article <8epk7t$aiv$1@nnrp1.deja.com>,
  michael.s.roth@saic.com wrote:
> John, I am having the same problem.  I have moved all of the .h files
> that the source code references into the JNI directory and it seems to
> be helping.  Now I am getting compiler errors inside the perl core
> (ipersys.h).  Sorry I'm no help but I am commiserating with you.
>
> Scott.
>
> In article <8ek9fc$beu$1@nnrp1.deja.com>,
>   johnpe@my-deja.com wrote:
> > I have problems installing JPL (Java-Perl Lingos
> > ) on the Windows NT system.
> >
> > *  I downloaded the source code of Perl 5.6.0.
> > * My machine has JDK1.2.2.
> > * I use Microsoft Visual C++ 6.0 as a compiler
> > for the source code.
> > * The compilation for perl 5.6.0 was successful.
> > * Following the instruction, I cd to JPL
> > directory and do the following:
> >     perl Makefile.PL
> >     nmake
> >     nmake install
> > It was successful.
> >
> > * Following the instruction, I cd to JNI
> > directory to compile the closer.java class by
> > using:
> >        javac Closer.java
> > It was successful.
> >
> > * Following the instruction, I
> >         copy typemap.win32 typemap and then type:
> >
> >         perl Makefile.PL
> >         nmake
> >
> > The CMD window gave a bunch of error messages
> > such as:
> > Jni.c
> > JNI.xs(124):  error C2223: left of -
> > >NewBooleanArray must point to struct/union.
> > left of ->SetBooleanArrayRegion must point to
> > struct/union
> >
> > I would appreciate if someone shares experience
> > with installing JPL (Java-Perl Lovers) in Win32
> > with JDK1.2.2.
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 4 May 2000 11:03:26 -0400
From: "Bruce McFarlane" <bmc@yeah-right.com>
Subject: Refresh problem
Message-Id: <NkgQ4.15281$HG1.408981@nnrp1.uunet.ca>

I have created a script that writes a setup file based on user input. A =
confirmation screen is displayed with the users input. The user selects =
Retry to make changes or Confirm to create the file. The script then =
creates the file and displays a confirmation screen. Every thing is fine =
to this point but if the user then clicks their browsers refresh or =
reload the script creates another file (the script checks for duplicates =
and increments the file name). How can I avoid this "refresh/reload" =
problem?

$confdt =3D $in{'chdt'};

# confirm data=20
if ($confdt ne "Confirm") {
 if ($confdt eq "Retry") {
 print "Content-type: text/html\n\n";
 print &conf_ret("ex/reg.html"); # redisplays the form for changes
 exit;
 }
 &conf_dat; # displays confirmation screen
 exit;
}
=20
&create_files; # if Confirm create files
&conf_note; # displays confirmation screen (root of problem)

sub conf_dat {
&head;
print qq~
<form method=3D"post" action=3D"rand_reg.pl">

# display info chopped for brevity

<input type=3Dsubmit name=3Dchdt value=3D"Confirm">=20
<input type=3Dsubmit name=3Dchdt value=3D"Retry"></form>~;
&tail;
}




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

Date: Thu, 4 May 2000 09:46:55 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: reg expressions assistance
Message-Id: <8es9hb$hnp$1@brokaw.wa.com>


Ala Qumsieh <aqumsieh@hyperchip.com> wrote in message
news:7asnvyphjz.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me...
> "Lauren Smith" <lauren_smith13@hotmail.com> writes:
> > spurcell <skpurcell@hotmail.com> wrote in message
> > news:390f2f24$0$1862@wodc7nh1.news.uu.net...
> > >
> > > $fish =~ s/^\s*|\s*$//g;
> >
> > That doesn't strip leading and trailing blank spaces.
>
> Ummm... it does:
>
> % perl -wl
> $fish = '    hello   ';
> $fish =~ s/^\s*|\s*$//g;
> print ">>$fish<<";
> __END__
> >>hello<<

I was thrown off by the alternation.

Chalk up another completely erroneous claim...

*sigh*  Maybe I should take a break from posting and drill down on some
things.

Lauren





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

Date: Thu, 4 May 2000 11:30:20 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Tanspose rows to columns
Message-Id: <Pine.A41.4.10.10005041128280.21122-100000@ginger.libs.uga.edu>

On Thu, 4 May 2000 jimbob4334@my-deja.com wrote:
> Hi,
> 
> I have been trying to convert this:
> 
> 4|3|7|0|2|0|2|0|2|1|1|0|2|3|0|0|0|0|0|0|0|0|0|0|1.1|
> 6|2|3|4|6|3|6|8|6|1|2|5|3|7|2|0|0|0|0|0|0|0|0|0|1.2|
> 0|0|0|0|0|0|0|0|0|0|0|0|0|5|3|0|0|0|0|0|0|0|0|0|1.3|
> 
> into this:
> 
> <PRO>
> 1.1
> 1.2
> 1.3
> </PRO>
> <DATA>
> 4	6	0
> 3	2	0
> 7	3	0
> 0	4	0
> 2	6	0
> 0	3	0
> 2	6	0
> 0	8	0
> 2	6	0
> 1	1	0
> 1	2	0
> 0	5	0
> 2	3	0
> 3	7	5
> 0	2	3
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> 0	0	0
> </DATA>

And it looks like you succeeded.  Since you're probably asking how one
might do this with perl, what have you tried so far?

--
Brad



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

Date: Thu, 04 May 2000 15:18:38 GMT
From: Vincent Murphy <Vincent.Murphy@Baltimore.Com>
Subject: Re: Transpose rows to columns
Message-Id: <xjgr9bibayf.fsf@gamora.us.cybertrust.com>

>>>>> "jim" == jimbob4334  <jimbob4334@my-deja.com> writes:

    jim> Hi,
    jim> I have been trying to convert this:

    jim> 4|3|7|0|2|0|2|0|2|1|1|0|2|3|0|0|0|0|0|0|0|0|0|0|1.1|
    jim> 6|2|3|4|6|3|6|8|6|1|2|5|3|7|2|0|0|0|0|0|0|0|0|0|1.2|
    jim> 0|0|0|0|0|0|0|0|0|0|0|0|0|5|3|0|0|0|0|0|0|0|0|0|1.3|

    jim> into this:

    jim> <PRO>
    jim> 1.1
    jim> 1.2
    jim> 1.3
    jim> </PRO>
    jim> <DATA>
    jim> 4	6	0
    jim> 3	2	0
    jim> 7	3	0
    jim> 0	4	0
    jim> 2	6	0
    jim> 0	3	0
    jim> 2	6	0
    jim> 0	8	0
    jim> 2	6	0
    jim> 1	1	0
    jim> 1	2	0
    jim> 0	5	0
    jim> 2	3	0
    jim> 3	7	5
    jim> 0	2	3
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> 0	0	0
    jim> </DATA>

There may be slick way of doing this with a matrices module.  Look at
the _Perl Algorithms_ book for more information.

Here is something that may help you:



#! /usr/local/bin/perl -w

use strict;
my @rows = ();
while( <DATA> )  {
  s/\|$//;  # strip off last pipe.
  chomp;
  push(@rows,[ split '\|' ]);
}

print "<PRO>\n", map "$_->[-1]\n" => @rows;
print '</PRO>', "\n";

# I assume, maybe incorrectly, all rows have equal number of columns.
my $row_length = @{ $rows[0] };
print "<DATA>\n";
for ( my $i = 0; $i < @{ $rows[0] } - 1; $i++ ) {
  foreach my $row ( @rows ) {
    print $row->[$i], "\t";
  }
  print "\n";
}
print "</DATA>\n";

__DATA__
4|3|7|0|2|0|2|0|2|1|1|0|2|3|0|0|0|0|0|0|0|0|0|0|1.1|
6|2|3|4|6|3|6|8|6|1|2|5|3|7|2|0|0|0|0|0|0|0|0|0|1.2|
0|0|0|0|0|0|0|0|0|0|0|0|0|5|3|0|0|0|0|0|0|0|0|0|1.3|


--Vinny


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

Date: Thu, 04 May 2000 16:44:07 GMT
From: jimbob4334@my-deja.com
Subject: Re: Transpose rows to columns
Message-Id: <8es9ci$9o0$1@nnrp1.deja.com>

I was able to get it working using this:

	#Generation of a LIST OF LISTS
	# reading from file
	@LoL = ();
	while ( <DATA_FILE> )
	{
		push @LoL, [ split(/\|/) ];
 	}
	print FILE_OUT "\n<PROJECT_DEFS>\n";
	print "Input file: $file \n";
	for $i ( 0 .. $#LoL )
	{
		for $j ( 0 .. $#{$LoL[$i]} )
		{

			if ($LoL[$i][$j] =~ /\d+\.\d+/)
			{
				print FILE_OUT "$LoL[$i][$j]\n";
			}
			else
			{
				if ($LoL[$i][$j] == "")
				{
					$LoL[$i][$j] = 0;
				}
				print TEMP_FILE "$LoL[$i][$j]\t";
			}
			last if ($LoL[$i][$j] =~ /\d+\.\d+/);
     		}
     		print TEMP_FILE "\n";
     	}
     	print FILE_OUT "TOTAL";
     	print FILE_OUT "</PROJECT_DEFS>\n";
 	print FILE_OUT "<DATA_TABLE>\n";
 	close (TEMP_FILE);
 	open (DATA, "$temp") || die "$file_out cannot be opened for
reading\n";
 	@d=();
	@input=();
	while (<DATA>)
	{
		for (0 .. scalar(@d = split) - 1)         #scalar(@d)
gets the number of elements in array
			{ $input[$_][$. - 1] = $d[$_] };  #$. is the
current input line of the last filehandle read
	}
	print FILE_OUT map { "@$_\n" } @input;  #map applies the
expression to the array
	print FILE_OUT "</DATA_TABLE>\n";
	close (DATA);  #closes file and resets $. to zero
	close (FILE_OUT);
	#system ("cp -p $outputfile $outputfile2");



In article <xjgr9bibayf.fsf@gamora.us.cybertrust.com>,
  Vincent Murphy <Vincent.Murphy@Baltimore.Com> wrote:
> >>>>> "jim" == jimbob4334  <jimbob4334@my-deja.com> writes:
>
>     jim> Hi,
>     jim> I have been trying to convert this:
>
>     jim> 4|3|7|0|2|0|2|0|2|1|1|0|2|3|0|0|0|0|0|0|0|0|0|0|1.1|
>     jim> 6|2|3|4|6|3|6|8|6|1|2|5|3|7|2|0|0|0|0|0|0|0|0|0|1.2|
>     jim> 0|0|0|0|0|0|0|0|0|0|0|0|0|5|3|0|0|0|0|0|0|0|0|0|1.3|
>
>     jim> into this:
>
>     jim> <PRO>
>     jim> 1.1
>     jim> 1.2
>     jim> 1.3
>     jim> </PRO>
>     jim> <DATA>
>     jim> 4	6	0
>     jim> 3	2	0
>     jim> 7	3	0
>     jim> 0	4	0
>     jim> 2	6	0
>     jim> 0	3	0
>     jim> 2	6	0
>     jim> 0	8	0
>     jim> 2	6	0
>     jim> 1	1	0
>     jim> 1	2	0
>     jim> 0	5	0
>     jim> 2	3	0
>     jim> 3	7	5
>     jim> 0	2	3
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> 0	0	0
>     jim> </DATA>
>
> There may be slick way of doing this with a matrices module.  Look at
> the _Perl Algorithms_ book for more information.
>
> Here is something that may help you:
>
> #! /usr/local/bin/perl -w
>
> use strict;
> my @rows = ();
> while( <DATA> )  {
>   s/\|$//;  # strip off last pipe.
>   chomp;
>   push(@rows,[ split '\|' ]);
> }
>
> print "<PRO>\n", map "$_->[-1]\n" => @rows;
> print '</PRO>', "\n";
>
> # I assume, maybe incorrectly, all rows have equal number of columns.
> my $row_length = @{ $rows[0] };
> print "<DATA>\n";
> for ( my $i = 0; $i < @{ $rows[0] } - 1; $i++ ) {
>   foreach my $row ( @rows ) {
>     print $row->[$i], "\t";
>   }
>   print "\n";
> }
> print "</DATA>\n";
>
> __DATA__
> 4|3|7|0|2|0|2|0|2|1|1|0|2|3|0|0|0|0|0|0|0|0|0|0|1.1|
> 6|2|3|4|6|3|6|8|6|1|2|5|3|7|2|0|0|0|0|0|0|0|0|0|1.2|
> 0|0|0|0|0|0|0|0|0|0|0|0|0|5|3|0|0|0|0|0|0|0|0|0|1.3|
>
> --Vinny
>



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 04 May 2000 11:03:47 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Re: Where is a clear, complete explanation of using perldebug?
Message-Id: <17eac528.cf86a484@usw-ex0103-018.remarq.com>

Command line debugger has to come up with its own vocabulary and
that's exactly done with perl -d.

You should learn how it works if you want to use it just like
any other thing.

Debugger Syntax are easy to work with once you practice..

I don't know much about how my life can be extremly easy with
debugger. I agree on the point that I need an enhanced guide for
that..



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 4 May 2000 11:57:17 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: Why won't Perl's 'use' includes the directory where script is run?
Message-Id: <39119ddd_1@news.iglou.com>

<8eqr58$8ri@netnews.hinet.net>:John Lin (johnlin@chttl.com.tw):comp.lang.perl.misc:Thu, 4 May 2000 11:34:12 +0800:quote:
: Dear all,
: 
: Why won't Perl's 'use' includes the directory where script is run?
: 
: What is your suggestion for this situation?

from perlfaq8 (type "perldoc perlfaq8" at the command line,
or look at the HTML docs if you are using ActiveState)

       How do I add a directory to my include path at runtime?

       Here are the suggested ways of modifying your include
       path:

           the PERLLIB environment variable
           the PERL5LIB environment variable
           the perl -Idir command line flag
           the use lib pragma, as in
               use lib "$ENV{HOME}/myown_perllib";

       The latter is particularly useful because it knows about
       machine dependent architectures.  The lib.pm pragmatic
       module was first included with the 5.002 release of Perl.

use lib is what you are looking for.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


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

Date: Thu, 04 May 2000 10:44:50 -0600
From: Michael Roinestad <michaelr@apgtest.com>
Subject: Win32::OLE::Variant Converting VB to Perl question (2nd attempt)
Message-Id: <3911A902.15548781@apgtest.com>

  I have been having problems trying to convert a VBA module to Perl.
  The following line shows how to use a method called GetXData in VBA.

    [-- Start of VBA example -- ]
        Dim FilterType as Variant
        Dim FilterValue as Variant

        Entity.GetXData("TEXT", FilterType, FilterValue)         # and
that works in VBA
    [ -- End of VBA example --]

    At this point in VBA FilterType and FilterValue contain an array of
Variant.  However
    in Perl, FilterType and FilterValue contain anything but useful
information.  I have been
    stuck for over a week, and the boss wants to know WTF.

    Here are just some of the different approaches I have tried( -w and
use strict haven't been very helpful either):

    1.  my $Codes  = Variant(VT_VARIANT | VT_BYREF | VT_ARRAY, 9);
         my $Values = Variant(VT_VARIANT | VT_BYREF | VT_ARRAY, 9);
         my $Entity = $Entities->Item($Index);
         $Entity->GetXData("TEXT", \$Codes, \$Values);

    2.  my $Codes  = Variant(VT_EMPTY);
         my $Values = Variant(VT_EMPTY);
         my $Entity = $Entities->Item($Index);
        $Entity->GetXData("APG_DEMO", \$Codes, \$Values);

    I could keep going, but I hope you get the idea.  I looked in
OLEVIEW and found this
    as the definition for GetXData:
            HRESULT GetXData([in] BSTR AppName, [out] VARIANT*
XDataType, [out] VARIANT* XDataValue);

This has been very frustrating, so please don't feel the need to flame
me.

Thank you in advance,
Michael Roinestad




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

Date: Thu, 04 May 2000 10:05:53 -0600
From: Michael Roinestad <michaelr@apgtest.com>
Subject: Win32::OLE::Variant Converting VB to Perl question.
Message-Id: <39119FE1.7E4F546C@apgtest.com>

    I have been having problems trying to convert a VBA module to Perl.

    In the following line
        ThisDrawing.Select(0, undef, undef, \$FType, \$FData)

            OLEVIEW shows Select being defined as
                Select(
                    [in] int Mode,
                [in, optional] VARIANT Point1,
                [in, optional] VARIANT Point2,
                [in, optional] VARIANT FilterType,
                [in, optional] VARIANT FilterData
              );




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

Date: Thu, 04 May 2000 10:09:53 -0600
From: Michael Roinestad <michaelr@apgtest.com>
Subject: Re: Win32::OLE::Variant Converting VB to Perl question.
Message-Id: <3911A0D1.CECCFB62@apgtest.com>

OOPS:  Sent to soon I will repost.
Sorry.

Michael Roinestad


Michael Roinestad wrote:

>     I have been having problems trying to convert a VBA module to Perl.
>
>     In the following line
>         ThisDrawing.Select(0, undef, undef, \$FType, \$FData)
>
>             OLEVIEW shows Select being defined as
>                 Select(
>                     [in] int Mode,
>                 [in, optional] VARIANT Point1,
>                 [in, optional] VARIANT Point2,
>                 [in, optional] VARIANT FilterType,
>                 [in, optional] VARIANT FilterData
>               );



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 2950
**************************************


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