[11960] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5560 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 4 13:27:11 1999

Date: Tue, 4 May 99 10:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 4 May 1999     Volume: 8 Number: 5560

Today's topics:
    Re: "Text file busy" error vajsejtl@my-dejanews.com
        Answer: RegEx for the "From " mbox DE-LIMIT-ER <nicholas.brenckle@yale.edu>
    Re: array assignment (Jon Orwant)
    Re: ASP & PERL <gellyfish@gellyfish.com>
        Bad File Number Error <clwolfe@indiana.edu>
        DBD-Oracle-0.61 install problem <Doug.Taylor@chel.com>
    Re: Declaration Help Please!! <morti_cne@my-dejanews.com>
    Re: Declaration Help Please!! (Larry Rosler)
    Re: Declaration Help Please!! (Tad McClellan)
    Re: Declaration Help Please!! <jeromeo@atrieva.com>
        Declaration Help Please! <morti_cne@my-dejanews.com>
    Re: Declaration Help Please! <Allan@due.net>
    Re: Declaration Help Please! <emschwar@rmi.net>
    Re: Declaration Help Please! (Tad McClellan)
        Generate more than one page with one script <e.pavis@silicomp.com>
    Re: GETting a Web-Site with IO::Socket::INET <dgris@moiraine.dimensional.com>
    Re: HELP: Printing binary files (e.g. pdf) to the clien (Tad McClellan)
    Re: HELP: Printing binary files (e.g. pdf) to the clien <design@raincloud-studios.com>
    Re: HELP: Printing binary files (e.g. pdf) to the clien (Larry Rosler)
    Re: How to distinguish between cron-startup and command <johan.schon@capgemini.se>
    Re: installing APi507e.exe on Win 95 <Matija.Exel@lag.ensieg.inpg.fr>
    Re: installing APi507e.exe on Win 95 <gellyfish@gellyfish.com>
    Re: ISPs that offer cgi space?? (Tad McClellan)
    Re: ISPs that offer cgi space?? <gellyfish@gellyfish.com>
    Re: Newbie in need (reading a file into an array) <scwood@home.com>
    Re: Newbie in need (reading a file into an array) <clwolfe@indiana.edu>
        Passing Parameters <thomas.jakober@ubs.com>
    Re: Perl and Password <matte_8000@my-dejanews.com>
    Re: Perl Beginner <clwolfe@indiana.edu>
    Re: Perl Beginner <design@raincloud-studios.com>
    Re: perl win32 directory layout is a mess! (Brett Tabke)
    Re: Problem in calling subroutine inside another routin <aqumsieh@matrox.com>
        Question: Updating an Array... (David Salvador Flores)
    Re: Question: Updating an Array... (Steve Linberg)
    Re: Question: Updating an Array... (Larry Rosler)
    Re: Stumped on Regex routine <aqumsieh@matrox.com>
    Re: Upload files and 'Jeff Scripts' <design@raincloud-studios.com>
    Re: Upload files <design@raincloud-studios.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 04 May 1999 15:59:59 GMT
From: vajsejtl@my-dejanews.com
Subject: Re: "Text file busy" error
Message-Id: <7gn5hr$e11$1@nnrp1.dejanews.com>

In article <7gg7e7$3nq$1@nitrogen.mankato.msus.edu>,
  larsot2@krypton.mankato.msus.edu (Timothy Larson) wrote:
> In article <7g9unu$qfm$1@nitrogen.mankato.msus.edu>,
> Timothy Larson <larsot2@krypton.mankato.msus.edu> wrote:
> >Sometimes my Perl script won't run and I get a 500 error from the web
> >server.  When I try it from the command line I get the error "Text file
> >busy".
> >What the heck does that mean?  Is it in the bathroom doing some business
> >and can't be disturbed?  How can a text file be busy?
> >
> >Any insights appreciated, thanks.
> >
> >Tim
> >
>
> In article <3729B9EE.755F6202@cthulhu.demon.nl>,
> Erik van Roode  <newsposter@cthulhu.demon.nl> wrote:
> >Jonathan Stowe wrote:
> >> You are on Unix and you are trying to overwrite the binary of a running
> >> program yes ?  You will have to kill the program before you can overwrite
> >> the file.
> >Or rename the executable.
>
> Ack, my connection barfed halfway through the reply.  Thank goodness
> for dead.article floating around...
>
> OK, I'm not trying to overwrite anything intentionally.  All I know is that
> I will get one or two runs out of the script (from the command line or
> web hits, whatever) and then the "text file busy" errors start in.  If I
> wait long enough they stop, and I can use the script a few more times.  I'm
> admittedly a newbie to using Perl, but this doesn't happen with CGI's I
> have written in other languages.  Is there something special I need to
> do in Perl to say "Hey, I'm done now" other than simple program termination?
> I can't very well have a CGI that only works half the time, now, can I?
> :)
> And BTW, it does seem to work if I copy it to a new name and run that one
> a few times, then the same thing happens.
>
> Thanks, any more ideas, just throw them my way....
> Tim
>
>

I was encountering the same problem in PHP.
It might be because of the reverse CR-LF ordering in Unix/Windows machines.
Since when I saved the script in Linux environment (pico) it happened to run
smoothly. But when saved in Windows-Homesite (via samba), I got the 500 Apache
error... You might try to save your script in linux.

