[18014] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 174 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 30 11:05:48 2001

Date: Tue, 30 Jan 2001 08:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980870712-v10-i174@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 30 Jan 2001     Volume: 10 Number: 174

Today's topics:
    Re: <>, tie *STDIN or *ARGV <rick.delaney@home.com>
        Can't copy a database handle using DBI mwarnes7676@my-deja.com
    Re: Can't copy a database handle using DBI <joe+usenet@sunstarsys.com>
    Re: Catching warnings from Getopt::Std <alan@nospam.com>
    Re: copy construct reference to anonymous scalar (Martien Verbruggen)
    Re: Creating calendar (reminder) class (Garry Williams)
    Re: DBI problem; can't use a reference to a db handle <tore@extend.no>
    Re: DBI problem; can't use a reference to a db handle <hollisin@yahoo.com>
    Re: DBI problem; can't use a reference to a db handle mwarnes7676@my-deja.com
    Re: email address with receiver's name <rick.delaney@home.com>
    Re: email address with receiver's name bits101010@my-deja.com
        Gamma and Deltacodes <frank@kitschanet.de>
        HELP Read from file on different server? emelin@my-deja.com
    Re: how do I temporarily close part of my site? <brentdax1_@_earthlink.net>
        How to display the Perl syntax error from a failed eval <brannon@lnc.usc.edu>
    Re: How to display the Perl syntax error from a failed  tigra@sky.deep.ru
    Re: How to display the Perl syntax error from a failed  <joe+usenet@sunstarsys.com>
    Re: How to send a file ... <sorinvc@utdallas.edu>
        Installing and using modules when you're not root? <ralawrence@my-deja.com>
    Re: Installing and using modules when you're not root? (Bernard El-Hagin)
    Re: Installing and using modules when you're not root? <ralawrence@my-deja.com>
    Re: Installing and using modules when you're not root? <djberge@uswest.com>
        netsaint via ssh <kperlich@sydios.de>
    Re: netsaint via ssh <rbfitzpa@my-deja.com>
    Re: newbie, problem in installing module (Garry Williams)
    Re: Perl on 98 <simon.andrews@bbsrc.ac.uk>
    Re: Question on appending to file <ccx138@coventry.ac.uk>
    Re: Question on appending to file <Jerome.Abela@free.fr>
    Re: Question on appending to file <rbfitzpa@my-deja.com>
    Re: Question on appending to file <Jerome.Abela@free.fr>
        Remotely Update <blnukem@hotmail.com>
        Shared temporary error array in object hierarchy twolfmaier@acm.org
        Sort not working (Blstone77)
        Which one to use...Date::Cal or Date::manip ? <sumera.shaozab@lmco.com>
        Win32::ChangeNotify not working under Win NT <dprowak@ci.syracuse.ny.us>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 30 Jan 2001 14:03:24 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: <>, tie *STDIN or *ARGV
Message-Id: <3A76CCF4.4E58B78B@home.com>

[posted & mailed]
[sorry if this goes twice; I was having some network problems]
John Lin wrote:
> 
> In the following program, my intension is:
> when @ARGV is provided, print those files in @ARGV as normal
> otherwise, when <> (originally) gets input from console, feed in
> 
> line 1
> line 2
> line 3
> 
> for it to print.
> 
> Note that all the magics should be done in the package.
> The main program should not be changed except for adding 'use A'.
> ----------------------------------------------------------------
> package A;
> 
> sub TIEHANDLE { print "tie called\n"; bless \(my $num = 0) }
> 
> sub READLINE {
>     my $num = shift;
>     $$num++ < 3? "line $$num\n": undef;
> }
> 
> BEGIN { tie *ARGV,'A' }

  BEGIN { tie *ARGV, 'A' unless @ARGV }

or maybe you really want

  BEGIN { tie *ARGV, 'A' unless -t }

?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 30 Jan 2001 14:20:12 GMT
From: mwarnes7676@my-deja.com
Subject: Can't copy a database handle using DBI
Message-Id: <956iik$1ip$1@nnrp1.deja.com>

I have two database handles created using DBI to two different data
sources. In a script I am developing, I want to select the appropriate
db handle for the data required and copy it to a 'dummy' database.
Here's a sample:

my $dbh1 = DBI::connect("DBI:ODBC:source1"....);
my $dbh2 = DBI::connect("DBI:ODBC:source2"....);
 .
 .
my $handle = 'dbh1'; # This would be picked up from a file for example
my $dummydbh = ${$handle}; # $dummydbh becomes $dbh1
my $sth = $dummydbh->prepare(...);
and so on...

The problem is that the program fails saying that $dummydbh is not
defined.

Does anyone know how I can make reference $dummydbh to the required
database handle?

Mark


Sent via Deja.com
http://www.deja.com/


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

Date: 30 Jan 2001 09:56:41 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Can't copy a database handle using DBI
Message-Id: <m3puh59jh2.fsf@mumonkan.sunstarsys.com>

mwarnes7676@my-deja.com writes:

> Here's a sample:
> 
> my $dbh1 = DBI::connect("DBI:ODBC:source1"....);
> my $dbh2 = DBI::connect("DBI:ODBC:source2"....);

Here's a thought:

s/::/->/;

and here's another:

        ... DBI->connect(...) or die $DBI::errstr;

