[19825] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2020 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 27 00:05:31 2001

Date: Fri, 26 Oct 2001 21:05:07 -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: <1004155507-v10-i2020@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 26 Oct 2001     Volume: 10 Number: 2020

Today's topics:
    Re: $ENV not defined (Tad McClellan)
        [OT] Re: $ENV not defined <joe+usenet@sunstarsys.com>
    Re: Array initialization, what am I doing wrong? <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Control of parent shell (Tad McClellan)
    Re: DBI/CSV Q (Chris Fedde)
    Re: DBI/CSV Q <mikecook@cigarpool.com>
    Re: DBI/CSV Q <jeff@vpservices.com>
    Re: Filling in PDF files using PERL <zkent@adelphia.net>
    Re: getting %errorlevel% values with perl? <Juha.Laiho@iki.fi>
    Re: handling numbers with leading zeros <slytobias@home.com>
        HOW to generate graph on MS-Excel using PERL (Tim)
    Re: HOW to generate graph on MS-Excel using PERL <bart.lateur@skynet.be>
    Re: HOW to generate graph on MS-Excel using PERL (Jason Kohles)
    Re: https and writing files <spam@thecouch.homeip.net>
        Performance gap in Benchmark.pm with/without Tk interfa <hen20040@bestweb.net>
    Re: Perl expression to delete delimited bits of text in (John J. Trammell)
    Re: Perl expression to delete delimited bits of text in <mbudash@sonic.net>
        Perl Newbie question : How can I open an internet conne <john@smithIndustries.com>
    Re: Perl Newbie question : How can I open an internet c <tony_curtis32@yahoo.com>
    Re: Security- Upload scripts <tintin@snowy.calculus>
    Re: variable replacement (Tad McClellan)
    Re: variable replacement <dtweed@acm.org>
    Re: variable replacement <mgjv@tradingpost.com.au>
    Re: Web image tables (Chris Fedde)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 27 Oct 2001 00:20:11 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: $ENV not defined
Message-Id: <slrn9tjqcp.84j.tadmc@tadmc26.august.net>

Mr Sunblade <djberge@uswest.com> wrote:
>Tad McClellan wrote:
>> Lars Snith <lars.snith@inpactmicro.com> wrote:
>> >OK, OK!
>> >
>> >Thanks for the help on the matter,
>>
>> You are the only person who knows who you are addressing.
>>
>
>Are you using a text based news reader?  


Yes. But that is a red herring.


>Doesn't the thread make this
>obvious?  


No. Threading is _based on_ the References header. Lars' article
referred only to Lars' previous article.

If it _had_ been a proper followup (References header set), _then_
threading would have made it obvious. But that isn't what happened.


>Or isn't the whole thread available to some text based
>readers?  


Some news *feeds* do not have the whole thread available. News
servers expire articles. Some articles _never_ reach some servers
(articles get "lost").

And propogation of news is not a guaranteed thing. Articles
may show up at some server in minutes, hours or days. (Or
may never show up at all, as noted above.) So the reader
of a followup may have no access to the followed-up-to
article. Quoting what you are commenting on avoids that.

And and, there were more than one followup, which one was
Lar's speaking of?

Has nothing to do with the news reader used. Has to do with
news propogation, feeds and servers, ie. "How news works".


>I'm curious about this piece of netiquette, since I've never
>used a text based news reader (call me crazy).


text vs. GUI has nothing to do with it.


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


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

Date: 26 Oct 2001 20:43:16 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: [OT] Re: $ENV not defined
Message-Id: <m33d45q5ej.fsf_-_@mumonkan.sunstarsys.com>

dlorraine@peoplepc.com (Lori Fleetwood) writes:

> tadmc@augustmail.com (Tad McClellan) wrote in message
> news:<slrn9tiqcc.6q3.tadmc@tadmc26.august.net>... 
> > Lars Snith <lars.snith@inpactmicro.com> wrote:
> > >OK, OK!
> > >
> > >Thanks for the help on the matter, 
> > 
> > 
> > You are the only person who knows who you are addressing.
> > 
> > You should quote the text you're commenting on, or at the very least
> 
> <<SNIP (Pretentious bullshit)>>
> 
> Only an asshole like you 

Your post is off-topic for this newsgroup.  For your edification,
here's a quote from Conway's _OOP_, page 71-

  The Perl groups provide an extraordinary amount of useful information
  and feedback, and an exceptional opportunity to interact with the
  designers and implementers of the Perl language.  They are frequented
  by a large cross-section of the worldwide Perl community from raw
  novices to supreme gurus.

  It is particularly important, therefore, to be aware of the culture
  and customs of the various groups before attempting to post.  If
  nothing else, be sure to read the relevant introductory messages
  (e.g., "Welcome- read this first" in comp.lang.perl.moderated). Better
  still, lurk around the various groups a little before you post.  Read
  the messages and get a feel for what's appropriate.
 
