[28415] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9779 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 28 11:05:54 2006

Date: Thu, 28 Sep 2006 08:05:07 -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           Thu, 28 Sep 2006     Volume: 10 Number: 9779

Today's topics:
        Adding text, merge with 2nd pdf and upload it ccampise@gmail.com
    Re: Adding text, merge with 2nd pdf and upload it <bik.mido@tiscalinet.it>
        cookie problem. <skimba@dambo.di>
    Re: Deleting characters from the end of each line <mritty@gmail.com>
    Re: Free ODBC driver for UNIX rajeev.networld@gmail.com
    Re: FTP from Perl script on Windows <rvtol+news@isolution.nl>
    Re: FTP from Perl script on Windows <ilackic@yahoo.com>
        help with threads please, example included <mem.namefix@gmail.com>
    Re: help with threads please, example included <bik.mido@tiscalinet.it>
        matching date joez311@yahoo.com
    Re: matching date <David.Squire@no.spam.from.here.au>
    Re: matching date <rvtol+news@isolution.nl>
    Re: Need help with pattern matching/substitution. <rvtol+news@isolution.nl>
    Re: Need help with pattern matching/substitution. <Peter@PSDT.com>
    Re: Need help with pattern matching/substitution. <tzz@lifelogs.com>
    Re: Need help with pattern matching/substitution. <shah@typhoon.xnet.com>
        Net::SMTP module error <uctraing@ultranet.com>
    Re: Net::SMTP module error <no@email.com>
    Re: Net::SMTP module error <uctraing@ultranet.com>
    Re: Net::SMTP module error <rmoritz@quantm.invalid.co.za>
    Re: Net::SMTP module error <tzz@lifelogs.com>
    Re: Questions about Inline::C <january.weiner@gmail.com>
    Re: Questions about Inline::C <january.weiner@gmail.com>
    Re: Questions about Inline::C <peace.is.our.profession@gmx.de>
    Re: threads not executing @ same time <mem.namefix@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Sep 2006 05:44:32 -0700
From: ccampise@gmail.com
Subject: Adding text, merge with 2nd pdf and upload it
Message-Id: <1159447472.447662.308600@i42g2000cwa.googlegroups.com>

Hello all-

I'm attempting to take two existing pdf files, add text to them, merge
them into 1 single pdf, then stream that pdf to a browser allowing the
user to download the modified-single file.

I have no problem when adding text to a single document, and then
streaming that.  The text shows up correctly in the downloaded pdf.

The problem is when I add text to > 1 document, merge them into a
single document, and stream the single document.  The downloaded pdf
file doesn't contain any of the text I added, although it does merge
them correctly.

My current code :

sub stream {
    my $self = shift;

    my $dest_pdf_filename   = "my_first.pdf";
    my $source_pdf_filename = "my_second.pdf";

    my $source_pdf = PDF::API2->open( $source_pdf_filename );
    my $dest_pdf   = PDF::API2->open( $dest_pdf_filename );

    my $page     = $source_pdf->openpage(1);

    $page->text->textlabel(
        60,
        681,
        $source_pdf->corefont('Arial'),
        45,
        'TEST');

    $dest_pdf->importpage( $source_pdf, 1);

    my $cgi = new CGI;

    print $cgi->header(
        -type       => "application/pdf",
        -attachment => "forms.pdf",
    );

    $dest_pdf->stringify;

    return;
}

Any thoughts or ideas on this would be greatly appreciated!

Chris



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

Date: 28 Sep 2006 15:11:57 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Adding text, merge with 2nd pdf and upload it
Message-Id: <qeinh2hpoisqnlm4ekhsasjqlsuc59rnrr@4ax.com>

On 28 Sep 2006 05:44:32 -0700, ccampise@gmail.com wrote:

>I'm attempting to take two existing pdf files, add text to them, merge
>them into 1 single pdf, then stream that pdf to a browser allowing the
>user to download the modified-single file.