> my $handle = 'dbh1'; # This would be picked up from a file for example
> my $dummydbh = ${$handle}; # $dummydbh becomes $dbh1
     ^^^^^^^^^^^^^^^^^^^^^^
Don't do this - here's another thought:

        use strict;

> my $sth = $dummydbh->prepare(...);
> and so on...

        I don't know what your original problem is, 
        but I suggest to use a hash.
                     --Rafael Garcia-Suarez

Try

        my %dbh = map { $_ => DBI->connect("DBI:ODBC:$_",...) 
                        or die $DBI::errstr } qw ( source1 source2 );

        my $handle = "source1"; # from another file, for example

        my $sth = $dbh{$handle}->prepare(...) or die $DBI::errstr;

and so on...


-- 
Joe Schaefer





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

Date: Tue, 30 Jan 2001 15:07:18 GMT
From: Alan Pettigrew <alan@nospam.com>
Subject: Re: Catching warnings from Getopt::Std
Message-Id: <VA.0000000a.0173af7a@fox-europe.com>

On a related topic, is it possible to get getopts to treat options 
'correctly'?

If I use
   perl xxx.pl -u "user" -p "" file
then from getopts("u:p:") I get
   $opt_u = 'user'     As expected
   $opt_p = 'file'     Wrong
This is not the same action as the C/Unix getopt function, and 
Getopt::Long doesn't look like it is better.

Is this a bug, a feature, or fixable?

Alan
alan dot pettigrew at fox hyphen europe dot com





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

Date: Tue, 30 Jan 2001 23:22:54 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: copy construct reference to anonymous scalar
Message-Id: <slrn97dcgu.vht.mgjv@martien.heliotrope.home>

On Mon, 29 Jan 2001 13:52:40 +0800,
	John Lin <johnlin@chttl.com.tw> wrote:
>
> my $scalar_hard_ref = \$scalar;
> my $scalar_copy_ref = ????????    # this is my question

> my $ref = \"$x";
> 
> Up to now, this is the best answer I can find, but looks weird.

And it always stringifies $x. If it was a reference to something before,
its copy isn't. But That may be ok, depending on why exactly (you think)
you need this.

> What is Perl's standard way to do this?

There is none. Any of the above probably will do.

I must say that I've been in the situation where I've had to make copies
of complex referents, like arrays or hashes, or objects, but I've never
had to explicitly make a copy of a scalar reference.

Out of curiosity, what are you going to use this for?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: Tue, 30 Jan 2001 13:27:27 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Creating calendar (reminder) class
Message-Id: <3jzd6.4593$GF2.64454@eagle.america.net>

On Mon, 29 Jan 2001 18:58:31 +0100, Marc Beck <marc.beck@bigfoot.com>
wrote:
>On Mon, 29 Jan 2001 06:26:49 GMT, garry@zvolve.com (Garry Williams)
>wrote:
>
>>  use Event;
>>
>I said it does the job but it didn't.
>
>What am I doing wrong?
>
>#!/usr/bin/perl

 #!/usr/bin/perl -w

>
>use strict;
>use Event;

 use Event qw( loop unloop );

You need to ask Event to export its subroutines, if you want to use
them without package qualifiers.  

>my $time = time();
>$time += 10;
>
>my $reminder = Event::timer->new({ at => $time });

 Event->timer( cb => \&msg, at => $time );

An event cannot be scheduled without a call-back defined.  The
constructor is `timer', not `new'.  The constructor expects a list
(hash) -- not a reference to a hash.  

>$reminder->cb(\&msg);

No need to do this, since the event will not be constructed without it
in the first place.  If you wanted to change the call-back after
constructing the event, I suppose this would do it, but I did not test
that.  

Now you have to call the event loop, if you expect the Event module to
schedule events.  Since you call unloop() in your only call-back,
control will return after the call to loop().  You might continue to
"watch" STDIN in one event without calling unloop() and in that
call-back, schedule the "alarm clocks" as the user enters them.
Whatever.  Here's the "one-shot": 

 loop;

>sub msg()
>{
>        print "Hello World!";
>
>        unloop('ok');
>}

You might find the tutorial that is distributed with Event.pm helpful.  

-- 
Garry Williams


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

Date: Tue, 30 Jan 2001 15:18:33 +0100
From: Tore Aursand <tore@extend.no>
Subject: Re: DBI problem; can't use a reference to a db handle
Message-Id: <MPG.14e0eba824c962a2989871@news.online.no>

In article <9543ti$u7b$1@nnrp1.deja.com>, mwarnes7676@my-deja.com 
says...
> Later on again, I then attempt to prepare an SQL statement (held in
> $sql) using the variable to reference the data source:

I'm not sure if I get you right, but you want to have multiple database 
connections in your script, and call them based on a variable?

If that's the case, I would have done something like this;

  my $dbh->{$var} = DBI->connect("DBI:ODBC:$var", "...", "...");

This way, I can easily called the specific DB handle;

  my $sth = $dbh->{$var}->prepare(...);

Hope this helps!


-- 
Tore Aursand - tore@extend.no - http://www.extend.no/~tore/


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

Date: Tue, 30 Jan 2001 14:30:06 -0000
From: jack <hollisin@yahoo.com>
Subject: Re: DBI problem; can't use a reference to a db handle
Message-Id: <t7djver59boked@corp.supernews.com>

