[25026] in Perl-Users-Digest
Perl-Users Digest, Issue: 7276 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 18:07:05 2004
Date: Wed, 20 Oct 2004 15: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, 20 Oct 2004 Volume: 10 Number: 7276
Today's topics:
Re: Any suggestions? <Jon.Ericson@jpl.nasa.gov>
Re: backup utility for remote hosts <nobull@mail.com>
Re: backup utility for remote hosts <someone@example.com>
Re: backup utility for remote hosts <someone@example.com>
Re: eval function <ioneabu@yahoo.com>
Re: eval function <ioneabu@yahoo.com>
Re: How do I print http 404 not found header? <flavell@ph.gla.ac.uk>
Re: How do I print http 404 not found header? <spamtrap@dot-app.org>
Re: HTML::Parser and <p> behaviour? (krakle)
Re: HTML::Parser and <p> behaviour? <a.newmane.remove@eastcoastcz.com>
Re: is it possible? <ron.parker@povray.org>
Re: Is PHP still slower than Perl? <onurb@xiludom.gro>
Mail::Sender - Attaching output from pipe <postmaster@localhost.localdomain>
Re: Mail::Sender - Attaching output from pipe <usa1@llenroc.ude.invalid>
Meaning of "Malformed UTF-8 character"? <elektrophyte-yahoo>
Re: options to shrink-wrap a perl script (dan baker)
Re: options to shrink-wrap a perl script <uguttman@athenahealth.com>
perl for to use imagemagick with php is the better solu <invalidamail@tucossa.it>
Re: perl for to use imagemagick with php is the better <usa1@llenroc.ude.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Oct 2004 11:09:24 -0700
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: Any suggestions?
Message-Id: <rcgu0spb6sr.fsf@Jon-Ericson.sdsio.prv>
David Warren <davidw_spam@spam_gto.net> writes:
> Jon Ericson wrote:
>> David Warren <davidw_spam@spam_gto.net> writes:
>>
>>> local $/ = "\r";
>> Do you really need this? Normally the default setting of $/ is just
>> fine.
>
> Lame doesn't print new lines to stdout, it only updates the last line.
> It only updates the portion of following line:
>
> Frame# ----> 8575<----/8575 192 kbps L R
>
> I've tried without adjusting $/ variable and the while loop doesn't
> receive any input other than 5 lines.
Ah. This is useful information. So the number before the slash is
always an integer and the number after the slash is the total number
of frames. The following should match that line and extract the two
numbers:
if (m{^Frame# +(\d+)/(\d+) +\d+ +kbps}){
my $frame = $1;
my $max_frames = $2;
...
With strictly consistent input like this, I like to match as much of
the line as possible. I think it makes it more clear what it is that
you expect.
> The excerpts from the program are working as I suggested, however I
> wanted to clean it up, learn better syntax... ;-) Next time, I'll try
> including small working example.
That would be good. The main thing missing for me is all of the
background information that you had. One of the benefits of a
self-contained example is that it reduces the number of red herrings.
> Thanks a lot for the help, I'm just trying to make it a tad bit more
> readable and tidy up the code and this was the spot that was bugging me.
> Still learning howto use regex..
That spot was a mess. :-)
Jon
------------------------------
Date: Wed, 20 Oct 2004 19:18:08 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: backup utility for remote hosts
Message-Id: <cl69sd$3lr$1@sun3.bham.ac.uk>
dan baker wrote:
> I recently hacked together a little utility to backup files from
> multiple remote hosts to a local PC. The host I use for a lot of
> websites does not offer nightly backups, and while they haven't
> crashed yet, I wanted to pull copies of databases and other files that
> get modified by server-side scripts.
> I thought that I'd just post the source in case:
> - people want to make constructive comments about how to improve the
> code
Ooooh... a code critique.
Hope you've got a think skin!
Firstly remember the golden rule:
Write less code. (Unless this would make your code less readable).
> ----------------
>
> #! /usr/bin/perl -w
The -w switch should be considered deproacted in favour of 'use warnings'.
Your code would be more mainatable if you also say 'use strict'.
> =head1
> # ------------------------------------------------------------------------------
>
> Purpose -
> This script backs up specific files from the web to local PC. Its
> intended to be run nightly by Task Manager on a PC as an "automated"
> utility that is capable of getting multiple files from multiple
> servers
> sequentially. Intended to get databases, or other files that may
> have been changed by server-side tools, and archive to a local PC
> just for
> backup in cases where the Host does not offer nightly backups, or you
> may not trust them to DO them.
>
> Input - 'requires' a config file "config_files.txt" that lists
> host,user,password
> and files to be backed up
>
> Output -
> - pulls files from remote webserver and creates a 'mirror' directory
> structure below this script on the local computer.
>
> - creates a log file and emails to desigated address for feedback
>
> History -
> written by dan_at_dtbakerprojects.com 10/2004
>
> # ------------------------------------------------------------------------------
> =cut
> # 3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-
> # ------------------------------------------------------------------------------
> # ##############################################################################
>
> # hardcoded parameters
>
> $pCGI_debuglog = './debug.txt';
>
> my $cSMTPserver = 'smtp.yourhost.net' ;
> my $Sender = '"Your Name"<you@yourdomain.com>';
> my $Recipient = $Sender ;
> my $Subject = 'web backup utility results' ;
> my $Type = 'text/plain';
> my $Body ='';
You missed a my on one of those - using strict would have pointed this
out for you.
> # ##############################################################################
> # ------------------------------------------------------------------------------
> # external modules
>
> use Net::FTP;
> use MIME::Lite ;
Comments should add something to the code, not just restate what is
already perfectly well stated in the code. Remember - "Write less code.
(Unless this would make your code less readable)". This applies to
comments too. If a comment adds no readability as in "external modules"
in front of a series of 'use' statements then you should not include it.
> # ------------------------------------------------------------------------------
> # init local vars
>
> my $tempString = '' ;
> my @tempList = () ;
> my %tempHash = () ;
> my $tempStatus = '';
Theses are bad variable names. This is the wrong place to declare them.
You should always declare all variables as lexically scoped in the
smallest applicable scope unless you have a reason not to. (This
applies in all programming languages not just Perl). The importance of
this advice must not be underestimated.
> local $host = '';
> local $username = '';
> local $password = '';
> local @FileList = ();
> local $LastRun = 0;
local() here makes no sense. You probably where thinking of 'use vars'.
Explicitly initialising an array to an empty list is totally redundant.
Explicitily initialising a scalar to 0 or '' to represent the concept
'false' or 'undefined' is inappropriate. Perl's scalars are implicitly
initialised to the special value undef and if you want a value to
repestent the concept on undefinedness that is the one to use.
> my $ftp = '';
> my $DirPath = '';
> my $LocalPath = '';
> my $FileExt = '';
> my $CurrType = 'binary';
> my $LastType = 'ascii';
This is the very much the wrong place to declare variables that are
going to be used inside a subroutine.
You should always declare all variables as lexically scoped in the
smallest applicable scope unless you have a reason not to. (This
applies in all programming languages not just Perl). The importance of
this advice must not be underestimated. I'm not kidding. This is
really very important.
> # grab the timestamp from debug file to tell when last run
>
> if (-f $pCGI_debuglog ) {
> @tempList = stat($pCGI_debuglog);
> $LastRun = $tempList[9];
Since @tempList is only being used within the block then that would be
the place to decare it. Except you could simply use a list-slice instead.
> } else {
> $LastRun = 0;
This is redundant. $LastRun is 0 already. And as I said above using
the number zero to represent the concept of undefinedness is un-Perlish.
> }
>
> $cDEBUG = 1 ; # set to 0 NOT to print debug statements to STDERR
> # set to 1 for high-level diagnostics
> # set to 'verbose' for detailed diagnostics
>
> $cDEBUG_type = 'overwrite' ;
> # 'append' | 'overwrite' debug file
You forgot to decalre those variables. Perl will do implicit variable
declaration if you omit 'use strict' but this runs a very high risk that
you'll mistype a variable name and Perl will think you really want
another variable.
> # clear and init logfile
> if ( $cDEBUG ) {
>
> if ( $cDEBUG_type eq 'append' ) { # append
> open( DEBUG_LOG , ">>$pCGI_debuglog" ) or
> die "Failed to open log at $pCGI_debuglog because $!" ;
> print DEBUG_LOG "appending to log" ;
>
> } else {
> open( DEBUG_LOG , ">$pCGI_debuglog" ) or
> die "Failed to open log at $pCGI_debuglog because $!" ;
> print DEBUG_LOG "cleared log" ;
> }
>
> print DEBUG_LOG " at [".scalar(localtime)."]\n" ;
> close DEBUG_LOG ;
> }
>
> # redirect stderr to the log
> # -----
> close STDERR ;
> open( STDERR , ">>$pCGI_debuglog" ) or
> die "Failed to redirect SDTERR because $!" ;
You just closed STDERR - where do you expect that error to go? (Don't
close STDERR).
> print STDERR "running: $0\n\n" ;
> print scalar(localtime)." running: $0\n\n" ;
>
> # ...and leave open for runtime errors
> # note that runtime msgs can be printed to STDERR regardless of
> $cDEBUG
>
> # ------------------------------------------------------------------------------
>
> require "config_files.txt" ; # pull in the hosts/files to be backed up
IMHO if the config file is written in Perl is it better to make your
utility into a module and make the confing file into a plain script that
uses the module.
> exit;
>
> # ##############################################################################
> # ##############################################################################
> sub GetFiles {
>
> $ftp = Net::FTP->new($host);
Here you are poluting the file-scoped $ftp variable. This is very bad.
You should declare $ftp here.
>
> print STDERR "\nLogging into $host \n" ;
> print "\nLogging into $host \n";
> unless ( $ftp->login( $username , $password ) ) {
> print "login to $host failed \n";
> print STDERR "login to $host failed \n";
> sleep 5;
> return(1);
> }
>
> foreach $File (@FileList) {
Get into the habit of always putting 'my' between the for and the
iterator unless you have a positive reason not to.
> # check directory tree
> # -----
> $LocalPath = '.';
> $DirPath = $host.$File ;
You sould always declare all variables as lexically scoped in the
smallest applicable scope unless you have a reason not to. So this
would have been the right place to declare those variables.
> $DirPath =~ s/(.+)\/.*$/$1/ ;
> unless ( -d $DirPath ) {
> print "gotta create local directories first...\n";
>
> @tempList = split ('/', $DirPath );
You sould always declare all variables as lexically scoped in the
smallest applicable scope unless you have a reason not to. So this
would have been the right place to declare that variable.
@tempList is still a bloody awful name. Give it a name that says
something or simply eliminate it. The variable is hardly shorter than
the split expression anyhow so you may as well just use the expression
directly.
> foreach $tempString ( @tempList ) {
> $LocalPath .= "\/$tempString" ;
> unless (-d $LocalPath ) {
> print "mkdir $LocalPath \n";
> mkdir($LocalPath , 0777);
> }
> }
> }
Consider using modules, like File::Path, for frequent tasks.
> # check type
> # -----
> if ( $File =~ m/.*\.(.+)$/ ) {
The leading .* is redundant.
> ....and the config file example
>
>
>
> # config_files.txt
> # ----------------
> # create a section for each host, and list the files to backup
> # be sure to make a call to &GetFiles between each!
>
> # ##############################################################################
> $host = 'host1.com' ;
> $username = 'user1' ;
> $password = 'password1';
> @FileList = qw(
> /public_html/employees/cgi-bin/databases/DB_OrderInfo
> );
>
> &GetFiles;
You should not use the special & prefixed syntax for calling subroutines
unless you understand and want the special semanitics it implies.
------------------------------
Date: Wed, 20 Oct 2004 19:27:43 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: backup utility for remote hosts
Message-Id: <P_ydd.36203$qU.11394@clgrps13>
Brian McCauley wrote:
>
> dan baker wrote:
>
>> I recently hacked together a little utility to backup files from
>> multiple remote hosts to a local PC. The host I use for a lot of
>> websites does not offer nightly backups, and while they haven't
>> crashed yet, I wanted to pull copies of databases and other files that
>> get modified by server-side scripts.
>
>> I thought that I'd just post the source in case:
>> - people want to make constructive comments about how to improve the
>> code
>
> Ooooh... a code critique.
Ooooh... a spelling critique.
> Hope you've got a think skin!
Hope it's THICK too! ;-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 20 Oct 2004 19:41:35 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: backup utility for remote hosts
Message-Id: <Pbzdd.36205$qU.28527@clgrps13>
Brian McCauley wrote:
>
> dan baker wrote:
>>
>> # check type
>> # -----
>> if ( $File =~ m/.*\.(.+)$/ ) {
>
> The leading .* is redundant.
No it is not, but the $ is.
$ perl -le'
for ( qw/ one.two.three.four five six.seven eight.nine.ten / ) {
print "A: $1" if m/.*\.(.+)$/;
print "B: $1" if m/\.(.+)$/;
print "C: $1" if m/.*\.(.+)/;
}
'
A: four
B: two.three.four
C: four
A: seven
B: seven
C: seven
A: ten
B: nine.ten
C: ten
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 20 Oct 2004 15:41:55 -0400
From: wana <ioneabu@yahoo.com>
Subject: Re: eval function
Message-Id: <10ndg25c6tngqa5@news.supernews.com>
Uri Guttman wrote:
>>>>>> "w" == wana <ioneabu@yahoo.com> writes:
>
> w> sub SaveToFile
> w> #takes scalar, scalar ref or array ref and a file name as arguments
> w> #and saves contentesthetice. Third, optional, arg: the word
> w> #'append' will put in append mode.
> w> {
> w> my ($data, $filename, $append) = @_;
> w> $_ = $append;
>
> blarg!! you just clobbered $_ which could be global (or localized) in
> the caller.
>
> w> $append = (defined and /^append$/i) ?'>>':'>';
Thanks for pointing that out. I had a bad feeling about that line when I
wrote it, but the reason didn't occur to me. How would you recommend
writing the two lines above, maintaining as much aesthetic appeal as
possible? I was trying to write as short a line as possible with the
minimum needed ()'s.
> w> open my $file, $append, $filename
> w> or die "Couldn't open $filename: $!";
> w> print $file @$data if ref($data) eq "ARRAY";
> w> print $file $$data if ref($data) eq "SCALAR";
> w> print $file $data if not ref $data;
> w> close $file or die "Error closing $filename: $!";
> w> }
>
> w> This is my first use ever of the ternary/trinary operator. It was
> not w> nearly as bad as I thought.
>
> look at File::Slurp on cpan which has write_file (and append_file) and
> which does this and much more and faster as well.
I'll check it out now. Thanks!
wana
>
> uri
------------------------------
Date: Wed, 20 Oct 2004 16:11:44 -0400
From: wana <ioneabu@yahoo.com>
Subject: Re: eval function
Message-Id: <10ndhq1re96of24@news.supernews.com>
wana wrote:
> Uri Guttman wrote:
>
>>>>>>> "w" == wana <ioneabu@yahoo.com> writes:
>>
>> w> sub SaveToFile
>> w> #takes scalar, scalar ref or array ref and a file name as arguments
>> w> #and saves contentesthetice. Third, optional, arg: the word
>> w> #'append' will put in append mode.
>> w> {
>> w> my ($data, $filename, $append) = @_;
>> w> $_ = $append;
>>
>> blarg!! you just clobbered $_ which could be global (or localized) in
>> the caller.
>>
>> w> $append = (defined and /^append$/i) ?'>>':'>';
>
> Thanks for pointing that out. I had a bad feeling about that line when I
> wrote it, but the reason didn't occur to me. How would you recommend
> writing the two lines above, maintaining as much aesthetic appeal as
> possible? I was trying to write as short a line as possible with the
> minimum needed ()'s.
>
local $_ = append;
Won't that fix it?
>> w> open my $file, $append, $filename
>> w> or die "Couldn't open $filename: $!";
>> w> print $file @$data if ref($data) eq "ARRAY";
>> w> print $file $$data if ref($data) eq "SCALAR";
>> w> print $file $data if not ref $data;
>> w> close $file or die "Error closing $filename: $!";
>> w> }
>>
>> w> This is my first use ever of the ternary/trinary operator. It was
>> not w> nearly as bad as I thought.
>>
>> look at File::Slurp on cpan which has write_file (and append_file) and
>> which does this and much more and faster as well.
>
> I'll check it out now. Thanks!
Your set of functions in File::Slurp is very similar to what I am writing
for my own use. I even have the exact same read_dir sub! I see that you
wrote your file access functions to be very efficient. It's hard to
believe that no matter what I think of, someone has already done it the way
I would but better. Thanks again!
wana (trying to have an original thought)
>
> wana
>
>>
>> uri
------------------------------
Date: Wed, 20 Oct 2004 19:33:54 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: How do I print http 404 not found header?
Message-Id: <Pine.LNX.4.61.0410201922460.1671@ppepc56.ph.gla.ac.uk>
On Wed, 20 Oct 2004 lesley_b_linux@yahoo.co.yuk wrote:
> > http://www.perldoc.com/perl5.8.4/pod/perlfaq9.html#What-is-the-correct-form-of-response-from-a-CGI-script-
> >
> Thanks for this URL. Can, and if so would, you say why none of the
> URL's indicated in it are hyperlinked?
I only provided some content to go into the POD to form that part of
the FAQ. Which then gets HTML-ified by some pod2html script, on which
others more familiar with the Perl distribution process may be able to
comment?
[...]
> tyvm for this link too.
With respect, one -is- supposed to familiarise oneself with the
relevant Perl FAQs before posting here (see the regular "posting
guidelines" which appear here). I'm not saying that in any personal
capacity (my little bit of FAQ is only a microscopic part of the
whole), but on behalf of all of those who generously give their time
to offer "high signal to noise ratio" (sic) quality answers here (they
know who they are...).
------------------------------
Date: Wed, 20 Oct 2004 15:09:22 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How do I print http 404 not found header?
Message-Id: <Fs-dnZ1dXtV-KuvcRVn-iw@adelphia.com>
Alan J. Flavell wrote:
> I only provided some content to go into the POD to form that part of
> the FAQ. Which then gets HTML-ified by some pod2html script, on which
> others more familiar with the Perl distribution process may be able to
> comment?
If you want links in the HTML, they need to be marked as links in the
POD markup, with L<scheme://invalid.com>. That is translated to an <a
...> element by pod2html.
There are other link formats that are used to refer to other POD
documents instead of URLs - details are in "perldoc perlpod".
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 20 Oct 2004 11:36:40 -0700
From: krakle@visto.com (krakle)
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <237aaff8.0410201036.4e7dba91@posting.google.com>
Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrncmssf8.3ss.tadmc@magna.augustmail.com>...
> Pinocchio (aka: Fred Canis, aka: 187, aka: krakle...)
uhh no.
------------------------------
Date: Wed, 20 Oct 2004 12:02:53 -0700
From: "Alfred Z. Newmane" <a.newmane.remove@eastcoastcz.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <2tnr42F212vt3U1@uni-berlin.de>
krakle wrote:
> Tad McClellan <tadmc@augustmail.com> wrote in message
> news:<slrncmssf8.3ss.tadmc@magna.augustmail.com>...
>> Pinocchio (aka: Fred Canis, aka: 187, aka: krakle...)
>
> uhh no.
It too suprises me how someone as smart as Tad can make such mistakes as
this. (I'm formerly 187, my old nick name - my /only/ other usenet/forum
name.) If someone wants to cast doubt, then post some actual evidence -
which obviously doesn't exist, for hopefully obvious reaons.
------------------------------
Date: Wed, 20 Oct 2004 14:27:21 -0500
From: Ron Parker <ron.parker@povray.org>
Subject: Re: is it possible?
Message-Id: <slrncndf0p.i8h.ron.parker@mail.parkrrrr.com>
On Wed, 20 Oct 2004 12:36:31 -0400, Sherm Pendley wrote:
> Arndt Jonasson wrote:
>
>> I don't know about others, but I'm getting some strange binary
>> sequences above, where according to "perldoc -q command", when I run
>> it, there should be simple backquotes and vertical bars. Just thought
>> I'd point it out.
>
> According to my news client, the post you're referring to is encoded as
> UTF-8, whereas yours is ISO-8859-1. Your news reader apparently doesn't
> like UTF-8.
Backtick is part of plain ASCII. Some brain-damaged so-called email clients
instead use a character in the private-use range in Unicode. If those
were really backticks, their ISO-8859-1 and UTF-8 representations would have
been identical.
http://www.fourmilab.ch/webtools/demoroniser/
--
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}
------------------------------
Date: Wed, 20 Oct 2004 22:18:16 +0200
From: bruno modulix <onurb@xiludom.gro>
Subject: Re: Is PHP still slower than Perl?
Message-Id: <4176c604$0$29525$626a14ce@news.free.fr>
Tassilo v. Parseval a écrit :
> Also sprach Joe Smith:
>
>
>>@ wrote:
>>
>>
>>>C. I don't know why it is not popular.
>>
>>I'd say it is because C does not have strings as a native data type.
>>Other than initializing an array of char, the C compiler has no
>>string manipulation built in; it requires library functions to do that.
>
>
> That's a distinction in C that's moot. It has no built-in IO mechanisms
> either. You have to include a header to get this functionality.
Including the header won't do much more than having correct
prototypes... You can also put the proto by yourself, it's just more
error prone.
> But
> nonestheless, it's still part of the language.
Of the ANSI/ISO standard, not of the core language. I/O are not builtin
constructs of the language, nor part of the language grammar. You don't
have to care about I/O when writing a C compiler. You can write a C
implementation without I/O, it won't of course be ISO/ANSI compliant but
still be legal and unmodified C syntax.
Bruno
------------------------------
Date: Wed, 20 Oct 2004 22:34:52 +0100
From: bengee <postmaster@localhost.localdomain>
Subject: Mail::Sender - Attaching output from pipe
Message-Id: <4176d9e3$0$3252$ed2619ec@ptn-nntp-reader02.plus.net>
Hi
I'm trying to send an HTML email with an inline PNG attached. I can do
this no probs as long as i'm attaching an actual PNG file. What i'd like
to do however, is attach the output of another perl program - graph.pl.
This creates a graphic (using GD.pm) and outputs to STDOUT.
Anyone know how i can capture the output of graph.pl and attach it to
the email that Mail::Sender creates. Here's the current "Attach" part of
the code (note the 'file' section is what i'm interested in):-
$rc = $mail->Attach({
'description' => 'graph.pl',
'ctype' => 'image/png',
'encoding' => 'base64',
'disposition' => "inline; filename=\"graph.png\";\r\nContent-ID: graph.pl",
'file' => '../bin/graph.pl'
});
Hope someone can help!
TIA
bengee
------------------------------
Date: 20 Oct 2004 21:49:50 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Mail::Sender - Attaching output from pipe
Message-Id: <Xns9588B56233338asu1cornelledu@132.236.56.8>
bengee <postmaster@localhost.localdomain> wrote in
news:4176d9e3$0$3252$ed2619ec@ptn-nntp-reader02.plus.net:
> I'm trying to send an HTML email with an inline PNG attached. I can do
> this no probs as long as i'm attaching an actual PNG file. What i'd
> like to do however, is attach the output of another perl program -
> graph.pl. This creates a graphic (using GD.pm) and outputs to STDOUT.
In Perl, we use backtics to get the output of a command.
perldoc -f system
> Anyone know how i can capture the output of graph.pl and attach it to
> the email that Mail::Sender creates. Here's the current "Attach" part
> of the code (note the 'file' section is what i'm interested in):-
>
> $rc = $mail->Attach({
> 'description' => 'graph.pl',
> 'ctype' => 'image/png',
> 'encoding' => 'base64',
> 'disposition' => "inline; filename=\"graph.png\";\r\nContent-ID:
> graph.pl", 'file' => '../bin/graph.pl'
> });
It looks like the Attach method does not support specifying a scalar whose
content is added (which, I guess, makes some sense).
I am going to suggest looking into the Part method.
Sinan.
------------------------------
Date: Wed, 20 Oct 2004 14:50:15 -0700
From: DM <elektrophyte-yahoo>
Subject: Meaning of "Malformed UTF-8 character"?
Message-Id: <4176ddc1$0$800$2c56edd9@news.cablerocket.com>
I'm using Perl 5.8.0 on RH Enterprise Linux. I'm trying to match this pattern:
$pattern = "href=.*?\\.pdf\[^>]*?>";
I'm seeing many of these errors:
Malformed UTF-8 character (unexpected continuation byte 0x96, with no preceding
start byte) in pattern match (m//) at /home/emicha/bin/moveFileType.pl line 79,
<INFILE> line 149.
And a few of these:
Malformed UTF-8 character (unexpected non-continuation byte 0x20, immediately
after start byte 0xe9) in pattern match (m//) at
/home/emicha/bin/moveFileType.pl line 79, <INFILE> line 51.
A Google search found a little bit of information on the second, but nothing
useful, and virtually nothing on the first.
Any help in interpreting/resolving these would be greatly appreciated.
Thanks,
dm
------------------------------
Date: 20 Oct 2004 12:22:36 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: options to shrink-wrap a perl script
Message-Id: <13685ef8.0410201122.578ac13a@posting.google.com>
Uri Guttman <uri@stemsystems.com> wrote in message news:<x7hdopcurb.fsf@mail.sysarch.com>...
> >>>>> "db" == dan baker <botfood@yahoo.com> writes:
>
> db> You have renewed my faith that there are people in this group capable
> db> of demonstrating not only knowledge, but are interested in giving
> db> complete and thoughtful answers.
>
> and you have renewed my faith in that there will always be those who
> need hand holding and then whine about it.
>
> uri
------------------
didn't your mother ever teach you to keep your mouth shut if you dont
have anything nice (or helpful) to say?
d
------------------------------
Date: Wed, 20 Oct 2004 15:39:35 -0400
From: Uri Guttman <uguttman@athenahealth.com>
Subject: Re: options to shrink-wrap a perl script
Message-Id: <m3oeixji14.fsf@linux.local>
>>>>> "db" == dan baker <botfood@yahoo.com> writes:
db> Uri Guttman <uri@stemsystems.com> wrote in message news:<x7hdopcurb.fsf@mail.sysarch.com>...
>>
>> and you have renewed my faith in that there will always be those who
>> need hand holding and then whine about it.
>>
>> uri
db> ------------------
db> didn't your mother ever teach you to keep your mouth shut if you dont
db> have anything nice (or helpful) to say?
pot. kettle. black.
at least i help others here with perl stuff and don't whine.
uri
------------------------------
Date: Wed, 20 Oct 2004 21:19:15 GMT
From: provaands <invalidamail@tucossa.it>
Subject: perl for to use imagemagick with php is the better solutions?
Message-Id: <nDAdd.173877$35.8360562@news4.tin.it>
For to use ImageMagick with Php is necessary to do a call to the
programm with command exec, or system, or shell_exec etc..; but this is
no good;
I do not want a directly called to system. I have found that interface
with Perl is the better solution. Is real? So, the safe_mode can
remain on ?
Is there a module Perl (I not know the language) ?
Is there a link with example for to do this?
Thank
------------------------------
Date: 20 Oct 2004 21:30:22 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: perl for to use imagemagick with php is the better solutions?
Message-Id: <Xns9588B21553ADFasu1cornelledu@132.236.56.8>
provaands <invalidamail@tucossa.it> wrote in
news:nDAdd.173877$35.8360562@news4.tin.it:
> For to use ImageMagick with Php is necessary to do a call to the
> programm with command exec, or system, or shell_exec etc..; but this is
> no good;
...
> Is there a module Perl (I not know the language) ?
>
> Is there a link with example for to do this?
http://search.cpan.org/~jcristy/PerlMagick-6.02/
Sinan.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7276
***************************************