[17192] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4604 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 13 06:05:25 2000

Date: Fri, 13 Oct 2000 03:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971431509-v9-i4604@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 13 Oct 2000     Volume: 9 Number: 4604

Today's topics:
    Re: about sendmail (Christopher Browne)
    Re: about sendmail <nospam@xepec.com>
    Re: cgi with perl on Apache-1.3.12-Linux-6.2 - beginner <anders@wall.alweb.dk>
        Data Strings <stuart@ammpro.com>
    Re: Data Strings <wyzelli@yahoo.com>
    Re: Difference between '=' and '.=' operators <bart.lateur@skynet.be>
        How to use bidirectional pipe at perl? <carfield@my-deja.com>
    Re: How to use bidirectional pipe at perl? <kistler@gmx.net>
    Re: How to use bidirectional pipe at perl? <carfield@my-deja.com>
    Re: How to use bidirectional pipe at perl? <kistler@gmx.net>
    Re: newbie: pws and active perl (Pieter Overbeeke)
    Re: OOP- Abstract Derived Classes ? <bart.lateur@skynet.be>
    Re: OOP- Abstract Derived Classes ? <kistler@gmx.net>
    Re: Perl compiler <zakazan@gmx.de>
    Re: Perl compiler <zakazan@gmx.de>
    Re: Perl Watching Perl? <steve.jones@takethisoutproact.net>
    Re: Perl Watching Perl? <bart.lateur@skynet.be>
    Re: Perl/Windows problem <bart.lateur@skynet.be>
    Re: Plz help - Perl Q <bart.lateur@skynet.be>
    Re: search engine in perl? <kistler@gmx.net>
    Re: thanks and one more question only <wstsoi@hongkong.com>
        using Perl module across the Net <Sagar.Shah@sid.cam.ac.uk>
    Re: Weekday at a date <ubl@schaffhausen.de>
        which perl modules are installed by deafult if any? <pete769@fsnet.co.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 13 Oct 2000 07:03:03 GMT
From: cbbrowne@knuth.kitenet.net (Christopher Browne)
Subject: Re: about sendmail
Message-Id: <HsyF5.6757$YX4.274985@news2.giganews.com>

In our last episode (Fri, 13 Oct 2000 05:31:22 GMT),
the artist formerly known as Andrew Serukov said:
>"Christopher Browne" <cbbrowne@knuth.brownes.org> wrote in message
>news:slrn8ud44j.7bc.cbbrowne@knuth.brownes.org...
>> In our last episode (Fri, 13 Oct 2000 11:43:57 +0800),
>> the artist formerly known as Lucas Gamp said:
>> >I used to send email in CGI by /usr/sbin/sendmail, but this time I must
>> >send a HTML that contains images, so how should I deal with the images,
>> >how to print to sendmail?
>>
>> Simple Answer:  You can't.
>>
>> This is more or like asking how you might use your refrigerator to bake
>> a pie.  I don't use my fridge for that; I use an oven.
>>
>> Explaining...
>>
>> -> Suppose your document contains the tag:
>>   <img src="local://myfilename.jpeg">
>>
>>   That represents an image that must _already_ be on a local filesystem
>>   at the destination.
>>
>> -> Suppose your document contains the tag:
>>   <img src="http://somehost.org/pictures/mypicture.jpeg">
>>
>>   That represents an image that the web browser will try to access
>>   via the HTTP protocol.
>>
>> Those are basically the two options you have.  Sendmail has no way
>> of indicating that a file be put into "myfilename.jpeg".
>>
>> And it is a server that uses the SMTP protocol, not the HTTP protocol,
>> so it can't serve up http://somehost.org/pictures/mypicture.jpeg
>>
>> This is inherently outside the scope of anything Sendmail might be
>> used to do.  Sendmail is used to send messages.  It doesn't
>> display images, or transfer anything using the HTTP protocol.  It is
>> not a program that is used to print things.
>>
>> Note that if you use an image URL that references your favorite
>> web server, someone that is reading their email using a web browser
>> rather than a mail client will find that their web browser will head
>> to that web server and pull the image via HTTP.  Sendmail won't be
>> involved in the slightest.
>> --
>> cbbrowne@hex.net - <http://www.ntlug.org/~cbbrowne/internet.html>
>> Do not meddle in the affairs of dragons, for you are crunchy and taste
>> good with ketchup.
>
>There's MHTML, mime-based multipart HTML.
>I'm not sure if it's Microsoft-proprietary (it feels like it's not) but MS
>does
>support it in newer apps. I haven't heard of Linux packages that would
>handle MHTML but then I  haven't looked for them either.
>If there's one, it may solve your problem just fine.

And this has _what_ to do with Sendmail?

And this has _what_ to do with the two ways that HTML provides for
referencing images?

And this has _what_ to do with HTTP?  Or SMTP?

Microsoft might have set up some proprietary way of transferring
images using MAPI, but that's not going to be generally useful
either with:
a) Sendmail, which simply transfers whatever you put in a message
   from one place to another, or