JV

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 04 May 1999 11:12:28 -0400
From: Nicholas Brenckle <nicholas.brenckle@yale.edu>
Subject: Answer: RegEx for the "From " mbox DE-LIMIT-ER
Message-Id: <372F0E5C.74AAAB0F@yale.edu>

:-)

Little did I know there was a man(5) page for mbox format.

"   The  From_  line  always  looks  like  From  envsender  date
    moreinfo.  envsender is one word, without spaces or tabs; it
    is usually the envelope sender of the message.  date is  the
    delivery date of the message.  It always contains exactly 24
    characters in asctime format.  moreinfo is optional; it  may
    contain arbitrary information.  "

The key is that the envelope sender may be blank (according to Innosoft
PMDF) It was harder to parse then I first thought. (If anyone has any
suggestions, please share.)

And so I came up with this - (ugly but it works)

 /^From
(.*)\s+(\w{3})\s+(\w{3})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})(.*)/

$1 being the envelope, $9 is the moreinfo and $2-$8 is the date.

Thanks for the help all. Thanks to Randal and Tom for the classes in
Boston. Good stuff if I can remember it all....

-Nick
--
----------------------------------------------------------------------
Nicholas Brenckle                   Yale University School of Medicine
nicholas.brenckle@yale.edu                     ITS Med - PO Box 208089
203-737-2377                                  New Haven, CT 06520-8089




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

Date: 04 May 1999 16:20:08 GMT
From: orwant@alphaville.media.mit.edu (Jon Orwant)
To: tvn007@my-dejanews.com
Subject: Re: array assignment
Message-Id: <ORWANT.99May4122008@alphaville.media.mit.edu>


In article <7gm7r6$kt6$1@nnrp1.dejanews.com> tvn007@my-dejanews.com writes:

   I have two array as shown below:

   @array1 = (1,4,10,5);
   @array2 =  (2,3,6,9,7,8);

   and I would like to have the output as follow:

   @array3 = (1,2,3,4,5,6,7,8,9,10);

@array3 = sort { $a <=> $b } (@array1, @array2)

-Jon Orwant
--


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

Date: 4 May 1999 16:58:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ASP & PERL
Message-Id: <372f191f@newsread3.dircon.co.uk>

Billy Cravens <bcravens@isccomputers.com> wrote:
> Kinda curious.. even though the convention is to not capitalize Perl,
> wouldn't it make since, since it is an acronym?
> (Practical Extraction and Reporting Language)
> Just a thought.
> 
> 
> <snip>
>>Secondly, Perl is not spelled PERL.  I do wish people would stop
>>capitalizing it.
> <snip>
>>Matt Curtin cmcurtin@interhack.net
> 
> 

Thats a FAQ  - in perlfaq1:


  What's the difference between "perl" and "Perl"?

    One bit. Oh, you weren't talking ASCII? :-) Larry now uses
    "Perl" to signify the language proper and "perl" the
    implementation of it, i.e. the current interpreter. Hence Tom's
    quip that "Nothing but perl can parse Perl." You may or may not
    choose to follow this usage. For example, parallelism means "awk
    and perl" and "Python and Perl" look ok, while "awk and Perl"
    and "Python and perl" do not. But never write "PERL", because
    perl isn't really an acronym, aprocryphal folklore and post-
    facto expansions notwithstanding.

I post this as I get this feeling that you came in on the other side
of this peculiar crosspost (and nearly half the possible posters will
have killed this thread because of the presence of the M word in the
groups ).

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 04 May 1999 10:30:02 -0500
From: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Bad File Number Error
Message-Id: <372F127A.49CB4652@indiana.edu>

Bravely wading into the world of TCP sockets...
I'd like to use IO::Socket::INET.  But when I do, my script bombs with a
"Bad File Number" error.  I checked Programming Perl, couldn't find that
error in there.  
I can get it to work using the older Socket method, but I'd rather go
modular.
Methinks there is a problem with my installation of the packages?

And incidently, does anyone have a working Perl script that can talk to
a Java applet over TCP?  I just want to send character strings reliably,
and I'd like how someone else did it.

Thanks for any advice, 
Clinton Wolfe


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

Date: Tue, 04 May 1999 09:47:20 -0600
From: Doug Taylor <Doug.Taylor@chel.com>
Subject: DBD-Oracle-0.61 install problem
Message-Id: <372F1688.8D099996@chel.com>

I am using Perl 5.005_3 with DBI 1.06 to try to use DBD Oracle 0.61 to
connect to an Oracle Database. All of the 'make' and 'make test' work
fine for Perl and DBI, except 'make test' for the Oracle DBD prints out

t/base..............install_driver(Oracle) failed: Can't load
'blib/arch/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1:
/usr/local/bin/perl: fatal: relocation error: file
blib/arch/auto/DBD/Oracle/Oracle.so: symbol ncrov: referenced symbol not
found at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line
169.

I have the ORACLE_HOME (/apps/oracle72), TWO_TASK (t72), and
ORACLE_USERID (umon) set properly (I believe), and sqlplus works fine to
talk to Oracle. I have compiled DBD using 'perl Makefile.PL -8'. If
anyone has suggestions, I would greatly appreciate the help. Kindly
reply to the email address.

