[16653] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4065 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 19 09:05:28 2000

Date: Sat, 19 Aug 2000 06:05:15 -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: <966690313-v9-i4065@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 19 Aug 2000     Volume: 9 Number: 4065

Today's topics:
    Re: Apache and cgi/perl (Tim Hammerquist)
    Re: cross platform newline processing (Eric Bohlman)
    Re: cross platform newline processing <flavell@mail.cern.ch>
    Re: Download a file <gellyfish@gellyfish.com>
    Re: Download a file (Ken Loomis)
        Embedding Perl akdwivedi@hotmail.com
    Re: Eval and Regexps Help bluearchtop@my-deja.com
    Re: Eval and Regexps Help (Eric Bohlman)
    Re: Eval and Regexps Help (Martien Verbruggen)
    Re: help foreach doesn't work (Martien Verbruggen)
    Re: Help. Proxy Server and login? <gellyfish@gellyfish.com>
        how to generate unreadable from readable perl code <horst@swid.de>
    Re: how to generate unreadable from readable perl code <gellyfish@gellyfish.com>
    Re: how to generate unreadable from readable perl code (Tony L. Svanstrom)
    Re: how to generate unreadable from readable perl code (Martien Verbruggen)
    Re: Mailform <shtan@kis.ru>
    Re: Matching the e-mail header <flavell@mail.cern.ch>
    Re: Matching the e-mail header <gellyfish@gellyfish.com>
    Re: Matching the e-mail header (Tony L. Svanstrom)
    Re: Need some quick help.. <gellyfish@gellyfish.com>
    Re: Net::ftp problem. <gellyfish@gellyfish.com>
    Re: newbie: s/// on windows subdirs? <gellyfish@gellyfish.com>
        OT: Re: setting up a cgi directory (Tim Hammerquist)
    Re: Passing argument to Perl script <gellyfish@gellyfish.com>
    Re: substring-p <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 19 Aug 2000 08:24:33 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Apache and cgi/perl
Message-Id: <slrn8pshmd.391.tim@degree.ath.cx>

On Fri, 18 Aug 2000 13:20:54 GMT, NP <nvp@spamnothanks.speakeasy.org> wrote:
> On Fri, 18 Aug 2000 09:55:28 +0100, pete <pete@alphanetcoms.co.uk> wrote:
> : Try the following:
> : 
> : #!c:/perl/bin/perl.exe
> 
> Does the above line work for you on your Windows machine?  Last I
> checked, DOS didn't understand shebang paths.

As Alan mentioned, Apache uses the shebang.  Also, there
are several unix shell emulators that sit on top of Windoze that make my
life under Win32 SOOOOOOOO much easier.  =)

> If the person *really* wants to execute Perl programs without executing
> 'perl.exe program', they can do 1 of 2 things (off the top of my
> head).  1. They can make appropriate registry entries (the ActivePerl
> installer does this) or 2. they can wrap their Perl program in a batch
> script with 'pl2bat'.

This puts a lot of faith in windows' registry interpretation; and
even _more_ faith in it's batch file processor, which is known to
break in Win95/98.  But there _are_ masochists out there, I suppose.

I mean no offense to anyone who is forced to use Win32, nor to anyone
who may, by some misfortune, _prefer_ Win32.  Besides...every once in a
while I feel bad for bashing Windoze...then I have to use it again.
Still, I _am_ grateful that ActiveState saw fit to grant this innately
flawed OS with a powerful (though somewhat flawed) implementation of
perl.

</Rant>

My $0.20  =)
-- 
-Tim Hammerquist <timmy@cpan.org>
Most people are other people. Their thoughts are someone else's
opinions, their lives a mimicry, their passions a quotation.
	-- Oscar Wilde


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

Date: 19 Aug 2000 10:01:38 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: cross platform newline processing
Message-Id: <8nllu2$imq$3@slb6.atl.mindspring.net>

Keith Calvert Ivey (kcivey@cpcug.org) wrote:
: Bob Walton <bwalton@rochester.rr.com> wrote:
: 
: >Mark, you should find that Perl will DTRT (do the right thing) in this
: >case (it does on Windoze, anyway).  It should treat "\012", "\015", and
: >"\015\012" all just like either of these sequences is a "\n" on input.
: 
: Not true.  Perl will convert the OS-specific line ending to "\n"
: on input (assuming no binmode), but it doesn't automatically
: handle line endings from other OSs.  For example, if you have
: "\015\012" on a Unix system, you'll be left with "\015" (or
: "\r") before the "\n".