I know this is clpmisc, but how 'bout using LaTeX with the pdfpages
package? (Hence xposted to ctt!)


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Thu, 28 Sep 2006 13:43:13 +0300
From: Oobi Van Doobi <skimba@dambo.di>
Subject: cookie problem.
Message-Id: <_bNSg.21550$Rr7.12331@reader1.news.jippii.net>

Could some kind soul advice a little,please.
I have a C++ client, communicating with a perl script over http. 
I send a cookie from the script to the client, and naturally want to send it
back to the script to maintain the state. 

However, sending the cookie back to the script causes the script to crash. 

the script is simple, it accepts parameters from a form in the C++ client,
and prints them back to the client( this part works). 

There is conclusively something wrong with the format of the cookie sent
back:
the line of the cookie sent to the script is this:

Cookie:cookiename=cookieval;cookieparam1...cookieparamn.

is this correct way of sending the cookie?(correct format?)

many thank's for any advice



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

Date: 28 Sep 2006 07:01:51 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Deleting characters from the end of each line
Message-Id: <1159452111.632721.318340@e3g2000cwe.googlegroups.com>

bytebro wrote:
> Uri Guttman wrote:
> > >>>>> "PL" == Paul Lalli <mritty@gmail.com> writes:
> >
> >   PL> I knew *someone* would bring this up. :-)   While I know about the
> >   PL> 4-arg substr, I've just never gotten the hang of reading it correctly,
> >   PL> and it always causes me to do a doubletake.  Even though the concept of
> >
> > i will give you a big help on grokking 4 arg substr. it has the SAME API
>
> I thought this looked odd. I just checked in my copy of the Camel book
> (2nd Ed), and AFAICT, there's no such beast as a 4 argument substr.
> Shows how out of touch I am, I guess.  Would I be correct in assuming
> this is a relatively recent addition?

Not really, no.

http://www.perl.com/doc/manual/html/pod/perldelta.html#4th_argument_to_substr

New as of Perl 5.005, which was released in 1998.  I don't know what
version the 2nd edition of the Camel covers.  You should really
consider upgrading to the third edition (which is still only 5.6, but
better than nothing...)

Paul Lalli



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

Date: 28 Sep 2006 05:29:40 -0700
From: rajeev.networld@gmail.com
Subject: Re: Free ODBC driver for UNIX
Message-Id: <1159446580.887359.269180@m7g2000cwm.googlegroups.com>

there is something called unixodbc

neil.shadrach@corryn.com wrote:
> Can anyone recommend a free ODBC driver for use with DBI::ODBC?
> I have a trial licence from one of the recommended sources on the CPAN
> page but I'd like to try a completely free alternative.



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

Date: Thu, 28 Sep 2006 13:28:07 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: FTP from Perl script on Windows
Message-Id: <efgir2.1f8.1@news.isolution.nl>

Ivan L schreef:

> "Cannot connect to host: Net::FTP: Bad protocol 'tcp' at ftptest1.pl
> line 3."

Check out the file "%windir%\system32\drivers\etc\protocol".

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Thu, 28 Sep 2006 11:52:54 +0000 (UTC)
From: Ivan L <ilackic@yahoo.com>
Subject: Re: FTP from Perl script on Windows
Message-Id: <Xns984C8CB3142BFivanlac@213.191.133.136>

There is no "%windir%\system32\drivers\etc\protocol" file on my machine.

"Dr.Ruud" <rvtol+news@isolution.nl> wrote in news:efgir2.1f8.1@news.isolution.nl:

> Ivan L schreef:
> 
>> "Cannot connect to host: Net::FTP: Bad protocol 'tcp' at ftptest1.pl
>> line 3."
> 
> Check out the file "%windir%\system32\drivers\etc\protocol".
> 



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

Date: 28 Sep 2006 05:18:14 -0700
From: "mem" <mem.namefix@gmail.com>
Subject: help with threads please, example included
Message-Id: <1159445894.041889.305120@k70g2000cwa.googlegroups.com>