Thanks
Doug Taylor
I.S. Technical Architect
Canadian Hunter Exploration Ltd.
Doug.Taylor@chel.com




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

Date: Tue, 04 May 1999 15:14:12 GMT
From: CNE_Morti <morti_cne@my-dejanews.com>
Subject: Re: Declaration Help Please!!
Message-Id: <7gn2s0$bap$1@nnrp1.dejanews.com>

In article <7gmj3u$t9f$1@fir.prod.itd.earthlink.net>,
  sowmaster@juicepigs.com (Bob Trieger) wrote:
> [ courtesy cc sent by mail if address not munged ]
>
> CNE_Morti <morti_cne@my-dejanews.com> wrote:
> >$department = "$FORM{'dept')";
> >if ( $department eq 'Information' ) {
> >   $recipient = 'someone@host.com';
> >}
> >elsif ( $department eq 'Technical Support' ) {
> >   $recipient = 'another@host.com';
> >}
> >
> >I know this is simple, but it's late and my brain isn't working.. keep
banging
> >my head against the wall..
>
> use the -w switch in your shebang line and the answer will hit you in
> the head.
>
>

OK I found my typo with ( and } and I lost the quotes, but it still does not
work!!	Could someone please give me some serious help?  I'm in a real time
crunch to get this working.  Someone please tell me what is wrong with the
code so I can finish this project.  I would really appreciate your help.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 4 May 1999 08:50:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Declaration Help Please!!
Message-Id: <MPG.1198b7244c175989899b1@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7gn2s0$bap$1@nnrp1.dejanews.com> on Tue, 04 May 1999 
15:14:12 GMT, CNE_Morti <morti_cne@my-dejanews.com> says...
 ...
> > >$department = "$FORM{'dept')";
> > >if ( $department eq 'Information' ) {
> > >   $recipient = 'someone@host.com';
> > >}
> > >elsif ( $department eq 'Technical Support' ) {
> > >   $recipient = 'another@host.com';
> > >}
 ...
> OK I found my typo with ( and } and I lost the quotes, but it still does not
> work!!	Could someone please give me some serious help?  I'm in a real time
> crunch to get this working.  Someone please tell me what is wrong with the
> code so I can finish this project.  I would really appreciate your help.

Presumably the code now compiles and executes.  So I presume
that when you say that 'it still does not work' that you expect
$FORM{dept} (or $department) to match 'Information' or
'Technical Support'.  These must be complete matches, and
some tests might show you why it doesn't match.

Have you done these 'obvious' tests?

    print "|$FORM{dept}|\n";

    print length($FORM{dept}), "\n";

Other than that, I don't see how anyone can help you further.

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


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

Date: Tue, 4 May 1999 07:13:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Declaration Help Please!!
Message-Id: <4okmg7.br3.ln@magna.metronet.com>

CNE_Morti (morti_cne@my-dejanews.com) wrote:

: OK I found my typo with ( and } and I lost the quotes, but it still does not
: work!!	


   What does "not work" mean?

   Do you have any observable behavior?

   error/warning messages?

   bounced mail?

   You need to give us _something_ to work with.



: Could someone please give me some serious help?  


   You have gotten some serious help.

   You have not given us enough information (like the real code) 
   to help further.


: I'm in a real time
: crunch to get this working.  


   Usenet is not the right choice then.

   Hire a contractor to take care of it for you.


: Someone please tell me what is wrong with the
: code 

   I do not see anything wrong with the code, other than the typos,
   and after fixing those, I'm not sure that you havent' broken
   something else, since we still have never seen the actual code
   that you are having trouble with.

   Also add an else clause in case $FORM{dept} is not one of the
   two values that you are prepared to handle.

   else {
      die "'$FORM{dept}' is neither 'Technical Support' nor 'Information'!\n";
   }


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 04 May 1999 09:33:33 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Declaration Help Please!!
Message-Id: <372F215D.3B80862D@atrieva.com>