Specifically:

Each platform will of course correctly read lines from a file using its 
own conventions.  Using the default value of $/:

Unix: Windows files will be correctly broken up into lines, but each line 
will have an extra \015 before the \n.  Mac files will be gulped as one 
long line with no \n at the end.

Windows: Both Unix and Mac files will be gulped as one long line with no 
\n at the end.

Mac: Unix files will be gulped as one long line with no trailing \n.  
Windows files will be correctly broken up into lines, but each line 
except the first will have a leading \012.


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

Date: Sat, 19 Aug 2000 14:30:09 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cross platform newline processing
Message-Id: <Pine.GHP.4.21.0008191410410.4213-100000@hpplus03.cern.ch>

On 19 Aug 2000, Eric Bohlman wrote:

[...]
> Unix: Windows files will be correctly broken up into lines, but each line 
> will have an extra \015 before the \n.  Mac files will be gulped as one 
> long line with no \n at the end.
> 
> Windows: Both Unix and Mac files will be gulped as one long line with no 
> \n at the end.
> 
> Mac: Unix files will be gulped as one long line with no trailing \n.  
> Windows files will be correctly broken up into lines, but each line 
> except the first will have a leading \012.

No argument with any of that, but it only seems to state the problems,
rather than offering an agenda for a solution.  The following thoughts
are entirely open to being shot down with something better.

I'm familiar with doing this on ASCII-based platforms only: I was
already out of EBCDIC before I ever heard that Perl was available on
such platforms.  So my approach may not be portable to those.

But when required to handle cross-platform text of this kind, I would
open the stream in binmode, and would write the code in terms of the
binary representations \015 and \012.  Since $/ can't be set to
several alternatives at the same time, I wouldn't use it, but would
use some other coding for breaking up the binary chunks into
lines/records (call them what you will).

That way, both the code and the data which it processes can be
portable (between ASCII-based platforms).  I've even on occasion
handled text files that had previously been processed on more than one
OS, and that as a result contained a mixture of newline
representations within the same file.  Of course, there _can_ then be
unresolvable ambiguities, but it was better than nothing ;-)

Sorry, this posting contains no actual code.  I'd rather discuss an
agreement on principles first, than tussle over the details of coding
a problem whose details haven't yet been clearly agreed.  OK, shoot.

all the best



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

Date: 19 Aug 2000 10:54:48 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Download a file
Message-Id: <8nllh8$f29$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 20:12:03 GMT Ken Loomis wrote:
> Hello:
> 
> What is the perl command to download a file from within a cgi
> response?
> 

print

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sat, 19 Aug 2000 12:52:30 GMT
From: nospam@nospam.com (Ken Loomis)
Subject: Re: Download a file
Message-Id: <399e82fa.10816989@news.tiac.net>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> 
>> What is the perl command to download a file from within a cgi
>> response?
>
>print
>
Thanks


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

Date: Sat, 19 Aug 2000 10:38:09 GMT
From: akdwivedi@hotmail.com
Subject: Embedding Perl
Message-Id: <8nlo2g$dad$1@nnrp1.deja.com>

Hi,

I need to embed Perl in my C++ code.. I went through the perlembed
documentation and it's good for startups.. But I couldn't get advanced
topics like handling files descriptors/handles from the embedded perl..
I need some help in passing the file handle from and to the
perlscripts.. Any reference to some examples and reference code would be
a big help...

thanks
Addy


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


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

Date: Sat, 19 Aug 2000 11:36:33 GMT
From: bluearchtop@my-deja.com
Subject: Re: Eval and Regexps Help
Message-Id: <8nlrg1$gga$1@nnrp1.deja.com>

In article <slrn8psb5h.n7v.mgjv@martien.heliotrope.home>,
  mgjv@tradingpost.com.au wrote:
> On Sat, 19 Aug 2000 02:42:39 GMT,
> 	bluearchtop@my-deja.com <bluearchtop@my-deja.com> wrote:
> > $str=<<'_EOF';
> [snip]
> > <%
> > for ($i=1;$i<11;$i++) {
> >   $i." ";
> > }
> > %>
> > _EOF
> > $str=~s/<%(.*?)%>/eval($1)/sge;
> > print $str;
> > ########################
> >
> >
> > $ perl -w test.pl
> > Useless use of concatenation in void context at (eval 2) line 4.
> > The current time is:
> > Fri Aug 18 22:39:06 2000
> >
> > Count to 10:
> >
> > Why does it think $i is a void context?
>
> because you don't assign the result of $i."" to anything. Did you mean
> something like:
>
> <%
> $x = '';
> for ($i = 1; $i < 11; $i++)
> {
> 	$x .= "$i ";
> }
> $x;
> %>

