[16939] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4351 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 17 21:05:21 2000

Date: Sun, 17 Sep 2000 18:05:08 -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: <969239108-v9-i4351@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 17 Sep 2000     Volume: 9 Number: 4351

Today's topics:
    Re: 5.6.0 shebang under NT (was Re: how to match the ho <randy_734@my-deja.com>
    Re: Call a Perlscript within a Javascript <anders@wall.alweb.dk>
    Re: Call a Perlscript within a Javascript <anders@wall.alweb.dk>
    Re: Can not read arrays from <STDIN> <anders@wall.alweb.dk>
    Re: Can not read arrays from <STDIN> (Abigail)
    Re: Can not read arrays from <STDIN> (Abigail)
    Re: cgi script for downloading <anders@wall.alweb.dk>
    Re: cgi script for downloading <flavell@mail.cern.ch>
    Re: cgi script for downloading (Abigail)
    Re: cgi script for downloading (Seth Sticco)
    Re: Copying Files <patrickjos@hotmail.com>
    Re: Copying Files <flavell@mail.cern.ch>
    Re: Is this terribly inefficient? <krahnj@acm.org>
        LWP/SSL problem to one specific URL brayjones@rhtc.net
    Re: open(FNAME...) versus FileHandle <mike@crusaders.no>
    Re: Printing to a printer without "|lp" <philipg@atl.mediaone.net>
    Re: Qualifications for new Perl programmer????? <nospam@david-steuber.com>
    Re: Shortest code for Fibonacci? (Abigail)
    Re: shtml on-the-fly <anders@wall.alweb.dk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 17 Sep 2000 22:52:07 GMT
From: Randy <randy_734@my-deja.com>
Subject: Re: 5.6.0 shebang under NT (was Re: how to match the hole string by first word? (need help))
Message-Id: <39c54ad1.25360765@207.126.101.100>

Is there any way to make the shebang "the first line of the script" in
this kind of a bat file?



aperrin@demog.berkeley.edu (Andrew J. Perrin) wrote:

>Randy <randy_734@my-deja.com> writes:
>
>> The problem is with the method I am using to run the script.
>> 
>> @rem = '
>> @echo off
>> e:\perl\bin\perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
>> goto EndOfPerl
>> @rem ';
>> 
>> #!perl -w
>> print "foo\n";
>> print $foo;
>> 
>> __END__
>> :EndOfPerl
>> 
>> It is the DOS "wrapper" that is keeping -w from working.
>
>Indeed - more specifically, it's because the shebang is not the first
>line of the script. 
>
>ap
>
>-- 
>----------------------------------------------------------------------
>Andrew Perrin - Solaris-Linux-NT-Samba-Perl-Access-Postgres Consulting
>       aperrin@igc.apc.org - http://demog.berkeley.edu/~aperrin
>----------------------------------------------------------------------



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

Date: Sun, 17 Sep 2000 22:09:07 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Call a Perlscript within a Javascript
Message-Id: <7ibx5.575$KJ4.8611@news000.worldonline.dk>

Werner Hofer wrote:

> Hello
> i would like to call a Perlscript within a Javascipt-Function. How is this
> possible ( with Server Site Include ? )   ?
> 
> Here is an example, witch i would like to realize
> 
> Test.html:
> -------------
> 
> <html>
> <head>
> <script language="Javascript">
> function abc() {
> call  Test.pl    // Aufruf des Perlcripts !!!!
> }
> </script>
> 
> </head>
> <body onUload="abc()">
> hello world...
> </body>
> </html>
> 
> Thank a lot for your help in advance
> Werner
> 
> 
> 
> 

no

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sun, 17 Sep 2000 22:10:14 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Call a Perlscript within a Javascript
Message-Id: <ajbx5.576$KJ4.8611@news000.worldonline.dk>

Werner Hofer wrote:

> Hello
> i would like to call a Perlscript within a Javascipt-Function. How is this
> possible ( with Server Site Include ? )   ?
> 
> Here is an example, witch i would like to realize
> 
> Test.html:
> -------------
> 
> <html>
> <head>
> <script language="Javascript">
> function abc() {
> call  Test.pl    // Aufruf des Perlcripts !!!!
> }
> </script>
> 
> </head>
> <body onUload="abc()">
> hello world...
> </body>
> </html>
> 
> Thank a lot for your help in advance
> Werner
> 
> 
> 
> 
> 
please do not repeatedly post the same message.

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sun, 17 Sep 2000 22:12:08 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Can not read arrays from <STDIN>
Message-Id: <Ykbx5.578$KJ4.8611@news000.worldonline.dk>

YzzuS1 wrote:

> Hello,
>          I am very new to Perl and programming. I am using Windows 95 and
>          Perl
> 5.22. When I try to read and array from <STDIN> by using control-D or
> control-Z I dump the program. Is there another control character in
> Windows to just state end of file? Also, how dow you clear the screen? In
> basic the command is clr. Thank You,
> bill

Get a better OS. Hint: some flavour of unix...

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: 17 Sep 2000 22:48:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Can not read arrays from <STDIN>
Message-Id: <slrn8saifi.h8o.abigail@alexandra.foad.org>

YzzuS1 (yzzus1@aol.com) wrote on MMDLXXIV September MCMXCIII in
<URL:news:20000917173040.29221.00000011@ng-fp1.aol.com>:
~~ Hello, 
~~          I am very new to Perl and programming. I am using Windows 95 and Per
~~ 5.22. When I try to read and array from <STDIN> by using control-D or control
~~ I dump the program. Is there another control character in Windows to just sta
~~ end of file? Also, how dow you clear the screen? In basic the command is clr.


5.22? Amazing. Way ahead of your time. Could you please wait till 2113,
when perl 5.22 will be officially released?


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: 17 Sep 2000 22:49:23 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Can not read arrays from <STDIN>
Message-Id: <slrn8saihf.h8o.abigail@alexandra.foad.org>

Anders Lund (anders@wall.alweb.dk) wrote on MMDLXXIV September MCMXCIII
in <URL:news:Ykbx5.578$KJ4.8611@news000.worldonline.dk>:
** YzzuS1 wrote:
** 
** > Hello,
** >          I am very new to Perl and programming. I am using Windows 95 and
** >          Perl
** > 5.22. When I try to read and array from <STDIN> by using control-D or
** > control-Z I dump the program. Is there another control character in
** > Windows to just state end of file? Also, how dow you clear the screen? In
** > basic the command is clr. Thank You,
** > bill
** 
** Get a better OS. Hint: some flavour of unix...


If you're getting a better OS, why settle for some flavour of UNIX?
Get VMS.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
#    Nine nesting ravens. Two
#    eagles nest in a lemon tree.
#    A wolf walks. Five beetles.


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

Date: Sun, 17 Sep 2000 22:17:23 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: cgi script for downloading
Message-Id: <Tpbx5.582$KJ4.8867@news000.worldonline.dk>

Seth Sticco wrote:

> I want to make a cgi script using perl that will track downloads.  I know
> mostly how I am going to do this.  I'm going to refer to the perl script
> in
> the link to download the file.  I want to know what the best way of having
> the script send the file is.  I could have it redirect to the file, or I
> can have the script send the file itself.  Which is the better idea? 
> Also,
> what is the best way of doing each?  I hope this is easy to understand. 
> If any of this is hard to understand, I'm willing to answer any questions.
> 
>  - Seth Sticco

Many sites are using a similar technique, eg tucows.
What they do is using a META redirect.
That means or cause that anyone who knows the REAL url of the file to 
download can do so without invoking the script.

There is ways around that, but they are complicated.

Dragging the files through you script is possible, but it will use a lot of 
resources, depending of the size of the files oyu offer.


Did you think of taking a peak in the server log?

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Mon, 18 Sep 2000 00:25:44 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi script for downloading
Message-Id: <Pine.GHP.4.21.0009180018330.6726-100000@hpplus03.cern.ch>

On Sun, 17 Sep 2000, Anders Lund wrote:

> Many sites are using a similar technique, eg tucows.
> What they do is using a META redirect.

There is indeed a stupid way of using the Netscape META Refresh thingy
to produce a value-reduced annoyance that in some respects pretends to
be a redirect.

However, from a CGI script this would be silly.  Whatever; this kind
of thing has only a tenuous relevance to the Perl language and would
be better discussed on the CGI group [f'ups set]



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

Date: 17 Sep 2000 22:50:47 GMT
From: abigail@foad.org (Abigail)
Subject: Re: cgi script for downloading
Message-Id: <slrn8saik3.h8o.abigail@alexandra.foad.org>

Seth Sticco (sethn@bigfoot.com) wrote on MMDLXXIV September MCMXCIII in
<URL:news:8FB2BE451sethn@204.186.201.11>:
<> I want to make a cgi script using perl that will track downloads.  I know 
<> mostly how I am going to do this.  I'm going to refer to the perl script in 
<> the link to download the file.  I want to know what the best way of having 
<> the script send the file is.  I could have it redirect to the file, or I 
<> can have the script send the file itself.  Which is the better idea?  Also, 
<> what is the best way of doing each?  I hope this is easy to understand.  If 
<> any of this is hard to understand, I'm willing to answer any questions.


Why don't you just turn on logging in your web server? That will track
all downloads.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'


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

Date: Sun, 17 Sep 2000 23:01:47 GMT
From: sethn@bigfoot.com (Seth Sticco)
Subject: Re: cgi script for downloading
Message-Id: <8FB2C885Fsethn@204.186.201.11>

anders@wall.alweb.dk (Anders Lund) wrote in
<Tpbx5.582$KJ4.8867@news000.worldonline.dk>: 

>Seth Sticco wrote:
>
>> I want to make a cgi script using perl that will track downloads.  I
>> know mostly how I am going to do this.  I'm going to refer to the perl
>> script in
>> the link to download the file.  I want to know what the best way of
>> having the script send the file is.  I could have it redirect to the
>> file, or I can have the script send the file itself.  Which is the
>> better idea? Also,
>> what is the best way of doing each?  I hope this is easy to
>> understand. If any of this is hard to understand, I'm willing to
>> answer any questions. 
>> 
>>  - Seth Sticco
>
>Many sites are using a similar technique, eg tucows.
>What they do is using a META redirect.
>That means or cause that anyone who knows the REAL url of the file to 
>download can do so without invoking the script.
>
>There is ways around that, but they are complicated.
>
>Dragging the files through you script is possible, but it will use a lot
>of resources, depending of the size of the files oyu offer.
>
>
>Did you think of taking a peak in the server log?
>
>-anders

Looking at the server log did occur to me.  I don't know how to do that, 
though.  I don't even know if I can.  I was going to send an email to the 
people hosting my site (www.virtualave.net), asking them about it, but I 
never did.  Do you know if they allow access to it?  If they do, what would 
I do to look at it?

Also, that meta redirect isn't really what I meant.  The redirect I meant 
is more like what 3dfiles.com does.  I think they put something in the http 
header that did the redirect.  I'll have to check, but I was hoping someone 
could tell me.

 - Seth Sticco


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

Date: Sun, 17 Sep 2000 16:20:56 -0700
From: Patrick Connolly <patrickjos@hotmail.com>
Subject: Re: Copying Files
Message-Id: <39C551D8.FC70EB5E@hotmail.com>


Yes, this is the only way ...Thanks Indy !

Patrick

Indy Singh wrote:

> Patrick Connolly <patrickjos@hotmail.com> wrote in message
> news:39C2DBBF.A7D3A993@hotmail.com...
> >
> > I'm trying to develop a perlscript to copy files (on windows nt)  from
> > one directory to another.  The simple requirements are:
> > 1.  The timestamp of the file must NOT be modified.
> > 2.  There must be no "noise" output to the screen.
> > 3.  There should be a way to verify that the copy was successful.
> >
> > The problem:
> > 1. I've tried the copy() function from File::Copy module. On windows
> > NT,  it modifies the timestamp to current time.
> > 2. I've tried using  system("copy sourcefile destfile")  but it prints
> > out noise to the screen for every file it copies.
> >
> >     Any suggestions ?
> >
> > Patrick
> >
> >
>
> Use stat to get the time of of the source file, and use utime to set the
> time of the dest file after copying.  See example below.
>
> sub copy_file_ex
> {
>     my ($src, $dest) = @_;
>     # copy file src -> dest preserve source file times and dest permissions
>     local ($/);
>     open (IN, $src) || die "Can't open $src $!\n";
>     my $srctime = (stat($src))[9];
>     my $srcmode = (stat($src))[2];
>
>     my $destmode;
>     binmode IN;
>     $/ = undef;
>     my $data = <IN>;
>     close IN;
>     if (-e $dest) {
>         $destmode = (stat($dest))[2];
>      chmod(0666, $dest);
>     } else {
>         # use dest file mode if avail, else use source file's mode
>         $destmode = $srcmode;
>     }
>     open (OUT, ">$dest") || die "Can't create $dest $!\n";
>     binmode OUT;
>     print OUT $data;
>     close OUT;
>     utime $srctime, $srctime, $dest;
>     chmod $destmode, $dest;
> }
>
> --
> Indy Singh
> IndigoSTAR Software -- www.indigostar.com



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

Date: Mon, 18 Sep 2000 01:32:14 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Copying Files
Message-Id: <Pine.GHP.4.21.0009180130190.12952-100000@hpplus03.cern.ch>

On Sun, 17 Sep 2000, Patrick Connolly up-ended usenet, gave a shake,
and this tumbled out:

> Yes, this is the only way ...

Oh, there's more than one way to do it.

But upside-down fullquotes aren't one of them.




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

Date: Sun, 17 Sep 2000 15:36:14 -0700
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Is this terribly inefficient?
Message-Id: <39C5475E.81C654E4@acm.org>

Stephan Carydakis wrote:
> 
> Hello All,
> 
> I have written a sort subroutine which I think maybe a little inefficient.
> Why do I think it's inefficient? Well, $a/$b are entire records from a flat
> file db(1 line per record) and I use re's to extract the dates from the
> record which I then split up into day/month/year using re's again. Is this
> inefficient? Could someone suggest a better way?
> 
> My code:
> 
> sub byDate {
> 
>     my ($dateA, $dateB, $yearA, $yearB, $monthA, $monthB, $dayA, $dayB);
> 
>     $a =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
>     $dateA=$1;
> 
>     $b =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
>     $dateB=$1;
> 
>     $dateA =~ m|(.*?)/(.*?)/(.*)|;
>     ($dayA,$monthA,$yearA)=($1,$2,$3);
> 
>     $dateB =~ m|(.*?)/(.*?)/(.*)|;
>     ($dayB,$monthB,$yearB)=($1,$2,$3);
> 
>     $yearB <=> $yearA
>                 ||
>     $monthB <=> $monthA
>                 ||
>     $dayB <=> $dayA;
> 
> }

I don't know if this is more efficient or not.

sub byDate {
    sprintf( '%04d%02d%02d', ($a =~ m#^(\d+)/(\d+)/(\d+)|#)[2,1,0] ) cmp
    sprintf( '%04d%02d%02d', ($b =~ m#^(\d+)/(\d+)/(\d+)|#)[2,1,0] );
}

John


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

Date: Sun, 17 Sep 2000 23:31:03 GMT
From: brayjones@rhtc.net
Subject: LWP/SSL problem to one specific URL
Message-Id: <8q3k7n$ln4$1@nnrp1.deja.com>

I'm trying to get the content results from the following URL using LWP/
SSL:

https://commercial.firstunion.com/conscard/bill.html

A browser works and returns the page, but using LWP / openssl, doesn't
work.  It works with any other SSL site, except this one.  I can't figure
out why it's not working.  Can someone try this on their machine and see
if they get the same results?  Maybe this URL is looking for something,
maybe a client cert.... but the browser doesn't ask for that either.

Any help in debugging this would be greatly appreciated... Thanks...

Bray Jones

Details below...

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

I have installed:

Kernel 2.2.14-12.8RS on an i686
libwww-perl-5.48
Crypt-SSLeay-0.16
openssl-0.9.5a

Using Linux, typing in:

GET https://commercial.firstunion.com/conscard/bill.html

Results:

<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</h1>
500 unexpected EOF before status line seen
</BODY>
</HTML>

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

Using openssl, typing in (with debug option, etc):

/usr/local/ssl/bin/openssl s_client -connect
commercial.firstunion.com:443

Results Detail:

CONNECTED(00000003)
depth=1 /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification
Authority
verify error:num=19:self signed certificate in certificate chain
verify return:0
---
Certificate chain
 0 s:/C=US/ST=North Carolina/L=Charlotte/O=First Union National Bank/OU=
Network Security Services/CN=commercial.firstuni
on.com
   i:/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification
Authority
 1 s:/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification
Authority
   i:/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification
Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICgDCCAe0CEBqRxHfVPKtzJeu71JJbSCcwDQYJKoZIhvcNAQEEBQAwXzELMAkG
A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD
VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk5
MTAwNDAwMDAwMFoXDTAwMTAwMzIzNTk1OVowgaYxCzAJBgNVBAYTAlVTMRcwFQYD
VQQIEw5Ob3J0aCBDYXJvbGluYTESMBAGA1UEBxQJQ2hhcmxvdHRlMSIwIAYDVQQK
FBlGaXJzdCBVbmlvbiBOYXRpb25hbCBCYW5rMSIwIAYDVQQLFBlOZXR3b3JrIFNl
Y3VyaXR5IFNlcnZpY2VzMSIwIAYDVQQDFBljb21tZXJjaWFsLmZpcnN0dW5pb24u
Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOjjtEQXVGXbF3tNVXW9Jx
2yK5c0iZPzwJm/sVHrKBqGRiwyo/vRS3Uuu4U9lgqxHp3DAFash91ytewR4ruLmT
zIw77Lq7MZs/HrCAu5Ie8y9eoPHdhPY0BEc9+09LV9FLzRjcC9pNSLtmXR6EdjiO
k7TAEbmFBg2r7rs/7uY4awIDAQABMA0GCSqGSIb3DQEBBAUAA34AE/Xub49UTqql
e/EDMkcULNnJ7Upp9a6g033+u0u+2sjao3EXFLK8jo1uCOZfczPc8rTJ14MuQ50A
1m67llqWNycwRYE0bemsvxG/UnPbfDG/W3Zw4rFE/cbcuG1iN9IVxnlgOCMCQX4I
rR7ww+THdSyCKuNuiqDAqnh3A3E=
-----END CERTIFICATE-----
subject=/C=US/ST=North Carolina/L=Charlotte/O=First Union National Bank/
OU=Network Security Services/CN=commercial.first
union.com
issuer=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification
Authority
---
No client certificate CA names sent
---
SSL handshake has read 1375 bytes and written 334 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-MD5
Server public key is 1024 bit
SSL-Session:
    Protocol  : SSLv3
    Cipher    : RC4-MD5
    Session-ID:
54196BC8300FFCC7B47EDAB26CB341D573714E4D2DA79F18D141BE00181DA929
    Session-ID-ctx:
    Master-Key:
D41C8AF8277AEBD41124CD198C84013B57358D7597B6FE1F1E67BBA7EBF1DF2D18091F8A1
332D1D0F2DB7AB2CADD1D9B
    Key-Arg   : None
    Start Time: 968967611
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
GET /conscard/bill.html (Type this in!!!)
read:errno=0


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


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

Date: Mon, 18 Sep 2000 01:24:23 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: open(FNAME...) versus FileHandle
Message-Id: <5ocx5.2480$mq2.41408@news1.online.no>


Jonathan Stowe <gellyfish@gellyfish.com> skrev i
meldingsnyheter:8q2ja9$e3c$1@orpheus.gellyfish.com...
> On Sat, 16 Sep 2000 11:25:15 GMT Brendon Caligari wrote:
> With 5.6.0 you get get autovivification of file handles so you can use
> a lexical variable as a filehandle :
> {
>   my $handle;
>   open($handle,">blah") || die "Can't open file - $!\n";
>   print $handle "Blah blah";
> }

You can even declare and use it in one go.
{
  open(my $handle,">blah") || die "Can't open file - $!\n";
  print $handle "Blah blah";
}

--
Trond Michelsen





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

Date: Mon, 18 Sep 2000 00:52:37 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: Printing to a printer without "|lp"
Message-Id: <pHdx5.14029$g35.2033841@typhoon.southeast.rr.com>

kj0 <kj0@mailcity.com> wrote in message
news:8q3a33$8jk$1@panix3.panix.com...
> I've written a CGI script for in-house use that, among other things,
> prints barcode labels via a networked barcode printer.  I can get the
> printing to work if I do something like:
>
>   open  BARCODE_PRINTER, "|/usr/bin/lp -d zebra" or PFFff_f_t(__LINE__);
>   print BARCODE_PRINTER $gobbledeyGook;
>   close BARCODE_PRINTER;
>
> But the above will crash my script if I turn on taint checking.  I
> understand the problem has to do with the implicit fork done by the
> open command.
>
> Therefore, I would like to print directly to the printer without
> forking a new process.  How can I do this?

Try the Net::Printer module.

Alternatively, you can make your current code work with taint checking by
explicitly setting $ENV{PATH} and by getting rid of a few env. variables.
See perldoc perlsec for more details.

hth,
p




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

Date: Sun, 17 Sep 2000 23:25:12 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <m3k8ca38ko.fsf@solo.david-steuber.com>

andrew-johnson@home.com (Andrew Johnson) writes:

' In article <8q0tsk$q2k$1@nnrp1.deja.com>,
'  Brendon Caligari <bcaligari@my-deja.com> wrote:
'  
' ! I believe that there is a consensus that while Perl is good, perl
' ! alone is not sufficient for a comprehensive education in
' ! programming.  It would be pretentious of oneself to call himself or
' ! practice as a programmer if his exposure has been limited to one
' ! language.
' 
' No more so than anyone calling herself a programmer having only
' exposure to any other single language. This is not a language
' specific issue -- would you accept me as a programmer if my only
' experience was with C? or Hypertalk? or Pascal? or Prograph? or
' Fortran? or Basic? or awk? or assembly? or mix? or scheme? or Python,
' or ... whatever?
'
' Is any one language sufficient for a comprehensive education in
' programming? Wouldn't a comprehensive education in programming
' involve more than just learning a single language? 

I've been giving this question some thought recently.  While I believe
a programmer should know several languages, I have recently decided
that it is indeed sufficient to know just one programming language.
All that is necessary is for that language to support the ability to
construct the important algorithms and support the notion of abstract
data types.  Perhaps even that is not necessary.  Machine language has
no concept of abstract data types.  Those are artifacts of Computer
Science looking for more efficient ways to Get The Job Done.

Perl is an abstract language.  Certainly more so than C.  Computer
Science topics are generally delt with on an abstract basis.
Sedgwick's book, "Algorithms in C++" has an entire section devoted to
ADTs.  Computer Science text books tend to assume things like infinite
resources too, to keep you a step or two from the specific machine you
are dealing with.

Perl may not be the ideal language to teach CS.  What is?  MIX?  I
don't think so.  However, Perl can do the job.  Anything in "The Art
Of Computer Programming" series can be coded in Perl.  You can even
deliberatly avoid convinient Perl facilities like the sort function
when you want to teach the principles involved with sorting and
searching.

While a Perl program can look like line noise, it can also be well
structured and easy to read by humans.  When time is money, it is
rather important that the code can be read and understood by humans.

While I do believe in knowing more than one computer language, there
is such a thing as knowing too many.  At least in my world.  Look at
Java and C++.  In Java, do you ever catch yourself comparing two
strings with `=='?  Oops!  Then in Perl, do you ever try to catinate
two strings with `+'?

I think you could probably go pretty far on just Perl.  Knowing C can
take you further.  I'm not sure how you do bit banging like the MD5
hash algorithm in pure Perl.  I'm not saying it can't be done.  It's
just a hell of a lot easier to have a lower level language used to
extend the higher level language when you need to do stuff like that.

One thing that Perl (and other scripting languages) offer to a
beginner is immediate feedback.  The K&R "Hello, world!" program has
to be compiled, linked, and assembled (the last step is hidden these
days) before it can run.  The Perl equivalent is much easier to get up
and running.

To answer the subject line, taken literally, the qualifications for a
new Perl programmer would be the ability to pick up the book,
"Learning Perl" by Schwartz & Christiansen and start hacking within a
few hours.  To become a novice, there is the more comprehensive Camel
book.  To be a master is a relative term.  A master should understand
the language well enough to implement a solution in much less time
than an intermediate Perl hacker that also runs more efficiently.

A novice through intermediate Perl hacker should know where to look
for the documentation.  The intermediate hacker should be able to
refer to the source directly when necessary.

I consider myself a novice.

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


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

Date: 17 Sep 2000 22:42:59 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Shortest code for Fibonacci?
Message-Id: <slrn8sai5e.h8o.abigail@alexandra.foad.org>

Owen Cook (rcook@pcug.org.au) wrote on MMDLXXIV September MCMXCIII in
<URL:news:4mhass06g96tr0bgb7ghg1fsfpkhcq7cfl@4ax.com>:
|| On 16 Sep 2000 16:21:05 GMT, abigail@foad.org (Abigail) wrote:
|| 
|| >Abigail
|| >-- 
|| >CHECK {print "another "}  #  A tiger prowls beside
|| >INIT  {print "Perl "   }  #  a river. A flying
|| >BEGIN {print "Just "   }  #  mosquito. Eshun.
|| >END   {print "Hacker\n"}
|| 
|| Few of these lately, what are we supposed to do with them? or are they
|| just a different series of SIGs


I dunno. What do you normally do with sigs?

Some people put them in scrapbooks, others eat them for the nutricients.
Some burn them for warmth, and there's this guy in Montana who's building
a cathedral out of them.

Me, I just keep a stack handy in case I run out of toilet paper.


Abigail
-- 
BEGIN {my $x = "Knuth heals rare project\n";
       $^H {integer} = sub {my $y = shift; $_ = substr $x => $y & 0x1F, 1;
       $y > 32 ? uc : lc}; $^H = hex join "" => 2, 1, 1, 0, 0}
print 52,2,10,23,16,8,1,19,3,6,15,12,5,49,21,14,9,11,36,13,22,32,7,18,24;


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

Date: Sun, 17 Sep 2000 22:18:31 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: shtml on-the-fly
Message-Id: <Xqbx5.583$KJ4.8867@news000.worldonline.dk>

Fernando wrote:

> I need to generate a shtml document from a cgi. For example, if I do like
> this:
> 
> #!/usr/bin/perl -w
> 
> print "Content-type: text/html\n\n";
> 
> print <<END;
> <html>
> <head><title>File1</title></head>
> <body bgcolor=white>
> 
> <!--#exec cgi="cgi-bin/inc.cgi" -->
> 
> </body>
> </html>
> END
> 
> The include will not execute. What should I do here? I thought in change
> the MIME type to something that points to shtml, but I don't know which
> one is it.
> 
> 
> 

Think about it for a while...

then try require, which may work depending on the contents...

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

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


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