Larry Rosler wrote:
> 
> [Posted and a courtesy copy sent.]
> 
> In article <7gn2s0$bap$1@nnrp1.dejanews.com> on Tue, 04 May 1999
> 15:14:12 GMT, CNE_Morti <morti_cne@my-dejanews.com> says...
> ...
> > > >$department = "$FORM{'dept')";
> > > >if ( $department eq 'Information' ) {
> > > >   $recipient = 'someone@host.com';
> > > >}
> > > >elsif ( $department eq 'Technical Support' ) {
> > > >   $recipient = 'another@host.com';

> These must be complete matches, and
> some tests might show you why it doesn't match.
> 
> Have you done these 'obvious' tests?
> 
>     print "|$FORM{dept}|\n";
> 
>     print length($FORM{dept}), "\n";
> 
> Other than that, I don't see how anyone can help you further.

He might try using a pattern match vice eq.

if( $department =~ /Information/){ # etc...

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Tue, 04 May 1999 15:29:49 GMT
From: CNE_Morti <morti_cne@my-dejanews.com>
Subject: Declaration Help Please!
Message-Id: <7gn3p7$c9u$1@nnrp1.dejanews.com>

OK, I've corrected the typo with ( and } and also removed the quotes and used
the -w

It still does not work and I'm in a real time crunch to get this finished.
Could someone PLEASE help me correct the code snippet so I can finish this
project?  I realize that you are not being paid to help, but I would really
appreciate it and I promise to return the favor by helping someone else.

Thank You
Steve

$department = $FORM{'dept'};
if ( $department eq 'Information' ) {
   $recipient = 'info@company.com';
}
elsif ( $department eq 'Technical Support' ) {
   $recipient = 'help@company.com';
}

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 4 May 1999 12:15:53 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Declaration Help Please!
Message-Id: <7gn61g$shj$1@nntp2.atl.mindspring.net>

CNE_Morti wrote in message <7gn3p7$c9u$1@nnrp1.dejanews.com>...
:OK, I've corrected the typo with ( and } and also removed the quotes and
used
:the -w
:It still does not work and I'm in a real time crunch to get this finished.
:Could someone PLEASE help me correct the code snippet so I can finish this
:project?  I realize that you are not being paid to help, but I would really
:appreciate it and I promise to return the favor by helping someone else.
:Thank You
:Steve
:
:$department = $FORM{'dept'};
:if ( $department eq 'Information' ) {
:   $recipient = 'info@company.com';
:}
:elsif ( $department eq 'Technical Support' ) {
:   $recipient = 'help@company.com';
:}

What do you mean it doesn't work?  What you have posted is internally
consistent and correct (if not efficient) both in terms of syntax and logic.
If something doesn't work the problem must lie in either code or intent to
which the group does not have access.  We need more information before we
can be of any more assistance.

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
People get annoyed when you try to debug them.
 - Larry Wall





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

Date: 04 May 1999 10:17:40 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Declaration Help Please!
Message-Id: <xkfbtg0lsgr.fsf@valdemar.col.hp.com>

CNE_Morti <morti_cne@my-dejanews.com> writes:
> It still does not work and I'm in a real time crunch to get this finished.
> Could someone PLEASE help me correct the code snippet so I can finish this
> project?  I realize that you are not being paid to help, but I would really
> appreciate it and I promise to return the favor by helping someone else.

I didn't pay much attention to your earlier posting, but the bit of code
you posted does exactly what it ought to, as best I can tell.  What are
your inputs, the results you're getting, and what are the results you
expect?

I expect my version of ESP::Psychic will be ready sometime last week.
More likely, yesterday (you know how schedules tend to slip).

-=Eric


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

Date: Tue, 4 May 1999 07:15:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Declaration Help Please!
Message-Id: <fskmg7.br3.ln@magna.metronet.com>

CNE_Morti (morti_cne@my-dejanews.com) wrote:

: It still does not work 

: $department = $FORM{'dept'};
: if ( $department eq 'Information' ) {
:    $recipient = 'info@company.com';
: }
: elsif ( $department eq 'Technical Support' ) {
:    $recipient = 'help@company.com';
: }


   That code works fine for me...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 04 May 1999 18:58:39 +0200
From: Edouard PAVIS <e.pavis@silicomp.com>
Subject: Generate more than one page with one script
Message-Id: <372F273F.2841F0C1@silicomp.com>

Hi,
I use the CGI.pm library and the object method.
This is the structure of my script :

**********************************
use CGI;

#Part one

$page1=new CGI;

$page1->header();
$page1->start_html();
print (......)
do (.....)
$page1->end_html();

#Part two

$page2=new CGI;

$page2->header();
$page2->start_html();
print (......)
do (.....)
$page2->end_html();

****************************
The second party never appear in my browser and seems be jump.

I hope that I'm clear.

Thangs,

Edouard
<e.pavis@silicomp.fr>





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

Date: 04 May 1999 09:53:55 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: GETting a Web-Site with IO::Socket::INET
Message-Id: <m36768esq4.fsf@moiraine.dimensional.com>

"Joe" <keitgen@keitgen.de> writes:

> My server is connected to 8 Major Backbones like AOL, MAE EAST, etc. and
> with 155 MBit/s connections each...

So.  You are still constrained by the bandwidth available to the
host at the far end.

> so I shouldn't have too much of a bottleneck problem with major
> sites...

And even at 155mbs I'd guess that you are still network-bound,
LWP::Simple just doesn't take all that much horsepower.  :-)

Let's look at an example.

On my heavily loaded K6 266 LWP::Simple takes just over a 
tenth of a second to compile using a (big, slow) -DDEBUGGING
perl.  Let's say that without -DDEBUGGING my perl speeds up
50% (a reasonable number), that means that compile time
is probably somewhere around two-thirds of a tenth of a second
or roughly 66 ms.

I normally see average latencies of 40-50 ms from a well-connected
(multi t3) box to major internet sites (news.com, cnn.com, and
yahoo.com).  

Doubling that latency to account for the intial connection initiation 
leaves us at 80-100 ms, already enough to begin to drown out the
overhead of loading LWP::Simple.  And you haven't even transferred
any actual data yet--just TCP bookkeeping information.  The overhead
of LWP::Simple is going to disappear into the noise completely by
the end of a single request.

Avoiding LWP::Simple is probably not going to solve your problem.
Like I said yeterday, if you absolutely need those documents for your
application--and you absolutely need them immediately--you will
probably want to investigate some sort of caching solution.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Tue, 4 May 1999 06:33:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HELP: Printing binary files (e.g. pdf) to the client browser
Message-Id: <tdimg7.kn3.ln@magna.metronet.com>

Egon Kraaikamp (kraaikae@xs4all.nl) wrote:
: I'm looking for a way to send the data from a .pdf file to the client
: browser trhough perl.
: I think it has to look like:
: 1) open the file
: 2) "print" the file-data
: 3) close the file

