[27911] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9275 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 9 18:05:52 2006

Date: Fri, 9 Jun 2006 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Jun 2006     Volume: 10 Number: 9275

Today's topics:
    Re: Binding array to pattern (Seymour J.)
    Re: Binding array to pattern (Seymour J.)
    Re: Binding array to pattern (Seymour J.)
    Re: Binding array to pattern (Seymour J.)
    Re: Binding array to pattern <uri@stemsystems.com>
    Re: CGI for collecting phone numbers <ferreira@unm.edu>
    Re: CGI for collecting phone numbers <tadmc@augustmail.com>
    Re: CGI for collecting phone numbers <jgibson@mail.arc.nasa.gov>
    Re: creating log file <CSB001@gmail.com>
    Re: creating log file <tzz@lifelogs.com>
    Re: creating log file <CSB001@gmail.com>
    Re: creating log file <DJStunks@gmail.com>
    Re: default value <nospam@home.com>
    Re: Determining lvalue context <nobull67@gmail.com>
    Re: help in array processing <christoph.lamprecht.no.spam@web.de>
        help with Globbing : use of -r with glob catches only h <martps100@gmail.com>
    Re: help with Globbing : use of -r with glob catches on xhoster@gmail.com
    Re: Help: how to run programs on a remote machine with  <glex_no-spam@qwest-spam-no.invalid>
        Internationalization of mod_perl scripts <ignoramus21252@NOSPAM.21252.invalid>
    Re: Merge part of CSV files <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 09 Jun 2006 16:25:56 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Binding array to pattern
Message-Id: <4489d954$1$fuzhry+tra$mr2ice@news.patriot.net>

In <4erq9dF1ge4orU1@individual.net>, on 06/09/2006
   at 01:30 AM, Gunnar Hjalmarsson <noreply@gunnar.cc> said:

>Shmuel (Seymour J.) Metz wrote:
>> I'd like to bind an array to a pattern.

>Why?

I want to test for a match anywhere in the array.

>This is more readable IMO:
>     foreach my $element ( @anarray ) {
>         while ( $element =~ /PATTERN/g ) {
>             ...
>         }
>     }

I had simplified my code because I was primarily concerned with the
endless loop rather than style. What I actually wound up with[1] was

 foreach (sort keys %{$host_info{$host}{Email}}) {
   push @Contacts, @{$host_info{$host}{Email}{$_}};
   my $scalarContacts="@{$host_info{$host}{Email}{$_}}";
   push @abuseContacts, @{$host_info{$host}{Email}{$_}}
     if (/abuse/ or $scalarContacts =~ /abuse/);
 }

and I'd rather avoid replicating the push statement. Given that, is
there a better style?

Thanks.

[1] The code is quck and dirty and at some point I intend to
    do some massive cleanup, but it's still a work in progress.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 09 Jun 2006 16:35:26 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Binding array to pattern
Message-Id: <4489db8e$2$fuzhry+tra$mr2ice@news.patriot.net>

In <slrne8hgee.3rt.tadmc@magna.augustmail.com>, on 06/08/2006
   at 07:33 PM, Tad McClellan <tadmc@augustmail.com> said:

>That makes no sense.

To you. Others had no trouble understanding it.

>Why would you like to bind an array to a pattern?

Because I want all of the matches on all of the strings in the array.

>(and what is your new definition of "pattern match" to go along with
>it?)

What is your definition of "new", and are you really older than
Griswold?

>Do you instead want to apply a pattern match to each _element_ of an
>array?

That would be obvious if you looked at the code. Do you know how
interpolation works inside quotes?

>If so, then use foreach or grep.

That would complicate the logic in this case.

>Errr, the "while" construct _is_ a loop. If you don't want a loop,
>then don't use "while".

Sorry, I meant nonterminating loop. Another poster has explained the
problem.

>What is it that you are ultimately trying to achieve?

Scan an array for a pattern as part of a larger boolean expression.
The code that I posted was part of debug scaffolding that I wrote
while trying to resolve the original problem.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 09 Jun 2006 16:36:22 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Binding array to pattern
Message-Id: <4489dbc6$3$fuzhry+tra$mr2ice@news.patriot.net>

