[25029] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7279 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 21 06:42:35 2004

Date: Thu, 21 Oct 2004 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 21 Oct 2004     Volume: 10 Number: 7279

Today's topics:
    Re: Any suggestions? <davidw_spam@spam_gto.net>
    Re: backup utility for remote hosts <jwillmore@adelphia.net>
    Re: eval function <ioneabu@yahoo.com>
    Re: eval function (Anno Siegel)
    Re: How can I know if STDOUT has been redirected? <bik.mido@tiscalinet.it>
    Re: How do I print http 404 not found header? lesley_b_linux@yahoo.co.yuk
    Re: How to checking a file that writing is complete? <bik.mido@tiscalinet.it>
    Re: How to I get an user email address, if I know the d (Anno Siegel)
    Re: localizing %SIG handlers (Anno Siegel)
        Mod_perl config questions lesley_b_linux@yahoo.co.yuk
    Re: Mod_perl config questions lesley_b_linux@yahoo.co.yuk
    Re: Net::FTP and Passive mode problems (Hostile17)
        perl call  winrunner ,  it is too slowly.... (guo liyu)
    Re: perl call  winrunner ,  it is too slowly.... (replace z with h, spam protection)
    Re: perl to english <tintin@invalid.invalid>
    Re: regex to clean path <bik.mido@tiscalinet.it>
    Re: Where should I post source code? <tintin@invalid.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 21 Oct 2004 02:12:35 -0400
From: David Warren <davidw_spam@spam_gto.net>
Subject: Re: Any suggestions?
Message-Id: <HK-dnRJtPZmiz-rcRVn-gw@golden.net>

