[29828] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1071 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 27 14:14:17 2007

Date: Tue, 27 Nov 2007 11:14:09 -0800 (PST)
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, 27 Nov 2007     Volume: 11 Number: 1071

Today's topics:
        Path to Perl <chuck@no.where>
    Re: Path to Perl <RedGrittyBrick@SpamWeary.foo>
    Re: Path to Perl <RedGrittyBrick@SpamWeary.foo>
    Re: Path to Perl <chuck@no.where>
    Re: Path to Perl <spamtrap@dot-app.org>
    Re: Path to Perl <noreply@gunnar.cc>
    Re: Path to Perl <RedGrittyBrick@SpamWeary.foo>
    Re: Path to Perl <chuck@no.where>
    Re: Path to Perl <gretchen@invalid.corn>
    Re: performance problem <anon24u@gmail.com>
        Perl reference, what's the difference <xueweizhong@gmail.com>
    Re: Perl reference, what's the difference <simon.chao@fmr.com>
    Re: Perl reference, what's the difference <xueweizhong@gmail.com>
    Re: Perl reference, what's the difference <simon.chao@fmr.com>
    Re: Perl usage <cwilbur@chromatico.net>
    Re: Scalar::Util is not using XS in Fedora 8, leading t <cwilbur@chromatico.net>
    Re: Scalar::Util is not using XS in Fedora 8, leading t <tzz@lifelogs.com>
    Re: Scalar::Util is not using XS in Fedora 8, leading t <anon24u@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Nov 2007 09:36:09 -0500
From: "chuck" <chuck@no.where>
Subject: Path to Perl
Message-Id: <fiha0p$ddc$1@nrc-news.nrc.ca>

Hi,

New to Linux and Apache and Perl so I appreciate any help i can get.

I have a user who needs to move his perl scripts from his Windows 
development machine to our Linux web server.  How can I easily change the 
path to all the perl scripts that will get transfered over ?  Or is there 
another alternative such as adding an environment variable for the "apache" 
user ?

Thanks 




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

Date: Tue, 27 Nov 2007 14:46:25 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Path to Perl
Message-Id: <474c2dc4$0$8423$db0fefd9@news.zen.co.uk>

chuck wrote:
> Hi,
> 
> New to Linux and Apache and Perl so I appreciate any help i can get.
> 
> I have a user who needs to move his perl scripts from his Windows 
> development machine to our Linux web server.  How can I easily change the 
> path to all the perl scripts that will get transfered over ?  Or is there 
> another alternative such as adding an environment variable for the "apache" 
> user ?
> 

Your subject says "Path to Perl" but the body says "path to all the perl 
scripts". Those are two completely different things. Assuming you mean 
the former and are referring to the so-called shebang line:

perl -p -i -e 's|^#!perl|#!/usr/bin/perl| if $.==1;' *.pl