Had you lurked for a while, you'd have known that Tad's comments
in this subthread are fairly accurate reflections of the customs 
of clp.misc.  Your sublime ignorance of this fact has surely left
a memorable impression.

-- 
Joe Schaefer            "Bad artists always admire each others work."
                                               -- Oscar Wilde



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

Date: Sat, 27 Oct 2001 00:22:01 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Array initialization, what am I doing wrong?
Message-Id: <3BD9E209.10705@post.rwth-aachen.de>

Jennifer Frank wrote:

> Hi,
> 
> I always get the message:
> 
> Use of uninitialized value at NOIS2XML.pl line 601.
> 
> When compiling the following code (only partial):
> 
>    @temp = (" ") x @temp;


When springing to life, @temp has zero elements. Hence you initialize 
zero elements with a whitespace which will keep the whole array 
uninitialized.

Tassilo

-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Sat, 27 Oct 2001 00:20:15 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Control of parent shell
Message-Id: <slrn9tjsku.84j.tadmc@tadmc26.august.net>

Tony Armell <Tony_Armell@notes.teradyne.com> wrote:
>Can the /bin/csh shell that executed a PERL script be controlled by that
>PERL script?
>
>Ex. A simple PERL/TK GUI to change directories where the c-shell follows
>the GUI.


Perl FAQ, part 8:

   "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?"


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


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

Date: Fri, 26 Oct 2001 22:40:25 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: DBI/CSV Q
Message-Id: <tDlC7.172$X3.171368448@news.frii.net>

In article <bplC7.395$ji6.180757@news.uswest.net>,
Michael Cook <mikecook@cigarpool.com> wrote:
>Hi folks,
>    I am trying to write a script which will delete a row from a CSV file
>given a key value to find. I have been able to write one which populates the
>CSV using the DBI. Attached is the Perl script which I am executing at the
>command line; a log of reading the file, running the script and reading it
>again with a dbitrace.log showing he internal calls.
>    Can anyone please tell me why this does not delete the row?
>        Thanks!!!
>            Michael

>begin 666 delpipe.pl
[...]
>end

Please refrain from posting encoded enclosures to this news group.  Try
posting a working code fragment in plain text that exhibits the problem you
are having. Include a short explanation of what is going wrong.
Maybe then we can better help you.

Thanks
and
Good Luck
-- 
    This space intentionally left blank


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

Date: Fri, 26 Oct 2001 18:18:18 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: DBI/CSV Q
Message-Id: <GXnC7.435$ji6.236682@news.uswest.net>

"Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
news:tDlC7.172$X3.171368448@news.frii.net...
> In article <bplC7.395$ji6.180757@news.uswest.net>,
> Michael Cook <mikecook@cigarpool.com> wrote:
> >Hi folks,
> >    I am trying to write a script which will delete a row from a CSV file
> >given a key value to find. I have been able to write one which populates
the
> >CSV using the DBI. Attached is the Perl script which I am executing at
the
> >command line; a log of reading the file, running the script and reading
it
> >again with a dbitrace.log showing he internal calls.
> >    Can anyone please tell me why this does not delete the row?
> >        Thanks!!!
> >            Michael
>
> >begin 666 delpipe.pl
> [...]
> >end
>
> Please refrain from posting encoded enclosures to this news group.  Try
> posting a working code fragment in plain text that exhibits the problem
you
> are having. Include a short explanation of what is going wrong.
> Maybe then we can better help you.
>
> Thanks
> and
> Good Luck
> --
>     This space intentionally left blank

Thanks for the tip! Sorry about that; here are the attachments in text:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Perl script:

#!/usr/bin/perl -w

use DBI;
use strict;
use vars qw(
            $delpipe
            $delproductnumber
            @delproductnumber
            $db
            $dbpath
            $dbh
           );

use CGI::Carp 'fatalsToBrowser';
use CGI qw(:standard :private_tempfiles -no_debug);
$delpipe=new CGI;
print $delpipe->header;
$delproductnumber=$delpipe->param('delproductnumber');
@delproductnumber=grep {s/^.*\/pix\/(\d+)\.jpg.*$/$1/} $delproductnumber;
$delproductnumber=pop(@delproductnumber);

# Delete the pipe