I am no perl pointer expert but I believe your pointer should point to 
$dbh, which is the required parent for a prepare. 
This :my $sth = ${$source}->prepare($sql);
must resolve to this :my $sth = $dbh->prepare($sql);

Maybe 
my $source = $dbh;
 ...
my $sth = ${$source}->prepare($sql);

mwarnes7676 wrote:
> 
> 
> I have a script where I connect to a database source at the top of the
> script.
> 
> e.g.
> my $dbh = DBI->connect("DBI:ODBC:MYSOURCE") or die "$DBI::errstr\n";
> 
> Later on in the script, I populate a variable with the source name:
> 
> e.g.
> my $source = 'MYSOURCE';
> 
> Later on again, I then attempt to prepare an SQL statement (held in
> $sql) using the variable to reference the data source:
> 
> e.g.
> my $sth = ${$source}->prepare($sql);
> 
> This fails with the following message:
> 
> Can't call method "prepare" on an undefined value at main.pl line 116.
> 
> I'm trying to do it this way so that I can open the data connections at
> the top of the program (I'm looking to create a persistent CGI script),
> and use the appropriate db handle when required.
> 
> Can anyone help? Or is what I'm trying to do the wrong approach?
> 
> Cheers,
> 
> Mark
> 
> 
> 
> 
> Sent via Deja.com
> http://www.deja.com/


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Tue, 30 Jan 2001 15:14:43 GMT
From: mwarnes7676@my-deja.com
Subject: Re: DBI problem; can't use a reference to a db handle
Message-Id: <956los$4nu$1@nnrp1.deja.com>

In article <MPG.14e0eba824c962a2989871@news.online.no>,
  Tore Aursand <tore@extend.no> wrote:
> In article <9543ti$u7b$1@nnrp1.deja.com>, mwarnes7676@my-deja.com
> says...
> > Later on again, I then attempt to prepare an SQL statement (held in
> > $sql) using the variable to reference the data source:
>
> I'm not sure if I get you right, but you want to have multiple
database
> connections in your script, and call them based on a variable?

Yes, that's right (glad you could understand what I was trying to
explain!)

> If that's the case, I would have done something like this;
>
>   my $dbh->{$var} = DBI->connect("DBI:ODBC:$var", "...", "...");
>
> This way, I can easily called the specific DB handle;
>
>   my $sth = $dbh->{$var}->prepare(...);
>
> Hope this helps!

It does help Tore, thank you! The "my $dbh->{$var}..." doesn't work
because the interpreter complains about an undefined value. But if I
use something like:

my %dbh;
$dbh{$var} = DBI->connect("DBI:ODBC:$var, "...", "...");
 .
 .
my $sth = $dbh{$var}->prepare(...);

it works! Thanks for pointing me in the right direction, Tore.

Mark


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 14:01:49 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: email address with receiver's name
Message-Id: <3A76CC96.96052395@home.com>

John Lin wrote:
> 
> Hmm... MIME::Lite is not machine independent...

Sure it is.  It just passes on what you give it to your MTA. 
Configuration of MTAs are often very different on different machines,
though.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 30 Jan 2001 14:51:41 GMT
From: bits101010@my-deja.com
Subject: Re: email address with receiver's name
Message-Id: <956kdp$3a6$1@nnrp1.deja.com>

John,

Although this format is allowed, the author discourages its use:
===== from MIME::Lite manual =========
"Name, Full" <full.name@some.host.com>
This last form is discouraged because SMTP must be able to get at the
name or name@domain portion.
======================================

Going through your code, I thought may be you should use:
     From => '"John Lin" <johnlin@chttl.com.tw>',

 .... double quoting the name

Good luck.

Winston.

In article <952omb$34a@netnews.hinet.net>,
  "John Lin" <johnlin@chttl.com.tw> wrote:
> Dear all,
>
> Sorry if this is a repost.  My news server lost my post.
>
> Let me explain "email address with receiver's name" first.
> For address "johnlin@chttl.com.tw", we can add a name "John Lin" to
it.
>
> "johnlin@chttl.com.tw (John Lin)" or "John Lin <johnlin@chttl.com.tw>"
>
> The two formats are frequently seen.  I am not sure which is right.
> But experiments showed neither could work correctly.
>
> I use MIME::Lite to send to many people "with names".  The following
is
> my code.  Only the first one received the email.  The others didn't.
>
> use MIME::Lite;
> my $mail = new MIME::Lite(
>     From => 'johnlin@chttl.com.tw (John Lin)',
>       To => 'lin54321@hotmail.com (John at hotmail), '.
>             'johnlin@chttl.com.tw (John at company)',
> Subject => 'test',
>     Data => "Hi\n"
> );
> $mail->send_by_smtp;
>
> Of course, if I send "without name", it works fine.
>
> To => 'lin54321@hotmail.com, johnlin@chttl.com.tw',
>
> My question is how can I send "with name"?  Could you help me please?
>
> Thank you very much.
>
> John Lin
>
> P.S.  In the code
>
> Data => "Hi\n";
>
> If I don't append the "\n", the program will hang there.
> It seems to be bug of MIME::Lite.
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 16:36:16 +0100
From: Frank Kitscha <frank@kitschanet.de>
Subject: Gamma and Deltacodes
Message-Id: <3A76DF70.6ED410BD@kitschanet.de>

Hi,

need Perlimplementation of Gamma and Deltacodes. ( or an URL whith
examples or downloads)


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

Date: Tue, 30 Jan 2001 10:55:38 GMT
From: emelin@my-deja.com
Subject: HELP Read from file on different server?
Message-Id: <9566j8$o71$1@nnrp1.deja.com>

I have a csv file on one of my homepages, and want to read the data
from it and write to another csv file on my other homepage on a
different server. But it only seems to work if the source file is on
the same server as the target file?

Is it possible to read data from a file on a different server?


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 15:14:08 GMT
From: "Brent Dax" <brentdax1_@_earthlink.net>
Subject: Re: how do I temporarily close part of my site?
Message-Id: <4TAd6.32414$J21.126761@newsread1.prod.itd.earthlink.net>

"Terry" <dcs@ntlworld.com> wrote in message
news:pvmd6.6940$cD2.232555@news2-win.server.ntlworld.com...
> Hi,
>
>  There will be times when I will need to modify cgi scripts, member stats
> etc. on my site.
> I know that I can change the .htaccess file to deny access to these areas
> (and this is what my host suggests I do). My problem with this is:
wouldn't
> that run the risk of corrupting my files if a user's input was modifying a
> file or files at the time?
>
>  If I'm wrong you can cut me off there.
> Assuming I'm correct, I was going to upload a small text file with only
the
> word open or closed in it, then have my scripts first check this file
before
> performing their normal tasks (or not, if it was "closed"). But I would
> still need to check that no sensitive files were open at the time, so
would
> have to go through a series of opening and "flocking" these files before
> shutting off access.
> Now, eventually, to my main problem.
> As new users join my site they generate new member files, so I have no way
> of knowing the names of the files to flock.
>
>  Is there someway I can get a listing of these files and use that list for
> the opening and "flocking"?
>
>  I don't know the command (if there is one) so I'll call it "dir" to show
> what I want
>
>      chomp (my @filelist = <"dir: /members/*.*">);   #to get list of
files.

opendir(MEMBERS, "./members/");
my @filelist=sort readdir(MEMBERS);    #you may not need sort, but theyll
come out in a weird order unless you use it
closedir(MEMBERS);

# if you need to select only certain files (like "*.member") do it like:
# @filelist=glob "./members/your-stuff-with-wildcards.here";

>          for ($i=0; $i<=$#filelist) {
        for($i=0; $i<@filelist; ++$i) {    #otherwise you get an infinite
loop
>              $thisfile = $filelist[$i];
>              $filename = "filenumber".$i;        #give each file a unique
> name.
>              $filepath = "/members/".$thisfile;
            $filepath="./members/".$thisfile
>              open ($filename,  $filepath);
>                  flock $filename;
>          }
>          open (CHK, "checkfile.txt");
>               truncate (CHK, 0);
>              print CHK, "closed\n";
>          close (CHK);
>          for ($i=0; $i<=$#filelist) {
>              $filename = "filenumber".$i;        #get each unique name.
>              close ($filenum);
>          }

Note the large number of changes from "/members/" to "./members/".  Unless
you have a folder off root called /members/, that whole thing would fail.
(By putting /members/ in, you're saying that there's a folder in the same
directory as /dev/, /etc/, and /usr/, among other directories.  To see if
this is true, type "ls /members" at your command prompt.  I doubt it is.)

HTH,
--Brent Dax
brentdax1@earthlink.net




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

Date: Tue, 30 Jan 2001 11:53:36 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: How to display the Perl syntax error from a failed eval?
Message-Id: <lbu26hfe82.fsf@lnc.usc.edu>

I dont get any output in $@ even though the evaluated index.pl
contains a syntax error --- a missing comma in a Perl hashref. 

How can I get a verbose description of exactly what went wrong with my
eval statement?

#!/usr/bin/perl

use Data::Dumper;
use File::Find;

find(\&wanted, 'art');

sub wanted {

  return unless -f;
  warn $_;

  if (/^index.pl$/) {
   warn $File::Find::name;
   eval {  do $_; } or die $@;
   print Data::Dumper::Dumper($artwork);
 }

}

# Here is index.pl (with the error still there).

$artwork = 
  {
   artiste   => 'Abigail',
   medium => 'Perl',
   title => 'Average of List of Numbers',
   description => 'Shown here is a strikingly elegant way to calculate the
average of an array of numbers.'
   sourcecode => 'source.pl'
  }

 


-- 
Terrence Brannon 
Carter's Compass:
 I know I'm on the right track when by deleting code I'm adding functionality.


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

Date: Tue, 30 Jan 2001 13:01:05 GMT
From: tigra@sky.deep.ru
Subject: Re: How to display the Perl syntax error from a failed eval?
Message-Id: <956due$thc$1@nnrp1.deja.com>

In article <lbu26hfe82.fsf@lnc.usc.edu>,
  Terrence Brannon <brannon@lnc.usc.edu> wrote:
> I dont get any output in $@ even though the evaluated index.pl
> contains a syntax error --- a missing comma in a Perl hashref.
>
> How can I get a verbose description of exactly what went wrong with my
> eval statement?
>
> #!/usr/bin/perl
>
> use Data::Dumper;
> use File::Find;
>
> find(\&wanted, 'art');
>
> sub wanted {
>
>   return unless -f;
>   warn $_;
>
>   if (/^index.pl$/) {
>    warn $File::Find::name;
>    eval {  do $_; } or die $@;
>    print Data::Dumper::Dumper($artwork);
>  }
>
> }
>
> # Here is index.pl (with the error still there).
>
> $artwork =
>   {
>    artiste   => 'Abigail',
>    medium => 'Perl',
>    title => 'Average of List of Numbers',
>    description => 'Shown here is a strikingly elegant way to calculate
the
> average of an array of numbers.'
>    sourcecode => 'source.pl'
>   }

Just a quotation from 'perldoc -f do':

You might like to use C<do> to read in a program configuration
file.  Manual error checking can be done this way:

    # read in config files: system first, then user
    for $file ("/share/prog/defaults.rc",
               "$ENV{HOME}/.someprogrc")
   {
        unless ($return = do $file) {
            warn "couldn't parse $file: $@" if $@;
            warn "couldn't do $file: $!"    unless defined $return;
            warn "couldn't run $file"       unless $return;
        }
    }

=cut

So 'do' NEVER dies. It reports its status via return value. Your eval
never fails, thus $@ becomes undefined.

Sergey


Sent via Deja.com
http://www.deja.com/


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

Date: 30 Jan 2001 08:33:36 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to display the Perl syntax error from a failed eval?
Message-Id: <m3y9vt9nbj.fsf@mumonkan.sunstarsys.com>

Terrence Brannon <brannon@lnc.usc.edu> writes:

> I dont get any output in $@ even though the evaluated index.pl
> contains a syntax error --- a missing comma in a Perl hashref. 
> How can I get a verbose description of exactly what went wrong 
> with my eval statement?

By dropping "eval"; "do" will handle errors for you.

> #!/usr/bin/perl
> 
> use Data::Dumper;
> use File::Find;
> 
> find(\&wanted, 'art');
> sub wanted {
> 
>   return unless -f;
>   warn $_;
> 
>   if (/^index.pl$/) {
>    warn $File::Find::name;
>    eval {  do $_; } or die $@;
     ^^^^^^^^^^

do always succeeds, so $@ will likely be empty.
Replace that line with this instead:

        do $_;    # ignore return value
        die "$!:$@" if $! || $@;

and see

% perldoc -f do
% perldoc -f eval

HTH
-- 
Joe Schaefer


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

Date: Tue, 30 Jan 2001 08:49:12 -0600
From: Sorin Voicu-Comendant <sorinvc@utdallas.edu>
Subject: Re: How to send a file ...
Message-Id: <Pine.GSO.4.21.0101300847180.18511-100000@apache.utdallas.edu>

Use the Mail::Sendmail module that is available at cpan.org. The author
has a good example of sending files as attachments on his website at
alma.ch.

Sorin.

***SOLI DEO GLORIA***

On 28 Jan 2001 Steve50@zxmail.com wrote:

#After a script has created a file on the server, I would like to email it
#automatically to one mail address.
#
#How can I do ? (I am a newbie :-)
#
#Thanks !
#Steve
#
#
#



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

Date: Tue, 30 Jan 2001 13:00:34 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Installing and using modules when you're not root?
Message-Id: <956dtf$th4$1@nnrp1.deja.com>

Hi,

I've got two modules I'd like to use on my system, I've downloaded them
and done everything bar "make install" because I'm not root on the
server (and never will be).

Is there any way I can use these modules without resorting to getting
root to install them? I've looks in the perlmod file but thats no help
and it isn't one of CPANs frequently asked questions so I'm a little
stuck.

Can anyone help?

Thanks

Rich


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 13:15:13 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Installing and using modules when you're not root?
Message-Id: <slrn97dfj0.2q0.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 30 Jan 2001 13:00:34 GMT, Richard Lawrence
<ralawrence@my-deja.com> wrote:
>Hi,
>
>I've got two modules I'd like to use on my system, I've downloaded them
>and done everything bar "make install" because I'm not root on the
>server (and never will be).
>
>Is there any way I can use these modules without resorting to getting
>root to install them? I've looks in the perlmod file but thats no help
>and it isn't one of CPANs frequently asked questions so I'm a little
>stuck.

Did you try the FAQ on your hard drive? You don't have to answer that.

>Can anyone help?

Yes, the FAQ on your hard drive. I can even tell you how to find the
answer yourself. You'll be amazed at how simple this is. Observe:

perldoc -q own (as in "my OWN module directory")

Easy, huh?

Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'


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

Date: Tue, 30 Jan 2001 13:09:01 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Re: Installing and using modules when you're not root?
Message-Id: <956ed9$tu8$1@nnrp1.deja.com>

In article <956dtf$th4$1@nnrp1.deja.com>,
  Richard Lawrence <ralawrence@my-deja.com> wrote:
> I've looks in the perlmod file but thats no help

Oops. Meant to say I looked in "perlmodinstall".

Rich


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 08:31:32 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Installing and using modules when you're not root?
Message-Id: <3A76D044.F099346B@uswest.com>

Bernard El-Hagin wrote:

> On Tue, 30 Jan 2001 13:00:34 GMT, Richard Lawrence
> <ralawrence@my-deja.com> wrote:
> >Hi,
> >
> >I've got two modules I'd like to use on my system, I've downloaded them
> >and done everything bar "make install" because I'm not root on the
> >server (and never will be).
> >
> >Is there any way I can use these modules without resorting to getting
> >root to install them? I've looks in the perlmod file but thats no help
> >and it isn't one of CPANs frequently asked questions so I'm a little
> >stuck.
>
> Did you try the FAQ on your hard drive? You don't have to answer that.
>
> >Can anyone help?
>
> Yes, the FAQ on your hard drive. I can even tell you how to find the
> answer yourself. You'll be amazed at how simple this is. Observe:
>
> perldoc -q own (as in "my OWN module directory")
>
> Easy, huh?
>
> Cheers,
> Bernard
> --
> #requires 5.6.0
> perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'

Then again, it's not as easy as just giving him the answer:

perl Makefile.PL LIB=/my/home/dir
make
make test
make install



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

Date: Tue, 30 Jan 2001 13:28:15 +0100
From: Karsten Perlich <kperlich@sydios.de>
Subject: netsaint via ssh
Message-Id: <3A76B35F.914B87B8@sydios.de>

Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------8330420FBE44F1169BC5F7E7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi folks,

I've got a problem with my netsaint. Netsaint starts perl scripts on my administrativ machine (solaris). These scripts contact a
deamon on the remote controlled machines. That what I don't like is the open port for this deamon. 
My idea is the perl scripts and the deamon should contact via ssh. 

		BUT HOW?

I've no experience in perl starting a perl session.

Thanks for any help

Karsten
--------------8330420FBE44F1169BC5F7E7
Content-Type: text/x-vcard; charset=us-ascii;
 name="kperlich.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte für Karsten Perlich
Content-Disposition: attachment;
 filename="kperlich.vcf"

begin:vcard 
n:Perlich;Karsten
tel;cell:+49 170 586 38 76
tel;work:+49 30 80944 832
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:kperlich@sydios.de
x-mozilla-cpt:;-23856
fn:Perlich
end:vcard

--------------8330420FBE44F1169BC5F7E7--



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

Date: Tue, 30 Jan 2001 15:45:03 GMT
From: igotlooks.com <rbfitzpa@my-deja.com>
Subject: Re: netsaint via ssh
Message-Id: <956nht$6e2$1@nnrp1.deja.com>

I'm not familiar with netsaint but I don't think it's ssh that your
looking for. ssh is a secure shell which replaces telnet or is a secure
replacement for telnet. Daemons don't contact other daemons through ssh,
however they do use the same principle but it's called secure sockets
(not ssh - secure shell).

The port has NOTHING to do with security when it comes down to it. There
are several standards which people use for secure and non-secure ports
but any port can be secured as well as any port can be insecure.
Depending on the purpose of your scripts and information that is being
communicated it may or may not be easier to encrypt the data being
transmitted over the socket - then you'll need to decrypt it.

I believe what your looking for is an SSL solution, I haven't worked
with SSL other than with webservers but this should be enough
information for you to post the proper question to what your looking
for and point you in the right direction.

In article <3A76B35F.914B87B8@sydios.de>,
  Karsten Perlich <kperlich@sydios.de> wrote:
> Dies ist eine mehrteilige Nachricht im MIME-Format.
> --------------8330420FBE44F1169BC5F7E7
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi folks,
>
> I've got a problem with my netsaint. Netsaint starts perl scripts on
my administrativ machine (solaris). These scripts contact a
> deamon on the remote controlled machines. That what I don't like is
the open port for this deamon.
> My idea is the perl scripts and the deamon should contact via ssh.
>
> 		BUT HOW?
>
> I've no experience in perl starting a perl session.
>
> Thanks for any help
>
> Karsten
> --------------8330420FBE44F1169BC5F7E7
> Content-Type: text/x-vcard; charset=us-ascii;
>  name="kperlich.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Visitenkarte für Karsten Perlich
> Content-Disposition: attachment;
>  filename="kperlich.vcf"
>
> begin:vcard
> n:Perlich;Karsten
> tel;cell:+49 170 586 38 76
> tel;work:+49 30 80944 832
> x-mozilla-html:FALSE
> adr:;;;;;;
> version:2.1
> email;internet:kperlich@sydios.de
> x-mozilla-cpt:;-23856
> fn:Perlich
> end:vcard
>
> --------------8330420FBE44F1169BC5F7E7--
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 12:04:20 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: newbie, problem in installing module
Message-Id: <85yd6.4590$GF2.64206@eagle.america.net>

On Tue, 30 Jan 2001 09:15:27 GMT, Rafael Garcia-Suarez
<rgarciasuarez@free.fr> wrote:
>Pradeep Sethi wrote in comp.lang.perl.misc:
>> Writing Makefile for XML::XPath
>> Unable to open MakeMaker.tmp: Permission denied at
>> /usr/lib/perl5/5.6.0/ExtUtils/MakeMaker.pm line 747.
>
>(Strange error to occur when you run perl as root.) But this error comes
>from the system, not from perl.

Yes, and it could be a NFS file system mounted without root
permissions.  

Probably not the best idea to install Perl modules as root anyway.  

-- 
Garry Williams


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

Date: Tue, 30 Jan 2001 14:16:36 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Perl on 98
Message-Id: <3A76CCC4.508444AC@bbsrc.ac.uk>

Anton Pieters wrote:
> 
> I seem to have a problem running Perl on windows 98. As soon as I start
> a CGI-script it bursts out in a DOS window and closes again. I have got
> WPS installed and running. I just can't get it going. Is there someone
> who can help me with this?

If you are starting the script by double clicking on the file this is
quite often all you will see.  Windows will close the window when the
program has finished running.  A better way to run scripts is to open a
DOS shell and use the syntax 

	'perl myscript.pl' 

to run your scripts.  This will leave the output visible.

Obviously, if you are trying to run a CGI script in its final form you
need to open the file from a browser to get it to run.  It's usually
(always?) better to debug from the command line though.

HTH

Simon


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

Date: Tue, 30 Jan 2001 11:02:13 +0000
From: John Tutchings <ccx138@coventry.ac.uk>
Subject: Re: Question on appending to file
Message-Id: <3A769F35.3E01D0C5@coventry.ac.uk>

It would seem better to fix the other program than fudge it this way. :)

A very rough and ready way is, but you need to be on a UNIX box and the
pattern match for the filename needs a little work.  That's a little "L"
after the wc.

@files = `wc -l *`;
chomp(@files);
for (@files){
        if(/\s+1\s+(.*)/){
            open (FILE, ">>$1") || die "Can't open $1\n";
            print FILE "\n";
            close(FILE);
        }
}


yongli01@my-deja.com wrote:

> Hi, all,
>
> I think this is a simple task but I cannot figure it out for one day.
>
> I wanted to write a acript to find the files in a directory which only
> contains one line, then append a blank line to the file so that it
> becomes two line.
>
> I want to do this because I use an existing program to parse the files
> but it stops when meet a one line file.
>
> Thanks in advance.
>
> Yong li
>
> Sent via Deja.com
> http://www.deja.com/



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

Date: Tue, 30 Jan 2001 14:12:40 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Question on appending to file
Message-Id: <3A76CAE4.1760A83D@free.fr>

John Tutchings a écrit :
> A very rough and ready way is, but you need to be on a UNIX box and the
> pattern match for the filename needs a little work.  That's a little "L"
> after the wc.
> 
> @files = `wc -l *`;
> chomp(@files);
> for (@files){

I hope there is no file with 10 zillion lines in that directory, or `wc`
will last a long time.

Here is a perlonly (if version>=5.6) solution:

for(<*>) {
  open(FILE,"<$_");
  <FILE>;
  if(!defined(<FILE>)) {
      open(FILE, ">>$_");
      print FILE "";
  }
}



Jerome.


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

Date: Tue, 30 Jan 2001 15:38:06 GMT
From: igotlooks.com <rbfitzpa@my-deja.com>
Subject: Re: Question on appending to file
Message-Id: <956n4u$608$1@nnrp1.deja.com>

You might want to add the 'close(FILE)' lines if you want it to work,
but I agree - this is probably the quickest/easiest solution.

 for(<*>) {
   open(FILE,"<$_");
   <FILE>;
   if(!defined(<FILE>)) {
       close(FILE);
       open(FILE, ">>$_");
       print FILE "";
   }
   close(FILE);
 }








In article <3A76CAE4.1760A83D@free.fr>,
  Jerome Abela <Jerome.Abela@free.fr> wrote:
> John Tutchings a écrit :
> > A very rough and ready way is, but you need to be on a UNIX box and
the
> > pattern match for the filename needs a little work.  That's a little
"L"
> > after the wc.
> >
> > @files = `wc -l *`;
> > chomp(@files);
> > for (@files){
>
> I hope there is no file with 10 zillion lines in that directory, or
`wc`
> will last a long time.
>
> Here is a perlonly (if version>=5.6) solution:
>
> for(<*>) {
>   open(FILE,"<$_");
>   <FILE>;
>   if(!defined(<FILE>)) {
>       open(FILE, ">>$_");
>       print FILE "";
>   }
> }
>
> Jerome.
>


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 16:04:25 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Question on appending to file
Message-Id: <3A76E50F.15987E81@free.fr>

"igotlooks.com" wrote :
> You might want to add the 'close(FILE)' lines if you want it to work,
> but I agree - this is probably the quickest/easiest solution.

I agree that you may want to add the 'close(FILE)' for many reasons
(make it more readable, easier to maintain, ...). However, you don't
have to add them to make it work, as open() behaviour is *defined* as
closing the file handle first. The manual for close() goes even further:

  "You don't have to close FILEHANDLE if you are immediately going to do
another `open' on it, because `open' will close it for you."


Jerome


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

Date: Tue, 30 Jan 2001 13:48:59 GMT
From: "blnukem" <blnukem@hotmail.com>
Subject: Remotely Update
Message-Id: <fDzd6.1533$zZ.529028@news02.optonline.net>

I was just wondering if it is possible for a client to log on to his web
server threw a web browser and then remotely update a file say "data.txt"
from another server totally elimination the client ever touching it?
Basically transfer from server to server. If it can be done please tell me
where can I read up on it.





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

Date: Tue, 30 Jan 2001 14:31:49 GMT
From: twolfmaier@acm.org
Subject: Shared temporary error array in object hierarchy
Message-Id: <956j8l$265$1@nnrp1.deja.com>

I have an object hierarchy that consists of two or more levels, a base
clase and several derived classes. In certain subroutines, save() in the
example below, each class in the hierarchy performs validations. Any
errors should be collected into an array of errors that is shared
between the classes in the hierarchy. The caller should be able to
access this array of errors. Something like the following:

use DerivedClass;
my $derived_class = new DerivedClass;
unless ($derived_class->save) {
    my @errors = @derived_class::errors;
}


The classes are as follows:

package DerivedClass;

use strict;

use vars qw(@ISA);
@ISA = qw(BaseClass);

sub new {
    my $proto  = shift;
    my $class = ref($proto) || $proto;
    my $self = $class->SUPER::new;
    bless $self, $class;
    return $self;
}

sub save {
    my $self = shift;

    # Perform some validation
    push @errors, 'There was an error in the derived class';

    return $self->SUPER::save;
}

1;

__END__


package BaseClass;

use strict;

sub new {
    my $proto  = shift;
    my $class = ref($proto) || $proto;
    my $self = {};
    bless $self, $class;
    return $self;
}

sub save {
    my $self = shift;

    # Perform some validation
    push @errors, 'There was an error in the base class';

    return if @errors;

    # Save the object

    return 1;
}

1;

__END__


How do I set up such a shared array and how would I access it? Part of
the problem is to clear the array between subsequent subroutine calls. I
tried adding the following to the base class:

my @errors = ();

sub errors {
    my $self = shift;

    if (@_) {
        return push @errors, @_;
    }

    return @errors;
}

In the derived and base class, errors are set with:

$self->errors('Error message');

and accessed from outside with:

$derived_class->errors();

The only problem is that errors keep accumulating. I could clear the
error array at the beginning of each subroutine, but then I run into the
problem of how objects higher in the hierarchy know that objects in the
lower level have already cleared the array. I would have the same
problem if I would assign the errors to an attribute of the object hash.

DBI seems to be doing something similar. I can't figure out, though, how
errstr is cleared between subsequent subroutine calls.

Perhaps I am trying to accomplish the impossible. Any help would be
appreciated.

Thomas

-----------------------------------------------------
Thomas Wolfmaier
Human-Computer Interaction Resource Network (HCIRN)
25 Bucks Green Road, Thornhill, ON, Canada, L3T 4G1
Tel: +1-905-881-7095
Email: twolfmaier@acm.org
Web: www.hcirn.com
-----------------------------------------------------


Sent via Deja.com
http://www.deja.com/


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

Date: 30 Jan 2001 15:53:02 GMT
From: blstone77@aol.com (Blstone77)
Subject: Sort not working
Message-Id: <20010130105302.16317.00001756@ng-cn1.aol.com>

I thought I had this all figured out, but obviously NOT! can anyone tell me why
this perl sortscript  is not working correctly. I am trying to sort by score,
but It prints nothing, and I can't seem to find the problem. Is this sorting
orcan you explain to  me where I am going wrong! 

#!/usr/local/bin/perl

	$scorefile = "scorelog.txt";

  print "Content-Type: text/html\n\n";
  print "<HTML><HEAD><TITLE>Search Statistics Report</TITLE></HEAD><body
link=red vlink=red bgcolor=ffffff text=000000><center>\n";
  print "<CENTER>\n";

  open (THELOG, "<$scorefile") or die $!;
  while (<THELOG> ) {
  chomp;
  ($screenname, $password, $score, $date, $quesnum, $status) = split(/\|/);
  $scores{$screenname} = [$password,$score,$date,$quesnum,$status];
   $total =($total + $score2);
  }
  close THELOG;
  foreach $word (sort { $scores{$b}->[0] <=> $scores{$a}->[0] } keys %scores) {
     print "$word  $scores2{$word}->[0] $scores2{$word}->[1]\n"; 
  }


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

Date: Tue, 30 Jan 2001 14:52:16 GMT
From: smax <sumera.shaozab@lmco.com>
Subject: Which one to use...Date::Cal or Date::manip ?
Message-Id: <956ket$3an$1@nnrp1.deja.com>

Hi,

I am trying to find the difference between two dates in days.  One date
is given in this format:  mm/dd/yy and the other date is the current
date that I have to get from the system.  Which module should I use to
calculate the difference between the two dates.  Should I convert the
system date in the mm/dd/yy format too?

any help is appreciated.  Thanks

SAS



Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 30 Jan 2001 14:50:07 GMT
From: "David Prowak" <dprowak@ci.syracuse.ny.us>
Subject: Win32::ChangeNotify not working under Win NT
Message-Id: <zwAd6.113483$ju6.11355149@typhoon.nyroc.rr.com>

Hi,
I have a simple program using Win32::ChangeNotify that
works on my Win98 machine but does not work on the same
machine when booted as a Win NT Server.

The error message indicates a problem with the $path.
If I change the $path to "C:" under Win NT, it runs, but acts "funny".
By "funny" I mean that it does not stop the monitoring when I place a file
in "C:".
(No error message is displayed, is just says "monitorDir.pl die on line
14".)
Meanwhile, once again, on a Win98 machine, everything works.  Help!!!
What the heck is wrong?

 use strict;
 use Win32::ChangeNotify;
# Look for any changes in the watched Dir.
# Changes include renames, deletions and creations.
 my $filter = "FILE_NAME";

 my ($notify);
 my $path =  "C:\\\\Timothymarsch\\SHARE";

 my $subTree = 1;
 my $retValue;  # return value

 $notify = Win32::ChangeNotify->new($path, $subTree, $filter) || die $!;
 $retValue = $notify -> wait or die "Something failed: $!\n";

 if ($retValue == 1) {
     print "hip, hip horaay!\n";
 } else {
 print STDERR "$notify\n";
 }

TIA,
Dave








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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 174
**************************************


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