Thanks, that works, but I don't understand why that would work but this
won't:
<%
$x = '';
for ($i = 1; $i < 11; $i++)
{
$x = "$i ";
$x;
}
%>

Why does it tell me that the variable still has a void context?


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


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

Date: 19 Aug 2000 12:53:22 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Eval and Regexps Help
Message-Id: <8nm002$82e$1@slb7.atl.mindspring.net>

bluearchtop@my-deja.com wrote:
: Thanks, that works, but I don't understand why that would work but this
: won't:
: <%
: $x = '';
: for ($i = 1; $i < 11; $i++)
: {
: $x = "$i ";
: $x;
: }
: %>
: 
: Why does it tell me that the variable still has a void context?

Because "$x;" appears inside a loop, which isn't a place where a 
statement in void context can return a value.  If you move it *outside* 
the loop, you don't get a warning because it's now the last statement in 
a sequence of statements being eval'd, and that *is* a place where it can 
return a value; the value of eval'ing a string consisting of a sequence 
of statements is the value of the last statement (as you have it now, the 
last statement in the sequence is actually the for loop).

There's a mention of this on page 46 of the second edition of the Camel, 
and also in the perldiag manpage.



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

Date: 19 Aug 2000 13:01:10 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Eval and Regexps Help
Message-Id: <slrn8psud2.n7v.mgjv@martien.heliotrope.home>

On Sat, 19 Aug 2000 11:36:33 GMT,
	bluearchtop@my-deja.com <bluearchtop@my-deja.com> wrote:
> In article <slrn8psb5h.n7v.mgjv@martien.heliotrope.home>,
>   mgjv@tradingpost.com.au wrote:

> > <%
> > $x = '';
> > for ($i = 1; $i < 11; $i++)
> > {
> > 	$x .= "$i ";
> > }
> > $x;
> > %>
> 
> Thanks, that works, but I don't understand why that would work but this
> won't:
> <%
> $x = '';
> for ($i = 1; $i < 11; $i++)
> {
> $x = "$i ";
> $x;
> }
> %>
> 
> Why does it tell me that the variable still has a void context?


Interesting question. I guess perl is even clever enough to figure out
that the $x inside of the for loop in can never be used for anything
useful. In Perl generally, the return value of the last statement of an
executable block becomes the return value of the block. A for loop does
not have a return value, so that $x is useless. However, the code block
as a whole does have a return value, and in fact that is what you use in
the eval. Perl obviously recognises the difference. Bit surprising, but
correct :)

So, summarising: In the code that I presented, the $x on a line of its
own becomes the return value of the complete block of code, and will be
read. In your code, the $x on its own sits inside of a for loop, and
will never do anything useful, since the return value of a for loop's
code block isn't used anywhere.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd.   | no excuse - Lazarus Long
NSW, Australia                  | 


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

Date: 19 Aug 2000 07:04:34 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: help foreach doesn't work
Message-Id: <slrn8psbsv.n7v.mgjv@martien.heliotrope.home>

[Reordered mail to respect the more natural arrow of time]

On Sat, 19 Aug 2000 03:54:42 GMT,
	j355@my-deja.com <j355@my-deja.com> wrote:
> In article <8nkjdr$6d1$1@nnrp1.deja.com>,
>   cornelhughes@netscape.net wrote:
> > I am new to perl and trying to figure out why the following code won't
> > work? Why doesn't the following code print "Why Don't you work";
> >
> > # determine which week to display, creates var- schedweek
> > $indx = 0;
> > $schedweek = 0;
> > foreach $week (@week) {
[snip]
>
> Not only is @week empty, but don't you need to assign the scaler,
> $week, to a name other than the @week array?

What makes you say that? What do you think 'foreach' does?

# perl -w
@week = (1..10);
foreach $week (@week)
{
	print "$week ";
}
print "\n";
__END__

What do you think the above prints?

Or are you confused about the fact that @week and $week have the same
last 4 characters? That's perfectly legal in Perl. $week, %week and
@week are different thingies.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
NSW, Australia                  | 


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

Date: 19 Aug 2000 10:51:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help. Proxy Server and login?
Message-Id: <8nllai$f26$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 15:55:11 -0500 Mohammad Khan wrote:
> Hi,
>     I have a perl script which posts data to different web sites. Now one of
> our customer is using Proxy server, which verifies the login and password
> before letting them see the external internet web sites. Now how do I pass
> the login info to the proxy server.
> 
> This is how my script looks like.
> 
> 
>   use LWP::UserAgent;
>   $ua = new LWP::UserAgent;
>   $ua->agent("AgentName/0.1 " . $ua->agent);
>   $ua->proxy(['http', 'ftp'] => 'http://proxy.com');
> 

The lwpcook manpage has a section that discusses working with proxies.  You
will probably also want to read about proxy_authorization_basic() and
proxy_authorization() methods in the HTTP::Headers manpage.

/J\


-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sat, 19 Aug 2000 09:42:27 +0200
From: Horst Wassenberg <horst@swid.de>
Subject: how to generate unreadable from readable perl code
Message-Id: <399E3A63.A5D94B79@swid.de>

Hi,

I need to provide perl code to others, but I would like to avoid that
- the code can be understood easily
- can be extended by others

Hence, I would like to run a program that replaces my "long name var
names" with something like "$V00001" to "$V99999" or similar, that
replaces sub-names in a similar mannor, that deletes all comments,
removes all indenting white space etc.

=> where can I find such a program?

Regards
Horst



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

Date: 19 Aug 2000 11:20:30 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <8nln1e$f5i$1@orpheus.gellyfish.com>

On Sat, 19 Aug 2000 09:42:27 +0200 Horst Wassenberg wrote:
> Hi,
> 
> I need to provide perl code to others, but I would like to avoid that
> - the code can be understood easily

Hire the winner of the Obfuscated Perl Contest.

> - can be extended by others
> 

Hire Matt Wright

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sat, 19 Aug 2000 14:11:34 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <1efm70g.46mhvfizbr3aN%tony@svanstrom.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:

> On Sat, 19 Aug 2000 09:42:27 +0200 Horst Wassenberg wrote:

> > I need to provide perl code to others, but I would like to avoid that
> > - the code can be understood easily

Well, a Perlscript is just pure text, and therefore it's quite easy to
write another Perlscript that changes and removes stuff in it...

> Hire the winner of the Obfuscated Perl Contest.
> 
> > - can be extended by others
> > 
> 
> Hire Matt Wright

*LMAO*


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 19 Aug 2000 13:01:12 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8psum1.n7v.mgjv@martien.heliotrope.home>

On Sat, 19 Aug 2000 09:42:27 +0200,
	Horst Wassenberg <horst@swid.de> wrote:
> Hi,
> 
> I need to provide perl code to others, but I would like to avoid that
> - the code can be understood easily
> - can be extended by others

This question comes up quite a lot on this group. It even has earned
itself a place in the Perl FAQ.

# perldoc perlfaq3
[snip]
       How can I hide the source for my Perl program?
[snip]

Please, in the future, do your homework before posting. People here
generally don't take it too well when something gets asked here that
could have been answered by doing a simple search on www.deja.com, or
reading the FAQ.

> Hence, I would like to run a program that replaces my "long name var
> names" with something like "$V00001" to "$V99999" or similar, that
> replaces sub-names in a similar mannor, that deletes all comments,
> removes all indenting white space etc.

That is useless. Wouldn't stop anything.

> => where can I find such a program?

If that's all you want to do, and you control the source you need to
transform: It's trivial to write that.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: 19 Aug 2000 10:43:16 +0300
From: Anton Shtanyuk <shtan@kis.ru>
Subject: Re: Mailform
Message-Id: <200008190743.LAA25233@xkis.kis.ru>


"Fatih C. Mercan" wrote:
> 
>  Hi there!
> 
>  I'm completely new at perl, and though I'm formiliar with html, asp,
>  javascript , I want to learn more about perl. I'm trying to write a script
>  that sends a form by email, but I receive the following error from my
>  logfile:
> 
>  'Premature end of script headers'
> 
>  That is this causing and how do I fix it?
> 
>  Ronald

Try to check the first line of the script file:
It's somthing like this:

 #!/usr/bin/perl

After "perl" must be only ONE byte - EF! (not two).

Anton




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

Date: Sat, 19 Aug 2000 10:59:24 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Matching the e-mail header
Message-Id: <Pine.GHP.4.21.0008191051200.27998-100000@hpplus03.cern.ch>

On Sat, 19 Aug 2000, Tony L. Svanstrom wrote:

> Eh, no... \n is LF + NL, not CR + NL.

You can't really mean that?!?

\n denotes the platform-dependent representation of a newline.

The terms CR and LF are usually used to denote the binary
representations of two control characters (\015 and \012 in ASCII),
that are involved in different ways on different platforms in the
representation of a newline.

Quite what NL is, I'm not sure.  I seem to recall there's an EBCDIC
control character called NL (distinct from CR and LF) but I don't
recall using it in my mainframe days.

This whole area is confusing enough, IMHO.  The perlport document has
some useful information.

cheers



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

Date: 19 Aug 2000 10:45:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Matching the e-mail header
Message-Id: <8nll07$f05$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 23:18:03 GMT fgont@my-deja.com wrote:
> Hi!
> 
> I've read that the header of an e-mail message is separated from the
> body by two "newlines" (\n\n).
> 
> I saved to disk the whole header and body of an e-mail message, and
> found that this is true, as I found a 0dh 0ah 0dh 0ah between the last
> line of the header and the first line of the body.

There has been a lot of discussion about where you are going wrong but I
would like to add in that if you are trying to parse mail messages you
might find that you are better off using the facilities provided by the
Mail-Tools package that is available from CPAN - this includes Mail::Util
that has a method of reading a mailbox file, Mail::Internet that provides
methods for accessing the content of a message and Mail::Header that
provides methods for manipulating the header of a message.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sat, 19 Aug 2000 14:01:08 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Matching the e-mail header
Message-Id: <1efm6mr.1fz4ej79bapc0N%tony@svanstrom.com>

Alan J. Flavell <flavell@mail.cern.ch> wrote:

> On Sat, 19 Aug 2000, Tony L. Svanstrom wrote:
> 
> > Eh, no... \n is LF + NL, not CR + NL.
> 
> You can't really mean that?!?
> 
> \n denotes the platform-dependent representation of a newline.

I thought so, but being a good poster I actually looked it up (after a
whole day on rollerblades I was too tired to trust myself), and when I
read "\n          newline         (LF, NL)" I just thought "Oh, well"
and wrote the above.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 19 Aug 2000 10:56:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need some quick help..
Message-Id: <8nlll6$f2k$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 23:04:34 GMT DS wrote:
> Hello-
>    I am wanting to print the last modified date to the html page. For
> example using
>     <!--#flastmod file="default.html" -->
> 
> but I don't want to edit it everytime I add it to a page. I know that
> DOCUMENT_NAME will return the current filename but it wont work like this :
> 
> <!--#flastmod file="DOCUMENT_NAME" -->
> 
> due to the fact it is looking for an actual document called "DOCUMENT_NAME".
> 

That doesnt look like Perl to me - you will probably use stat() to get the
last modified date in a Perl program.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 19 Aug 2000 11:10:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Net::ftp problem.
Message-Id: <8nlmeu$f47$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 21:22:07 GMT 26red@my-deja.com wrote:
>  I am using gbarr's version  of FTP.pm and I wrote a
> sample program that uses it.. Here is how it looks..
> 
> #!/usr/local/bin/perl5 -w
> 
> BEGIN
> {
>    require "FTP.pm";

Stop right there - that you have put this suggests strongly that you
simply copied the file FTP.pm from libnet and hoped that it would work,
well it won't - the module name is Net::FTP and it requires other modules
that are in the libnet package - including but not limited to Net::Cmd.
You will need to install the module correctly as described in the README
file in the distribution, if you dont have rights to install the modules
in the correct place then you can read what it says in the FAQ about keeping
your own module directory.  

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 19 Aug 2000 11:22:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie: s/// on windows subdirs?
Message-Id: <8nln55$f5l$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 22:05:08 +0200 Christoph wrote:
> Could someone point me to a perl script that will perform a string
> substitution on all files that have one of several given file extensions
> (for example *.htm and *.html and *.txt) in a directory and all of its
> subdirectories on a Windows (!) system?
> 
> All the examples for this problem I could find were for Unix systems.
> Thanks.
> 

Use the module File::Find to obtain the file names.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sat, 19 Aug 2000 08:13:04 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: OT: Re: setting up a cgi directory
Message-Id: <slrn8psh10.391.tim@degree.ath.cx>

On Fri, 18 Aug 2000 15:58:57 GMT, cedop@my-deja.com <cedop@my-deja.com> wrote:
> Im running redhat linux 6.2
> I dont know which apache server is installed, but

	bash$ httpd -V

returns on my system:

:	Server version: Apache/1.3.12 (Unix)  (Red Hat/Linux)
:	Server built:   Mar 27 2000 20:05:31
:	Server's Module Magic Number: xxxxxxxx:x
:	Server compiled with....
:	 -D EAPI
:	 -D HAVE_MMAP
:	 -D HAVE_SHMGET
:	 -D USE_SHMGET_SCOREBOARD
:	 -D USE_MMAP_FILES
:	 -D USE_FCNTL_SERIALIZED_ACCEPT
:	 -D HTTPD_ROOT="/usr"
:	 -D SUEXEC_BIN="/usr/sbin/suexec"
:	 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
:	 -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard"
:	 -D DEFAULT_LOCKFILE="/var/run/httpd.lock"
:	 -D DEFAULT_XFERLOG="/var/log/httpd/access_log"
:	 -D DEFAULT_ERRORLOG="/var/log/httpd/error_log"
:	 -D TYPES_CONFIG_FILE="/etc/httpd/conf/mime.types"
:	 -D SERVER_CONFIG_FILE="/etc/httpd/conf/httpd.conf"
:	 -D ACCESS_CONFIG_FILE="/etc/httpd/conf/access.conf"
:	 -D RESOURCE_CONFIG_FILE="/etc/httpd/conf/srm.conf"

> when I try to load the script, i get the whole script
> returned in the browser, not the expected output
> 
> instead of getting the line:
> 
> Hello World
> 
> I get:
> 
> print "Hello World";
> 
> the script is correct, in that it works at UNI on my account
> there, but not at home.

Any CGI script in Apache should be either in a ScriptAlias'ed directory
or otherwise recognizable by apache as a cgi script.

Furthermore, the simplest perl script to send "Hello World" to the
browser is:

	#!/usr/bin/perl
	print "Content-type\n\n";
	print "This is not a Hello, World program.";

Finally, the script should be marked as executable by your operating
system.  Win95/98 doesn't care, and I'm not sure how NT works. Never
cared.  On *nix systems (including yours), try:

	chmod 755 script_name

If you follow all these steps, you should have a running CGI perl
script.  If not, you need to:

	1. Make sure your perl interpreter is set up properly.
	2. Find an Apache newsgroup.
	3. Give _them_ more information, like some contents of your
	httpd.conf, your entire script, etc.

If you like, if you've followed the above recommendations and it still
doesn't seem to work, you may email me directly.

HTH
-- 
-Tim Hammerquist <timmy@cpan.org>
Be assured that a walk through the ocean of most Souls would scarcely
get your Feet wet.  Fall not in Love, therefore: it will stick to your face.
	-- National Lampoon, "Deteriorata"


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

Date: 19 Aug 2000 11:18:42 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Passing argument to Perl script
Message-Id: <8nlmu2$f54$1@orpheus.gellyfish.com>

On Sat, 19 Aug 2000 11:51:43 +1000 Minh Le wrote:
> Hi,
> I'm trying to pass 3 different arguments to my simple perl script without
> any success.  I did try GetOption ... but they are all failed.
> What I need is during execute my script, I need to pass 3 different
> arguments to the program and depend on which argument has been provided, a
> particular sub-routine or task will be called.
> Example:  myperl -a x  -b x -c x
> where x can be 0 or 1.  if there is no option or argument provided, it will
> print out a help message, say " Please run myperl -help"
> 

You will probably want to use the module Getopt::Std to do this - in your
case you will have something similar to :


#!/usr/bin/perl -w

use Getopt::Std;
use strict;

my %opts;

getopts('a:b:c:',\%opts) || die "Invalid argument\n";

unless(exists $opts{a} &&
       exists $opts{b} &&
       exists $opts{c} )
{
  die "You must supply all of the arguments\n";
}


/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 19 Aug 2000 11:26:47 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: substring-p
Message-Id: <8nlnd7$f64$1@orpheus.gellyfish.com>

On 18 Aug 2000 13:48:47 -0400 Art Werschulz wrote:
> Hi.
> 
> I would like to determine whether a particular string (say, $word)
> appears as a substring of another string (say, $keywords).  The
> obvious thing to do would be
> 
>   print $word, "\n" if ($keywords =~ $word);
> 
> Unfortunately, this doesn't work if (e.g) $word contains a
> parenthesis.  The main point here is that I would like $word to be
> treated as a garden variety string, not a regular expression.


Well of course as has been pointed out the real answer is to use index()
but the answer to the problem you are experiencing is to use \Q to
quote the metacharacters as described in the perlre manpage ;

   $keywords =~ /\Q$word/;

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

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


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