In <1149855475.824531.49490@g10g2000cwb.googlegroups.com>, on
06/09/2006
   at 05:17 AM, "Brian McCauley" <nobull67@gmail.com> said:

>It's not the fact that it's interpolation, it's the fact that it's an
>rvalue expression so each time round the while() loop the =~ is
>binding to a new string and the /g position pointer is starts again
>at zero.

Thanks.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 09 Jun 2006 16:47:27 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Binding array to pattern
Message-Id: <4489de5f$4$fuzhry+tra$mr2ice@news.patriot.net>

In <20060608191324.722$p9@newsreader.com>, on 06/08/2006
   at 10:08 PM, xhoster@gmail.com said:

>So apparently the reinterpolation is performed each time and thus the
>string is not known to be the same.

Ouch!

>Of course it did, what with the while there and all.  Oh, you mean
>an infinite loop. 

Well, it ends when I do ^c ;-) Sorry, I should have been clearer.

>I have no idea why you want to do it in the first place,

I need a term in a boolean expression for a match anywhere in the
array.

>I guess one possibly better alternative would be:
>foreach ("@anarray" =~ /pattern/g) {

That would have the wrong semantics even if it didn't go into an
endless loop. IAC, the code that I posted was test cases intended to
help me track down the original problem. The original failing code was
a match inside a boolean expression, and I have currently changed it
to the following:

  foreach (sort keys %{$host_info{$host}{Email}}) {
    push @Contacts, @{$host_info{$host}{Email}{$_}};
    my $scalarContacts="@{$host_info{$host}{Email}{$_}}";
    push @abuseContacts, @{$host_info{$host}{Email}{$_}}
      if (/abuse/ or $scalarContacts =~ /abuse/);
  }

I could use

  foreach my $type (sort keys %{$host_info{$host}{Email}}) {

and throw in a nested 

  foreach (@{$host_info{$host}{Email}{$type}}) {

but I'd consider replicating the push to be uglier than coercing the
array to a string.

Thanks.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 09 Jun 2006 17:20:54 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Binding array to pattern
Message-Id: <x7veraf2kp.fsf@mail.sysarch.com>

>>>>> "SJM" == Shmuel (Seymour J ) Metz <spamtrap@library.lspace.org.invalid> writes:

  SJM>  foreach (sort keys %{$host_info{$host}{Email}}) {
  SJM>    push @Contacts, @{$host_info{$host}{Email}{$_}};
  SJM>    my $scalarContacts="@{$host_info{$host}{Email}{$_}}";
  SJM>    push @abuseContacts, @{$host_info{$host}{Email}{$_}}
  SJM>      if (/abuse/ or $scalarContacts =~ /abuse/);
  SJM>  }

  SJM> and I'd rather avoid replicating the push statement. Given that, is
  SJM> there a better style?

disregarding the loop issues, that is very hard to read code. notice the
massive redundant use of $host_info{$host}{Email} in there? factor that
out into a scalar before the loop. and then it can become almost
readable (with some needed whitespace too)

	my $email_info = $host_info{$host}{Email} ;

	 foreach (sort keys %{$email_info}) {

		my $emails = $email_info->{$_} ;
		push @Contacts, @{$emails};
		push @abuseContacts, @{$emails};
		my $scalarContacts = "@{$emails}";

		if (/abuse/ or $scalarContacts =~ /abuse/);

that method of checking a joined string vs scanning a array bothers
me. and why do you push the same stuff into 2 different arrays?
if you used List::Utils::first you can scan for the first abuse email in
the array and it could be faster as you don't make up the string first.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 9 Jun 2006 11:27:23 -0700
From: "ferreira@unm.edu" <ferreira@unm.edu>
Subject: Re: CGI for collecting phone numbers
Message-Id: <1149877643.360367.286660@y43g2000cwc.googlegroups.com>

Please don't think that I am asking some one to do this for me! I have
spent hours trying to figure out why this simple script won't work.

This is what I have:

The html file:

<FORM ACTION="/sms.pl" METHOD="POST">Cell Number: <INPUT TYPE="text"
NAME="phone"><input type="submit" name="submitButtonName" border="0">
</FORM>


The sms.pl file:

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
my $file = '/users/web/king/web/sms.txt';
open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
flock (FILE, 2) or die "cannot lock file exclusively: $!";
print "Content-type: text/html\n\n";
print FILE $phone . "\n";
close (FILE) or die "cannot close file: $!";



And a sms.txt file
All of the files are in the same place on the server

The is the error log message:
access:
c-68-35-76-89.hsd1.nm.comcast.net - - [09/Jun/2006:17:28:30 +0000]
"POST /sms.pl HTTP/1.1" 500 -

error:
[Fri Jun  9 17:28:30 2006] [error] [client 68.35.76.89] Premature end
of script headers: /users/web/king/web/sms.pl
[Fri Jun  9 17:28:30 2006] [error] [client 68.35.76.89] File does not
exist: /users/web/king/web/error500.html

I have also tried changing the .pl to .cgi but the result is the same.


The error after clicking the submit button:

Internal Server Error
 The server encountered an internal error or misconfiguration and was
unable to complete your request.

 Please contact the server administrator,  king@garyking.org and inform
them of the time the error occurred, and anything you might have done
that may have caused the error.

 More information about this error may be available in the server error
log.

Additionally, a 404 Not Found error was encountered while trying to use
an ErrorDocument to handle the request.



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

Date: Fri, 9 Jun 2006 13:16:22 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: CGI for collecting phone numbers
Message-Id: <slrne8jenm.66r.tadmc@magna.augustmail.com>

ferreira@unm.edu <ferreira@unm.edu> wrote:

> Thank you for the response. I have the format figured out but the code
> in the .pl file has me going in circles. Every time I hit the submit
> button I get an internal server error.


You have an error on line 17.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 09 Jun 2006 12:37:46 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: CGI for collecting phone numbers
Message-Id: <090620061237469395%jgibson@mail.arc.nasa.gov>

In article <1149877643.360367.286660@y43g2000cwc.googlegroups.com>,
<"ferreira@unm.edu"> wrote:

> Please don't think that I am asking some one to do this for me! I have
> spent hours trying to figure out why this simple script won't work.
> 
> This is what I have:
> 
> The html file:
> 
> <FORM ACTION="/sms.pl" METHOD="POST">Cell Number: <INPUT TYPE="text"
> NAME="phone"><input type="submit" name="submitButtonName" border="0">
> </FORM>
> 
> 
> The sms.pl file:
> 
> #!/usr/bin/perl

You should have here:

   use strict;
   use warnings;

> use CGI::Carp qw(fatalsToBrowser);
> my $file = '/users/web/king/web/sms.txt';

Print the HTTP header here, before you do anything else. If open fails
in the next line, you will be sending invalid HTML to the server.

> open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
> flock (FILE, 2) or die "cannot lock file exclusively: $!";
> print "Content-type: text/html\n\n";

Too late!

> print FILE $phone . "\n";
> close (FILE) or die "cannot close file: $!";

You might be better off using the CGI module, as well. Do you have
access to the server logs? What do they say? You likely have a file
protection problem trying to open the sms.txt file.


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

Date: 9 Jun 2006 12:13:38 -0700
From: "CsB" <CSB001@gmail.com>
Subject: Re: creating log file
Message-Id: <1149880418.202913.189620@j55g2000cwa.googlegroups.com>

I have a logging subroutine I commonly use.  I modify it to insert
date/time stamp, pid, script name, etc. as required.  Here's the skinny
version. Hope it helps

# Define log file var at the beginnig of script
$LogFile = "/my/log/dir/output.log";

# use &output_log("data"); each time you want to send something to the
log file.
&output_log("Some statement I want in the log file.");
&output_log("And another.");

# Subroutine for opening, printing output, and closing log file.
sub output_log {
	my ($log_output) = @_;
	open( LOG, ">>$LogFile" ) || die "Cannot open $LogFile\n $!\n";
	print LOG "$log_output\n";
	close(LOG) || die "WARNING: Can't close $LogFile\n $!\n";
}



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

Date: Fri, 09 Jun 2006 16:05:56 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: creating log file
Message-Id: <g69irnart5n.fsf@CN1374059D0130.kendall.corp.akamai.com>

On  9 Jun 2006, CSB001@gmail.com wrote:

> I have a logging subroutine I commonly use.  I modify it to insert
> date/time stamp, pid, script name, etc. as required.  
 ...
> &output_log("And another.");

I think shorter is better for commonly used functions, so this should
be named l() or something like that.

Also, it's always a good idea to provide an optional log level:

my $level = shift @_ || 5;

in the function.  Then you can turn the verbosity up or down, if you
choose to use log levels in your code, and if not everything will work
just fine.  I find log levels very useful as a program grows, and it's
very little work to include them from the start.

Ted


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

Date: 9 Jun 2006 13:18:12 -0700
From: "CsB" <CSB001@gmail.com>
Subject: Re: creating log file
Message-Id: <1149884292.178320.9580@g10g2000cwb.googlegroups.com>

I like the log level option.  I have another version of the subroutine
where I read the value of $logging_enabled and just return if the value
is 0 (don't log).

So, I can go through my script and enable/disable logging at various
points.  I'll include the $level option next time I use it.  Maybe
output to different files accordingly or something.  Thanks.

Ted Zlatanov wrote:
> On  9 Jun 2006, CSB001@gmail.com wrote:
>
>
> Also, it's always a good idea to provide an optional log level:
>
> my $level = shift @_ || 5;
>
> in the function.  Then you can turn the verbosity up or down, if you
> choose to use log levels in your code, and if not everything will work
> just fine.  I find log levels very useful as a program grows, and it's
> very little work to include them from the start.
> 
> Ted



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

Date: 9 Jun 2006 13:41:17 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: creating log file
Message-Id: <1149885677.569524.126980@g10g2000cwb.googlegroups.com>


CsB wrote:
> Ted Zlatanov wrote:
> > On  9 Jun 2006, CSB001@gmail.com wrote:
> >
> >
> > Also, it's always a good idea to provide an optional log level:
> >
> > my $level = shift @_ || 5;
> >
> > in the function.  Then you can turn the verbosity up or down, if you
> > choose to use log levels in your code, and if not everything will work
> > just fine.  I find log levels very useful as a program grows, and it's
> > very little work to include them from the start.
>
> I like the log level option.  I have another version of the subroutine
> where I read the value of $logging_enabled and just return if the value
> is 0 (don't log).
>
> So, I can go through my script and enable/disable logging at various
> points.  I'll include the $level option next time I use it.  Maybe
> output to different files accordingly or something.  Thanks.

top posting tastes bad, dude.

you, and the OP, may want to check out Log::Log4perl, the preeminent
logging module.  I used to use a subroutine I rolled my self (much like
yours) until I discovered this module.  it is very flexible and
powerful.

-jp



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

Date: Sat, 03 Jun 2006 14:49:33 GMT
From: "Nospam" <nospam@home.com>
Subject: Re: default value
Message-Id: <1khgg.2097$n13.1924@newsfe2-win.ntli.net>


"Bart Van der Donck" <bart@nijlen.com> wrote in message
news:1149341535.307390.210370@f6g2000cwb.googlegroups.com...
> Nospam wrote:
>
> > does anyone know a command to leave the default value for a field in a
> > browser i.e something like field('value',); would something like this
leave
> > the default value in?
>
> This sounds (!) like an HTML question, please see alt.html. Maybe you
> mean:
>
> <input type="text" size="5" value="apple">
>
> -- 
>  Bart
>

I have something like

<input type="hidden" name="field1" value="500" />

this is the default value if I look at the source code in the browser,
however I would like the field in mechanize to automatically use this
default value, I have tried different connotations but none so far have
worked:

$mech->field(field1,"");

$mech->field(field1,");

$mech->field(field1,'');

$mech->field(field1,');

$mech->field(field1,);





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

Date: 9 Jun 2006 11:34:52 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Determining lvalue context
Message-Id: <1149878092.519877.293290@i40g2000cwc.googlegroups.com>


Brian McCauley was, contrary to apperances, sober when he wrote:
> Ferry Bolhar wrote:
> > I looked in perlsub for "Lvalue subroutines", [...
> >                          ...] Is there a special
> > variable indicating lvalue context (didn't found anything in
> > perlvars), or how can I determine this?
>
> At the time the function is called it cannot be determined. Consider
>
> my $r = \foo(); # Context not yet known.
> if ( rand > 0.5 ) {
>    print $r->();  # Use return of foo() as an rvalue
> } else {
>     $r->() = 666;  # Use return of foo() as an lvalue
> }

OK, that's gibberish. Instread consider...

my $r = \foo(); # Context not yet known.
if ( rand > 0.5 ) {
   print $$r;  # Use return of foo() as an rvalue
} else {
    $$r = 666;  # Use return of foo() as an lvalue
}

> sub next_vtx_page : lvalue {
>    my $docid = shift;
>    Tie::OneOff->lvalue({
>             STORE => sub {
>                 # lvalue action
>             },
>             FETCH => sub {
>                # rvalue action
>             },
>         });
> }

Just to clarify...

         STORE => sub {
             my $new_value = shift;
             # lvalue action
          },



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

Date: Sat, 03 Jun 2006 00:37:54 +0200
From: Ch Lamprecht <christoph.lamprecht.no.spam@web.de>
Subject: Re: help in array processing
Message-Id: <e5qejv$2pl$1@online.de>

bhooshan.dixit@gmail.com wrote:
> I have an array which looks something like this
> 
> Bob
> Bruce
> Tim
> Jimmy
> 
> 
> I want to add a comma ',' to the end of each element in the array
> except for the last element.


> After the comma's are inserted I want to concatenate and put them in a
> string
> something like. $t="Bob,Bruce,Tim,Jimmy";
> 
> I am kinda a new to perl..so if someone can suggest me different
> methods, It would be great.
> 
> Thanks
> bcd
> 

#!/usr/bin/perl
use strict;
use warnings;

my @names = qw/ Bob
                 Bruce
                 Tim
                 Jimmy
               /;
my $joined_names = join(',',@names);


See 'perldoc -f join' for documentation.

Christoph
-- 

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"


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

Date: 9 Jun 2006 14:10:01 -0700
From: "martin" <martps100@gmail.com>
Subject: help with Globbing : use of -r with glob catches only half of the matching files ...
Message-Id: <1149887400.942273.288080@g10g2000cwb.googlegroups.com>

Hi, I am trying to use a combination of  file test with '-r' and file
globbing to check existense of a certain number of files on a linux
system. I appreciate any help on this, as I catch only half of the
files that are supposed to be detected.

I open a file that has a list of files with format of each line:

/dir1/subdir2/subdir3/file.xy <-- full path of a sample file

for any file "file.xy" there are several files in the system
such as

file.xy.0
file.xy.1
file.xy.1.2
file.xy.1.2.3
and one file which has the .ex at the end
file.ext.xy.1.2.4.ex


the part between .xy and .ex could be any number of times occurding
 .[\d]*

My goal is to read list of files one by one and then to see if each
*.xy file has a corresponding *.xy....ex file.


I use this peace of code but out of 100 files, it only catches the
alternate files. and misses the other ones.

use strict;
use warnings;

my $globFile;

loop here ---> while (<FILEwithlistofFiles>) {
my $file = $_;

if (-r ($globFile  = glob("$file*.ex"))) {
     print " Found a matching file with .ex extension at the end.
      print "found file is $globefile \n";
}
else {
  print "missed to find the matching file with ending .ex extension in
the directory tree\n";
}

I should add that all the files are visible from the directory where I
invoke the script.

any help appreciated. 

Thanks.



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

Date: 09 Jun 2006 20:25:38 GMT
From: xhoster@gmail.com
Subject: Re: help with Globbing : use of -r with glob catches only half of the matching files ...
Message-Id: <20060609173056.305$Uc@newsreader.com>

"martin" <martps100@gmail.com> wrote:
> Hi, I am trying to use a combination of  file test with '-r' and file
> globbing to check existense of a certain number of files on a linux
> system. I appreciate any help on this, as I catch only half of the
> files that are supposed to be detected.

from perldoc perlop:

       A (file)glob evaluates its (embedded) argument only when it is
       starting a new list.  All values must be read before it will start
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       over.  In list context, this isn't important because you
       ^^^^
       automatically get them all anyway.  However, in scalar context the
       operator returns the next value each time it's called, or "undef"
       when the list has run out.  As with filehandle reads, an automatic
       "defined" is generated when the glob occurs in the test part of a
       "while", because legal glob returns (e.g. a file called 0) would
       otherwise terminate the loop.  Again, "undef" is returned only once.
       So if you're expecting a single value from a glob, it is much better
       to say

           ($file) = <blurch*>;

       than

           $file = <blurch*>;



>
> loop here ---> while (<FILEwithlistofFiles>) {

Perl already has a system for comments.  Please use it
rather than making up your own:

while (<FILEwithlistofFiles>) { #<----- loop here


> my $file = $_;
>
> if (-r ($globFile  = glob("$file*.ex"))) {

my ($globFile)= glob("$file*.ex"); # call in list context
if (defined $globFile and -r $globFile) {

Cheers,

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Fri, 02 Jun 2006 16:12:12 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Help: how to run programs on a remote machine with Perl script...
Message-Id: <EU1gg.21$9i.8913@news.uswest.net>

Dune wrote:
> J. Gleixner wrote:
>> Dune wrote:
[...]
>>> I am not very familiar with Perl, and would like to have your guys'
>>> kind suggestion about which Perl package/component can help me do this?
>>> Is the above procedures feasible? Is there any example or template I
>>> can learn from?
>> If you know shell scripting, that would probably be much easier,
>> compared to learning and using perl.
>>
>> If you want to go with perl, for whatever reason, search CPAN
>> (http://search.cpan.org/) for Net::SSH and Net::SFTP. Read their
>> documentation, install them, and give it a try.  In addition, you may
>> also want to look at the Expect module, which is also available on CPAN.
> 
> Thanks a lot! Could you please give a little bit more details about how
> to write such  shell script? 

Not on a perl newsgroup. Look around the Internet for Korn Shell (ksh), 
or C-Shell (csh) scripting; your *nix system should have one of those 
installed already,  or talk with your System Administrator about what 
shells are available for you.

>e.g., how to monitor that the optimizator
> on the server has finished task (keep checking or is there any signal)?

That'd be up to you. Simply waiting for ssh to exit and getting the 
resulting file should be fine.

> how to supply the password while ssh/sftp  in Perl/shell script ?

Ahhh.. from the Net::SSH documentation..

FREQUENTLY ASKED QUESTIONS ^

Q: How do you supply a password to connect with ssh within a perl script 
using the Net::SSH module?

A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.




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

Date: Sun, 04 Jun 2006 14:03:36 GMT
From: Ignoramus21252 <ignoramus21252@NOSPAM.21252.invalid>
Subject: Internationalization of mod_perl scripts
Message-Id: <YKBgg.20207$h12.17556@fe13.usenetserver.com>

I have a website full of mod_perl scripts. They are doing their job in
a typical fashion saying print "this" and print "that" etc. To make
matters worse, some use functions returning strings that call other
functions returning strings etc. (usually they would be either one
word, or complete sentences). 

The other component of my website is user contributed content (lessons
and solvers), and that can be simply translated anew. 

Anyway, I am thinking maybe to hire someone through RentaCoder to do
internationalization for me. That is, I would provide a software
framework for internationalization and they would "fill in the blanks"
by writing foreign sentences. 

One point to note is that all websites for all languages (such as
es.algebra.com, de.algebra.com etc) would be hosted by the same
physical server.

My question is how to do it. It would be nice to have all new
sentences in a database (MySQL) and refer to them by ID. On the other
hand, it is expensive to do dozens of queries per page. 

Is there some standard solution, preferably a perl module, that does
internationalization in a rational fashion? Anyone has any experience
"from the trenches"?

i



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

Date: Fri, 9 Jun 2006 09:52:42 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Merge part of CSV files
Message-Id: <slrne8j2pq.5iu.tadmc@magna.augustmail.com>

sparrie2k <duncan@itswakeling.com> wrote:
> Hi,
> I'm trying to merge some CSV files into one. They all have a header
> line, a single data line and footer line, but it is only the data line
> (minus the first field) that I want to merge. The bit I'm missing-out
> from the data line is a line number (always 001 in the single files) so
> I'll be doing an incremental count in the combined file. The header and
> footer lines are not required at all.
> Has anyone got any ideas on a quick and easy way to do this?



What part of that are you stuck on?

If you show us the code you have so far, we can probably help
you fix it...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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


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