: Can someone direct me to the right way to do this?


   That should do it, with the addition of binmode() if you
   are Operating System challenged.


      perldoc -f binmode


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 04 May 1999 16:14:03 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: HELP: Printing binary files (e.g. pdf) to the client browser
Message-Id: <f1FX2.853$iu1.1060@news.rdc1.tn.home.com>

>: I'm looking for a way to send the data from a .pdf file to the client
>: browser trhough perl.
>: I think it has to look like:
>: 1) open the file
>: 2) "print" the file-data
>: 3) close the file
>
>: Can someone direct me to the right way to do this?
>
>   That should do it, with the addition of binmode() if you
>   are Operating System challenged.


Not to stray too far, but you will most likely need the correct Content
Type if it's headed for a browser. I'm uncertain what it is, but a quick
search for content type headers and PDF should get that.

I have always just provided the PDF as a link and let the browser / user
decide what to do with it.  Many browsers / plug-in combinations out
there are just flat out broken. If you know for a fact that the browsers
can display the PDF (in a semi-predictable Intranet) then you'll
probably be okay. Otherwise, you should consider compatibility issues
before pushing this into someone's personal space.

$0.02

CT




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

Date: Tue, 4 May 1999 09:11:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP: Printing binary files (e.g. pdf) to the client browser
Message-Id: <MPG.1198bbffdf6557089899b2@nntp.hpl.hp.com>

In article <tdimg7.kn3.ln@magna.metronet.com> on Tue, 4 May 1999 
06:33:33 -0400, Tad McClellan <tadmc@metronet.com> says...
> Egon Kraaikamp (kraaikae@xs4all.nl) wrote:
> : I'm looking for a way to send the data from a .pdf file to the client
> : browser trhough perl.
> : I think it has to look like:
> : 1) open the file
> : 2) "print" the file-data
> : 3) close the file
> 
> : Can someone direct me to the right way to do this?
> 
>    That should do it, with the addition of binmode() if you
>    are Operating System challenged.

Or even if you are not.  Who knows where your code may end up someday?  
(Both the input file and STDOUT should be binmode()ed.)

1a) Print the appropriate 'Content-type: ...' header.  I have no idea 
what that might be.  Perhaps someone in one of the WWW nesgroups knows.

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


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

Date: Tue, 4 May 1999 17:08:40 +0200
From: "johan schoen" <johan.schon@capgemini.se>
Subject: Re: How to distinguish between cron-startup and command-line startup
Message-Id: <7gn2c3$7gt$1@news.capgemini.se>

Dear Joakim,

I do not know if this solves your problem, but you can check if STDIN is a
tty like this:

if (-t)
{
        print "tty - interactive mode enabled!\n";
}
else
{
        print "not a tty - no user input!\n";
}

# schoen






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

Date: Tue, 04 May 1999 17:01:35 +0200
From: Matija Exel <Matija.Exel@lag.ensieg.inpg.fr>
Subject: Re: installing APi507e.exe on Win 95
Message-Id: <372F0BCF.8DF9597D@lag.ensieg.inpg.fr>



Tim a icrit :