b) The vast selection of mail clients out there that may not even
   interpret HTML.
-- 
cbbrowne@hex.net - <http://www.ntlug.org/~cbbrowne/lsf.html>
Why are there 5 syllables in the word "monosyllabic"? 


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

Date: Fri, 13 Oct 2000 08:13:11 GMT
From: "Andrew Serukov" <nospam@xepec.com>
Subject: Re: about sendmail
Message-Id: <ruzF5.4924$MK6.172920@newsread1.prod.itd.earthlink.net>


"Christopher Browne" <cbbrowne@knuth.kitenet.net> wrote in message
news:HsyF5.6757$YX4.274985@news2.giganews.com...
> In our last episode (Fri, 13 Oct 2000 05:31:22 GMT),
> the artist formerly known as Andrew Serukov said:
> >"Christopher Browne" <cbbrowne@knuth.brownes.org> wrote in message
> >news:slrn8ud44j.7bc.cbbrowne@knuth.brownes.org...
> >> In our last episode (Fri, 13 Oct 2000 11:43:57 +0800),
> >> the artist formerly known as Lucas Gamp said:
> >> >I used to send email in CGI by /usr/sbin/sendmail, but this time I
must
> >> >send a HTML that contains images, so how should I deal with the
images,
> >> >how to print to sendmail?
> >>
> >> Simple Answer:  You can't.
> >>
> >> This is more or like asking how you might use your refrigerator to bake
> >> a pie.  I don't use my fridge for that; I use an oven.
> >>
> >> Explaining...
> >>
> >> -> Suppose your document contains the tag:
> >>   <img src="local://myfilename.jpeg">
> >>
> >>   That represents an image that must _already_ be on a local filesystem
> >>   at the destination.
> >>
> >> -> Suppose your document contains the tag:
> >>   <img src="http://somehost.org/pictures/mypicture.jpeg">
> >>
> >>   That represents an image that the web browser will try to access
> >>   via the HTTP protocol.
> >>
> >> Those are basically the two options you have.  Sendmail has no way
> >> of indicating that a file be put into "myfilename.jpeg".
> >>
> >> And it is a server that uses the SMTP protocol, not the HTTP protocol,
> >> so it can't serve up http://somehost.org/pictures/mypicture.jpeg
> >>
> >> This is inherently outside the scope of anything Sendmail might be
> >> used to do.  Sendmail is used to send messages.  It doesn't
> >> display images, or transfer anything using the HTTP protocol.  It is
> >> not a program that is used to print things.
> >>
> >> Note that if you use an image URL that references your favorite
> >> web server, someone that is reading their email using a web browser
> >> rather than a mail client will find that their web browser will head
> >> to that web server and pull the image via HTTP.  Sendmail won't be
> >> involved in the slightest.
> >> --
> >> cbbrowne@hex.net - <http://www.ntlug.org/~cbbrowne/internet.html>
> >> Do not meddle in the affairs of dragons, for you are crunchy and taste
> >> good with ketchup.
> >
> >There's MHTML, mime-based multipart HTML.
> >I'm not sure if it's Microsoft-proprietary (it feels like it's not) but
MS
> >does
> >support it in newer apps. I haven't heard of Linux packages that would
> >handle MHTML but then I  haven't looked for them either.
> >If there's one, it may solve your problem just fine.
>
> And this has _what_ to do with Sendmail?
>
> And this has _what_ to do with the two ways that HTML provides for
> referencing images?
>
> And this has _what_ to do with HTTP?  Or SMTP?
>
> Microsoft might have set up some proprietary way of transferring
> images using MAPI, but that's not going to be generally useful
> either with:
> a) Sendmail, which simply transfers whatever you put in a message
>    from one place to another, or
> b) The vast selection of mail clients out there that may not even
>    interpret HTML.
> --
> cbbrowne@hex.net - <http://www.ntlug.org/~cbbrowne/lsf.html>
> Why are there 5 syllables in the word "monosyllabic"?