Im coding an irc bot to alert channels of new torrent releases.
threading is needed to reply to server pings else we are disconnected.

while the threads are started, they dont print anything until input is
recieved on $sock (my raw connection). complete example code below. All
help is greatly appreciated, thanks.



use threads;
use threads::shared;

use IO::Socket;

$server = "au.austnet.org";
$login = $nick = "perlbot";

my $chan = "#test1";

@arr_a = ("q", "w", "e", "r", "t", "y", "a", "s", "d", "f");
@arr_b = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");

print "\n### Connecting to irc server: $server\n\n";

our $sock = new IO::Socket::INET
(
	PeerAddr => $server,
	PeerPort => 6667,
        Proto => 'tcp'
) or die "!!! Error Couldnt connect to $server\n";

print "### Send login information\n";

print $main::sock "NICK $nick\r\n";
print $main::sock "USER $login 8 * :argghhh\r\n";

# wait for login to be confirmed

while ($input = <$main::sock>)
{
	if ($input =~ /004/)
	{
		# 004 = login confirmed
		last;
	}
	elsif ($input =~ /433/)
	{
		die "Nickname is already in use.";
	}
	elsif ($input =~ /^PING \:(.*)$/i)
	{
		# We must respond to PINGs to avoid being disconnected.
		print $sock "PONG $1\r\n";
		print "*** PONG :$1\r\n";
	}
}

print "### Connected to $server\n\n";

print $sock "JOIN $chan\r\n";
print "### Joined $chan\n";