Jon Ericson wrote:
> David Warren <davidw_spam@spam_gto.net> writes:
> 
> 
>> Jon Ericson wrote:
>> 
>>> David Warren <davidw_spam@spam_gto.net> writes:
>>> 
>>> 
>>>> local $/ = "\r";
> 
> 
>>> Do you really need this?  Normally the default setting of $/ is 
>>> just fine.
>> 
>> Lame doesn't print new lines to stdout, it only updates the last 
>> line. It only updates the portion of following line:
>> 
>> Frame#  ----> 8575<----/8575   192 kbps  L  R
>> 
>> I've tried without adjusting $/ variable and the while loop doesn't
>>  receive any input other than 5 lines.
> 
> 
> Ah.  This is useful information.  So the number before the slash is 
> always an integer and the number after the slash is the total number
>  of frames.  The following should match that line and extract the two
>  numbers:
> 
> if (m{^Frame# +(\d+)/(\d+) +\d+ +kbps}){ my $frame = $1; my 
> $max_frames = $2; ...
> 
> With strictly consistent input like this, I like to match as much of
>  the line as possible.  I think it makes it more clear what it is
> that you expect.
> 

Which makes perfect sense to me.  Your suggestion above works perfectly.
I also added a ( $frame % 50 == 0 ) to the IF expression above.  Now it
only updates the progress bar if the number is divisble by 50.  Reduces
CPU usage and makes absolutely no difference to the progress bar updating.

Thanks again for your help.

David


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

Date: Thu, 21 Oct 2004 00:09:16 -0400
From: James Willmore <jwillmore@adelphia.net>
Subject: Re: backup utility for remote hosts
Message-Id: <nuCdncuJKOf4q-rcRVn-vg@adelphia.com>

Brian McCauley wrote:
> 
> 
> dan baker wrote:
> 
>> I recently hacked together a little utility to backup files from
>> multiple remote hosts to a local PC. The host I use for a lot of
>> websites does not offer nightly backups, and while they haven't
>> crashed yet, I wanted to pull copies of databases and other files that
>> get modified by server-side scripts.
> 
> 
>> I thought that I'd just post the source in case:
>> - people want to make constructive comments about how to improve the
>> code
> 
> 
> Ooooh... a code critique.
> 
> Hope you've got a think skin!
> 
> Firstly remember the golden rule:
> 
>   Write less code.  (Unless this would make your code less readable).

<snip>

>> 3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789- 

I think Brain said what the majority would say.

I'd also like to point out that you can save yourself a lot of time 
formating your code by using Perl Tidy 
(http://search.cpan.org/~shancock/Perl-Tidy-20031021/lib/Perl/Tidy.pm). 
  That appears to be the only reason for the line with the numbers 
(column numbers maybe?).

HTH

Jim


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

Date: Thu, 21 Oct 2004 00:46:43 -0400
From: wana <ioneabu@yahoo.com>
Subject: Re: eval function
Message-Id: <10neg01j8dc926f@news.supernews.com>

> [...]
> 
>> local $_ = append;
>> 
>> Won't that fix it?
> 
> In most cases it would (if there were a "$" in front of "append"), but
> there appear to be exceptions.  Brian?  You're the specialist!
> 
> In any case, a one-shot for-loop is often a better way to make
> $_ represent something else for a moment, as in
> 
>     $_ = ( defined and /^append$/i) ? '>>' : '>' for $append;
> 
> This makes $_ an alias for $append, which can even be used as an
> lvalue.  The technique is sometimes called topicalisation.
> 
> But I'd probably not use that here, but write (in the appropriate place)
> 
>     $append = shift || '>'; # default
>     $append =~ s/^append$/>>/i;

I was about to go with your above example, which would work great, but I
realized that my use of the fancy one-liner:
my ($data, $filename, $append) = @_;

precludes me from using shift since $data and $filename will still be
sitting at the front of @_.  It occurred to me that for my purposes, it is
not that important what the value of $append is.  I can make use of the
fact that it either exists or it doesn't.  So I finally went with this:

$append = $append ? '>>':'>';

which allows me to keep my cool trinary operator and keep things simple.  Is
it ok the way I wrote it without the defined function?  I was worried about
issues of statement vs expression and precedence here but it seemed to work
fine.  Thanks for the help!

wana

> 
> which two lines, but clearer.
> 
> Anno



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

Date: 21 Oct 2004 07:20:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: eval function
Message-Id: <cl7o0o$c73$2@mamenchi.zrz.TU-Berlin.DE>

wana  <ioneabu@yahoo.com> wrote in comp.lang.perl.misc:

[attribution missing, I wrote this]

> >     $append = shift || '>'; # default
> >     $append =~ s/^append$/>>/i;
> 
> I was about to go with your above example, which would work great, but I
> realized that my use of the fancy one-liner:
> my ($data, $filename, $append) = @_;
> 
> precludes me from using shift since $data and $filename will still be
> sitting at the front of @_.  It occurred to me that for my purposes, it is
> not that important what the value of $append is.  I can make use of the
> fact that it either exists or it doesn't.  So I finally went with this:
> 
> $append = $append ? '>>':'>';
> 
> which allows me to keep my cool trinary operator and keep things simple.  Is
> it ok the way I wrote it without the defined function?  I was worried about
> issues of statement vs expression and precedence here but it seemed to work
> fine.  Thanks for the help!

That's fine.  Undef is a legal (false) boolean value.

Anno


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

Date: Thu, 21 Oct 2004 09:10:49 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How can I know if STDOUT has been redirected?
Message-Id: <96nen0t544pfrv9hl2rv65i9al5oglj8rs@4ax.com>

On 20 Oct 2004 13:20:15 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>The file test -t checks if a filehandle is open to a tty.  It does
>not check whether the handle has been redirected -- redirection is
>a shell action that simply offers the other program the named file
>as stdin (or stdout, or stderr).  There is no way you can look at
>a filehandle and decide whether it was opened due to a redirect
>action.

TY, I suspected that the answer would have been somewhere in the docs.
Only buried a little deeper...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 21 Oct 2004 10:46:53 +0100
From: lesley_b_linux@yahoo.co.yuk
Subject: Re: How do I print http 404 not found header?
Message-Id: <m3y8i0tnci.fsf@helmholtz.local>

"Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:

> On Wed, 20 Oct 2004 lesley_b_linux@yahoo.co.yuk wrote:
> 
> > > http://www.perldoc.com/perl5.8.4/pod/perlfaq9.html#What-is-the-correct-form-of-response-from-a-CGI-script-
> > > 
> > Thanks for this URL.  Can, and if so would, you say why none of the 
> > URL's indicated in it are hyperlinked?
> 
> I only provided some content to go into the POD to form that part of 
> the FAQ.  Which then gets HTML-ified by some pod2html script, on which 
> others more familiar with the Perl distribution process may be able to 
> comment?
> 
> [...]
> > tyvm for this link too.
> 
> With respect, one -is- supposed to familiarise oneself with the 
> relevant Perl FAQs before posting here (see the regular "posting 
> guidelines" which appear here).  I'm not saying that in any personal 
> capacity (my little bit of FAQ is only a microscopic part of the 
> whole), but on behalf of all of those who generously give their time 
> to offer "high signal to noise ratio" (sic) quality answers here (they 
> know who they are...).

Fair comment about familiarising oneself with the FAQ's.

I would like a pointer being published in this NG, either monthly or
fortnightly to the URL http://www.perldoc.com/perl5.8.0/pod/perlfaq.html and
perhaps also saying " Use any or all of 'man perl', 'man perlfaq', 'man
perldoc' and 'perldoc perldoc' to view up to date information that comes with
your distribution."

If this was published under the same subject line each time then it would
simplify the 'finding the FAQ' problem. 

Also, none of the pre- or post amble in FAQ: messages here contains information on
using any or all of

man perl
man perfaq
perldoc perldoc 
see this url : http://www.perldoc.com/perl5.8.0/pod/perlfaq.html

which, imho, are relevant and would be of some considerable help to any newbie.

An offering of possible improvement to the pre-amble in the FAQ: messages 

"This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.  Use any or all of 'man perl', 
'man perlfaq', 'man perldoc' and 'perldoc perldoc' to view up to date
documentation that comes with your distribution. "

An offering of possible improvement to the post-amble in the FAQ: messages

"Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  Use any or all of 'man
perl', 'man perlfaq', 'man perldoc' and 'perldoc perldoc' to view up to date
information that comes with your distribution. It may have been edited to
reflect the additions, changes and corrections provided by respondents,
reviewers, and critics to previous postings of these FAQ. "

But the additional information suggested assumes (afaik) a *nix platform and I
have no clue how a Windows person might access the documentation under that OS.

And as for 
"Complete text of these FAQ are available on request." 
who/where are people to request such information from, how should they
formulate that request and why should they have to request it when they can be
pointed to the information on their own installation?

Absolutely no disrespect intended to people who have put so much effort in
already to disseminating information via the FAQ: postings, but my
view of this NG is that it's not just for proficient perl programmers but also
for newbies who may actually not know where to find the information they need.
Imho, one place they should be able to find out how to access that info is
here. But then everyone else might have different ideas. :)

Regards

Lesley


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

Date: Thu, 21 Oct 2004 09:10:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to checking a file that writing is complete?
Message-Id: <gomen0p4toi5due45ffj1oqsk3e0cd612b@4ax.com>

On Tue, 19 Oct 2004 18:22:37 +0100, Ben Morrow <usenet@morrow.me.uk>
wrote:

>> I think that nowadays it is common for /dev to be on devfs, which btw
>> doesn't contradict the key point you're addressing, since it is just
>> as 'fake'.
>
>It was. As of 2.6 devfs is deprecated and the alternative is udev, which
>is a tmpfs with device nodes created by a userspace daemon.

I know (2.6.8.1 here). Funny thing is that in 2.6 devfs is deemed
deprecated and udev experimental!


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 21 Oct 2004 08:52:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to I get an user email address, if I know the domain/username
Message-Id: <cl7tbt$fqc$1@mamenchi.zrz.TU-Berlin.DE>

Mav <mluvw47@yahoo.com> wrote in comp.lang.perl.misc:
> Hi,
>    Using Perl, Windows, if I know the person domain name(or the whole
> user domain) and userid, like (google/foo). is that a way to return
> that person the email address progrom? I am on the same domain.
> 
>   I found out on windows, I can right click on any folder,
> Sharing -> Sharing this folder -> Permission -> Add
> on the box "Enter the object names to select:"
> If I enter something like google/foo, and Check name, that will return
> me the email.
> 
>   Is that a way I can write I program to do to find out the email
> address?

That has nothing to do with Perl.  Ask a group that concerns itself
with email.

Anno


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

Date: 21 Oct 2004 07:12:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: localizing %SIG handlers
Message-Id: <cl7nhi$c73$1@mamenchi.zrz.TU-Berlin.DE>

Charles DeRykus <ced@bcstec.ca.boeing.com> wrote in comp.lang.perl.misc:
> In article <ckdtd2$of3$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >It is common practice to localize %SIG handlers in this fashion:
> >    
> >    $SIG{ HUP} = \ &global_handler;
> >
> >    {
> >        local $SIG{ HUP} = \ &local_handler;
> >        # provoke and deal with one or more HUP signals
> >    }
> >
> >The assumption is that $SIG{ HUP} is either the global or the local
> >handler at all times, so the (HUP) signal will always be caught, but
> >apparently that assumption isn't true.  "local" sets the handler
> >to undef, and then "=" sets it to \ &local_handler.  It is quite
> >possible for a signal to arrive when the hander is undefined, which
> >ends the program through an uncaught signal.  The following code
> >shows this:
> >
> >    my ( $count_a, $count_b) = ( 0, 0); # unused, but left in place
> >    $SIG{ HUP} = sub { $count_a ++ };
> >
> >    # create a stream of HUP signals from kid to parent
> >    my $parent = $$;
> >    defined( my $pid = fork ) or die "fork: $!";
> >    unless ( $pid ) {
> >        require Time::HiRes;
> >        require POSIX;
> >        my $tick = 1/POSIX::sysconf( POSIX::_SC_CLK_TCK());
> >        while ( 1 ) {
> >            kill HUP => $parent or exit; # don't survive parent
> >            Time::HiRes::sleep( $tick); # shortest admissible sleep time
> >        }
> >        exit(); # not reached;
> >    }
> >
> >    # main loop
> >    while ( 1 ) {
> >        {
> >           local $SIG{ HUP} = sub { $count_b ++ };
> >    #       my $save = $SIG{ HUP};
> >    #       $SIG{ HUP} = sub { $count_b ++ };
> >    #       $SIG{ HUP} = $save;
> >        }
> >    }
> >
> >With the "main loop" as shown ("local" active), after a few seconds
> >the program ends with a "Hangup" message, characteristic for an
> >uncaught HUP signal.  With "local" commented out and the other three
> >lines active, the program runs happily as long as I let it.
> >
> >My conclusion:  The practice of localizing %SIG handlers isn't safe,
> >and probably never has been.
> >
> 
> I see the Hangup on 5.8.4 almost immediately but a HUP blocker
> eliminates 'em (at least for a 10 min. test). Are you 
> thinking perhaps a HUP block shouldn't be necessary..
> or am I missing another point.. 

HUP is just an example, any other (catchable) signal would do.
It isn't be necessary to block a signal that is being caught.
The fact that the job dies shows that local() leaves a gap when
there is no handler set.

> unless ( defined sigprocmask(SIG_BLOCK, $sigset, $old_sigset) ) {
>    die "can't block SIGHUP\n";
> } else {
>    local $SIG{ HUP} = sub { $count_b ++ };
>    unless ( defined sigprocmask(SIG_UNBLOCK, $old_sigset) ) {
>       die "can't unblock SIGHUP\n";  # restore
>    }
>    ...
> }

That's a way around, but it shouldn't be needed.

Anno


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

Date: 21 Oct 2004 08:08:49 +0100
From: lesley_b_linux@yahoo.co.yuk
Subject: Mod_perl config questions
Message-Id: <m3r7nsv98e.fsf@helmholtz.local>

Hi

I'm running SuSe 8.3 with Apache 1.3.27 properly installed.

I am still working through a 'good' install of Apache i.e. one with modules
etc. ;) for v 1.3.31

My 1.3.27 is configured for mod_perl v1.27

I've probably tweaked my httpd.conf for v1.3.27 but what I can't do is figure
out how to run/use/employ mod_perl.

Is the scenario that :

1. It's installed therefore all I have to do is put stuff in the right place in
the /srv/www tree and all will be well

2. The default index page on http://localhost says it's installed but I have
   to configure stuff in my httpd.conf to get it to work.  

I've had a hunt  round for mod_perl stuff in the httpd.conf file. It's
different to what's listed on http://perl.apache.org/docs/1.0/guide/getwet.html
but I am still ploughing through the documentation on that site.

Here's anything that refers to mod_perl in my httpd.conf

<IfModule mod_perl.c>
    # Provide two aliases to the same cgi-bin directory, 
    # to see the effects of the 2 different mod_perl modes.
    # for Apache::Registry Mode
    ScriptAlias /perl/          "/srv/www/cgi-bin/"
    # for Apache::Perlrun Mode
    ScriptAlias /cgi-perl/      "/srv/www/cgi-bin/"
</IfModule>


<IfModule mod_perl.c>
Perlrequire /usr/include/apache/modules/perl/startup.perl
PerlModule Apache::Registry

#
# set Apache::Registry Mode for /perl Alias
#
<Location /perl>
SetHandler  perl-script
PerlHandler Apache::Registry
Options ExecCGI
PerlSendHeader On
</Location>

#
# set Apache::PerlRun Mode for /cgi-perl Alias
#
<Location /cgi-perl>
SetHandler  perl-script
PerlHandler Apache::PerlRun
Options ExecCGI
PerlSendHeader On
</Location>

</IfModule>

<IfDefine STATUS>
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
</Location>

#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".your-domain.com" to match your domain to enable.
#
<Location /server-info>
    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from localhost
</Location>

#
# enable perl-status for mod_perl
#
<IfModule mod_perl.c>
<Location /perl-status>
    SetHandler perl-script
    PerlHandler Apache::Status
    order deny,allow
    deny from all
    allow from localhost
</Location>
</IfModule>
</IfDefine>

Any advice or pointers to more help would be apprecaited.

Regards

L.


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

Date: 21 Oct 2004 08:46:55 +0100
From: lesley_b_linux@yahoo.co.yuk
Subject: Re: Mod_perl config questions
Message-Id: <m3ekjsv7gw.fsf@helmholtz.local>

lesley_b_linux@yahoo.co.yuk writes:

<snip>

Please ignore previous post

Erroneous post to wrong group.

Regards

L.


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

Date: 21 Oct 2004 00:29:46 -0700
From: hosti1e17@yahoo.com (Hostile17)
Subject: Re: Net::FTP and Passive mode problems
Message-Id: <a5522b8e.0410202329.2a002cb0@posting.google.com>

"A. Sinan Unur" <usa1@llenroc.ude.invalid> wrote in message news:<Xns9588EA031B566asu1cornelledu@132.236.56.8>...
> Why don't you have:
> 
> use strict;
> use warnings;

Because you asked for the "shortest possible script".

> > My question is, when I told the module to use the Passive mode, why
> > does it wait two minutes, time out, and then switch to Passive mode?
> 
> I don't know.
> 
> However, the Net::FTP docs do mention that you should normally not need to 
> set this parameter.

I'll refer our system administrator to that document right away. I'm
sure they'll change the way the server is set up in shame.
 
> On the other hand, did you try:

[SNIP]

I just tried it. The transfer took two minutes, just the same as
before.

I don't mean to be rude, but you're not helping. The two of us are
wasting time on a conversation which can be reduced to:

  ME:  Why does NET::FTP do this?
  YOU: Don't know.

And it's actually a purely theoretical question at this stage, as I've
already figured out a workaround. I was hoping to _learn_ something...

Anyone else?


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

Date: 20 Oct 2004 23:27:17 -0700
From: guoliyu@gmail.com (guo liyu)
Subject: perl call  winrunner ,  it is too slowly....
Message-Id: <8280f8b.0410202227.2b66126@posting.google.com>

Hi , all:
I use perl's system() and exec() to call a bat file in win2000. That
bat file is just to start the winrunner and run a lot of test script.
But I found it is 2 times slow than run the bat file independence.And
because the slow response,  some test script can not run properly.
Is perl can not call a progame with GUI. Or sth. else.
Pls give me some help or suggestion. 
Thanks&#12290;


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

Date: Thu, 21 Oct 2004 08:55:57 +0200
From: "D. Marxsen" <detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)>
Subject: Re: perl call  winrunner ,  it is too slowly....
Message-Id: <cl7mv7$alf$1@news1.transmedia.de>

"guo liyu" <guoliyu@gmail.com> schrieb im Newsbeitrag
news:8280f8b.0410202227.2b66126@posting.google.com...
> I use perl's system() and exec() to call a bat file in win2000. That
> bat file is just to start the winrunner and run a lot of test script.
> But I found it is 2 times slow than run the bat file independence.And
> because the slow response,  some test script can not run properly.
> Is perl can not call a progame with GUI. Or sth. else.

Hi!

I did not come across this problem (at least I didn't notice it).
But you may give

Win32::Process::Create

a try.
Maybe it performs better.


Just my two cents.

Cheers,
Detlef.

--
D. Marxsen, TD&DS GmbH
detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)




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

Date: Thu, 21 Oct 2004 20:36:11 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: perl to english
Message-Id: <2tp759F215vqnU1@uni-berlin.de>


"wana" <ioneabu@yahoo.com> wrote in message 
news:10ndlt9dh9og462@news.supernews.com...
> buildmorelines wrote:
>
>> Is there any script or pragma or something that will translate perl
>> code to pure english, like that perl latin module, just in english. I
>> want to show a person who cant read perl code or any computer
>> language, some perl code, so they have remotly a clue what the code
>> does or how it flows. It doesnt need to perfectly make sense or be
>> proper english sentences. Just soemthing that will translate perl code
>> and/or syntax to english.
>
> It is possible!  I have written and tested a preliminary version of the
> program that performs the task you are requesting.  Here it is:
>
> #! /usr/bin/perl
>
> use STD; #my home made module

Oooohhh, please share this module!!

I'm surprised it's not on CPAN yet.

> use strict;
> use warnings;
>
> my $file = $ARGV[0];
> ReplaceInFile('=', 'is equal to', $file);
>
> I tested it on several perl scripts and it worked beautifully.

I bet I could give you some scripts that it wouldn't work beautifully on. 




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

Date: Thu, 21 Oct 2004 09:10:48 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: regex to clean path
Message-Id: <61oen0pb0c029kgk8rsfo5opu593mbbam2@4ax.com>

On Wed, 20 Oct 2004 15:03:45 -0500, parv <parv_@yahooWhereElse.com>
wrote:

>>>  printf "Unordered: %s\n\nOrdered: %s\n"
>>>  , ${ make_path( @paths ) }
>>>  , ${ make_path_ordered( @paths ) }
>>>  ;
>>
>> Hmmm, I couldn't help giving a peek at least into the first few
>> lines... however this makes me think I should be moderately glad
>> I'm refusing to read it all!
>
>Hey, whatever suits you, fine w/ me.

I mean, yes: my cmts were not particularly constructive, an I
apologize for this, but the overall impression is that you have the
tendency to abuse printf() and referencing-dereferencing. As I said,
this is just an impression, maybe I'll take the time to look more
carefully into your code.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Thu, 21 Oct 2004 20:41:19 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: Where should I post source code?
Message-Id: <2tp7evF21qk0fU1@uni-berlin.de>


"PerlFAQ Server" <comdog@panix.com> wrote in message 
news:cl6no8$luk$1@reader1.panix.com...
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with Perl.
>
> --------------------------------------------------------------------
>
> 2.10: Where should I post source code?
>
>
>    You should post source code to whichever group is most appropriate, but
>    feel free to cross-post to comp.lang.perl.misc. If you want to
>    cross-post to alt.sources, please make sure it follows their posting
>    standards, including setting the Followup-To header line to NOT include
>    alt.sources; see their FAQ ( 
> http://www.faqs.org/faqs/alt-sources-intro/
>    ) for details.


Might be useful to mention (although it is in the posting guidelines) to not 
post huge scripts and not to MIME encode them.

Also, poorly formatted code will be unfavourabled looked upon. 




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

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 V10 Issue 7279
***************************************


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