unlink 'dbitrace.log' if -e 'dbitrace.log';
DBI->trace( 1, 'dbitrace.log' );

$dbpath = './db';
$db = 'pipes';
$dbh =
DBI->connect("DBI:CSV:f_dir=$dbpath;csv_sep_char=:",,,{RaiseError=>1});
$dbh->do( qq{
             DELETE FROM $db
              WHERE productnumber = '1004'
            } );
exit;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log of commands:

/home/www/cgi-bin - 28-> cat db/pipes
brand:model:shape:bent:finish:size:nomenclature:weight:new:condition:comment
:origin:productnumber:re
tail:price:onsaleprice:hold:sold:future1:future2
Dunhill:Shell:Billiard:n:sandblast:3:"Made in England":32:n:vgc:"Great
blast!!!":England:1001:225:20
0:175::::
"Peter Matzhold"::Apple:y:smooth:4:"Matzhold Pipes&nbsp;tadpole
logo":40:n:vgc:"Great grain from one
 of the premier pipemakers in the world":Austrian:1002:360:225:180::::
Peterson:Milverton:Billiard:y:smooth:5:"Sherlock
Holmes,Milverton":65:y:y:"System pipe - smokes dry"
:Irish:1003:225:200:125:y:::
Castello:"Sea Rock":Yachtsman:y:rusticated:5:"Made in Cantu,
Italy":60:n:vgc:"Nice Rustication":Ital
y:1004:300:200:::::
Barling:1:Pot:n:smooth:4:"Barling's
Make":40:n:vgc:pre-transition:England:1005:200:175:::::

/home/www/cgi-bin - 29-> ./delpipe.pl
Content-Type: text/html

