[21809] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4013 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 23 03:05:43 2002

Date: Wed, 23 Oct 2002 00:05:09 -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           Wed, 23 Oct 2002     Volume: 10 Number: 4013

Today's topics:
        [Q] An associative array of file handles <newspeak@nowhere.com>
    Re: [REPOST] Need advice on a project (wrt to tie'ing t <bik.mido@tiscalinet.it>
    Re: [REPOST] Need advice on a project (wrt to tie'ing t <bik.mido@tiscalinet.it>
    Re: [REPOST] Need advice on a project (wrt to tie'ing t <bik.mido@tiscalinet.it>
    Re: deleting a file... kill ???   Thanks... <jurgenex@hotmail.com>
    Re: deleting a file... kill ??? <jurgenex@hotmail.com>
    Re: Hiding password variables in PERL <pobugfix@peterlink.ru>
        How to hide command line parameters from modules? <chris@home.com>
    Re: How to hide command line parameters from modules? <krahnj@acm.org>
    Re: NEWBIE foreach problem <bwalton@rochester.rr.com>
    Re: NEWBIE foreach problem <wksmith@optonline.net>
    Re: NEWBIE foreach problem <goldbb2@earthlink.net>
    Re: Perl Program <matt.stoker@motorola.com>
    Re: Running Perl through cron <matt.stoker@motorola.com>
    Re: Running Perl through cron <tony_curtis32@yahoo.com>
    Re: Running Perl through cron <wksmith@optonline.net>
    Re: Running Perl through cron <tony_curtis32@yahoo.com>
        What is a file XXX.pl.swp ?? (Steve)
    Re: What is a file XXX.pl.swp ?? <rereidy@indra.com>
    Re: What is a file XXX.pl.swp ?? <mgjv@tradingpost.com.au>
    Re: Writing Microsoft Outlook Notes With Perl <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 22 Oct 2002 20:39:37 -0700
From: Morden <newspeak@nowhere.com>
Subject: [Q] An associative array of file handles
Message-Id: <3DB619F9.1020403@nowhere.com>

Suppose I want to write snippets to files instead of pooling the text in 
memory ($logtext associative array). Is it doable to have an associative 
array of filehandles? Is it worth the trouble? The size of associative
array could exceed the number of handles in the OS. Is it handled by
Perl under the covers?

#!/usr/bin/perl

if($ARG = shift(@ARGV)) {
	open(STDIN, "$ARG") || die("can't open file $ARG\n");
	$ARG .= ".";
} else {
	# alternatively it could be "stdin."
	$ARG="";
}

while($_=<>) {
	($n1,$n2,$store,$therest) = split(/\t/, $_);
	# remove doublequotes around store number
	$store =~ s/"//g;
	if("$store" ne "") {
		$logtext{$store} .= $_;
	}
}

foreach $key (sort keys(%logtext)) {
	#print "$key\n";
	open(OUT, ">$ARG$key") || die("can't open file $ARG$key\n");
	print OUT "$logtext{$key}";
	close(OUT);
}



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

Date: Wed, 23 Oct 2002 08:29:03 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [REPOST] Need advice on a project (wrt to tie'ing to a file and general strategy)
Message-Id: <7h8bru4jvn9lebhr4pk0jvqc2824d3fj8e@4ax.com>

On Mon, 21 Oct 2002 16:09:19 -0500, tadmc@augustmail.com (Tad
McClellan) wrote:

>Did the previous feedback not answer your question?

It didn't answer all of my questions.

>> I'm posting it again. 
>
>Why?

Because I still have doubts.

>If what was suggested there won't work for you, then share why
>it won't work for you.

Because there's nothing that actually "won't work" for me. Only I
still haven't got enough details to make up my mind.

>> Sorry for any
>> disturbance this might cause...
>
>What do you hope to gain this time that didn't happen the first time?

more answers?


Seriously, I apologize once more for my behaviour, but I actually got
further (and more useful, IMHO) information from other two posts in
this thread.


Michele
-- 
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
           [Dante Alighieri, Purg. I, 71-72]

I am my own country - United States Confederate of Me!
           [Pennywise, "My own country"]


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

Date: Wed, 23 Oct 2002 08:29:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [REPOST] Need advice on a project (wrt to tie'ing to a file and general strategy)
Message-Id: <1ebbrucm4shgksdfmas20g23pcb7hq5jsg@4ax.com>

On Tue, 22 Oct 2002 07:25:06 GMT, Bart Lateur <bart.lateur@pandora.be>
wrote:

>A tied hash 5berkely style DB) is IMO an excellent choice for this kind
>of application. See `perldoc AnyDBM_File` for a generic intro. In
>general, the database itself cannot be moved to another platform,
>because of binary incompatibilities, but the data is meaningless on
>another platform anyway. At least the code will be portable.

Sorry, but I'm really ignorant here. I thought that to use the DB_File
module I had to get a system library and was not sure if it were
available under non-*nix systems.

Actually I was surprised to find that Mrs Activestate's ppm gently
provided me with a ready to use dll...

However, I can accept that the database cannot be moved to another
platform (what else can I do?), but I really can't understand the
reason why. That is, for example, jpeg is a binary format too, but it
can be written both on unices and on Windoze and on many other OSes!

So, why isn't there a cross-platform db format? Also, what does it
mean that "data is meaningless on another platform anyway": in my case
I would have to do with paths, numbers and checksums. Nothing too
exotic or platform-dependent (directory separator apart, of course,
but not too much also in this case for what regards perl) IMHO.


Michele
-- 
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
           [Dante Alighieri, Purg. I, 71-72]

I am my own country - United States Confederate of Me!
           [Pennywise, "My own country"]


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

Date: Wed, 23 Oct 2002 08:29:07 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [REPOST] Need advice on a project (wrt to tie'ing to a file and general strategy)
Message-Id: <569bru05m35j8udoivt9sk7iks1rcnb28s@4ax.com>

On Tue, 22 Oct 2002 00:12:01 -0400, Benjamin Goldberg
<goldbb2@earthlink.net> wrote:

>Store the data in a database -- either one created with a tied hash,
>using one of the modules that comes with perl (DB_File or SDBM_File) or
>using a "real" database, with DBI, and one of access, or oracle, or
>SQLite, etc.

I'm currently experimenting with DB_File. This is an 'easy' enough
solution, from a newbie's point of view.

I still have some questions: as you might have read I had thought of
using a hash whose values are array refences. In any case it seems
that I can't have a tied hash of arrays, can I?!? In connection with
this problem, would it be better to use a "real" database?

>> Notice that I'm aware this strategy won't catch all duplicates between
>> one run and the other, but I'm sure it would be nevertheless an
>> enhancement for my purposes...
>
>Why wouldn't it?

Most probably I wasn't clear. I was thinking of an algorithm taking
checksums only of files with the same size. Thus if I run it today it
will catch all duplicates in one particular basedir; then I will
"process" those files somehow, but I will keep track of the pairs
(size, checksum) for those files for which the checksum was
calculated. Tomorrow I will run it again and I'll catch tomorrow's
duplicates along with files that were already duplicates today.

But my algorithm won't spot that a certain file that I have today is
the same as one that I will get tomorrow if that particular file isn't
duplicate today. However it suffices for me and is suitable for the
application I need it for.

>Suppose that you implement your remove-duplicates thing as follows:

[code snipped]

I'll have to look at the code carefully and it will take some time.
For sure it will give some insight and some ideas.

>There's no need to check for lengths being the same, since MD5 checksums
>also mix in the length of the data.

My original, gross, shell script used the algorithm roughly described
above because taking a file size is *much* faster than taking a
checksum and two files having different sizes is a sufficient
condition for them to be different (mathematically, it's an
"invariant", isn't it?).

I must add that more or less by chance I found the
File::Find::Duplicates module. For the moment I've neither tried it
nor have I watched its code (it could be hard, nay, it *will* be
hard), but the manpage says: "it returns a hash, keyed on filesize, of
lists of the identical files of that size", so the basic idea must be
the same as mine (and this makes me somehow proud). Only I *think*
that files are compared directly, because there's no mention of
checksums...

>I stat $fh instead of $_ because it's usually faster to stat a
>filehandle than a filename.  This may differ on other systems than mine,
>though.

Useful to know...


Michele
-- 
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
           [Dante Alighieri, Purg. I, 71-72]

I am my own country - United States Confederate of Me!
           [Pennywise, "My own country"]


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

Date: Wed, 23 Oct 2002 01:15:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: deleting a file... kill ???   Thanks...
Message-Id: <KKmt9.3013$wm6.2638@nwrddc01.gnilink.net>

G.Doucet wrote:
> PS.
> Wouldn't you think that my book's index would have had an entry on
> deleting files?

PS: Wouldn't you think that the Perl documentation is a better source for
information about a specific function than some book?

jue




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

Date: Wed, 23 Oct 2002 01:12:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: deleting a file... kill ???
Message-Id: <FHmt9.2995$wm6.1736@nwrddc01.gnilink.net>

G.Doucet wrote:
> I was updating a perl script that I wrote last year. The Perl script
> reads and writes to a few database files which are just simple text
> files. At one point, the perl script deletes an old file which goes
> something like this:
>
>   if(-e "$obidfil"){kill $obidfil;}

I don't think so :-)

> I wanted to know if I could tell whether the command was able to
> delete the file, or whether there would be an error. So I decided to

die "Couldn't delete the file $obifil because of $!\n" unless unlink
$obifil;

Further details see "perldoc -f unlink"

> read up on the kill function

Good idea!

> in my old Perl book "Using Perl 5 for web
> programming".

Bad idea! The authoritative source for any information about any Perl
function is always the documentation, which came with the system (except for
the source code itself, of course).
Did you try "perldoc -f kill"?

> As I read this (which I printed below), I was thinking
> that either there is a mistake in my book, or the kill statement does
> something other than deleting a file.

As "perldoc -f kill" says it has nothing to do with files but everything
with processes.

> I just want to make sure that I am using the correct function to
> delete a file.

You don't. Use "unlink".

> Does anyone understand that jargon?

Pretty standard and easy to understand when you are a little bit familiar
with processes.

jue




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

Date: Wed, 23 Oct 2002 05:14:52 +0400
From: "Andrew V. Tkachenko" <pobugfix@peterlink.ru>
Subject: Re: Hiding password variables in PERL
Message-Id: <ap4stf$pjp$1@news.sovam.com>

If you have *.c programs running under root privileges and just want to 
care about main.pl, and main.pl is running on the same machine as both 
decrypt.c and encrypt.c so how about checking main.pl's md5 sum and 
compare with it's original value just after you get request for decryption?
But IMHO you won't be protected against someone who may trace main.pl 
with debugger :))

Marc Pelletier wrote:
> Alright, so here's the scoop .. wondering if anyone has ever come
> across something like this.  Looking for any advice or workarounds as
> well.
> 
> I have a main PERL script (call it main.pl) which reads a
> username/password file (call it nodes.txt), grabs these login details,
> Telnet's to a switch, executes a few commands and logs out.  Pretty
> simple so far.
> 
> I've added two more scripts to encrypt/decrypt the passwords
> (encrypt.c and decrypt.c) from the nodes.txt .. so that if anyone
> tries to read the file, they don't get the password. Decrypt.c only
> accepts requests from main.pl through some hand-shaking. You can't run
> this script on it's own against nodes.txt. So far so good, to recap:
> 
> 1. Populate nodes.txt file
> 2. Run the encrypt.c script to encrypt passwords in node.txt
> 3. main.pl calls decrypt.c and stores username/password (which is
> non-encrypted now)
> 4. MY QUESTIONS: Is there a way to ensure that someone can't modify
> the main.pl script to output the password before it gets sent off to a
> switch?  Does PERL allow me have hidden variables or some sort?
> 
> I give this program out to users to install on their Unix machines
> with root.  Anyone with root access can modify the main.pl script .. I
> have no control over that.  I just want to see if there's anything I
> can do to hide the password variable in main.pl so they can't simply
> put a print statement on the variable before I call Telnet.
> 
> This isn't a banking system model, but so far I can say I have some
> decent work around the encrypt/decrypt portions.  There are ways to
> break into this that would require some work/tools, that's a given. 
> Now I just need something to make the main.pl a little more hack
> proof.
> 
> Thanks in advance!!



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

Date: Wed, 23 Oct 2002 02:27:37 GMT
From: chris <chris@home.com>
Subject: How to hide command line parameters from modules?
Message-Id: <g12cruccvd3ia9rlfs3umsh1c5lgbdpos8@4ax.com>

My script receives switches from the command line. When I create a new
instance of an object, the object inherits the same switches. How do I
hide some?

for example

myscript.pl -A -B -C

I want the modules to see only -A -B


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

Date: Wed, 23 Oct 2002 02:41:02 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How to hide command line parameters from modules?
Message-Id: <3DB60C4F.4E963253@acm.org>

chris wrote:
> 
> My script receives switches from the command line. When I create a new
> instance of an object, the object inherits the same switches. How do I
> hide some?
> 
> for example
> 
> myscript.pl -A -B -C
> 
> I want the modules to see only -A -B

Remove them from @ARGV.

perldoc -f shift
perldoc -f pop
perldoc -f splice



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 23 Oct 2002 01:35:28 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: NEWBIE foreach problem
Message-Id: <3DB5FC84.2030304@rochester.rr.com>

Deepa wrote:

 ...
> The code below seems to work fine through the
> foreach loop.


Nope.  Doesn't compile.  You need my in front of the first occurrance of 
the variables $Item and @ThisItem .


> 
> #!/usr/bin/perl -w
> 
> use CGI qw(:all);
> use strict;
> 
> # Create a cookie called "testcookie"
> 
> my $Cook_sample=cookie( -name => 'testcookie',
>    -value => '123456:1|234567:3|345678:2',
>    -expires => '+12h');
> 
> print header (-cookie => $Cook_sample);
> 
> # Read the Cookie
> 
> print header();
> 
> my $ItemsInCart = cookie('testcookie');
> 
> print "<p> The Variable Items in Cart is $ItemsInCart</p>";
> 
> my @EachItem = split('\|', $ItemsInCart);

/----------------------^--^
The first argument to split is normally a regex -- but what you have 
will work.


> my $Search_String = "";
> my $Long = @EachItem;
> 
> print "<p>The number of items in Each Item is $Long</p>";
> 
> #When I remove the next lines of code, it executes
> #just fine, saying the number of items in $EachItem is 3
> #Despite the help, I still can't see what it wrong with
> #this code.
> 
> foreach $Item (@EachItem) {

my ------^


> @ThisItem = split('\:', $Item);

my^
/:/-----------------^^^^


> $Search_String = $Search_String . $ThisItem[0] . " ";
> }
> 
> print "<p>The search string is $Search_String</p>";
> 
> 
> 
> There are probably obvious errors in this, but I am
> having trouble seeing them.
 ...


> Deepa :-)


You also need to separate this into two programs, one of which sets your 
cookie, and other of which reads the cookie.  If you run your program 
(with the indicated modifications -- at least the addition of the two 
my's) as a CGI script once, then comment the lines:

       my $Cook_sample...

through

       print header (-cookie...

and then run it again as a CGI script, it will "work" the second time. 
It sets the cookie the first time, but the rest of it is ineffective the 
first time through.


 ...


-- 
Bob Walton



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

Date: Wed, 23 Oct 2002 02:10:49 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: NEWBIE foreach problem
Message-Id: <Jynt9.7368$Z9.6375@news4.srv.hcvlny.cv.net>


"Deepa" <tech@REMOVETOMAILall-in-one-business.com> wrote in message
news:urbf99bqml5e@corp.supernews.com...
> Hey, this code is supposed to read a cookie,
> separate it into pairs of Item:Quantity and
> then break those down into a list of items
> stored in a string for sorting.
>
> The code below seems to work fine through the
> foreach loop.
>
> #!/usr/bin/perl -w
>
> use CGI qw(:all);
> use strict;
>
> # Create a cookie called "testcookie"
>
> my $Cook_sample=cookie( -name => 'testcookie',
>    -value => '123456:1|234567:3|345678:2',
>    -expires => '+12h');
>
> print header (-cookie => $Cook_sample);
>
> # Read the Cookie
>
> print header();
>
> my $ItemsInCart = cookie('testcookie');
>
> print "<p> The Variable Items in Cart is $ItemsInCart</p>";
>
> my @EachItem = split('\|', $ItemsInCart);
> my $Search_String = "";
> my $Long = @EachItem;
>
> print "<p>The number of items in Each Item is $Long</p>";
>
> #When I remove the next lines of code, it executes
> #just fine, saying the number of items in $EachItem is 3
> #Despite the help, I still can't see what it wrong with
> #this code.
>
> foreach $Item (@EachItem) {
> @ThisItem = split('\:', $Item);
> $Search_String = $Search_String . $ThisItem[0] . " ";
> }
>
> print "<p>The search string is $Search_String</p>";
>
>
>
> There are probably obvious errors in this, but I am
> having trouble seeing them.



Test you code from the command line.  The lines in question do not compile.
You did specify strict and warnings, but you do not see these messages in
the CGI environment.

Bill




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

Date: Tue, 22 Oct 2002 23:03:26 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: NEWBIE foreach problem
Message-Id: <3DB6117E.3838AB57@earthlink.net>

Deepa wrote:
[snip]
> print header (-cookie => $Cook_sample);

This prints a header for the CGI protocol.

> # Read the Cookie
> 
> print header();

This prints *another* header for the CGI protocol.

You're only supposed to print one.

> my $ItemsInCart = cookie('testcookie');

*This* reads the cookie.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Tue, 22 Oct 2002 18:17:06 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: Perl Program
Message-Id: <3DB5F892.7D7E257F@motorola.com>

Aryan wrote:
> 
> I am populating the two these kind of hashes, it is based upon the what user
> does on the web page. I have to manipulate with these two hashes plzz help
> me..
> 
> %original_list = (
> 
>         "name1" => "name1:",
>         "name2" => "name2:update",
>         "name3" => "name3:update",
>         "name4" => "name4:update",
> 
> );
> 
> %changed_list = (
> 
>         "name1" => "name1:update",
>         "name2" => "name2:",
> 
> );
> 
> Sub unsubscribe {
> 
> }
> 
> Sub subscribe{
> 
> }
> 
> Assumptions:
> 
> The changed list would have same number of keys as original or lesser.

I assume you mean the keys of %changed_list are a subset of the keys of
%original_list.  In other words, %changed_list will never have a key
that is not in %original_list.

> 
> For All the keys which are in originalList  but not in  chnaged call a
> function called unsubscribe and populate a array called
> unsubscribeArray.
> 
> Now compare the values for each keys which are there in both of these
> lists::::
>  if  in List1 value contains update for perticular key and in list 2 for the
> same key it is null for that key call unsubscribe function and add the
> element into unsubscribed Array.

What are List1 and list 2, I thought we were talking about
%original_list and %changed_list?  I assume List1 refers to
@original_list and list 2 refers to %changed_list.  Also, I assume by
"update" you mean the value contains the key name followed by a colon
":" followed by any string of 1 or more characters and by "null" you
mean the key name followed by a colon ":" followed by nothing.

> 
>  if  in List1 value does not  contains update for perticular key and in list
> 2 it is update call subscribe function and add the element into subscribed
> Array.

Again, by update, I assume you mean any non-null string following the
key name and a colon.  I also assume you want the script to do nothing
for the two cases you ommitted (1. %original_list contains update and
%changed_list contains update and 2. %original_list contains null and
%changed_list contains null).

Your description is not very clear.  The following script does what you
ask, though perhaps not what you want:

#!/usr/local/bin/perl

%original_list = (

        "name1" => "name1:",
        "name2" => "name2:update",
        "name3" => "name3:update",
        "name4" => "name4:update",
);
 
%changed_list = (
 
        "name1" => "name1:update",
        "name2" => "name2:", 
);

foreach (keys %original_list) {
  if (exists $changed_list{$_}) {    # key is in both lists
    if (($original_list{$_} !~ /$_:$/) && ($changed_list{$_} =~ /$_:$/))
{
      &unsubscribe($_);      
      push @unsubscribeArray,$_;
    } elsif ($original_list{$_} =~ /$_:$/ && $changed_list{$_} !~/$_:$/)
{     
      &subscribe($_);
      push @subscribed,$_;
    }      
  } else {              # key is in %original_list, but not in
%changed_list
    &unsubscribe($_);
    push @unsubscribeArray,$_; 
  }
}

print "subscribed: @subscribed";

print "\nunsubscribeArray: @unsubscribeArray\n";


sub unsubscribe { }
sub subscribe { }


-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com
|                            
| Motorola, SPS  EL722       |     Phone: (480)413-2744            |
| 2100 E Elliot Road         |     Pager: (888)645-8163            |
| Tempe, AZ 85284            |       Fax: (480)413-4511            |
|------------------------------------------------------------------|


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

Date: Tue, 22 Oct 2002 18:40:19 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: Running Perl through cron
Message-Id: <3DB5FE03.E0F1AD56@motorola.com>

Which script returns the access denied errors, the Perl script or the
rsynch.sh script?  I've noticed in Unix that attempting to launch a perl
script from a c program gives similar problems.  In that case it appears
to be due to the shebang (#!/usr/bin/perl) not getting processed
correctly.  If this is the cause of your problem, a simple workaround is
to write a small script file that simply launches the perl script and
have the calling program (cron in your case) call the shell script
rather than the perl script. 


-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com
|                            
| Motorola, SPS  EL722       |     Phone: (480)413-2744            |
| 2100 E Elliot Road         |     Pager: (888)645-8163            |
| Tempe, AZ 85284            |       Fax: (480)413-4511            |
|------------------------------------------------------------------|
| Motorola Document Classification                                 |
| [X]  General business information                                |
| [ ]  Motorola internal use only                                  |
| [ ]  Motorola confidential proprietary                           |
\------------------------------------------------------------------/


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

Date: Tue, 22 Oct 2002 20:59:15 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Running Perl through cron
Message-Id: <87n0p5lxu4.fsf@limey.hpcc.uh.edu>

>> On Tue, 22 Oct 2002 18:40:19 -0700,
>> Matthew Stoker <matt.stoker@motorola.com> said:

> Which script returns the access denied errors, the Perl
> script or the rsynch.sh script?  I've noticed in Unix
> that attempting to launch a perl script from a c program
> gives similar problems.  In that case it appears to be
> due to the shebang (#!/usr/bin/perl) not getting
> processed correctly.  If this is the cause of your
> problem, a simple workaround is to write a small script
> file that simply launches the perl script and have the
> calling program (cron in your case) call the shell
> script rather than the perl script.

Nonsense.  But what are you talking about anyway?


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

Date: Wed, 23 Oct 2002 02:27:42 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Running Perl through cron
Message-Id: <yOnt9.7465$Z9.1229@news4.srv.hcvlny.cv.net>


"LiquidPHP" <liquidphp@yahoo.com> wrote in message
news:8db54e4f.0210221055.4d93b82f@posting.google.com...
> I'm encountering a weird problem when running a Perl script from a
> cron job. The perl script uses another script to rsync a directory
> with four other servers. I am using the fully qualified filename
> (/usr/bin/rsynch.sh) to the script in the perl script. When I run the
> script from the command line, it works. However, when run from cron,
> it returns access denied errors. Everything - the cron job, the
> scripts, the directories, etc. - is owned by the same user.
>
> Thanks for your help.


This is not a Perl question.  cron jobs run in a special user.  Either your
own account has access to the files but the special one does not or your
script needs something (e.g. set environmental variables) that you do in
your session or shell initialization that is not done in the initialization
of the special usr.

Bill




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

Date: Tue, 22 Oct 2002 21:32:09 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Running Perl through cron
Message-Id: <87k7k9lwba.fsf@limey.hpcc.uh.edu>

>> On Wed, 23 Oct 2002 02:27:42 GMT,
>> "Bill Smith" <wksmith@optonline.net> said:

> "LiquidPHP" <liquidphp@yahoo.com> wrote in message
> news:8db54e4f.0210221055.4d93b82f@posting.google.com...
>> I'm encountering a weird problem when running a Perl
>> script from a cron job. The perl script uses another
>> script to rsync a directory with four other servers. I
>> am using the fully qualified filename
>> (/usr/bin/rsynch.sh) to the script in the perl
>> script. When I run the script from the command line, it
>> works. However, when run from cron, it returns access
>> denied errors. Everything - the cron job, the scripts,
>> the directories, etc. - is owned by the same user.

> This is not a Perl question.  cron jobs run in a special
> user.  Either your own account has access to the files

No they don't, they run as you, but as a child of the cron
daemon.

hth
t



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

Date: Wed, 23 Oct 2002 06:04:57 GMT
From: THISISAFAKE@ADDRESS.000 (Steve)
Subject: What is a file XXX.pl.swp ??
Message-Id: <3db628f4.19736731@news.earthlink.net>

Hi,

I just had a programmer write a script for my web site. When I
installed it, there were a couple of files ending in .swp. This script
was installed on a Linux server.

What type of file is this? 

I looked it up on the web and all the file id guides I could find say
they are DOS Swap files?

I also understand that Linux is able to use files for swapping so I
pulled up a search on "Linux" and ".pl.swp" and found several hits but
I was unable to find one that defined it. My guess is-it is a swap
file for the Perl Script. 

My question is. If I modify the script, do I need to modify the swp?
Is it automatically generated by Perl? Please point me to a web page
or faq that explains this better.

Thanks in advance,
Steve
My real email address is dealsgalore[A-T]earthlink.net

www.cheap-land.com


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

Date: Wed, 23 Oct 2002 00:34:05 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: What is a file XXX.pl.swp ??
Message-Id: <3DB642DD.90932BF@indra.com>

Steve wrote:
> 
> Hi,
> 
> I just had a programmer write a script for my web site. When I
> installed it, there were a couple of files ending in .swp. This script
> was installed on a Linux server.
> 
> What type of file is this?
> 
> I looked it up on the web and all the file id guides I could find say
> they are DOS Swap files?
> 
> I also understand that Linux is able to use files for swapping so I
> pulled up a search on "Linux" and ".pl.swp" and found several hits but
> I was unable to find one that defined it. My guess is-it is a swap
> file for the Perl Script.
> 
> My question is. If I modify the script, do I need to modify the swp?
> Is it automatically generated by Perl? Please point me to a web page
> or faq that explains this better.
> 
> Thanks in advance,
> Steve
> My real email address is dealsgalore[A-T]earthlink.net
> 
> www.cheap-land.com
man vi
-- 
Ron Reidy
Oracle DBA


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

Date: Wed, 23 Oct 2002 06:50:02 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: What is a file XXX.pl.swp ??
Message-Id: <slrnarchnm.kud.mgjv@verbruggen.comdyn.com.au>

On Wed, 23 Oct 2002 06:04:57 GMT,
	Steve <THISISAFAKE@ADDRESS.000> wrote:
> Hi,
> 
> I just had a programmer write a script for my web site. When I
> installed it, there were a couple of files ending in .swp. This script
> was installed on a Linux server.
> 
> What type of file is this? 

\begin[totally,utterly]{offtopic}

It looks like a temp file for vim to me, but you should ask the
programmer who wrote the stuff, not us. Most likely you can delete
them. You should ask your programmer to clean up better when preparing
stuff for distribution, if, indeed, they are temporary files from vim.

\end{offtopic}

Martien
-- 
                        | 
Martien Verbruggen      | I'm just very selective about what I accept
Trading Post Australia  | as reality - Calvin
                        | 


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

Date: Wed, 23 Oct 2002 02:26:42 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Writing Microsoft Outlook Notes With Perl
Message-Id: <3DB60885.70804@rochester.rr.com>

Chris wrote:

> I've got this half-baked idea for writing a program that will
> dynamically generate Microsoft Outlook Notes from information gathered
> from a database.  I know how to do everything except create the
> Outlook Note.  Can anyone point me in the direction of information for
> accomplishing this?  I've seen others do this (not with Perl) where
> the program will seek data from the weather service and write that
> data into an Outlook Note.  That's similar to what I am trying to do.
> 
> Any help will be greatly appreciated.
> 
> Chris
> 

By "Outlook Note", do you mean "email note"?  If so,

     use Net::SMTP;

-- 
Bob Walton



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

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.  

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


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