> I've only installed Perl on English Windows, so I don't know if any
> language-specific issues may exist. However you may want to
> check with ActiveState [ http://www.ActiveState.com ]and also
> consider installing the latest build (515?).

and yes, I searched the faqes and the deja.news archive: nothing
illuminating on the subject...



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

Date: 4 May 1999 16:36:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: installing APi507e.exe on Win 95
Message-Id: <372f13f7@newsread3.dircon.co.uk>

Matija Exel <Matija.Exel@lag.ensieg.inpg.fr> wrote:
> 
> Tim wrote:
> 
>> I've only installed Perl on English Windows, so I don't know if any
>> language-specific issues may exist. However you may want to
>> check with ActiveState [ http://www.ActiveState.com ]and also
>> consider installing the latest build (515?).
>> Tim K.
> 
> well, I just tried build 515 with the same result: it happens just after
> "Configuring Active Perl. This may take a minute." and then while
> "Configuring Perl..." an error window for _INS0432 pups up and
> the Debug information is:
> 
> _INS0432 a causi une difaillance de page dans:
> 

I think that something is wrong with your windows rather than with Perl.

I would as a first precaution shutdown all Applications - including
any that may be running as services (Installed in the system tray .)

The error you have there looks for all the world like a rather serious
'Out of memory' condition.

An alternative might be that you have got a duplcate Perlez.dll in your
windows directory - and it GPFs when fed some bad parameter to some
function call : you should use the 'Find' utility to search your disk.

Beyond that I cant say much because I've never heard of this happening
before.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 4 May 1999 06:37:30 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: ISPs that offer cgi space??
Message-Id: <alimg7.kn3.ln@magna.metronet.com>

BBlackmoor (bblackmoor@my-dejanews.com) wrote:

: In article <372EA152.D8B1FCA6@chatbase.com>,
:   webmaster@chatbase.com wrote:
: > Mike Flaherty wrote:
: > >
: > > I haven't looked yet but this seems like to best place to start.
: >
: > Well, it's actually not the best place to start, being this NG is
: > dedicated and geared towards Perl. Which your question has nothing
: to do
: > with.

: That's absurd: 
[snip]
: Of course this newsgroup is an appropriate place to ask
: his question.


   But he is sitting on a chair when he does his CGI programming,
   so he should ask in alt.furniture?

   He is using a computer for this programming, so he should
   crosspost to all of the comp.* newsgroups?

   Perl is not equivalent to CGI programming.


   *plonk*


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 4 May 1999 16:50:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ISPs that offer cgi space??
Message-Id: <372f174f@newsread3.dircon.co.uk>

BBlackmoor <bblackmoor@my-dejanews.com> wrote:
> 
> Hash: SHA1
> 
> In article <372EA152.D8B1FCA6@chatbase.com>,
>   webmaster@chatbase.com wrote:
>> Mike Flaherty wrote:
>> >
>> > I haven't looked yet but this seems like to best place to start.
>>
>> Well, it's actually not the best place to start, being this NG is
>> dedicated and geared towards Perl. Which your question has nothing
> to do
>> with.
> 
> That's absurd: you want him to start comp.lang.perl.isp just to ask
> one question? Of course this newsgroup is an appropriate place to ask
> his question.
> 

What are you on about ?  The original question didnt even contain the
word Perl.  Perl is not synonomous with CGI.  This is not the
appropriate place to ask this sort of question.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 04 May 1999 15:35:11 GMT
From: "Steve Wood" <scwood@home.com>
Subject: Re: Newbie in need (reading a file into an array)
Message-Id: <PsEX2.5400$NC4.8342@news.rdc1.ab.wave.home.com>

I'm totally new at this (utterly), but wouldn't this work?
(Note: So I'm answering because it helps _me_ too.)

open ( INFILE, "inputfile.txt") or die "die message\n" ;

@LineArray=();        # The array that holds one file line per array entry.

while (<INFILE>){
push ( @LineArray , $_ ) ; # Push the current line onto the end of @LineArray.
}

--Steve Wood.

> "Matt G. Ellis" <mgeusenet@usa.net> writes:
>
> > Okay i have a file, i want to be able to read all the lines into one big
> > array so i can refrence it in my script.
> >
> > So $arrayname[0] would be line one and $arrayname[1] world be line 2 and so
> > on?





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

Date: Tue, 04 May 1999 10:49:04 -0500
From: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Re: Newbie in need (reading a file into an array)
Message-Id: <372F16F0.D9399601@indiana.edu>

Whoa, tiger.  Much easier way.
@LineArray = <INFILE>; #does the same things as your while loop.
This is called list context.  If you use a list (array) where you would
usually use a scalar, you generally "get what you want."  A lot of
perl's functions work this way.
Enjoy!

CLinton Wolfe

Steve Wood wrote:
> 
> I'm totally new at this (utterly), but wouldn't this work?
> (Note: So I'm answering because it helps _me_ too.)
> 
> open ( INFILE, "inputfile.txt") or die "die message\n" ;
> 
> @LineArray=();        # The array that holds one file line per array entry.
> 
> while (<INFILE>){
> push ( @LineArray , $_ ) ; # Push the current line onto the end of @LineArray.
> }
> 
> --Steve Wood.
> 
> > "Matt G. Ellis" <mgeusenet@usa.net> writes:
> >
> > > Okay i have a file, i want to be able to read all the lines into one big
> > > array so i can refrence it in my script.
> > >
> > > So $arrayname[0] would be line one and $arrayname[1] world be line 2 and so
> > > on?


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

Date: Tue, 04 May 1999 17:12:33 +0200
From: Thomas Jakober <thomas.jakober@ubs.com>
Subject: Passing Parameters
Message-Id: <372F0E61.67540C92@ubs.com>

I'm calling a perl script from a HTML page on a Windows NT client using
a mime type. The script is well downloaded and executed on the client
but i cannot pass any parameter to the script. The command line argument
array is always empty.

Does anybody know how to specify the parameters on the url, how to
configure the mime-type?

Thanks in advance, 

Thomas Jakober
UBS Zuerich


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

Date: Tue, 04 May 1999 15:08:01 GMT
From: Matthew Evans <matte_8000@my-dejanews.com>
Subject: Re: Perl and Password
Message-Id: <7gn2ge$at6$1@nnrp1.dejanews.com>

In article <372EC209.62026873@lfi.uni-hannover.de>,
  Folkert Meeuw <fmee@lfi.uni-hannover.de> wrote:
> possibles to use
> passwords and cryption in perl and known security problems.
> They needed it for a Apache-Webserver ?!?
>What's going on there ?

Sounds like they are serious about serving web pages.
They probably have a UNIX box somewhere with apache on it.

> Where users can select over forms, advance document data.
> Maybe this sounded in the moment such little confuse, but it must going
> on.

Passwording in perl is quite simple, you can use the environment variables to
pick out the authenticated user. Use .htaccess files to authenticate the user
and then you can pick out the username from the environment variable AUTH_USER
( i think thats the one )
If you want to check the password file yourself, or modify it you have to open
the password file and do something like this:

-----snip-----

sub change_password
{
	$rstring="!\@\$C&\$#OISMLNXCDFHDIFY*)\$%\$HFJDKNLDUF365441g5k41tr09713
\$*Y)U#PRDFD<MISF})W_(\$uoihfogihdfsgnfdsh\`\'verg";
	open(PASSFILE, $password_file)||&errprn("Cannot open password file");
	open(PASSFILE_TMP, $password_file.".tmp")||&errprn("Cannot open
temporary password file");

	srand($$|time());
	$rand1 = rand(length($rstring));
	$rand2 = rand(length($rstring));

	$crand1 = substr($rstring, $rand1, 1);
	$opass = $data{'old_pass'};
	$npass = $data{'new_pass'};
	$cnpass = $data{'checked_new_pass'};

	if(($new_pass ne $checked_new_pass) || ($new_pass eq ""))
	{
		errprn("Invalid password or passwords do not match<BR>Press
back and renter<BR>\n");
	}
	$crand2 = substr($rstring, $rand2, 1);
	$crand1 = $crand1.$crand2;

	while($input = <PASSFILE>)
	{
		chop($input);
		@up = split(/:/, $input);
		if($usertoedit eq $up[0])
		{
			if(&check_pass($up[1], $old_pass))
			{
			       $newpass = crypt($npass, $crand1);
			} else {
				&errprn("Incorrect password for $usertoedit<BR>
\n");
			}
			$up[1] = $newpass;
		}
		print PASSFILE_TMP "$up[0]:$up[1]\n";
	}

	close(PASSFILE);
	close(PASSFILE_TMP);
	unlink($password_file);
	rename($password_file".tmp", $password_file);
	print "Password has been changed for $usertoedit<BR>Click <A href=
\"$start_page\">here</a> to return<BR>\n";
}

sub check_pass
{
	my($encpass, $topass) = @_;

	$salt = substr($encpass, 0, 2);

	$passtmp = crypt($topass, $salt);

	if($passtmp eq $encpass)
	{
		return 1;
	} else {
		return 0;
	}
}


------snip-----
I hope this helps,

Cheers,

Matt

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 04 May 1999 10:45:22 -0500
From: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Re: Perl Beginner
Message-Id: <372F1612.2D5D9578@indiana.edu>

Yes, it certainly is.
Try something like this (not slick, but clear):

$filename = "/tmp/foo.bar";
$contents = "";

open(FOO_IN, $filename) or die "I couldn't open the file : $!";

# This reads the file, one line at a time, and puts the current 
# line in $_   
while (<FOO_IN>) {
	$contents = $contents . $_;
}
close(FOO_IN) or die "I couldn't close the file : $!";

#Do something with $contents

# Note the all-important ">" on the next line
open(FOO_OUT, ">/tmp/thenewfoo.bar") or die "Couldn't open the file :
$!";
print FOO_OUT $contents;
close(FOO_OUT) or die "Couldn't close the new file: $!";

######## end of script
I would suggest you run, not walk, to your nearest bookstore and buy a
copy of Learning Perl, by Randal L Schwartz and Tom Christiansen (the
llama book).  The book is very easy and entertaining to read, and you'll
find help on all the questions you'll soon be asking - about regular
expressions, hashes, lists vs. scalars, CGI, modules, I/O, you name it.

Welcome to Perl, and good luck.
Clinton Wolfe
Brian Altman wrote:
> 
> Hi there,
> 
> I am just beginning to learn how to program in Perl.
> Right now I am wondering if it is possible to 'get' specific data from an
> existing file (any text based file), and write it to a new file.
> 
> Can someone help me with this ?
> Thanks a lot in advance !!


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

Date: Tue, 04 May 1999 15:51:39 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Perl Beginner
Message-Id: <fIEX2.851$iu1.1203@news.rdc1.tn.home.com>

>I am just beginning to learn how to program in Perl.
>Right now I am wondering if it is possible to 'get' specific data from
an
>existing file (any text based file), and write it to a new file.


I don't think that's ever been tried! Just kidding. Of course it's
possible.

http://language.perl.com/newdocs/pod/perlfaq5.html

contains a ton of info on file operations, although I do
not see one geared for your specific question. It will be a good
exercise to read through the others so you'll get a good sense of
what perl can do and just how many of your questions can be answered
instantly in the FAQ.

http://language.perl.com/faq/index.html

>Can someone help me with this ?


Only you can prevent forest fires.

CT




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

Date: Tue, 04 May 1999 07:56:15 -0400
From: invalid-see-sig@nope.joefarmer.com (Brett Tabke)
Subject: Re: perl win32 directory layout is a mess!
Message-Id: <fBuL3k+hD03Y092yn@joefarmer.com>

rurban@sbox.tu-graz.ac.at (Reini Urban) wrote:
>win32/vc installers might not like the changed directly layout as it
>used now.
>in detail i don't like
>~INST_TOP~~INST_VER~\lib\~archname~ and
>~INST_TOP~~INST_VER~\bin\~archname~

The latest activestate allows you to specify the top level
directory.  The latest GS version allows you to specify the top
level directory.

Mine setsup in /usr making for a #!/usr/bin/perl shabang.

Whats the problem?

Brett
Howdy )at( netlane.com

 ...www.operasoftware.com because html standards are not just a nice idea.




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

Date: Tue, 4 May 1999 10:21:08 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Problem in calling subroutine inside another routine
Message-Id: <x3yvhe8apbf.fsf@tigre.matrox.com>


shaominchi@my-dejanews.com writes:

> When I call func1() inside func2(), PERL complained.
> Can any one tell me why I got the following errors ?

[snip]

> sub func1() {
>    local (@f1)=@_;

You are prototyping the subroutine such that it takes no arguments,
yet you pass arguments to it and expect to receive them. Read perlsub
for a clearer explanation of what's really happening, then you can
drop the brackets after the sub name, and all will be fine.

HTH,
Ala



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

Date: 4 May 1999 15:52:07 GMT
From: dsf3g@node16.unix.Virginia.EDU (David Salvador Flores)
Subject: Question: Updating an Array...
Message-Id: <7gn537$6k6$1@murdoch.acc.Virginia.EDU>


Now, I know from "Learning Perl" that the push, pop, shift and unshift
functions allow you to update the "left" or "right" end of an array.
But is there a simple way of stuffing new values into the middle of
an array without overwriting a previous value?

I know I can do this the loopety loop method with temporary holding arrays
and stuff. But is there a simple, one command is all you need, method?


-Dave





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

Date: Tue, 04 May 1999 12:19:42 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Question: Updating an Array...
Message-Id: <linberg-0405991219420001@ltl1.literacy.upenn.edu>

In article <7gn537$6k6$1@murdoch.acc.Virginia.EDU>,
dsf3g@node16.unix.Virginia.EDU (David Salvador Flores) wrote:

> Now, I know from "Learning Perl" that the push, pop, shift and unshift
> functions allow you to update the "left" or "right" end of an array.
> But is there a simple way of stuffing new values into the middle of
> an array without overwriting a previous value?

No.  Arrays are sequential.  You'll have to do some moving.

> I know I can do this the loopety loop method with temporary holding arrays
> and stuff. But is there a simple, one command is all you need, method?

Using array slices for this will make your life much easier, and avoid the
"loopety loop" method.  Learning Perl discusses this, I believe.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Tue, 4 May 1999 09:18:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question: Updating an Array...
Message-Id: <MPG.1198bdc81d951209899b3@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7gn537$6k6$1@murdoch.acc.Virginia.EDU> on 4 May 1999 
15:52:07 GMT, David Salvador Flores <dsf3g@node16.unix.Virginia.EDU> 
says...
> Now, I know from "Learning Perl" that the push, pop, shift and unshift
> functions allow you to update the "left" or "right" end of an array.
> But is there a simple way of stuffing new values into the middle of
> an array without overwriting a previous value?
> 
> I know I can do this the loopety loop method with temporary holding arrays
> and stuff. But is there a simple, one command is all you need, method?

perldoc -f splice

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


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

Date: Tue, 4 May 1999 09:56:43 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Stumped on Regex routine
Message-Id: <x3ywvyp9bvo.fsf@tigre.matrox.com>


Eric Bohlman <ebohlman@netcom.com> writes:

> Ala Qumsieh <aqumsieh@matrox.com> wrote:
> 
> : 	$Url =~ s-/[^/]+$--;
> 
> Anyone who would choose a delimiter like that is badly in need of being 
> whipped with a cat-o'-nine-tails made out of overcooked fettucine.

Is this a good thing? ;-)

Actually, this is the very first time I ever used the '-' as a
delimiter for a substitution. I think it looks rather good (cryptic,
but still good).

I usually use '/', but if a slash has to appear in my regexp, I use an
exclamation mark. But, consistency makes life boring, don't you think?

Ala



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

Date: Tue, 04 May 1999 16:22:09 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Upload files and 'Jeff Scripts'
Message-Id: <R8FX2.854$iu1.1173@news.rdc1.tn.home.com>

>included with the files I get "Premature end of script headers".


>I read about this message and I think file-upload.cgi takes care of the
>problem by flushing Perl's buffer. $| = 1;


No no. :) It means what it says. You didn't send a complete header
before the output. Did you delete a line that said something like this?

Check out the CGI faq for Perl...

http://language.perl.com/faq/index.html

Tom? I didn't see anything about the basic Content Type problems in the
'Idiot's Guide to Solving Perl CGI problems'. Is it elsewhere, or just
an oversight?

CT




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

Date: Tue, 04 May 1999 16:54:23 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Upload files
Message-Id: <3DFX2.857$iu1.1313@news.rdc1.tn.home.com>

Is there an echo in here?




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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

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

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

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


------------------------------
End of Perl-Users Digest V8 Issue 5560
**************************************

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