while ($input = <$sock>)
{
	if ($input =~ /^PING \:(.*)$/i)
	{
		# We must respond to PINGs to avoid being disconnected.
		print $sock "PONG $1\r\n";
		print "*** PONG :$1\r\n";
	}
	elsif($input =~ /^\:(.*?)\!.*? PRIVMSG (\#.*?)\s+\:\!test1/)
	{
		$user = lc $1;
		push @thr, threads->create(\&speak_arr, $user, @arr_a)->detach;
	}

	elsif($input =~ /^\:(.*?)\!.*? PRIVMSG (\#.*?)\s+\:\!test2/)
	{
		$user = lc $1;
		push @thr, threads->create(\&speak_arr, $user, @arr_b)->detach;
	}
}

exit;

sub speak_arr
{
	my ($chan, @arr) = @_;

	for my $line(@arr)
	{
		print $main::sock "PRIVMSG $chan :$line\r\n";
		print ">>> $nick \@ $chan | $line\n";
		sleep 2;
		
	}
}



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

Date: 28 Sep 2006 15:58:53 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: help with threads please, example included
Message-Id: <g0jnh2p2f8oblilbvle5l7u9cf47aq17b3@4ax.com>

On 28 Sep 2006 05:18:14 -0700, "mem" <mem.namefix@gmail.com> wrote:

I don't know threads, but...

>use threads;
>use threads::shared;

  # Do a favour to yourself and
  use strict;
  use warnings;

>use IO::Socket;
>
>$server = "au.austnet.org";
>$login = $nick = "perlbot";

  perldoc -f my

>my $chan = "#test1";
>
>@arr_a = ("q", "w", "e", "r", "t", "y", "a", "s", "d", "f");
>@arr_b = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");

Hmmm... I may be wrong but I smell wheel^Whash re-inventing. Well
let's see later on...

How 'bout

  my @arr_a = qw/q w e r t y a s d f/;
  # or
  @arr_a = 'qwertyasdf' =~ /./;

anyway? How 'bout

  my @arr_b = (1..9, 0);

for the other one?

>print "\n### Connecting to irc server: $server\n\n";
>
>our $sock = new IO::Socket::INET

Why not a lexical?

>print $main::sock "NICK $nick\r\n";
>print $main::sock "USER $login 8 * :argghhh\r\n";

No harm done but no need to fully qualify $sock.

>while ($input = <$main::sock>)
>{
>	if ($input =~ /004/)
>	{
>		# 004 = login confirmed
>		last;
>	}

One good point for using the if statement input modifier. BTW: I don't
know the protocol, but are you fine with such loose checks? The
regexen seem pretty generic.

>	elsif ($input =~ /433/)
>	{
>		die "Nickname is already in use.";
>	}

No need of elseif, since this point is never reached if the previous
check succeeds.

>	elsif ($input =~ /^PING \:(.*)$/i)
>	{
>		# We must respond to PINGs to avoid being disconnected.
>		print $sock "PONG $1\r\n";
>		print "*** PONG :$1\r\n";
>	}

ditto as above.

>while ($input = <$sock>)
>{
>	if ($input =~ /^PING \:(.*)$/i)

IMHO a good point where to use $_, along with slimmer code in the
block.

>	{
>		# We must respond to PINGs to avoid being disconnected.
>		print $sock "PONG $1\r\n";
>		print "*** PONG :$1\r\n";
>	}

Deja vue! Calls for... "factorization". How 'bout a sub?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 28 Sep 2006 06:29:16 -0700
From: joez311@yahoo.com
Subject: matching date
Message-Id: <1159450156.729789.132950@e3g2000cwe.googlegroups.com>

Hi,
Can someone help me out with the following pattern match? I want to
match on the date went its formated like mm/dd/yy. I was trying:
/[0,1][0-9]/[0-3][0-9]/[0-9[0-9]/
but my match doesn't seam to work as expected. I think its because of
the / used to split the feilds. Could some one show me the correct way
to pattern match on this?
Thanks,
Zim



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

Date: Thu, 28 Sep 2006 14:40:24 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: matching date
Message-Id: <efgjc8$jp4$1@gemini.csx.cam.ac.uk>

joez311@yahoo.com wrote:
> Hi,
> Can someone help me out with the following pattern match? I want to
> match on the date went its formated like mm/dd/yy. I was trying:
> /[0,1][0-9]/[0-3][0-9]/[0-9[0-9]/
> but my match doesn't seam to work as expected. I think its because of
> the / used to split the feilds. Could some one show me the correct way
> to pattern match on this?

Hmmm. Very hard to know exactly what you want without a real Perl code
example (please read the posting guidelines for this group). Perhaps you
want something like:

my ($month, $day, $year) = ($date_string =~
m|([01][0-9])/([0-3][0-9])/([0-9][0-9])|); # Untested. Assumes there
will always be two characters per field

Note that you can use delimiters other than '/' for your regular
expression if you start with 'm' explicity.

There are also several powerful modules on CPAN for parsing dates and
times. It would be a good idea to use one of those for any serious work.


DS


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

Date: Thu, 28 Sep 2006 16:01:00 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: matching date
Message-Id: <efgrme.1f0.1@news.isolution.nl>

joez311@yahoo.com schreef:

> Can someone help me out with the following pattern match? I want to
> match on the date went its formated like mm/dd/yy. I was trying:
> /[0,1][0-9]/[0-3][0-9]/[0-9[0-9]/
> but my match doesn't seam to work as expected. I think its because of
> the / used to split the feilds. Could some one show me the correct way
> to pattern match on this?
> Thanks,
> Zim


I see a comma that probably shouldn't be there, and a missing "]", and
unescaped slashes, which leads to:

  m~[01][0-9]/[0-3][0-9]/[0-9][0-9]~



Check out Regexp::Common
http://search.cpan.org/search?module=Regexp::Common

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Thu, 28 Sep 2006 14:22:16 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Need help with pattern matching/substitution.
Message-Id: <efgm2d.k4.1@news.isolution.nl>

Hemant Shah schreef:

> I have a script that reads data from a file. Each line in a file is
> comma seperated list of values.
>
> Example:
>
> DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE   '
> DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
>
> I want to check if any value contains a quote and add another quote
> to it.

That is only possible if you can make several assumptions, from the
structure of each record.
Are they fixed length?

An error prone approach:

#!/usr/bin/perl
  use warnings ;
  use strict ;

  while ( <DATA> )
  {
    chomp ;

    # replace '...'<comma> by "..."<newline>
    s/'(.*?)',/"$1"\n/g ;

    # special treatment of the last field
    s/(?:\n|,)'(.*)'$/\n"$1"/ ;

    # double any quotes
    s/'/''/g ;

    # change all <newline>s back to commas
    s/\n/,/g ;

    print "$_\n" ;
  }

__DATA__
DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE   '
DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
DWH_TRRM|'002','A000855737',146,'02-20-2006',10,'CAN'T DELETE '

This prints:
DWH_TRRM|"001","A000855747",100,"02-20-2006","CAN DELETE   "
DWH_TRRM|"002","A000855737",146,"02-20-2006","CAN''T DELETE "
DWH_TRRM|"002","A000855737",146,"02-20-2006",10,"CAN''T DELETE "

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Thu, 28 Sep 2006 13:42:48 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Need help with pattern matching/substitution.
Message-Id: <pan.2006.09.28.13.42.45.532119@PSDT.com>

On Wed, 27 Sep 2006 18:06:56 +0000, Hemant Shah wrote:
> While stranded on information super highway Peter Scott wrote:
>> On Tue, 26 Sep 2006 22:31:57 +0000, Hemant Shah wrote:
>>> I have a script that reads data from a file. Each line in a file is comma
>>> seperated list of values.
>>> 
>>> Example:
>>> 
>>> DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE                    '
>>> DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE                  '
>> 
>> That isn't valid in any CSV format I know.  To keep us from guessing,
>> please post the specification for the syntax of the lines you are parsing.
> 
>  Yes, this is not a valid CSV format. The format is:
> 
>  TableName|CSV format for data values.

It still isn't valid.  The fields are single quoted yet the last field in
the second record has an unescaped single quote in it.  That doesn't
correspond to any CSV format I know of and is ambiguous.  Without more
information limiting the syntax, Abigail is right: your problem is
unsolvable.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Thu, 28 Sep 2006 10:52:30 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Need help with pattern matching/substitution.
Message-Id: <g69lko4t55d.fsf@CN1374059D0130.kendall.corp.akamai.com>

On 28 Sep 2006, Peter@psdt.com wrote:

On Wed, 27 Sep 2006 18:06:56 +0000, Hemant Shah wrote: 
> While stranded on information super highway Peter Scott wrote: 
>> On Tue, 26 Sep 2006 22:31:57 +0000, Hemant Shah wrote:
>>>> I have a script that reads data from a file. Each line in a file is comma
>>>> seperated list of values.
>>>>
>>>> Example:
>>>>
>>>> DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE '
>>>> DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE                  '
>>>
>>> That isn't valid in any CSV format I know.  To keep us from guessing,
>>> please post the specification for the syntax of the lines you are parsing.
>>
>> Yes, this is not a valid CSV format. The format is:
>>
>> TableName|CSV format for data values.
>
> It still isn't valid.  The fields are single quoted yet the last field in
> the second record has an unescaped single quote in it.  That doesn't
> correspond to any CSV format I know of and is ambiguous.  Without more
> information limiting the syntax, Abigail is right: your problem is
> unsolvable.

I think with the (maybe reasonable, maybe not) assumption that
internal quotes will never have a comma next to them, it's solvable.
I agree that as it stands, the format is not parseable.

The OP may want to look at the producers of that data and see if they
can be fixed to produce real CSV at the source.  It will be a lot
easier than fixing it after the damage to the data has been done.

Ted


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

Date: Thu, 28 Sep 2006 14:58:47 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Re: Need help with pattern matching/substitution.
Message-Id: <efgnv7$qek$1@new7.xnet.com>

While stranded on information super highway Dr.Ruud wrote:
> Hemant Shah schreef:
> 
>> I have a script that reads data from a file. Each line in a file is
>> comma seperated list of values.
>>
>> Example:
>>
>> DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE   '
>> DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
>>
>> I want to check if any value contains a quote and add another quote
>> to it.
> 
> That is only possible if you can make several assumptions, from the
> structure of each record.
> Are they fixed length?

 No, each line may be of different length, depending on number of columns in
 the table, also the string with quote can also be in any position in the
 list.

 The problem is that this file is generated from a COBOL program that reads
 EBCDIC data and generated ASCII file. My perl script has to read the file
 and dump data into DB2 tables. There is not much string manipulation they can
 do in COBOL so I have to do it in perl.

 It was decided that the strings will never have a '?' so the COBOL program
 now uses '?' instead of a quote in the data and my perl script replaces all
 '?' with two quotes.


> 
> An error prone approach:
> 
> #!/usr/bin/perl
>   use warnings ;
>   use strict ;
> 
>   while ( <DATA> )
>   {
>     chomp ;
> 
>     # replace '...'<comma> by "..."<newline>
>     s/'(.*?)',/"$1"\n/g ;
> 
>     # special treatment of the last field
>     s/(?:\n|,)'(.*)'$/\n"$1"/ ;
> 
>     # double any quotes
>     s/'/''/g ;
> 
>     # change all <newline>s back to commas
>     s/\n/,/g ;
> 
>     print "$_\n" ;
>   }
> 
> __DATA__
> DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE   '
> DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
> DWH_TRRM|'002','A000855737',146,'02-20-2006',10,'CAN'T DELETE '
> 
> This prints:
> DWH_TRRM|"001","A000855747",100,"02-20-2006","CAN DELETE   "
> DWH_TRRM|"002","A000855737",146,"02-20-2006","CAN''T DELETE "
> DWH_TRRM|"002","A000855737",146,"02-20-2006",10,"CAN''T DELETE "
> 
> -- 
> Affijn, Ruud
> 
> "Gewoon is een tijger."
> 
> 

-- 
Hemant Shah                           /"\  ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.           
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


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

Date: Thu, 28 Sep 2006 12:29:14 GMT
From: - Bob - <uctraing@ultranet.com>
Subject: Net::SMTP module error
Message-Id: <3gfnh2d3u9cjfs4nddo1uolfqbb8qj439t@4ax.com>

I ran into the following error when trying to run a program using
Net::smtp on a server at conversent.net. I think this is some sort of
a configuration error on their part but I don't know enough about Perl
and Unix to tell. I do know that the same program runs on other
similar servers without any problem. 

I'd be interested in whether this is something I can hack a fix to
myself or if I am required to have the systems people correct it. 

Thanks, 

Error output and program snipit follow: 

---------------------------------------------------------------------
Technical data v:: Can't locate Net/SMTP.pm in @INC (@INC contains:
/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int
/usr/perl5/site_perl/5.6.1 /usr/perl5/site_perl
/usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
/usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at
/webhome/s/mydomain.com/public_html/cgi-bin/myProgram.pl line 95.
BEGIN failed--compilation aborted at
/webhome/s/mydomain.com/public_html/cgi-bin/myprogram.pl line 95.

---------------------------------------------------------------------
#Program
---------------------------------------------------------------------
# start program
#!/usr/bin/perl -w 
use strict;
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser warningsToBrowser set_message);
# lots of code

sub send_email{

     my($to, $from, $subject, $body)=@_;
     use Net::SMTP;
     my $relay="smtp.mydomain.net";
     my $smtp = Net::SMTP->new($relay);
     die "Could not open connection: $!" if (! defined $smtp);
    $smtp->mail($from);
    $smtp->to($to);
    $smtp->data();
    $smtp->datasend("To: $to\n");
    $smtp->datasend("From: $from\n");
    $smtp->datasend("Subject: $subject\n");
    $smtp->datasend("\n");
    $smtp->datasend("$body\n");
    $smtp->dataend(); 
    $smtp->quit;
}
# end program 




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

Date: Thu, 28 Sep 2006 13:34:07 +0100
From: Brian Wakem <no@email.com>
Subject: Re: Net::SMTP module error
Message-Id: <4o1tpuFccko3U1@individual.net>

- Bob - wrote:

> I ran into the following error when trying to run a program using
> Net::smtp on a server at conversent.net. I think this is some sort of
> a configuration error on their part but I don't know enough about Perl
> and Unix to tell. I do know that the same program runs on other
> similar servers without any problem.
> 
> I'd be interested in whether this is something I can hack a fix to
> myself or if I am required to have the systems people correct it.
> 
> Thanks,
> 
> Error output and program snipit follow:
> 
> ---------------------------------------------------------------------
> Technical data v:: Can't locate Net/SMTP.pm in @INC


Your host does not have the module installed.


-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: Thu, 28 Sep 2006 13:24:58 GMT
From: - Bob - <uctraing@ultranet.com>
Subject: Re: Net::SMTP module error
Message-Id: <d6jnh2h5b9l4n4lcna7q2t73vd85o9p530@4ax.com>

On Thu, 28 Sep 2006 13:34:07 +0100, Brian Wakem <no@email.com> wrote:


>> ---------------------------------------------------------------------
>> Technical data v:: Can't locate Net/SMTP.pm in @INC
>
>
>Your host does not have the module installed.


Thanks... that's what I suspected. Is there anyway for me to
install/hack that module within my own area or do I have to have them
install no matter what ? 

As a followup, is there alternative code that might do the same thing
without the Net::SMTP  module ? 



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

Date: Thu, 28 Sep 2006 15:24:31 +0100
From: Ralph Moritz <rmoritz@quantm.invalid.co.za>
Subject: Re: Net::SMTP module error
Message-Id: <uy7s4jcgw.fsf@quantm.invalid.co.za>

- Bob - <uctraing@ultranet.com> writes:

> On Thu, 28 Sep 2006 13:34:07 +0100, Brian Wakem <no@email.com> wrote:
>
>
>>> ---------------------------------------------------------------------
>>> Technical data v:: Can't locate Net/SMTP.pm in @INC
>>
>>
>>Your host does not have the module installed.
>
>
> Thanks... that's what I suspected. Is there anyway for me to
> install/hack that module within my own area or do I have to have them
> install no matter what ? 

If @INC includes the current directory, you could simply install the
module into your program's directory.

> As a followup, is there alternative code that might do the same thing
> without the Net::SMTP  module ? 

Mail::Transport::SMTP might be an alternative.

P.S CPAN is your friend => search.cpan.org

-- 
Ralph Moritz
Quantum Solutions       Ph: +27 315 629 557
GPG Public Key: http://ralphm.info/public.gpg


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

Date: Thu, 28 Sep 2006 11:00:36 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Net::SMTP module error
Message-Id: <g69hcyst4rv.fsf@CN1374059D0130.kendall.corp.akamai.com>

On 28 Sep 2006, uctraing@ultranet.com wrote:

> As a followup, is there alternative code that might do the same thing
> without the Net::SMTP  module ? 

Since you are not doing anything fancy, you could just open a
connection to the SMTP server on port 25 and print your message.  You
have to escape lines that begin with a period, but otherwise it's
really not very complicated.  That's what the Net::SMTP module does
internally, although it handles other ESMTP commands you won't need,
judging by your original code sample.

I would strongly recommend trying to install Net::SMTP instead,
though.  Life's too short to reinvent the wheel!

Ted


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

Date: Thu, 28 Sep 2006 12:16:45 +0200 (CEST)
From: January Weiner <january.weiner@gmail.com>
Subject: Re: Questions about Inline::C
Message-Id: <efg7ed$ejj$1@sagnix.uni-muenster.de>

Sisyphus <sisyphus1@nomail.afraid.org> wrote:
> Yes, I believe so - not sure of the details but I think it has something to
> do with the possibility that perl has been compiled with its own malloc()
> function.
> Instead of malloc(), use New(). (See 'perldoc perlapi'.)

O, thanks, that's cool, many thanks.

> In perl you can quote string literals inside either single or double
> quotes - but in C you have to use double quotes. Using single quotes will

 ...oh my. That is what years of writing Perl does to you :-) Sure, I have
completly forgotten. Single quotes are for characters. Of course. Silly me
:-)

> newSVpv() has to take 2 arguments - see (again) 'perldoc perlapi'.

Typo when writing the Usenet post. I'm using newSVpvf.

Cheers,
January

-- 


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

Date: Thu, 28 Sep 2006 12:25:05 +0200 (CEST)
From: January Weiner <january.weiner@gmail.com>
Subject: Re: Questions about Inline::C
Message-Id: <efg7u1$ejj$2@sagnix.uni-muenster.de>

Mirco Wahab <peace.is.our.profession@gmx.de> wrote:
> One question in advance: Why use Inline::C if
> your C-Program is what counts. Why don't you

Not really. The C program does not do anything new (Needleman-Wunsch +
Smith-Waterman algorithms with one or two important modifications that you
will not find elsewhere). The Perl part is, apart from the parsing and
output formatting, Real Science (TM) :-) It does not take as much time to
calculate, but its tricky. 

> simply link the 'perl' to your program and
> call it with the stuff you need. This is,

You mean, call Perl from C and not C from Perl? Hmm, that could be a
solution as well.  However, I have much more stuff (and also much more
stuff that matters) in Perl than I do in C -- for my project, I have now
only two small functions in C that do a simple job quickly. For everything
else, I have my Perl. 

I am wondering, however, how complicated it is to link an existing C
library to Perl. I am sure there are dozens of examples for that, if you
know of a good one, I would love to see how it works...

> in large projects (imho) *much* simpler than
> vice versa.

Because I am lazy :-) and because it is not a large project.

> Perl will be much slower if used trivially so (I can tell
> you this). Just use your matrix in C as usual and make
> some Into-Perl-Calls if necessary, eg. by pack(...)-ing
> your variables into Perl-scalars and unpacking
> them again in the perl.

Thanks,

January

-- 


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

Date: Thu, 28 Sep 2006 15:52:15 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Questions about Inline::C
Message-Id: <efgkaq$11r$1@mlucom4.urz.uni-halle.de>

Thus spoke January Weiner (on 2006-09-28 12:25):

> I am wondering, however, how complicated it is to link an existing C
> library to Perl. I am sure there are dozens of examples for that, if you
> know of a good one, I would love to see how it works...

OK, I see your point now. You could give
a link option afaik by :

  use Inline C => Config => LIBS => '-L/your/path -lyourlib';

 ... according to the "Inline" docs

Did you think about PDL?

==>
  http://pdl.sourceforge.net/PDLdocs/API.html#creating_a_piddle_in_c

Regards

Mirco



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

Date: 28 Sep 2006 04:49:42 -0700
From: "mem" <mem.namefix@gmail.com>
Subject: Re: threads not executing @ same time
Message-Id: <1159444182.389427.25090@e3g2000cwe.googlegroups.com>


> I haven't read your code in great detail or even tried to run it. What
> caught my eye immediately was that you're joining your threads. When
> you call join() on a thread, it causes the current thread to wait for
> that thread to finish executing before continuing. If you want them to
> run in "parallel" you'll want to use detatch() instead, as in:
>
>   $thread = threads->create(\&speak_arr, $u, @arr);
>   $thread->detach();
>

Ralph,

Thanks, I did try detach and they do execute @ the same time but then
this situation occurs:

Each thread prints the 1st part of the array sent, then waits for input
newline input on the socket. So unless some1 is typing the threads halt
on the sleep command.
Without sleep command they flood and exit.



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

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


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