Indeed this doesn't have much to do with sendmail or HTTP or SMTP.
Or MAPI for that matter. I'm just trying to find a solution for the original
problem and your

> >> Simple Answer:  You can't.

is not quite convincing. There're possibilities out there.
Suppose MHTML-archival utility is able to resolve links
and pack locally/relatively rereferenced files together in one (text) file.
Using MIME which does not have anything to do with Microsoft and
does have some relation to SMTP and sendmail. The result file file
can be fed to sendmail as a simple solution to the original question.

I know MHTML exists (I've seen it in MS products but it doesnt mean
nobody else did it, right?) and it's certainly worth an RPM search.

--Andrew

BTW, you forgot at least one more legal way to reference images from html:
    <img src="pictures/mypicture.jpeg">
It means "picture location is relative to the base of current file".





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

Date: Fri, 13 Oct 2000 11:50:43 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: cgi with perl on Apache-1.3.12-Linux-6.2 - beginner
Message-Id: <IWAF5.363$Uy5.24989@news000.worldonline.dk>

abevec@my-deja.com wrote:

> I created a cgi Perl script in my cgi-bin directory that is suppose to
> get executed on an "get" html command.  But the Appache server comes
> back with an error.  I'm the server administrator.  All the
> files/directories are mode 755 protected.  Any ideas how to correct this
> problem.

use CGI::Carp qw/fatalsToBrowser/;

will let you know if and why your script fails if it parses, and even if 
the error happens in the last stage of the parsing.

use CGI;

This will let you run your script in a term interactively, meaning you can 
provide params to it. Don't forget the -w scwitch!

If you transferred oyur script to the server using FTP, and didn't set 
ascii ftp mode, you have some control chars at the top of the file.

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 13 Oct 2000 10:24:34 +0100
From: "Stuart Maclean" <stuart@ammpro.com>
Subject: Data Strings
Message-Id: <8s6kdc$hgt$1@news.minx.net.uk>

I need some way to replace the blank spaces within a string with the value
%20.

before conversion:

THIS IS A TEST STRING

alter conversion:

THIS%20IS%20A%20TEST%20STRING

Can anyone help?

email to stuart@ammpro.com





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

Date: Fri, 13 Oct 2000 19:02:57 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Data Strings
Message-Id: <4CAF5.2$rJ4.783@vic.nntp.telstra.net>

"Stuart Maclean" <stuart@ammpro.com> wrote in message
news:8s6kdc$hgt$1@news.minx.net.uk...
> I need some way to replace the blank spaces within a string with the
value
> %20.
>
> before conversion:
>
> THIS IS A TEST STRING
>
> alter conversion:
>
> THIS%20IS%20A%20TEST%20STRING
>

s/ /%20/g;

Check the section called perlre in the documentation.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Fri, 13 Oct 2000 09:42:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Difference between '=' and '.=' operators
Message-Id: <q0mduscpmnp6ellc2bc3akoq13gnj91drs@4ax.com>

Sean McAfee wrote:

