[22424] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4645 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 28 21:11:13 2003

Date: Fri, 28 Feb 2003 18:10:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 28 Feb 2003     Volume: 10 Number: 4645

Today's topics:
        my own "modules" for want of a better name <firalu@optusnet.com.au>
    Re: my own "modules" for want of a better name <tassilo.parseval@post.rwth-aachen.de>
    Re: my own "modules" for want of a better name <tassilo.parseval@post.rwth-aachen.de>
    Re: Newbie: Trouble with time() from "learning perl" bo (cayenne)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tad McClellan)
        Problem running Sybperl scripts as root user (Apryl Ferrell)
    Re: Question about text processing <newsfeed2@boog.co.uk>
    Re: Question about text processing <krahnj@acm.org>
    Re: Question about text processing <ajglist@izzy.net>
    Re: Reading configuration files using strict (Zix)
    Re: regular expression or not <peakpeek@purethought.com>
    Re: regular expression or not <uri@stemsystems.com>
    Re: regular expression question *NOT PERL-SPECIFIC* (Tad McClellan)
    Re: search algorithm needed (Tad McClellan)
        Sending mulitple lines of text in email problem <robert.j.sipe@boeing.com>
    Re: Sending mulitple lines of text in email problem <noreply@gunnar.cc>
    Re: Sending mulitple lines of text in email problem <peakpeek@purethought.com>
    Re: Sending mulitple lines of text in email problem <REMOVEsdnCAPS@comcast.net>
    Re: Sending mulitple lines of text in email problem <robert.j.sipe@boeing.com>
    Re: sleep happening at the wrong time. <newsfeed2@boog.co.uk>
        SMTP MySQL Table Send <andrew.rich@bigpond.com>
    Re: SMTP MySQL Table Send <ian@WINDOZEdigiserv.net>
    Re: Using AuthTicket with a Mac? (Pete Keiper-White)
    Re: Using AuthTicket with a Mac? <jurgenex@hotmail.com>
        XML::Simple or other? <bushong@OCF.Berkeley.EDU>
    Re: XML::Simple or other? (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 1 Mar 2003 07:19:49 +0800
From: "Ralf Schneider" <firalu@optusnet.com.au>
Subject: my own "modules" for want of a better name
Message-Id: <3e5fee96$0$12821$afc38c87@news.optusnet.com.au>

Hi All, I'm fairly new to Perl/CGI - having crossed over from Pascal.

I'd like to create a file that contains the standard subroutines I've
written, which I use in practically every Perl program I write "loadfile();
savefile(); placeimage();.....

Can I create this file in my cgi-bin and call the functions from it. If so -
could I get a snippet of the syntax required at the two ends (at this point
I only pass scalars and arrays).

I've read about the modules that come with Perl, but it sounds like they
have to reside in the /Perl/bin folder (I don't think my ISP would allow
anyone access to those folders).

Thank you very much in advance
-Ralf.





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

Date: 28 Feb 2003 23:45:18 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: my own "modules" for want of a better name
Message-Id: <b3osae$pit$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Ralf Schneider:

> Hi All, I'm fairly new to Perl/CGI - having crossed over from Pascal.
> 
> I'd like to create a file that contains the standard subroutines I've
> written, which I use in practically every Perl program I write "loadfile();
> savefile(); placeimage();.....
> 
> Can I create this file in my cgi-bin and call the functions from it. If so -
> could I get a snippet of the syntax required at the two ends (at this point
> I only pass scalars and arrays).
> 
> I've read about the modules that come with Perl, but it sounds like they
> have to reside in the /Perl/bin folder (I don't think my ISP would allow
> anyone access to those folders).

They can reside in any directory. You just have to tell perl about it.
Here's an example with a real package. 

    # Functions.pm

    package Functions;
    
    use strict;
    
    # Exporter handles the exports of symbols so they are available
    # in your programs
    use base qw/Exporter/; 

    use vars qw/@EXPORT/;

    # Put all functions into this array if you want them to be
    # exported default-wise
    @EXPORT = qw/loadfile savefile/;

    sub loadfile {
        ...
    }

    sub savefile {
        ...
    }
    
    # modules need to return a true value. 
    1;
    __END__

And in your main-script:

    use FindBin;
    use lib $FindBin::Bin;
    use Functions;

    my $return = loadfile("file");
    __END__
    
That's all. The FindBin and lib-stuff takes care that perl knows where
Functions.pm is located. 'use lib "/path"' adds "/path" to the
directories that perl scans when use()ing a module. $FindBin::Bin is the
actual path of your script so the above will work if your module is in
the same directory as your script.
    
There is another approach using do(). It might be simpler but it's less
powerful and too restrictive on the long run. When using a module you
have several options. You could for instance use() a module without
importing its functions and variables into your script (that is, the
package of your script which is usually the package "main"):

    use Functions ();
    #             ^^ empty list: don't important anything
    my $return = Functions::loadfile("file")

That way you keep your namespaces clean. To access the functions of your
module, you have to fully qualify them with their package name.

'perldoc perlmod' gives an in-depth explanation of modules. 'perldoc
Exporter' will tell you how to export your functions and variables from
a module into your programs.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 28 Feb 2003 23:54:35 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: my own "modules" for want of a better name
Message-Id: <b3osrr$ptk$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Ralf Schneider:

[...]

Grrr, you multi-posted this question to this group and clp.modules as I
just had to realize. Don't do that! If you want your postings to appear
in several groups, do a proper cross-posting. That way, replies to your
postings will appear in both groups and keep the thread joined together.

Oh, while we're at it: don't top-post. You didn't yet, but I have the
eerie feeling that you might in the event of the thread. Tad is regularly
posting the guidelines of this group (aptly subjected "Posting
Guidelines for comp.lang.perl.misc"). Find one of these posts and read
it carefully.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 28 Feb 2003 12:57:28 -0800
From: chilecayenne@yahoo.com (cayenne)
Subject: Re: Newbie: Trouble with time() from "learning perl" book example...please help explain?
Message-Id: <2deb3d1.0302281257.127da72c@posting.google.com>

First, thanks one and all for the responses....as usual, you look at
code over, and over, and over again....and you give up..post to
USENET...1 min later...you find your problem.  The problem actually
WAS a typo in my original code....(that I didn't cut and paste )...

In the reporting code...I had a mistake where it subtracts stored time
from current time ...since there was a problem...it didn't give me
correct elapsed time...the fact that all the times it spit out were
the same should have clued me in....

Anyway, this is fun to learn, and I think I'll enjoy using Perl.
Thanks again!

CC

gpatterson@opec.org (Graham Patterson) wrote in message news:<7dfc2de8.0302280338.779dfca6@posting.google.com>...
> chilecayenne@yahoo.com (cayenne) wrote in message news:<2deb3d1.0302270856.6d55bdad@posting.google.com>...
> 
> > I'm just starting to learn some Perl. I'm using Linux RH 7.2. I'm
> > working through the first chapter of the O'Reilly book, Learning Perl.
> > There is the part where you are storing the last guess of a password
> > into a local database using dbopen.
> 
> Sounds like you have the second edition, as this program is no longer
> in chapter 1 of the third edition of the llama book. Anyway, to save
> you having to retype the examples and introducing typos, O'Reilly has
> the examples from both the second and third editions online at:
> http://examples.oreilly.com/lperl/
> 
> HTH, and have fun with Perl! Cheers, Graham


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

Date: Fri, 28 Feb 2003 17:36:50 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <slrnb5vski.1u6.tadmc@magna.augustmail.com>

Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On Thu, 27 Feb 2003 21:53:45 -0600,
>>> tadmc@augustmail.com said:
> 
>>     A note to newsgroup "regulars":
> 
>>        Do not use these guidelines as a "license to
>> flame" or other meanness. It is possible that a poster
>> is unaware of things discussed here.  Give them the
>> benefit of the doubt, and just help them learn how to
>> post, rather than assume
> 
> Did the end of this paragraph get chopped off accidentally?


Yep.

Looks like it has been that way since the start of regular postings too!

I'll fix it soon, once I figure out what it was supposed to say.  :-)

Thanks for the catch.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 28 Feb 2003 13:21:39 -0800
From: apryl.banister@cpa.state.tx.us (Apryl Ferrell)
Subject: Problem running Sybperl scripts as root user
Message-Id: <35a88b91.0302281321.14d185b5@posting.google.com>

Hello,

I would be grateful for any advice you might be able to give me with a
problem we are having executing CGI scripts as the root user.  Here's
a little info on our environment:

AIX 4.3.3
Apache 1.3.20
SybPerl 2.09

We have several SybPerl scripts that will not run in the command line
mode as the root user but run successfully as any other user on the
box (including the nobody user).  When the scripts are run as the root
user, the following error message is displayed:

window1/web/window/cgi-bin> ./test

 getting data
DB-Library error:
        Unable to connect: SQL Server is unavailable or does not
exist.
Operating-system error:
        Bad address
Can't call method "dbcmd" without a package or object reference at
 ./test line 2
3.

This seems like it might be a problem with the environment, but when I
am the root user and I su to another user and stay in the root user
environment, the script completes successfully:

window1/web/window/cgi-bin> whoami
root              
window1/web/window/cgi-bin> echo $SYBASE
/sybase  
window1/web/window/cgi-bin> su anybody
window1/web/window/cgi-bin> whoami
anybody
window1/web/window/cgi-bin> echo $SYBASE
/sybase         
window1/web/window/cgi-bin> ./test

 getting data
                           
586066HUBBARD-BOWIE         TX
355006HUBBARD-HILL          TX
266288HUDSON OAKS           TX
387947HUDSON-ANGELINA       TX
495625HUDSON-HARRIS         TX
233261HUGHES SPRINGS        TX
489127HUMBLE-HARRIS         TX   

The Sybperl script sets the environment to /sybase, so it should be
able to find the interfaces file since that's where it is located. 
Just in case, though, I put a copy of the interfaces file in the root
user's home dir.

The scripts give the same error message in the error_log when accessed
through our Apache Web server.  Our apache processes run as the user
'nobody' with the parent process owned by the root user.  The nobody
user can run the scripts via the command line, so it's probably
inheriting something (permissions? environment?) from the parent user
root that is causing it to get these errors via the Web.

The root user should have ample permissions to run the script and
access the Sybperl and Sybase files if other users can.  The
environment doesn't seem to be the problem since another user with the
root user's environment can execute the scripts successfully.

Does anyone have any thoughts/insights on this problem?  I would
appreciate any help you could offer.

Thanks in advance!
Apryl
P.S.  I put a sample of the test script below, but all of our SybPerl
scripts are acting this way.

#!/usr/local/bin/perl -w


BEGIN {
$ENV{SYBASE}="/sybase";
}

use File::Copy;
use Sybase::DBlib;

$db = "mileage";
$table = "mile_city";

print "\n getting data \n";
&GetData;


sub GetData {
        $user = "********";
        $password = "********";
        $server = "SYB_PROD";
        ((my $dbh = new Sybase::DBlib $user, $password, $server) );
        $dbh->dbcmd("use $db");
$dbh->dbsqlexec;
        $dbh->dbcmd("select * from $table ");
        $dbh->dbsqlexec;
        while($dbh->dbresults != NO_MORE_RESULTS) {
                while(@data = $dbh->dbnextrow) {
                        print @data,"\n";
                }
        }

        $dbh->dbresults;

} # end


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

Date: Fri, 28 Feb 2003 19:45:32 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Question about text processing
Message-Id: <D_O7a.7878$EN3.61547@newsfep4-glfd.server.ntli.net>

"Uri Guttman" <uri@stemsystems.com> wrote ...
>   PC> I rearranged his code so it made sure you had the string renewed
>   PC> each time, and the tr was fixed to use the /s modifier, as it
>   PC> should be.
>
> show your code.
>
> did s/// have the /g option?

S**t! This isn't my day, is it. Forgot about that. It's totally affected the
results ;-)

> did you have sequences of white space throughout the strings?

Yep. Bizarrely Helgi's string didn't. I didn't bother to put anything in to
create random strings because of laziness.. but with the new results there's no
doubt which way is faster..

Code..

timethese($count,
{ 'tr' => sub {
              $_  = "a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg
lisjafgijh  sg";
              tr/\s/ /s;
          }
, 's'  => sub {
              $_  = "a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg
lisjafgijh  sg";
              s/\s+/ /g;
          }
});

Yields..

s: 10 wallclock secs ( 9.03 usr +  0.00 sys =  9.03 CPU) @ 110692.94/s
(n=1000000)
tr:  3 wallclock secs ( 2.77 usr +  0.01 sys =  2.78 CPU) @ 359195.40/s
(n=1000000)

So tr is 'three times faster' in this example. Pretty significant if you're
doing a lot of these, I guess.

Pete




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

Date: Fri, 28 Feb 2003 20:39:27 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Question about text processing
Message-Id: <3E5FC903.2987E29@acm.org>

Peter Cooper wrote:
> 
> Yep. Bizarrely Helgi's string didn't. I didn't bother to put anything in to
> create random strings because of laziness.. but with the new results there's no
> doubt which way is faster..
> 
> Code..
> 
> timethese($count,
> { 'tr' => sub {
>               $_  = "a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg
> lisjafgijh  sg";
>               tr/\s/ /s;

You are still not using tr/// correctly.  \s has no special meaning to tr///.

$ perl -le'
$_  = "a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg    lisjafgijh  sg"; 
print;
tr/\s/ /s;
print;
'
a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg    lisjafgijh  sg
a    d gf      i   uad  ghi8o ad      fg´pg´     jg    li jafgijh   g


If you want tr/// to do the same thing as s/\s+/ /g you have to do it like this:

$ perl -le'
$_  = "a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg    lisjafgijh  sg";
print;
tr/ \t\r\n\f/ /s;
print;
'
a   sd gf     si   uad  ghi8osad      fg´pg´ s   jg    lisjafgijh  sg
a sd gf si uad ghi8osad fg´pg´ s jg lisjafgijh sg



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 01 Mar 2003 00:23:43 GMT
From: Alan Gutierrez <ajglist@izzy.net>
Subject: Re: Question about text processing
Message-Id: <slrnb6007g.381.ajglist@izzy.net>

In article <x765r4c1q1.fsf@mail.sysarch.com>, Uri Guttman wrote:
> coding rules:
> 
> 	code is for people, not computers.
> 
> 	code is for others, not yourself.
> 
> 	code is what, comments are why.

I like this. Can I quote you on this Uri? 

-- 
Alan Gutierrez - ajglist@izzy.net
http://khtml-win32.sourceforge.net/ - KHTML on Windows


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

Date: 28 Feb 2003 14:13:23 -0800
From: zix6@yahoo.com (Zix)
Subject: Re: Reading configuration files using strict
Message-Id: <3f1e5480.0302281413.6aa9b0f1@posting.google.com>

But isn't the scope that the 'do "settings.conf";" the same as the
scope as it was executed from?

 Jeff D Gleixner <glex_nospam@qwest.net> wrote in message news:<e5O7a.614$IE.47486@news.uswest.net>...
> Zix wrote:
> 
> > But, why?  Shouldn't have the version using "my" have worked also?
> 
> No.
> 
> See http://perl.plover.com/FAQs/Namespaces.html


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

Date: Fri, 28 Feb 2003 23:43:31 +0000
From: Sharon Grant <peakpeek@purethought.com>
Subject: Re: regular expression or not
Message-Id: <6grv5vkn0dreocpu41lal9k7i9goufu46n@4ax.com>

On Fri, 28 Feb 2003 15:19:12 GMT, in comp.lang.perl.misc, "D" <d@d.com> wrote:

>how would i write a regular expression to format a time field ?  i get
>values from a database like 430 and 2130, and sometimes even just 30.  i
>want those values to read 04:30,  21:30, 00:30 when i display them.  or
>should i not use a regular expression ?

No need for a regular expression

Convert to a 4-digit string
Split into 2 2-digit strings
Join the 2-digit strings with a ':'

for (430, 2130, 30) {
        print join(':', (unpack "A2" x2, sprintf("%04u", $_))), "\n";
        }

-- 
Sharon


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

Date: Fri, 28 Feb 2003 23:52:39 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: regular expression or not
Message-Id: <x7y9407yk9.fsf@mail.sysarch.com>

>>>>> "SG" == Sharon Grant <peakpeek@purethought.com> writes:

  SG> On Fri, 28 Feb 2003 15:19:12 GMT, in comp.lang.perl.misc, "D" <d@d.com> wrote:
  >> how would i write a regular expression to format a time field ?  i get
  >> values from a database like 430 and 2130, and sometimes even just 30.  i
  >> want those values to read 04:30,  21:30, 00:30 when i display them.  or
  >> should i not use a regular expression ?

  SG> No need for a regular expression

  SG> Convert to a 4-digit string
  SG> Split into 2 2-digit strings
  SG> Join the 2-digit strings with a ':'

  SG> for (430, 2130, 30) {
  SG>         print join(':', (unpack "A2" x2, sprintf("%04u", $_))), "\n";
  SG>         }

no need for a regex but why not:

	s/(\d*)(\d{2})/sprintf "%02d:$2", $1/e

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Fri, 28 Feb 2003 17:34:01 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regular expression question *NOT PERL-SPECIFIC*
Message-Id: <slrnb5vsf9.1u6.tadmc@magna.augustmail.com>

C3 <someone@microsoft.com> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnb5tqcm.26v.tadmc@magna.augustmail.com...

>> The danger of assuming an alias is that someone else might have
>> assumed the same alias, you live subject to someone _else's_ history...
> 
> Too bad this isn't even an 'alias'.


I've just never heard of someone who has an at-sign in their Real Name,
forgive my limited experience. My bad.

Did you know that "johnsmith" is running around using your real name?


>> Your address is scored down very steeply.
> 
> Oh no, what ever am I going to do, now?


Get less answers to the questions you post here.


>> Consider choosing a different one.
> 
> Consider keeping your irrelevant and saturnine opinion to yourself.


Many people had your post automatically deleted.

You will get less (or no) answers to your questions if less
people see your questions. I assume that you _do_ want to
get answers to the questions you ask. Was I wrong there?

I thought that, just in case you did not know that this was happening
to you, I'd let you know.


I answered your question.

You seem to not like that.

What was it that you were hoping for when you posted then?


> By the way, I specified it in capital letters in the subject that I'm not
> using perl.


One of my answers used only commonly available regex features,
so that shouldn't be a problem either.

If you need an answer that does not depend on common things, then
you'll need to tell us what common things are not available to you.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 28 Feb 2003 18:17:43 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: search algorithm needed
Message-Id: <slrnb5vv17.1u6.tadmc@magna.augustmail.com>

FMAS <massion@gmx.de> wrote:

> foreach $term (@term) {
> 	for($phrasecounter=0 ; $phrasecounter <= $#phrase ; $phrasecounter++)
> {


That is not very Perlish. This does the same thing (approximately), 
only easier to understand:

   foreach my $phrasecounter ( 0 .. $#phrase )


> 	$phrase = $phrase[$phrasecounter];
> 	chomp $term;
> 	chomp $phrase;


You could just do this before the loop:

   chomp @term;
   chomp @phrase;

Then you wouldn't have to chomp() them everytime you look at them.


> if ($phrase =~ m/(.*)(\b$term\b)(.*)$/gi)
                   ^^^^^         ^^^^^  ^

You don't need the .*

You don't need to capture the matched chars either, you are
taking the time to "remember" 3 things that you never use.

You don't need the m//g option.

You didn't need to chomp() for that pattern to match either.


> if ($phrase ne $phrase[$phrasecounter++]) {


That works? I'd think not, but maybe I'm wrong.

I would think you'd need *pre*increment instead:

   if ($phrase ne $phrase[++$phrasecounter]) { 


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 28 Feb 2003 22:58:09 GMT
From: "Robert" <robert.j.sipe@boeing.com>
Subject: Sending mulitple lines of text in email problem
Message-Id: <HB1Jsz.362@news.boeing.com>

Greeitngs

   I am using the sendmail sub

sub send_email2 {
   open(SENDMAIL, "|/usr/sbin/sendmail -oi -t ") or die "Can't fork for
sendmail $!\n";
   print SENDMAIL <<"EOF";
From: $from_address
To: $to_address
Subject: $subject

blah blah blah

@{$_[0]}
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely\n";
}

and need to include a list.  Currently the list is an array; @{$_[0]}.  The
problem is the array is wrapping (as one would expect).  I can't come up
with a way to include the list into my here doc so it is in a column format.
I can reformat the method to redirect a file in to sendmail but I would have
to rewrite the script and it would not be as elegant.  Please help me think
out of the box.  Thanx





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

Date: Sat, 01 Mar 2003 00:45:20 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Sending mulitple lines of text in email problem
Message-Id: <b3ot3m$1p0tde$1@ID-184292.news.dfncis.de>

Robert wrote:
> Currently the list is an array; @{$_[0]}.  The problem is the array
> is wrapping (as one would expect).  I can't come up with a way to
> include the list into my here doc so it is in a column format.

You could put the list in a scalar variable:

     my $list = join "\n", @{$_[0]};

and include that variable in the here doc instead.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sat, 01 Mar 2003 00:29:43 +0000
From: Sharon Grant <peakpeek@purethought.com>
Subject: Re: Sending mulitple lines of text in email problem
Message-Id: <j2vv5vcl9od82kjj29ld3i4k4nhug0jfni@4ax.com>

On Fri, 28 Feb 2003 22:58:09 GMT, in comp.lang.perl.misc, "Robert" <robert.j.sipe@boeing.com> wrote:

>print SENDMAIL <<"EOF";
>@{$_[0]}
>EOF
>
>and need to include a list.  Currently the list is an array; @{$_[0]}.  The
>problem is the array is wrapping (as one would expect).  I can't come up
>with a way to include the list into my here doc so it is in a column format.

This description is a big vague, "wrapping" and "column format" are 
ambiguous terms and you have not explained what data your list 
contains

Is it this simple? ...

If your list contains ('a', 'b', 'c', 'd') does your script print
a b c d

and you want
a
b
c
d

??

Can you post again, with a small, but complete working script, 
including input data, output data, and what you want the output data 
to look like

-- 
Sharon


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

Date: Fri, 28 Feb 2003 19:13:45 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Sending mulitple lines of text in email problem
Message-Id: <Xns9330CDA3DD64Asdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"Robert" <robert.j.sipe@boeing.com> wrote in
news:HB1Jsz.362@news.boeing.com: 

> and need to include a list.  Currently the list is an array; @{$_[0]}.
>  The problem is the array is wrapping (as one would expect).  I can't
> come up with a way to include the list into my here doc so it is in a
> column format. I can reformat the method to redirect a file in to
> sendmail but I would have to rewrite the script and it would not be as
> elegant.  Please help me think out of the box.  Thanx

Perhaps set $" to "\n" and then just include @{$_[0]} in the here-doc?

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPmAJFGPeouIeTNHoEQJONQCeJ5n86tbHQezvDy2riPDxrOEyyUkAn04V
2HoSvk5kkKjyeZ9ep6vzsAg1
=TAbh
-----END PGP SIGNATURE-----


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

Date: Sat, 1 Mar 2003 00:52:38 GMT
From: "Robert" <robert.j.sipe@boeing.com>
Subject: Re: Sending mulitple lines of text in email problem
Message-Id: <HB1p3o.CyJ@news.boeing.com>

Thanx Gunnar.


"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:b3ot3m$1p0tde$1@ID-184292.news.dfncis.de...
> Robert wrote:
> > Currently the list is an array; @{$_[0]}.  The problem is the array
> > is wrapping (as one would expect).  I can't come up with a way to
> > include the list into my here doc so it is in a column format.
>
> You could put the list in a scalar variable:
>
>      my $list = join "\n", @{$_[0]};
>
> and include that variable in the here doc instead.
>
> / Gunnar
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
>




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

Date: Fri, 28 Feb 2003 19:48:16 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: sleep happening at the wrong time.
Message-Id: <91P7a.7881$EN3.61305@newsfep4-glfd.server.ntli.net>

> Yup. It means that the admin of your newsserver is doing a lousy job
> (even though I still think that a newsserver carrying groups that don't
> officially exist is better than one that misses official groups; not
> that one would have a choice between those two though).

Yeah, those lousy Google admins :-)

http://groups.google.com/groups?q=comp.lang.perl&sa=N

Pete




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

Date: Sat, 01 Mar 2003 08:29:33 +1000
From: "Andrew Rich" <andrew.rich@bigpond.com>
Subject: SMTP MySQL Table Send
Message-Id: <%6R7a.57581$jM5.145894@newsfeeds.bigpond.com>

Hi,

I am trying to do this:-

1. Insert FLAG, SMTP address, Subject, Message into a MySQL table
2. every  minute, send what is in the table with the flag set to "Pending"

Do you think that perl could do this using DBI and sendmail ?

Cheers 


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

Date: Fri, 28 Feb 2003 22:56:38 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: SMTP MySQL Table Send
Message-Id: <t6qv5v0rabfrbg0mf98rfen1q9kom0em6g@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on Sat, 01 Mar 2003 08:29:33 +1000, "Andrew
Rich" <andrew.rich@bigpond.com> managed to scribble:

> Hi,
> 
> I am trying to do this:-
> 
> 1. Insert FLAG, SMTP address, Subject, Message into a MySQL table
> 2. every  minute, send what is in the table with the flag set to
> "Pending"  
> 
> Do you think that perl could do this using DBI and sendmail ?
> 
> Cheers 


Just write the mailing procedure and the database procedure. Run the
Perl script as a cronjob rather than trying to concoct a Perl timer
to do it for you.

In answer to your question, yes.



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPl/pJGfqtj251CDhEQIJIwCeLKE4JCi5p8EBIieo3ayl0DYP+j0AoK+W
r43WqBa7ghyHSnWVsdDZ+fu6
=PXJQ
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: 28 Feb 2003 12:14:36 -0800
From: pete@bostonsucks.org (Pete Keiper-White)
Subject: Re: Using AuthTicket with a Mac?
Message-Id: <888aea98.0302281214.91ec76f@posting.google.com>

I posted to this ng because the issue involves AuthTicket (which is a
perl). I also posted a simillar message to other NGs.


Pete


helgi@decode.is (Helgi Briem) wrote in message news:<3e5f76f0.1825262148@news.cis.dfn.de>...
> On 28 Feb 2003 06:35:45 -0800, pete@bostonsucks.org (Pete
> Keiper-White) wrote:
> 
> >So, I have a link to file in a protected area (protected by
> >AuthTicket). If I link to an HTML file all is fine. However, if I link
> >to a downloadable file (i.e. a StuffIt file, etc) it comes back with
> >an error that IE could not load the file. This only happens on Macs
> >running IE 5.1.6 and lower and it only happens the first time you
> >click on the file in question. On a PC it always works as desired. Has
> >anyone else seen this? Any thoughts on how to correct this?
> 
> Why on earth are you posting this to a Perl newsgroup?
> 
> Do you go to a classical music group to discuss chicken
> farming?


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

Date: Fri, 28 Feb 2003 21:46:10 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using AuthTicket with a Mac?
Message-Id: <CMQ7a.46440$ep5.17262@nwrddc02.gnilink.net>

Pete Keiper-White wrote:
> I posted to this ng because the issue involves AuthTicket (which is a
> perl). I also posted a simillar message to other NGs.

Wow, I thought there was only one perl, but apparently I am wrong: there is
another perl out there called AuthTicket.

jue




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

Date: Fri, 28 Feb 2003 23:39:34 +0000 (UTC)
From: Michael Bushong <bushong@OCF.Berkeley.EDU>
Subject: XML::Simple or other?
Message-Id: <b3orvm$no8$1@agate.berkeley.edu>

I am new to Perl (~25 hours experience now :), and I need to finish some
scripts that:

- Parse an XML document
- Assign unique IDs to a subset of the elements
- Modify some of the structures within
- Other stuff not terribly relevant

I am using ActivePerl 5.8.  I installed XML-Ximple (which I assume is
the same?) and XML-SAX-Simple.  I looked on Perldoc and it mentioned not
using XML::Simple if you have character tagging (which I do).  

I was wondering which I should use (or if there is another I have yet to
stumble across).  I assume the docs are good enough to get up and going,
but any additional things I might want to know early on that are not in
the docs might also be helpful.

-Mike


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

Date: Fri, 28 Feb 2003 19:22:41 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: XML::Simple or other?
Message-Id: <slrnb602r1.293.tadmc@magna.augustmail.com>

Michael Bushong <bushong@OCF.Berkeley.EDU> wrote:

> I am new to Perl (~25 hours experience now :), and I need to finish some
> scripts that:
> 
> - Parse an XML document


Just in case you don't know about it, there is a mailing list
specifically for discussing doing XML stuff using Perl:

   http://listserv.ActiveState.com/mailman/listinfo/perl-xml


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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.  

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


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