Use of uninitialized value in substitution (s///) at ./delpipe.pl line 24.

/home/www/cgi-bin - 30-> cat db/pipes
brand:model:shape:bent:finish:size:nomenclature:weight:new:condition:comment
:origin:productnumber:re
tail:price:onsaleprice:hold:sold:future1:future2
Dunhill:Shell:Billiard:n:sandblast:3:"Made in England":32:n:vgc:"Great
blast!!!":England:1001:225:20
0:175::::
"Peter Matzhold"::Apple:y:smooth:4:"Matzhold Pipes&nbsp;tadpole
logo":40:n:vgc:"Great grain from one
 of the premier pipemakers in the world":Austrian:1002:360:225:180::::
Peterson:Milverton:Billiard:y:smooth:5:"Sherlock
Holmes,Milverton":65:y:y:"System pipe - smokes dry"
:Irish:1003:225:200:125:y:::
Castello:"Sea Rock":Yachtsman:y:rusticated:5:"Made in Cantu,
Italy":60:n:vgc:"Nice Rustication":Ital
y:1004:300:200:::::
Barling:1:Pot:n:smooth:4:"Barling's
Make":40:n:vgc:pre-transition:England:1005:200:175:::::

/home/www/cgi-bin - 31-> cat dbitrace.log
    DBI 1.14-nothread dispatch trace level set to 1
    -> DBI->connect(DBI:CSV:f_dir=./db;csv_sep_char=:, HASH(0x823ea5c),
****)
    -> DBI->install_driver(CSV) for perl=5.006 pid=29185 ruid=539 euid=539
       install_driver: DBD::CSV loaded (version 0.1027)
    <- install_driver= DBI::dr=HASH(0x81719a8)
    <- default_user= ( HASH(0x823ea5c)1keys undef ) [2 items] at DBI.pm line
405.
    <- STORE('f_dir' '.' ...)= 1 at File.pm line 95.
    <- STORE('f_dir' './db' ...)= 1 at File.pm line 106.
    <- STORE('csv_sep_char' ':' ...)= 1 at File.pm line 106.
    <- FETCH= undef at CSV.pm line 78.
    <- STORE('csv_tables' HASH(0x822f268) ...)= 1 at CSV.pm line 78.
    <- connect= DBI::db=HASH(0x81b3660) at DBI.pm line 408.
    <- STORE('PrintError' 1 ...)= 1 at DBI.pm line 433.
    <- STORE('AutoCommit' 1 ...)= 1 at DBI.pm line 433.
    <- connect= DBI::db=HASH(0x81b3660)
    <- FETCH= 'DBD::CSV::st' ('ImplementorClass' from cache) at File.pm line
162.
    <- STORE('f_stmt' DBD::CSV::Statement=HASH(0x81dff58) ...)= 1 at File.pm
line 169.
    <- STORE('f_params' ARRAY(0x82d2f2c) ...)= 1 at File.pm line 170.
    <- STORE('NUM_OF_PARAMS' 0 ...)= 1 at File.pm line 171.
2   <- prepare('
             DELETE FROM pipes
              WHERE productnumber = '1004'
            ' undef ...)= DBI::st=HASH(0x81dfde4) at DBI.pm line 930.
    <- execute(CODE)= '0E0' at DBI.pm line 931.
    <- rows= 0 at DBI.pm line 932.
    <- do('
             DELETE FROM pipes
              WHERE productnumber = '1004'
            ' CODE)= '0E0' at delpipe.pl line 39.
    <- DESTROY= undef at delpipe.pl line 44.
    <- disconnect_all= undef at DBI.pm line 450.
    <- DESTROY= undef during global destruction.
    <- DESTROY= undef during global destruction.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks!
    Michael
--
== CigarPool ==
http://www.cigarpool.com




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

Date: Fri, 26 Oct 2001 18:42:15 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBI/CSV Q
Message-Id: <3BDA10F7.1CD7183D@vpservices.com>

Michael Cook wrote:
> 
> [snip of far too much info]
> 
> $delproductnumber=$delpipe->param('delproductnumber');

In other words, you want to define the variable from a parameter.

> /home/www/cgi-bin - 29-> ./delpipe.pl

In other words, you are calling the script with no parameters.

> Use of uninitialized value in substitution (s///) at ./delpipe.pl line 24.

And perl dutifully warns you that you are trying to use a parameter that
you never entered.

> @delproductnumber=grep {s/^.*\/pix\/(\d+)\.jpg.*$/$1/} $delproductnumber;

Look up grep, among other things, it's second argument is a list, not a
scalar as you have it.

> DBI->trace( 1, 'dbitrace.log' );

Fix your perl first before worrying about a DBI trace.  There's nothing
wrong with the DBI portion of your code.

-- 
Jeff



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

Date: Sat, 27 Oct 2001 00:13:12 GMT
From: "Zachary Kent" <zkent@adelphia.net>
Subject: Re: Filling in PDF files using PERL
Message-Id: <s_mC7.11577$EO1.1257421@news1.news.adelphia.net>

"Frank Pikelner" <pikelner@home.com> wrote in message
news:kd1C7.100636$5h5.40575694@news3.rdc2.on.home.com...
> Hello,
>
> I have a PDF file (application form) in which I would like to create form
> fields using Adobe Acrobat (writer). I'm wondering whether there is a way
to
> fill in the fields I create in the PDF file using PERL?
>
> I've ready about some commercial products, so I know it is possible. I'm
> hoping there are free techniques in accomplishing what I need.
>

Frank,

Are you trying to create a template for Perl to insert the data dynamically?

If so, create the original PDF file with placeholders for the data such as
%%first_name%% or %%date%%. Have your Perl script open the PDF, substitute
the placeholders with the actual data and then display the file (be sure to
send the correct header for PDFs) or write the new file to disk.

Hope this helps,
Zach




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

Date: 26 Oct 2001 14:06:16 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: getting %errorlevel% values with perl?
Message-Id: <9rbqko$cib$1@ichaos.ichaos-int>

ek <e_kelleher@hotmail.com> said:
>I have tried catching %errorlevel% values from the command prompt
>unsuccessfully using perl.  It seems to be a scope problem as batch
>files seem to handle it okay.  If for example I type dir rubbish and
>then echo %errorlevel% the return value is 1.  If I put this in a perl
>script as
>`dir rubbish`;
>$var=`echo \%errorlevel\%';
>$var's value is always 0.  Does anyone have any idea how to keep the
>scope so perl will catch the actual %errorlevel% value?

You can get the exit value by using function system instead of ``, but
then you won't get the stdout from the actual command.

Your problem is that %errorlevel% contains the exit code from the previous
commands run in the same command interpreter. But above, your dir and echo
are run in two separate command interpreters, and the latter didn't run any
other command before echoing the errorlevel, so the errorlevel will be zero.

If it's that you want to get listing of a directory, and don't know whether
the directory exists, use "if ( -d $potential_directory )" to test if
something is a directory, then use opendir/readdir/closedir to get the
directory listing.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ UH++++$ UL++++$ P++@ L+++ E(-) W+$@ N++ !K w !O
         !M V PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h--- r+++ y+++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Sat, 27 Oct 2001 02:20:11 GMT
From: David Sletten <slytobias@home.com>
Subject: Re: handling numbers with leading zeros
Message-Id: <3BDA1925.9050306@home.com>

You say your website collects SSN's. Presumably this involves HTML forms 
and HTTP. As such, the values are delivered to your server-side program 
as a string of characters either in $ENV{QUERY_STRING} or <STDIN>. What 
are you doing to these strings that causes them to be evaluated as 
numbers? Are you doing SSN arithmetic? :)

You should be able to use CGI::param() to parse the values as strings.

David Sletten

Zachary Kent wrote:

> ----- Original Message -----
> From: "John W. Krahn" <>
> 
>>Zachary Kent wrote:
>>
>>>Our website collects Social Security Numbers and I have had problems
>>>
> with
> 
>>>Perl assuming that leading zeros are not needed and throws them out.
>>>
> How do
> 
>>>I tell Purl(sic)[1] to treat a variable as a string when it contains
>>>
> only numbers?
> 
> Now how many programmers actually know what sic means?  Ex-journalists
> maybe?  My wife is a writer....
> 
> 
>>One word - context - if you use a scalar in a numerical context it's a
>>number, in a string context it's a string.
>>
> 
> I understand the context issue.  The problem is that Perl thinks that
> 012345678 should be 12345678 (removes the leading zero).  However, there are
> SSNs that contain leading zeros.  I have been thinking about prefacing the
> number with a letter just to keep Perl from making the assumption that it is
> a number and losing the zero.
> 
> 
 



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

Date: 26 Oct 2001 17:13:43 -0700
From: tvn007@hotmail.com (Tim)
Subject: HOW to generate graph on MS-Excel using PERL
Message-Id: <21724be2.0110261613.347d4311@posting.google.com>

Hi,


If I would like to automatic generate
some graphs using MS-Excel by writing PERL script .

COuld someone please show/tell me what do I need ?

Thanks for your time and help.


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

Date: Sat, 27 Oct 2001 01:37:52 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: HOW to generate graph on MS-Excel using PERL
Message-Id: <sd3ktt4n2ej4fh29v5i55so4d8eih7jlrc@4ax.com>

Tim wrote:

>If I would like to automatic generate
>some graphs using MS-Excel by writing PERL script .
>
>COuld someone please show/tell me what do I need ?

You need the module Win32::OLE, and then some code that works.
Fortunately for you, this got into the OLE FAQ:
<http://aspn.activestate.com//ASPN/Reference/Products/ActivePerl/faq/Windows/ActivePerl-Winfaq12.html#make_chart>

-- 
	Bart.


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

Date: 27 Oct 2001 03:20:21 GMT
From: usenet@jasonkohles.com (Jason Kohles)
Subject: Re: HOW to generate graph on MS-Excel using PERL
Message-Id: <slrn9tk9rl.dp5.usenet@poseidon.mediabang.com>

On 26 Oct 2001 17:13:43 -0700, Tim wrote:
>If I would like to automatic generate
>some graphs using MS-Excel by writing PERL script .
>
>COuld someone please show/tell me what do I need ?
>
Check the documentation for the Spreadsheet::WriteExcel module.


-- 
Jason S Kohles
email@jasonkohles.com          http://www.jasonkohles.com/


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

Date: Fri, 26 Oct 2001 18:38:31 -0400
From: "Mina Naguib" <spam@thecouch.homeip.net>
Subject: Re: https and writing files
Message-Id: <4BlC7.22077$E03.1258446@wagner.videotron.net>


"Ted Apke" <tedapke@apkesoftware.com> wrote in message
news:3a7C7.22796$IR4.12821565@news1.denver1.co.home.com...
> Sorry.  I wish there were more details to share.  The open fails.  Here is
a
> sample script.
>
>    require 'ctime.pl';
>    if (!open(DEBUGLOG, '>>DebugLog.html'))
>    {
>       $DEBUG_LOG = 0;
>    } else {
>       print DEBUGLOG "===================================<br>\n";
>       print DEBUGLOG "ManRegister.pl Started at ", &ctime($^T), "<br>\n";
>    }
>
> This portion of my script works fine when the cgi is accessed via http.
If
> https is used, the open fails, and no debug log is created/written to.
> There are multiple (3) file writes in the script.  All fail.
>
> Ideas?

Maybe the HTTP daemon serving the secure connection runs as a different user
than the daemon serving the unencrypted connection, and that other user does
not have permissions to write to the destination file ?

try this out. of the open() fails, print this:
print "Content-type: text/html\n\nMY ERROR FOR OPEN() IS  $!";

See what that will show you, it could shed mroe light on the source of the
problem.

>
> Ted
>
>
> "Mina Naguib" <spam@thecouch.homeip.net> wrote in message
> news:BQWB7.3519$cE2.162075@weber.videotron.net...
> >
> > "Ted Apke" <tedapke@apkesoftware.com> wrote in message
> > news:5EVB7.20414$IR4.11759583@news1.denver1.co.home.com...
> > > I'm having a problem writing to a file when the perl CGI script is
> > accessed
> > > via a secure connection.  The script works fine when the connection is
> via
> > > http, but when run from https it fails.  I'm not 100% sure of the host
> > > environment but I'd say it is Solaris.
> > >
> > > I've done a number of searches, including Google groups, and found
> nothing
> > > similar.  I'd appreciate any suggestions.
> >
> > I also got into my car a few days ago but it didn't take me to work. Can
> you
> > tell me why ?
> >
> > Seriously, you provide no details at all. Help us out here. What exactly
> is
> > the error message, if any.. ?
> >
> > >
> > > Thanks in advance.
> > >
> > > Ted Apke
> > >
> > >
> > >
> >
> >
>
>




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

Date: Fri, 26 Oct 2001 21:57:59 -0400
From: "Hans N." <hen20040@bestweb.net>
Subject: Performance gap in Benchmark.pm with/without Tk interface
Message-Id: <20011026.215757.1922652810.1587@localhost.localdomain>

Hello all,

	I'm in the process of learning perl/Tk, but I thought my post would be
more pertinent to this group. I'm messing around with creating a
graphical interface to the Benchmark.pm module. 

	I've gone as far as getting a working program to run a benchmark on a 
single chunk of code as well as an optional chunk to be excluded from the
benchmark test. However, my problem is that testing the exact same piece
of code in a script without any fancy tricks on a command line completes
the test in a tenth of the time, if not less, compared to my Tk dabbling.
I think I have the issue drawn down to using eval, but I wanted to
consult the group for some well informed advice/information. Take a look
below for the snippits of code, both are utilizing the timeit() method.

	I'm using $x = 3; as the optional block of code inputed by the user.
The code to benchmark, that I'm using to test the program, is:
	$y = $x**234;
	$z = $x**$y;
	print "$z";

### Script with Tk:
sub bench1
{
  # Grabs user code from Tk text boxes
  $optCode = $optTxt->get("1.0", "end");
  $code1 = $codeTxt1->get("1.0", "end");
  # Runs user input code
  sub One
  {
    $stat->configure(-foreground => 'green3');
    eval($optCode); # Optional block from user
    sub Code1 {
      eval($code1); # Block to benchmark
    }
}
# Run benchmark and assign result to textvariable
$t = timeit($loopNum, '&Code1');
$result = "Running $loopNum loops of your code took:" . timestr($t);
# 100,000 loops takes approximately 49-52 CPU (sys + usr time) seconds

### Script without Tk:
eval($x = 3); # Simulate optional block from Tk version
# Sub simulates benchmark from Tk version
sub Code1
{
  eval
  {
    $y = $x**2340;
    $z = $x**$y;
    print "$z";
  };
}
$t = timeit($loopNum, '&Code1');
$result = "Running $loopNum loops of your code took:" . timestr($t);
print "$result";
# 100,000 loops this way take approximately 3.5-5 CPU (sys + usr time) 
# seconds

	Any and all input would be greatly appreciated, including criticism :^)
Thanks in advance, especially for just reading all of this.

Sincerely and respectfully,
Hans N.


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

Date: Fri, 26 Oct 2001 17:05:46 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Perl expression to delete delimited bits of text in a line (help)
Message-Id: <slrn9tjnhq.5pa.trammell@haqq.el-swifto.com>

On 26 Oct 2001 14:56:42 -0700, wb0gaz <wb0gaz@hotmail.com> wrote:
> Given the string  ABC<DEF>GHI<JKL>MNO I want to eliminate
> the <DEF> and <JKL> leaving the rest intact. My attempt has
> produced unwanted results of ABCMNO (basically the < and >
> given below as the "ends" of my pattern work out-to-in rather
> than left-to-right, in my layman's terms.)
> 
> What am I doing wrong?
> 
> (FYI it's part of a routine to partially clean out HTML
> tags, which I'm sure is a common thing to do, but I also would
> like to learn from this misfortune...)
> 
> Tnx,
> 
> Dave
> 
> MY ATTEMPT:
> 
> $try =~ s/<.*>//g;

$try =~ s/<.*?>//g;

Look up "non-greedy regular expressions", e.g.:

http://safari.oreilly.com/main.asp?bookname=cookbook&snode=122

-- 
To think intelligently about copyrights, patents or trademarks, you must
think about them separately.  The first step is declining to lump them
together as "intellectual property".                  - Richard Stallman


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

Date: Fri, 26 Oct 2001 22:35:06 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Perl expression to delete delimited bits of text in a line (help)
Message-Id: <mbudash-27247B.15351126102001@news.sonic.net>

In article <7670fd52.0110261356.64898a61@posting.google.com>, 
wb0gaz@hotmail.com (wb0gaz) wrote:

> Given the string  ABC<DEF>GHI<JKL>MNO I want to eliminate
> the <DEF> and <JKL> leaving the rest intact. My attempt has
> produced unwanted results of ABCMNO (basically the < and >
> given below as the "ends" of my pattern work out-to-in rather
> than left-to-right, in my layman's terms.)
> 
> What am I doing wrong?
> 
> (FYI it's part of a routine to partially clean out HTML
> tags, which I'm sure is a common thing to do, but I also would
> like to learn from this misfortune...)
> 
> Tnx,
> 
> Dave
> 
> MY ATTEMPT:
> 
> $try =~ s/<.*>//g;

the short answer is:

s/<.*?>//gs;

the '?' enables non-greedy matching (or disables greedy matching, 
depending on your point of view). i'm sure you already witnessed the 
effects of greedy matching (it matched a '>').

the longer answer is, don't try to remove html tags this way unless 
you're sure the tags can *never* contain '>'s or '<'s themselves, and 
even then, this method is fraught with problems. use one of the modules 
such as HTML::Parser.

perldoc -q "How do I remove HTML from a string?"

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Fri, 26 Oct 2001 23:48:16 +0100
From: "John Smith" <john@smithIndustries.com>
Subject: Perl Newbie question : How can I open an internet connetion from Perl ?
Message-Id: <9rcrhf$vnd$1@news5.svr.pol.co.uk>

Hello,

I'm writing a Perl script to grab some data from the web. The problem is
that my phone line is not always connected (it's a home phone line, so I
don't have a perpetual connection to the web !). I seems that all the
scripts I've seen so far, assume that you have a leased line or something.
Does anyone know of how I can "force" a connection, i.e. dial my ISP and
make a connection, if i am not connected to the internet ?

Many thanks in advance

Cheers




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

Date: Fri, 26 Oct 2001 18:31:55 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Perl Newbie question : How can I open an internet connetion from Perl ?
Message-Id: <87y9lyasgk.fsf@limey.hpcc.uh.edu>

>> On Fri, 26 Oct 2001 23:48:16 +0100,
>> "John Smith" <john@smithIndustries.com> said:

> Hello, I'm writing a Perl script to grab some data from
> the web. The problem is that my phone line is not always
> connected (it's a home phone line, so I don't have a
> perpetual connection to the web !). I seems that all the
> scripts I've seen so far, assume that you have a leased
> line or something.  Does anyone know of how I can
> "force" a connection, i.e. dial my ISP and make a
> connection, if i am not connected to the internet ?

That's way outside the realm of what perl (or any other
programming language) should be doing.

It's off-topic but have a look around somewhere like
http://freshmeat.net/ for PPP autodialing configurations.

You might want to follow up to a group like
comp.os.linux.misc (or whatever OS you're using).

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Sat, 27 Oct 2001 09:05:46 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Security- Upload scripts
Message-Id: <o0mC7.2$OY2.98401@news.interact.net.au>


"spamfree" <spamfree@sorted2000.net> wrote in message
news:pH9C7.5443$lp2.792879@news1.cableinet.net...
> Hi,
> I'm wanting to modify a simple upload script.
> Any recommended resources/tuts on the many security issues using upload
> scripts in perl to Unix?

Make sure it starts with:

#!/usr/bin/perl -wT
use strict;





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

Date: Sat, 27 Oct 2001 00:20:12 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: variable replacement
Message-Id: <slrn9tjs3j.84j.tadmc@tadmc26.august.net>

Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
>
>  >>> $b = q/$1$1/;
>
>  >>> s/$a/$b/egs;
>
>  >> Yes : $b is interpolated, 
>
>
>  TM> No, $b is _evaluated_, not interpolated.
>
>debatable. 


The below reads like that should be "not correct" rather
than merely "in question" (debatable). But I remain
unconvinced.


>ilya has pointed out that the replacement side of s/// is
                                                    ^^^
                                                    ^^^ note no 'e'

>just a double quotish string. so it really is interpolation. internally
>there is an implicit "" put around it.


This I knew.

But when you add an 'e', that is no longer true (I hope I'm not
disagreeing with Ilya here, 'cause that would pretty much
mean that I'm wrong).

s///e treats the replacement as code, not as a double-quotish string.

Right?


>  TM> A variable's name evaluates to the variable's value.
>
>true, but in the replacement part it is interpolated into a string. 
                                                      ^^^^^^^^^^^^^

With an 'e', there is no "string", there is only "code" in
the replacement part. (and the result of evaluating the code
is taken as the string to use.)


>  >> s/$a/$b/eegs; # double the 'e' !
>
>  TM> Two evals, zero interpolations.
>
>again, the first eval effectively removes the implied "" so there was an
>interpolation before that.


Huh? Interpolation happened as a result of the implied quotes
(double-quotish). How can it also happen when the double-quotishness
has been removed?

I stand by the "2 evals, 0 interpolations" statement.

I'm open to enlightenment of course, but I haven't gotten it yet...


>  TM> (my other followup OTOH has 2 evals and 1 interpolation, 'cause
>  TM>  the code for the 2nd eval is a double quoted string.)
>
>s/foo/$b/ is the same as s/foo/"$b"/e.


Yes, because the _code_ happens to use quotes in the code-to-be-evaluated.


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


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

Date: Sat, 27 Oct 2001 01:25:09 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: variable replacement
Message-Id: <3BDA0B8D.630D03B1@acm.org>

Tad McClellan wrote:
> You have one "round" of "e"valuation. After one eval you have:
>    s/$a/$1$1/gs;
> When you use 'e' options, you do not get interpolation.

I understand what you're saying, but would it be more correct
to say, "when you use 'e' options, you do not get an extra
round of interpolation"? After all, you do get interpolation
each time you "e"valuate a double-quotish string.

In fact, it seems to me that a substitute with no 'e' option:
    s/patt/repl/;
is exactly equivalent to:
    s/patt/"repl"/e;

If you keep this in mind, it makes it clearer when and how
interpolations occur, and how many 'e's will be required to
get a desired effect.

The OP's substitute could be written:
    s/$a/"\"$b\""/eegs;
Each 'e' eats one pair of quotes and does one round of
interpolation.

-- Dave Tweed


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

Date: Sat, 27 Oct 2001 11:26:01 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: variable replacement
Message-Id: <slrn9tk398.b50.mgjv@martien.heliotrope.home>

On Sat, 27 Oct 2001 00:20:12 GMT,
	Tad McClellan <tadmc@augustmail.com> wrote:
> Uri Guttman <uri@sysarch.com> wrote:
>>>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
>>
>>  >>> $b = q/$1$1/;
>>
>>  >>> s/$a/$b/egs;
>>
>>  >> Yes : $b is interpolated, 
>>
>>
>>  TM> No, $b is _evaluated_, not interpolated.
>>
>>debatable. 
> 
> 
> The below reads like that should be "not correct" rather
> than merely "in question" (debatable). But I remain
> unconvinced.

I tend to not trust the documentation in these areas very much, but
FWIW: from perlop:

[snip]
               Any non-alphanumeric, non-whitespace delimiter may
               replace the slashes.  If single quotes are used,
               no interpretation is done on the replacement
               string (the "/e" modifier overrides this, how­
               ever).
[snip]

Looks like /e forces interpolation, even when it normally wouldn't
happen.

This is how I read the documentation:

The first /e causes the replacement to be interpolated, and evaluated.
If there is only a single /e, the syntax of the replacement is checked
at run-time (and presumably it is compiled as well). If there is a
second e modifier, the effect is similar to eval "".

As I said, I don't trust the documentation in this area to be right. The
lack of clarity is warning enough not to put too much trust in it.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 26 Oct 2001 23:02:01 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Web image tables
Message-Id: <JXlC7.174$X3.183368704@news.frii.net>

In article <Pine.A41.4.33.0110261427180.20858-100000@dante35.u.washington.edu>,
Brian D. Green <greenbd@u.washington.edu> wrote:
>Hello,
>
>I'm trying to simplify my online photo galleries by writing a Perl script
>to generate the tables of thumbnails.  How would I make the script begin a
>new row after every seventh cell?  My script is below.
>

Here is my hack to do it.

    #!/usr/bin/perl

    my $width = 7;
    my $count = 0;

    print "<table>\n";
    while (<>) {                    #assume input is a list of image files
	chomp;
	if ($count % $width == 0) {
	    print "<tr>";
	}
	print "\t<td><img height=64 width=64 src=$_></td>\n";
	if ($count % $width == $width -1) {
	    print "</tr>";
	}
	$count++;
    }
    print "</table>\n";

Good Luck!
-- 
    This space intentionally left blank


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

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 2020
***************************************


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