>while (($key, $value) = some_func()) {
>    ($hash{$key} .= exists $hash{$key} && "\n") .= $value;
>}
>
>I was surprised to find that this code didn't behave as I expected; the
>exists $hash{$key} expression always evaluated to true, so that after the
>loop completed every hash value had a "\n" prepended.  Somehow the .=
>operator causes $hash{$key} to spring into existence before the right-hand
>side is evaluated.  This doesn't happen with the = operator, though:

You're right. It's not just ".=": "||=" behaves exactly the same.

See the difference:

	foreach('a'..'f') {
	    $a{$_} = keys %a;
	    $b{$_} ||= keys %b;
	}
	use Data::Dumper;
	print Dumper \%a, \%b;

Notice how the values for %a and %b differ by one for the same keys
(it's one bigger for %b). So in %b, the new key is added *before the RHS
is evaluated; for %a, the RHS is evaluated first.

In your case, I think it's a good reason to use defined() instead of
exists().

-- 
	Bart.


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

Date: Fri, 13 Oct 2000 06:55:09 GMT
From: Carfield Yim <carfield@my-deja.com>
Subject: How to use bidirectional pipe at perl?
Message-Id: <8s6bkd$4u$1@nnrp1.deja.com>

I receive the following error message at my script:

Can't open bidirectional pipe at ./get_news_out.pl line 54, <CONTENT>
line 1.

The code line 54 is:

        open (LANG, "| ".$MA_path."/bin/txtlan |");
        print LANG $data;
        $language = <LANG>;

I guess that there is no language error but I need to config something
to enable the bidirectional pipe. If this is true, how do I do?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 13 Oct 2000 09:39:48 +0200
From: Per Kistler <kistler@gmx.net>
To: Carfield Yim <carfield@my-deja.com>
Subject: Re: How to use bidirectional pipe at perl?
Message-Id: <39E6BC44.2E1257B4@gmx.net>

perldoc IPC::Open2 instead.
Per.

Carfield Yim wrote:
>         open (LANG, "| ".$MA_path."/bin/txtlan |");
>         print LANG $data;
>         $language = <LANG>;


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

Date: Fri, 13 Oct 2000 09:14:09 GMT
From: Carfield Yim <carfield@my-deja.com>
Subject: Re: How to use bidirectional pipe at perl?
Message-Id: <8s6jou$6ok$1@nnrp1.deja.com>

In article <39E6BC44.2E1257B4@gmx.net>,
  Per Kistler <kistler@gmx.net> wrote:
> perldoc IPC::Open2 instead.
> Per.
>
Thx for your information, from the manual, I see the following line:

$pid = open2(\*RDRFH, \*WTRFH, 'some cmd and args');
my($rdrfh, $wtrfh);
$pid = open2($rdrfh, $wtrfh, 'some cmd and args');

As I am just a newbie of perl, I guess the input and output variable.
So I try to use the following statement to get the result:

$language = \$output;
print "$language\n";

But it only print: SCALAR(0x813902c). How can I get the output value?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 13 Oct 2000 11:35:01 +0200
From: Per Kistler <kistler@gmx.net>
To: Carfield Yim <carfield@my-deja.com>
Subject: Re: How to use bidirectional pipe at perl?
Message-Id: <39E6D745.D8F13B6F@gmx.net>

For instance:

use IPC::Open2;

$pid = open2(\*R,\*W,"bc");
$pid || die "did not work as expected:$!";

print W "8*3\n";
print $answer = <R>;
print W "quit\n";

Per.

Carfield Yim wrote:
>... How can I get the output value?
>


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

Date: Fri, 13 Oct 2000 07:54:07 GMT
From: overbeek@chello.nl (Pieter Overbeeke)
Subject: Re: newbie: pws and active perl
Message-Id: <39e6c085.6301451@news.arnhem.chello.nl>

>documentation for how to set up script mappings and how to set up 
>virtual directories
>
>hint: the problem is *probably* that the script mapping is set up for 
>the server - but not for the /cgi-bin virtual directory itself .. you 
>may need to do this manually from the PWS administration tool
>
>-- 
>  jason -- elephant@squirrelgroup.com --

Thanks, its working now!!

Pieter Overbeeke


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

Date: Fri, 13 Oct 2000 09:33:37 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: OOP- Abstract Derived Classes ?
Message-Id: <nukduskbg209oqeqijvlrl1rnhv1sequvd@4ax.com>

Joe Schaefer wrote:

>I'd like so setup a module whose job is to 
>add/override a particular object method; 
>the problem is that I don't a'priori know what
>base class the object will be in. 

If all objects of this class should derive from the same superclass,
then all you need to do is set @ISA for your class to that superclass.
For example, in the import method:

	package My::SubClass;

	sub import {
	    my $junk = shift;
	    push @ISA, @_;
	}

Usage:

	use My::Subclass 'HTML::Parser';

Note: I haven't tested this.

Now, if you want a general overriding class, for example for debugging,
and you need different objects to derive from different subclasses, then
then this trick won't help. I would think of custom packages, which
probably need to be generated through symbolic references, from your new
method. Something like (based upon your code, and again, untested):

	package My::Subclass;

	sub new {
	    my ($type, $base_instance) = @_;
	    my $class = ref($type) || $type;
	    my $subclass = __PACKAGE__ . '::' . $class;
	    no strict 'refs';
	    @{$subclass . '::ISA'} = (__PACKAGE__, $class);
	    bless $base_instance, $subclass;
	}

The idea is that for HTML::Parser, a package
"My::Subclass::HTML::Parser" gets generated, in which the objects will
be blessed, and the variable @My::Subclass:HML::Parser::ISA is set to
your package, for your custom method, and to the object's original
class, for all other methods.

Well it's not tested, and I'm no OO expert, so I don't even know if this
could ever fly.

I think that the method "new" should actually be inherited from the
original class, and your package should then rebless what it got back.

-- 
	Bart.


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

Date: Fri, 13 Oct 2000 11:22:04 +0200
From: Per Kistler <kistler@gmx.net>
To: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: OOP- Abstract Derived Classes ?
Message-Id: <39E6D43C.FD1F66C5@gmx.net>

Like so:

#!/usr/bin/perl

# Different base classes for same subclass test

package BaseA;

        sub new {
                my ($type) = shift;
        }
        sub myMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }
        sub myBaseMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }

package BaseB;

        sub new {
                my ($type) = shift;
        }
        sub myMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }
        sub myBaseMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }

package SubClass;

        @ISA;

        sub new {
                my ($type,$baseClass) = shift;
                push(@ISA,$baseClass);
                bless {}, ref($type) || $type;
        }
        sub myMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }
        sub mySubMethod {
                my ($type) = shift;
                print "I'm in package: " . __PACKAGE__ . "\n";
        }

package main;

use strict;

for my $base ( qw( BaseA BaseB ) ){
        my $obj = SubClass->new($base);

        for my $m ("\$obj->myMethod",
                        "\$obj->myBaseMethod",
                        "\$obj->mySubMethod"){
                print $m,"\n\t";
                eval $m;
        }
}


Joe Schaefer wrote:
 ...
> does anyone have a better way?
> 
> TIA.
> --
> Joe Schaefer


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

Date: Fri, 13 Oct 2000 11:50:54 +0200
From: "Werner, Wolfgang" <zakazan@gmx.de>
Subject: Re: Perl compiler
Message-Id: <39E6DAFE.DA8ECC8A@gmx.de>

is it that thing, youre looking for?

vivek@cse.iitd.ernet.in wrote:

> Can you please guide me to a perl compiler.
> ( i would like to have a script having Tk compiled)
>
> Vivek Malik
> icq: 57264676
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Fri, 13 Oct 2000 11:51:16 +0200
From: "Werner, Wolfgang" <zakazan@gmx.de>
Subject: Re: Perl compiler
Message-Id: <39E6DB14.6463607C@gmx.de>

öhöm, sorry, forgot the link...
http://www.indigostar.com/perl2exe.htm


vivek@cse.iitd.ernet.in wrote:

> Can you please guide me to a perl compiler.
> ( i would like to have a script having Tk compiled)
>
> Vivek Malik
> icq: 57264676
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Fri, 13 Oct 2000 09:42:43 +0100
From: "Steve Jones" <steve.jones@takethisoutproact.net>
Subject: Re: Perl Watching Perl?
Message-Id: <39e6cb69$1_2@nnrp1.news.uk.psi.net>

Rathmore,

As you admit, your approach is a second best solution, it would be better to
fix ftp so that it is reliable.

However, if you want to use this workaround, then I have solved some of
these problems in the last few months, so maybe you can learn from what I
know.

First of all, I had to perform a database backup in a given amount of time.
I had to be able to break the backup off it it took too long. This means I
had to have a perl program which launched (not forked) another script and
waited for it to exit. If it didn't exit in x minutes, I had to get rid of
the job and restart the database.

To do this, I use a (supposedly portable) module called Proc::Background.
use Proc::Background qw(timeout_system);

I downloaded this from CPAN, and installed it under the lib directory. The
code to use it is as follows:

#-------------------------------------------------------------
sub ExecuteCommandWithTimeout ($$$)
{
  # Abstract:
  # Issue an OS command, but timeout after n seconds if it doesn't return
  my $status;
  my $startTime;
  my $endTime;
  my $commandString;
  my @commandList;
  my $timeout;
  my $deltaT;

  $commandString = $_[0];
  $timeout = $_[1];
  @commandList = split /\s+/,$commandString;

  $startTime = time();
  $status = timeout_system($timeout, @commandList);
  $endTime = time();

  $deltaT = $endTime - $startTime;

  # Set the timed-out flag if the delta t >= timeout limit
  $_[2] = 0;
  if ($deltaT >= $timeout)
  {
    $_[2] = 1;
  }
  return $status;
}

Note though that because I'm using NT, perl creates two tasks (don't ask me
why, it just does!), and this method only kills one of them. This was hard
to get around, and I eventually had to write some Delphi code to walk the
process table and kill the matching parent and child processes. If you are
on Unix, or have a different Perl for NT to me, you might be OK.



Steve



--
<rathmore@tierceron.com> wrote in message
news:8s5b42$75j$1@nnrp1.deja.com...
> This promises to be a bit extended so I'll try to be as brief as
> possible.
>
> Is it possible to have a Perl program, fork another Perl program whose
> purpose is to monitor the first program and restart it if it takes too
> long to complete?
>
> Here's the background: I've written a Perl program that opens an FTP
> connection to a remote server and downloads a file, then deletes that
> file. The program does this on each file that matches some criteria-
> there could be anywhere from 1 to over 20 files that need to be
> downloaded then deleted. I'm using Net::FTP to handle the FTP
> processing.
>
> About 1 out of every 5 times that I do this, the program hangs within
> the block that downloads the files and deletes them. From all
> appearances, the program is patiently waiting for the next packet of
> information to be received, which it never receives. This points to a
> problem with the machine that the program is accessing, so the easy
> answer is fix that machine; but the machine doesn't belong to me and
> the entity that owns the machine isn't going to do anything to improve
> or make the machine better. Besides that, I'm a program so I want to
> code a solution.
>
> Being new to Perl, I don't know if you can do what I suggested in my
> 2nd paragraph in this post-fork another Perl program that is capable of
> monitoring the program that called it, and have it reset that program
> if it takes too long to complete.
>
> I hope that the feedback you can give will not only confirm or refute
> this approach, but will also have a few suggestions on how to implement
> such a thing! (You don't have to spell it out, but just enough to get
> me started would be peachy.)
>
> Thanks!
> Rathmore
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Fri, 13 Oct 2000 09:36:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl Watching Perl?
Message-Id: <nplduscl76ori6ivrivls9a41csrbje2e8@4ax.com>

rathmore@tierceron.com wrote:

>Is it possible to have a Perl program, fork another Perl program whose
>purpose is to monitor the first program and restart it if it takes too
>long to complete?

