develooper Front page | perl.beginners | Postings from September 2009

text html from file to a scalar

Thread Next
John Plum
September 11, 2009 03:30
text html from file to a scalar
Message ID:
HI Folk,

May I introduce myself, John Plumridge, London, UK. 
      - I'm still in awe of this whole creation we're in.

Nice to meet you.

I have a reason of course, for approaching you, via my MTNews 'console'.
What a great application!

MY problem is obtaining and passing text/html from file to a scalar 
variable to be printed to mail, (using MIME::Creator).

Unfortunately I get: 'printFile(FileHandle=GLOB(0x84b66b8))'

 The reference assigned to the scalar variable is from a FileHandle sub 
routine. However, with a similar reference to sub routines, i.e. 
OrderFromForm_html(),  I get the output printed to mail without a 
problem. That sub routine  is perl processed form data passed from a 
preceding visible page in browser - 'form.html') 

With mixed success then, I'v worked hard at this. Take a look:

###----signature (html)from external file----###

my $signature_file = "/path_to/signature.html";

use FileHandle;
   my $signature = new FileHandle;
      $signature->open("<$signature_file")or die "Could not open 

sub printFile($) {
 my $fileHandle = $_[0];
    while (<$fileHandle>) {
        my $line = $_;
        print "$line\n";
$fileHandle->close(); # automatically closes file

#---Assemble/concatenate references in both ascii and html, to make full 
confirmatory message bodies with order details---

$scalar_sig = "\printFile($signature)";

my $customer_msg_html = $customer_msgStart_html  . OrderFromForm_html() 
. $customer_msgEnd_html . $scalar_sig;

#---- Create Message ---

        attributes => {
            content_type => "text/html",
            charset      => "UTF-8",
            encoding     => "quoted-printable",
            format       => "flowed",
        body => $customer_msg_html,

So, as I suggested, the message arrives with the body message all nicely 
concatenated , except for the $scalar_sig variable, which is moissing: 
and I have the 'printFile(FileHandle=GLOB(0x84b66b8))' as a nice fat 

I would really appreciate your help, and outright suggestions, as I have 
struggled with is and tests for three days now, (but I have got a lot of 
the work done (: -  though this problem has me stumped)!

John P.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About