Presumably the user used no unusual modules and didn't make explicit 
references to platform specific filesystem locations ("c:\") etc etc.


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

Date: Tue, 27 Nov 2007 14:51:07 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Path to Perl
Message-Id: <474c2edf$0$21097$da0feed9@news.zen.co.uk>

chuck wrote:
> Or is there 
> another alternative such as adding an environment variable for the "apache" 
> user ?

Oops yes, IIRC the apache config file specifies what happens when 
someone requests a URL that points to a .pl or .cgi file.

I'd be surprised if your Apache service wasn't already configured for 
this but YMMV.


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

Date: Tue, 27 Nov 2007 10:16:40 -0500
From: "chuck" <chuck@no.where>
Subject: Re: Path to Perl
Message-Id: <fihcco$eqf$1@nrc-news.nrc.ca>

What I need to do is change the first line of all the scripts from 
"c:/perl/..." to "#!usr/bin/perl"

or get the system into look in /usr/bin/perl without changing the scripts by 
using an environment variable.




"RedGrittyBrick" <RedGrittyBrick@SpamWeary.foo> wrote in message 
news:474c2dc4$0$8423$db0fefd9@news.zen.co.uk...
> chuck wrote:
>> Hi,
>>
>> New to Linux and Apache and Perl so I appreciate any help i can get.
>>
>> I have a user who needs to move his perl scripts from his Windows 
>> development machine to our Linux web server.  How can I easily change the 
>> path to all the perl scripts that will get transfered over ?  Or is there 
>> another alternative such as adding an environment variable for the 
>> "apache" user ?
>>
>
> Your subject says "Path to Perl" but the body says "path to all the perl 
> scripts". Those are two completely different things. Assuming you mean the 
> former and are referring to the so-called shebang line:
>
> perl -p -i -e 's|^#!perl|#!/usr/bin/perl| if $.==1;' *.pl
>
>
> Presumably the user used no unusual modules and didn't make explicit 
> references to platform specific filesystem locations ("c:\") etc etc. 




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

Date: Tue, 27 Nov 2007 11:39:44 -0500
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Path to Perl
Message-Id: <m17ik3y75b.fsf@dot-app.org>

"chuck" <chuck@no.where> writes:

> New to Linux and Apache and Perl so I appreciate any help i can get.
>
> I have a user who needs to move his perl scripts from his Windows 
> development machine to our Linux web server.  How can I easily change the 
> path to all the perl scripts that will get transfered over ?  Or is there 
> another alternative such as adding an environment variable for the "apache" 
> user ?

Just use "#!/usr/bin/perl" - Windows uses its file-type associations to find
the Perl binary anyway, so it won't care.

sherm--

-- 
WV News, Blogging, and Discussion: http://wv-www.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 27 Nov 2007 18:01:24 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Path to Perl
Message-Id: <5r30ncF12m0fuU1@mid.individual.net>

Sherman Pendley wrote:
> "chuck" <chuck@no.where> writes:
>>
>> from his Windows development machine to our Linux web server.

Sounds like CGI scripts to me ...

> Just use "#!/usr/bin/perl" - Windows uses its file-type associations to find
> the Perl binary anyway, so it won't care.

 ... and if so, that's not true. CGI scripts need the correct path to 
perl also on Windows.

OTOH, personally I have a symlink in C:/usr that points to the directory 
with perl.exe, and that directory is conveniently named 'bin'. 
Consequently, #!/usr/bin/perl works just fine for my CGI scripts on Windows.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Tue, 27 Nov 2007 17:40:41 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Path to Perl
Message-Id: <474c569c$0$21095$da0feed9@news.zen.co.uk>

chuck wrote:

<top-posting corrected - pleas don't do that>

> 
> "RedGrittyBrick" <RedGrittyBrick@SpamWeary.foo> wrote in message 
> news:474c2dc4$0$8423$db0fefd9@news.zen.co.uk...
>> chuck wrote:
>>> Hi,
>>> 
>>> New to Linux and Apache and Perl so I appreciate any help i can
>>> get.
>>> 
>>> I have a user who needs to move his perl scripts from his Windows
>>>  development machine to our Linux web server.  How can I easily
>>> change the path to all the perl scripts that will get transfered
>>> over ?  Or is there another alternative such as adding an
>>> environment variable for the "apache" user ?
>>> 
>> Your subject says "Path to Perl" but the body says "path to all the
>> perl scripts". Those are two completely different things. Assuming
>> you mean the former and are referring to the so-called shebang
>> line:
>> 
>> perl -p -i -e 's|^#!perl|#!/usr/bin/perl| if $.==1;' *.pl
>> 
>> 
>> Presumably the user used no unusual modules and didn't make
>> explicit references to platform specific filesystem locations
>> ("c:\") etc etc.
> 
> 
> What I need to do is change the first line of all the scripts from 
> "c:/perl/..." to "#!usr/bin/perl"

perl -p -i.bak -e 's|^\S+|#!/usr/bin/perl| if $.==1;' *.pl

Untested. Should retain flags (e.g. #!c:/perl/bin/perl.exe -w).
Assumes the old (Windows) path to perl contains no spaces.
Keeps a copy of original versions of scripts with filename suffix ".bak".

You could also use awk sed or some similar tool that you are more
familiar with. I guess you are not familiar with these since you asked
the question. Which suggests you are not very familiar with Unix/Linux.
If so, do above when logged in as ordinary user (not root), I'd put
files in a newly created directory before working on them.

> 
> or get the system into look in /usr/bin/perl without changing the
> scripts by using an environment variable.
> 

I'd configure Apache, forget environment variables.




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

Date: Tue, 27 Nov 2007 13:39:49 -0500
From: "chuck" <chuck@no.where>
Subject: Re: Path to Perl
Message-Id: <fiho9l$419$1@nrc-news.nrc.ca>


"RedGrittyBrick" <RedGrittyBrick@SpamWeary.foo> wrote in message 
news:474c569c$0$21095$da0feed9@news.zen.co.uk...
> chuck wrote:
>
> <top-posting corrected - pleas don't do that>
>
>>
>> "RedGrittyBrick" <RedGrittyBrick@SpamWeary.foo> wrote in message 
>> news:474c2dc4$0$8423$db0fefd9@news.zen.co.uk...
>>> chuck wrote:
>>>> Hi,
>>>>
>>>> New to Linux and Apache and Perl so I appreciate any help i can
>>>> get.
>>>>
>>>> I have a user who needs to move his perl scripts from his Windows
>>>>  development machine to our Linux web server.  How can I easily
>>>> change the path to all the perl scripts that will get transfered
>>>> over ?  Or is there another alternative such as adding an
>>>> environment variable for the "apache" user ?
>>>>
>>> Your subject says "Path to Perl" but the body says "path to all the
>>> perl scripts". Those are two completely different things. Assuming
>>> you mean the former and are referring to the so-called shebang
>>> line:
>>>
>>> perl -p -i -e 's|^#!perl|#!/usr/bin/perl| if $.==1;' *.pl
>>>
>>>
>>> Presumably the user used no unusual modules and didn't make
>>> explicit references to platform specific filesystem locations
>>> ("c:\") etc etc.
>>
>>
>> What I need to do is change the first line of all the scripts from 
>> "c:/perl/..." to "#!usr/bin/perl"
>
> perl -p -i.bak -e 's|^\S+|#!/usr/bin/perl| if $.==1;' *.pl
>
> Untested. Should retain flags (e.g. #!c:/perl/bin/perl.exe -w).
> Assumes the old (Windows) path to perl contains no spaces.
> Keeps a copy of original versions of scripts with filename suffix ".bak".
>
> You could also use awk sed or some similar tool that you are more
> familiar with. I guess you are not familiar with these since you asked
> the question. Which suggests you are not very familiar with Unix/Linux.
> If so, do above when logged in as ordinary user (not root), I'd put
> files in a newly created directory before working on them.
>
>>
>> or get the system into look in /usr/bin/perl without changing the
>> scripts by using an environment variable.
>>
>
> I'd configure Apache, forget environment variables.
>
>

Thanks.  Ended up using sed, after figuring out the escape characters that 
is.





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

Date: Tue, 27 Nov 2007 10:50:01 -0800
From: "Gretch" <gretchen@invalid.corn>
Subject: Re: Path to Perl
Message-Id: <5r376vF12hj2oU1@mid.individual.net>

In news:fihcco$eqf$1@nrc-news.nrc.ca,
chuck <chuck@no.where> wrote:

> What I need to do is change the first line of all the scripts from
> "c:/perl/..." to "#!usr/bin/perl"

Please don't top-post.

The relative path "usr/bin/perl" isn't what you want to do. You'll have
better portability with

#!/usr/bin/env perl



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

Date: Tue, 27 Nov 2007 09:22:47 -0800 (PST)
From: Gizbo <anon24u@gmail.com>
Subject: Re: performance problem
Message-Id: <76c6c835-cbb6-44f0-9e3c-91a9e9841af5@e6g2000prf.googlegroups.com>

>
>     perl -MCPAN -e'install Scalar::Util'
>
> or
>
>     cpan -i Scalar::Util
>
> should do it. It may ask you some questions first: except for the one

Thanks Ben.  I basically did that except I had to "force install"
because cpan found that the module was up-to-date.

For anyone with the same problem, there is a more focused post on this
problem here:

http://groups.google.ca/group/comp.lang.perl.misc/browse_thread/thread/b198594762a1039a?hl=en#


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

Date: Tue, 27 Nov 2007 06:46:58 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Perl reference, what's the difference
Message-Id: <2a36096c-6503-40f0-ad51-528ace8ff51d@b40g2000prf.googlegroups.com>

What causes the difference below?

    #! /bin/perl -l
         $h = *STDOUT{IO};
         print $h "hello";
    __END__

    hello


    #! /bin/perl -l
         print *STDOUT{IO} "hello";
    __END__

    String found where operator expected at - line 2, near "} "hello""
    	(Missing operator before  "hello"?)
    syntax error at - line 2, near "} "hello""
    Execution of - aborted due to compilation errors.


Thanks,
Todd


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

Date: Tue, 27 Nov 2007 06:54:22 -0800 (PST)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Perl reference, what's the difference
Message-Id: <d5dc1ff2-9423-4ae5-8e75-d79d6080f8d7@a39g2000pre.googlegroups.com>

On Nov 27, 9:46 am, Todd <xueweizh...@gmail.com> wrote:
> What causes the difference below?
>
>     #! /bin/perl -l
>          $h = *STDOUT{IO};
>          print $h "hello";
>     __END__
>
>     hello
>
>     #! /bin/perl -l
>          print *STDOUT{IO} "hello";
>     __END__
>
>     String found where operator expected at - line 2, near "} "hello""
>         (Missing operator before  "hello"?)
>     syntax error at - line 2, near "} "hello""
>     Execution of - aborted due to compilation errors.
>
> Thanks,
> Todd

print { *STDOUT{IO} } "Hello\n";


see perldoc -f print

 ...
             Note that if you're storing FILEHANDLEs in an array,
             or if you're using any other expression more complex
             than a scalar variable to retrieve it, you will have
             to use a block returning the filehandle value
             instead:

                 print { $files[$i] } "stuff\n";
                 print { $OK ? STDOUT : STDERR } "stuff\n";


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

Date: Tue, 27 Nov 2007 07:03:26 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Re: Perl reference, what's the difference
Message-Id: <2cad07db-3665-457a-b3e5-a56c82714af8@s12g2000prg.googlegroups.com>

Hi nolo,

> print { *STDOUT{IO} } "Hello\n";
> see perldoc -f print
>              or if you're using any other expression more complex
>              than a scalar variable to retrieve it, you will have
>              to use a block returning the filehandle value
>              instead:

Really nice. But do you ever know the difficulty in the compiler which
causes this intention?

-Todd



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

Date: Tue, 27 Nov 2007 07:06:14 -0800 (PST)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Perl reference, what's the difference
Message-Id: <9fbaaa0f-5cac-4cbd-9eca-d14a703df122@d4g2000prg.googlegroups.com>

On Nov 27, 10:03 am, Todd <xueweizh...@gmail.com> wrote:
> Hi nolo,
>
> > print { *STDOUT{IO} } "Hello\n";
> > see perldoc -f print
> >              or if you're using any other expression more complex
> >              than a scalar variable to retrieve it, you will have
> >              to use a block returning the filehandle value
> >              instead:
>
> Really nice. But do you ever know the difficulty in the compiler which
> causes this intention?
>

nolo no know.


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

Date: 27 Nov 2007 10:16:24 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Perl usage
Message-Id: <87y7cjzpkn.fsf@mithril.chromatico.net>

>>>>> "x" == xhoster  <xhoster@gmail.com> writes:

    x> If the manager did give you reasons (not covered in the FAQs),
    x> we could possibly formulate rebuttals to do them, if we knew
    x> what those reasons were.

It's also worth reiterating here that you can't reason someone out of
a position that he or she didn't get to by reason in the first place.
In other words, no matter what reason he gives, if your manager
arrived at the decision not to use Perl based on gut feelings and
subjective impressions, you most likely won't be able to argue him out
of it with facts.

I've been in this situation a couple times.  When you have more than 3
or 4 people in the organization, the options really boil down to
these: first, you can get a consensus among 2/3 of the people working
there that they would be better off in another language; second, you
can get a new VP who thinks the old way is bad and the Perl way is
clearly the way of the future, and who has enough credibility with his
fellow VPs to make that pronouncement stick; third, you can stick with
whatever the dominant programming language there is; fourth, you can
find a job somewhere that they use Perl.  

Managers think, and by and large correctly, that they're better off
sticking with a language that their team is comfortable and productive
in, even if it has clear technical shortcomings, than switching to a
new and untested language, even if it has clear technical advantages.
Some of this is merely being conservative, but managers are also more
concerned with clear forecasting:   you can get a more reliable
estimate of how long a project will take with a tool you know than
with a tool you don't know, and it's better from a business point of
view to have a reliable estimate than to have a chance of finishing it
in half the time but a comparable chance that it will take twice as
long.

Charlton



-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: 27 Nov 2007 10:23:22 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Scalar::Util is not using XS in Fedora 8, leading to performance  problem
Message-Id: <87tzn7zp91.fsf@mithril.chromatico.net>

>>>>> "BM" == Ben Morrow <ben@morrow.me.uk> writes:

    BM> Just out of interest: where did your original copy of S::U
    BM> come from?  Did it come out of a rpm, or did you install it
    BM> yourself and it failed to find gcc? If Redhat are providing
    BM> rpms with the pure-Perl version of S::U, this could be quite a
    BM> problem... :(.

They are (or at least were, the last time I dealt with them), and it
is.

Charlton




-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Tue, 27 Nov 2007 13:03:41 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Scalar::Util is not using XS in Fedora 8, leading to performance  problem
Message-Id: <8663zn7boy.fsf@lifelogs.com>

On Mon, 26 Nov 2007 18:28:17 -0800 (PST) Gizbo <anon24u@gmail.com> wrote: 

G> Well, I solved the problem after some more googling.  For those it may
G> help, I simply did a force install of Scalar::Util, within the cpan
G> shell:

G> bash%  cpan
cpan> force install Scalar::Util

G> This completely resolved the problem.  Thanks to the guy in my
G> previous post who pointed me in the right direction.

This may make your life easier, as it doesn't require the shell:

perl -MCPAN -e'force(install => "Scalar::Util")'

Ted


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

Date: Tue, 27 Nov 2007 09:17:36 -0800 (PST)
From: Gizbo <anon24u@gmail.com>
Subject: Re: Scalar::Util is not using XS in Fedora 8, leading to performance  problem
Message-Id: <e6e0bc3d-6340-4a3c-8386-5fa454363ec3@j20g2000hsi.googlegroups.com>

> Just out of interest: where did your original copy of S::U come from?
> Did it come out of a rpm, or did you install it yourself and it failed
> to find gcc? If Redhat are providing rpms with the pure-Perl version of
> S::U, this could be quite a problem... :(.
>
> Ben

Hi Ben,

As far as I know, our sysadmin installed the Red Hat distribution as
is, and we do have gcc installed.  I can't say definitively whether
this is a problem with our installation or the distribution though.



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 1071
***************************************


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