Can't you do it in one program, using alarm()? That is, if your other
stuff doesn't depend on it. Set $SIG{ALRM} to a sub that relaunches
itself and then exits the script. Well, exec() seems to be designed
especially for this purpose.

-- 
	Bart.


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

Date: Fri, 13 Oct 2000 09:18:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl/Windows problem
Message-Id: <5qjdusklg9sfpb6su7gk9frgsqgsbiaq1k@4ax.com>

John Clifford Williams wrote:

>but Windows doesn't seem to like it when I try to
>associate the .ATT file type with my script. 

You probably need to save it as a BAT file, and associate the extension
with that. Oh, with Activestate's Perl, there's a utility called PL2BAT
(in Perl's "bin" dir) which can do the conversion for you.

A major problem is that BAT fiels get their arguments in 8.3 AKA "short
filename" format. The really annoying part is that there is no API call
to get the associated long filename. Not that I know of.

-- 
	Bart.


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

Date: Fri, 13 Oct 2000 10:00:06 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Plz help - Perl Q
Message-Id: <s0nduschlcfpshpd7sueki19o7l275rbea@4ax.com>

Michael Cook wrote:

>    My question is: If I have to lock more than 1 file in a script, should I
>undefine $OFH after each use? Or maybe use a different scalar designator for
>the flush each use? Or do I need to only flush once per script?

>$OFH=select(MEMBERS); $| = 1; select($OFH);

$OFH is only used to temporarily store the current handle. There's no
reason not to reuse this variable for other purposes. Well, personally,
I would make it a localized variable:

	{
	    my $ofh = select MEMBERS;
	    $| = 1;
	    select $ofh;
	}

But, coming back to this:

>If I have to lock more than 1 file in a script

At the same time? Be careful for avoiding deadlock. If program A grabs X
and then Y, and program B grabs Y and then X, well, if this happens
simulataniously, and A has X and B has Y, they'll wait for each other
forever. That is called "deadlock". But actually, that's not a Perl
specific problem.

-- 
	Bart.


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

Date: Fri, 13 Oct 2000 09:04:44 +0200
From: Per Kistler <kistler@gmx.net>
To: "Yura N.Kryukov" <yura@wsr.ru>
Subject: Re: search engine in perl?
Message-Id: <39E6B40C.4BDC7DC0@gmx.net>

Hi Yura

First, there is the unix tool rgrep (rgrep -r 'pat' dirnames) and then
there
is perl. A quick mix of perl and unix would be (if searching for
instance for
the word "font" in all html files):

find . -type f -name \*.html -print |xargs perl -ne 'print "$ARGV: $_"
if /font/'

If with template you mean something more complicated than a regexp, then
one
would have to know what.

Per.

"Yura N.Kryukov" wrote:
> 
> somebody know how quickly search with template in more than 1000 files?
> 
> thaks


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

Date: Fri, 13 Oct 2000 17:28:23 +0800
From: "Lucas Gamp" <wstsoi@hongkong.com>
Subject: Re: thanks and one more question only
Message-Id: <8s6kui$crr$1@horn.hk.diyixian.com>


Thanks in advance !!

I tried MIME::Lite, and it worked fine, thank you.
However, I met another problem, I don;t know how to send
many images at a time.


$msg->attach(
  Type => 'text/html',
  Data => qq{ $HTML }
 );

and my HTML have 3 images, so I tried
 $msg->attach(
   Type =>  'image/gif',
   Id   =>  'popup_back1.gif',
   Path =>  '../htdocs/images/popup_back1.gif',
  );

  $msg->attach(
   Type =>  'image/gif',
   Id   =>  'popup_back.gif',
   Path =>  '../htdocs/images/popup_back.gif',
  );

  $msg->attach(
   Type =>  'image/gif',
   Id   =>  'circle.gif',
   Path =>  '../htdocs/images/circle.gif',
  );

but only the last one, circle.gif is sent, I read the document,
but I can't find the parts that talking about sending multiple
images, anybody could give me a clue?

Thanks again.




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

Date: Fri, 13 Oct 2000 09:16:19 +0100
From: "Sagar R. Shah" <Sagar.Shah@sid.cam.ac.uk>
Subject: using Perl module across the Net
Message-Id: <Pine.WNT.4.21.0010130913160.-382781@sscpc44.sid.cam.ac.uk>

Hi All

Doing 

use lib qw(xxxxx);

allows you to specify extra paths to search when looking for perl modules
by modifying @INC (or whatever it is)

Does anyone know whether there is a way to specify a URL to look at when
looking for perl modules.

This might sound slightly irregular, but I think would be very useful.

My specific problem is that I have a number of websites on a single
webserver, I want to move one to a totally different server, but avoid
having to have duplicate copies of my personal standard utility modules on
each server....

Any ideas appreciates

Sagar

--------------------------------------------------------------------------
Sagar R. Shah                 www: http://thor.cam.ac.uk/~srs29
Room Z5                       map: http://thor.cam.ac.uk/~srs29/sidmap.jpg
Sidney Sussex College         ICQ: 34249234
Cambridge                     Mob: 07703 663 879
CB2 3HU                       Tel: Coming.....
--------------------------------------------------------------------------



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

Date: Fri, 13 Oct 2000 10:26:27 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Weekday at a date
Message-Id: <39E6C732.904A8E30@schaffhausen.de>

Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------6BF11A651450B25335AE11F7
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit



Steffen Beyer schrieb:

> In article <slrn8uarl6.2uf.trammell@nitz.hep.umn.edu>, John J. Trammell <trammell@nitz.hep.umn.edu> wrote:
>
> >>My problem is that I need to know which day was on a particular
> >>date. An example problem would be to find out on which day of
> >>the week you were born.
> >>I basically need to implement this function:
> >>sub weekday_of_date(someDate)
>
> > One solution is:
> > use Date::Calc qw[ Day_of_Week ];
> > $dow = Day_of_Week($year,$month,$day);
>
> Fastest possibility probably would be to use Perl's builtin function
> "localtime()" (see "perldoc -f localtime"), but the range is only
> 1970 - 2038 (on most systems).
>
> For the range 1955 - ... as in your case Date::Calc is indeed a feasible
> solution, since it's written in C internally for maximum speed.

Just to let you know, I timed both variants with Benchmark.pm and both were
under the measurable amount of time.

Thanx for your help,

malte

--------------6BF11A651450B25335AE11F7
Content-Type: text/x-vcard; charset=us-ascii;
 name="ubl.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte fŸr Malte Ubl
Content-Disposition: attachment;
 filename="ubl.vcf"

begin:vcard 
n:Ubl;Malte
tel;cell:+49 173 9237521
tel;fax:+49 4121 472938
tel;home:+49 4121 438297
tel;work:+49 4121 472964
x-mozilla-html:FALSE
url:http://www.schaffhausen.de
org:Schaffhausen | Interactive
adr:;;Daimlerstrasse 17;Elmshorn;;25337;Germany
version:2.1
email;internet:ubl@schaffhausen.de
title:Developer for web-based applications
x-mozilla-cpt:;1
fn:Malte Ubl
end:vcard

--------------6BF11A651450B25335AE11F7--



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

Date: Fri, 13 Oct 2000 10:47:03 +0100
From: "Pete" <pete769@fsnet.co.uk>
Subject: which perl modules are installed by deafult if any?
Message-Id: <39e6e028.0@energise.enta.net>

Hi,

I was wondering if someone could put me straight on the following query:
Which modules are installed by default when perl is installed on Linux
and Windows '98?

I have looked at the documentation with the activestate version
and cannot figure this out.

I find that a lot of samples I come across contain phrases like:
USE XXX::YYY OR USE XXX
For example: USE DBI
I am familiar with integrating Perl with the MySQL database using the DBI
method, but am not sure whether any modules are installed by default
and can just be implementedusing the 'USE XXX' syntax.

Anyone have any views on this?

Any help received would be greatly appreciated as this would greatly
enhance my patchy knowledge of perl.

Thanks, Pete




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

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 V9 Issue 4604
**************************************


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