[22374] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4595 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 20 18:06:26 2003

Date: Thu, 20 Feb 2003 15:05:11 -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           Thu, 20 Feb 2003     Volume: 10 Number: 4595

Today's topics:
    Re: & befoer subroutine call <REMOVEsdnCAPS@comcast.net>
        /^-?(?:\d+(?:\.\d*)?\d+)$/ <remccart@uiuc.edu.spam>
    Re: /^-?(?:\d+(?:\.\d*)?\d+)$/ <rgarciasuarez@free.fr>
    Re: /^-?(?:\d+(?:\.\d*)?\d+)$/ <uri@stemsystems.com>
        A regex to shorten up this command line <oxmard.Rules@ab.ab>
    Re: A regex to shorten up this command line (Anno Siegel)
    Re: A regex to shorten up this command line (Jay Tilton)
    Re: creating a command line alias <me@privacy.net>
    Re: creating a command line alias <hasting@agere.com>
        having PERL respond to a key press <tyrannous@o-space.com>
        inserting a string into an LWP post (Jason Quek)
    Re: inserting a string into an LWP post <peakpeek@purethought.com>
        modifying text (david)
    Re: modifying text <rereidy@indra.com>
    Re: Newbie Q re form to mail script FormProcessorPro (Anno Siegel)
    Re: Newbie Q re form to mail script FormProcessorPro (Jay Tilton)
    Re: Parsing Unix mbox in MS Environment <tassilo.parseval@post.rwth-aachen.de>
    Re: Parsing Unix mbox in MS Environment <vampire@tiamat.obscure.org>
    Re: Parsing Unix mbox in MS Environment <tassilo.parseval@post.rwth-aachen.de>
    Re: Perl Library to execute stored procedures in MS-SQL <s.patterson@freeuk.com>
    Re: pipe() + fork() + exit() == problem? <goldbb2@earthlink.net>
    Re: pipe() + fork() + exit() == problem? <gordan@_NOSPAM_bobich.net>
        Redirecting STDOUT to Socket <demetros@edamail.fishkill.ibm.com>
    Re: Redirecting STDOUT to Socket <demetros@edamail.fishkill.ibm.com>
    Re: Redirecting STDOUT to Socket <demetros@edamail.fishkill.ibm.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Feb 2003 16:52:22 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: & befoer subroutine call
Message-Id: <Xns9328B5C877215sdn.comcast@216.166.71.239>

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

mans.breimer@ubs.com (mans) wrote in 
news:a4f94baa.0302200612.3963aaae@posting.google.com:

> Hello,
> 
> Just wondering if there is a difference in calling my subroutine
> like this: 
>     my $retVal= mysubroutine($param); 
> 
> compared to:
>     my $retVal= &mysubroutine($param);
> 
> At least I find the notation without the ampersand easier to read...

The & is a (mostly) obsolete holdover from perl 4.  It is not required, 
and serious perl programmers don't use it, in my experience.

The difference between the two above is that the latter will ignore 
mysubroutine's prototype, if it has one (few subroutines have or need 
prototypes).

A trickier situation exists in the following:

    my $retval = &mysubroutine;

With an ampersand and no argument list, mysubroutine will get called with 
the current @_, which is of almost no use in practice, and can be a 
source of hard-to-find bugs.

- -- 
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/AwUBPlVcDmPeouIeTNHoEQKeJACfYqn4Bbj+QLDc3HB+jYd/BxnWlGMAnA0l
nrE/FRvnDrBy+BPs+iwIxuyo
=aytF
-----END PGP SIGNATURE-----


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

Date: Thu, 20 Feb 2003 14:43:50 -0600
From: Ryan McCarthy <remccart@uiuc.edu.spam>
Subject: /^-?(?:\d+(?:\.\d*)?\d+)$/
Message-Id: <A1b5a.871$o7.11158@vixen.cso.uiuc.edu>

Can somebody provide me some insight as to why the following matches 
numbers like 25, 25.0, 5.0 but NOT '5'?  Thanks!

/^-?(?:\d+(?:\.\d*)?\d+)$/



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

Date: 20 Feb 2003 20:52:35 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: /^-?(?:\d+(?:\.\d*)?\d+)$/
Message-Id: <slrnb5ag0p.tu.rgarciasuarez@dat.local>

Ryan McCarthy wrote in comp.lang.perl.misc :
> Can somebody provide me some insight as to why the following matches 
> numbers like 25, 25.0, 5.0 but NOT '5'?  Thanks!
> 
> /^-?(?:\d+(?:\.\d*)?\d+)$/

Remove the ()? and ()* parts to see what mandatory parts remain, and
you'll get your fish.

-- 
Round up the usual suspects. -- Capitaine Louis Renault, in "Casablanca".


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

Date: Thu, 20 Feb 2003 20:53:23 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: /^-?(?:\d+(?:\.\d*)?\d+)$/
Message-Id: <x7isveptbx.fsf@mail.sysarch.com>

>>>>> "RM" == Ryan McCarthy <remccart@uiuc.edu.spam> writes:

  RM> Can somebody provide me some insight as to why the following matches
  RM> numbers like 25, 25.0, 5.0 but NOT '5'?  Thanks!

  RM> /^-?(?:\d+(?:\.\d*)?\d+)$/
             ^^^          ^^^

each of those matches at least 1 digit so single digit numbers will
never be matched

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: Thu, 20 Feb 2003 13:20:07 -0600
From: "Peter Shankey" <oxmard.Rules@ab.ab>
Subject: A regex to shorten up this command line
Message-Id: <9YScnfoeuuT1t8ijXTWcqg@comcast.com>

c:\wip\perl>perl -v

This is perl, v5.8.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)


After I RTFM a bit I came up with this:

perl -ne "if (/A_String/){$seen{$i}++;}END {print $seen{$i}}"
load_customers.sql

However is there a way to shorten this up a bit. Something like

perl -ne "some_regex/A_String/" load_customers.sql

that would print out the number of lines matched in the file?

Thanks




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

Date: 20 Feb 2003 22:12:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: A regex to shorten up this command line
Message-Id: <b33jrr$qfn$4@mamenchi.zrz.TU-Berlin.DE>

Peter Shankey <oxmard.Rules@ab.ab> wrote in comp.lang.perl.misc:
> c:\wip\perl>perl -v
> 
> This is perl, v5.8.0 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)
> 
> 
> After I RTFM a bit I came up with this:
> 
> perl -ne "if (/A_String/){$seen{$i}++;}END {print $seen{$i}}"
> load_customers.sql

I can't help wondering what FM recommends using "$seen{$i}" as a scalar
variable.  This is, frankly, nonsense.

> However is there a way to shorten this up a bit. Something like

    perl -lne '$seen++ if /A_String/; END{ print $seen}' load_customers.sql

Anno


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

Date: Thu, 20 Feb 2003 22:43:53 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: A regex to shorten up this command line
Message-Id: <3e5551c0.55258786@news.erols.com>

 "Peter Shankey" <oxmard.Rules@ab.ab> wrote:

: c:\wip\perl>perl -v
: 
: This is perl, v5.8.0 built for MSWin32-x86-multi-thread
: (with 1 registered patch, see perl -V for more detail)
: 
: After I RTFM a bit I came up with this:
: 
: perl -ne "if (/A_String/){$seen{$i}++;}END {print $seen{$i}}"
: load_customers.sql

What's the significance of the %seen hash?

: However is there a way to shorten this up a bit. 

Any old scalar could be used in the place of $seen{$i}

    perl -ne "if (/A_String/){$i++}END{print $i}" load_customers.sql

Which can be restructured into

    perl -ne "$i++ if/A_String/;END{print $i}" load_customers.sql

Other stabs at golfing it:

    perl -ne "END{print$i}$i+=/A_String/" load_customers.sql
    perl -e "print 0+grep/A_String/,<>" load_customers.sql
    perl -pe "$_=($i+=/A_String/)x eof" load_customers.sql

The second one is stupid.  The third is fragile.  Go with the first.



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

Date: Fri, 21 Feb 2003 08:05:23 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: creating a command line alias
Message-Id: <b33fup$1itt09$1@ID-172104.news.dfncis.de>


"Joe Hasting" <hasting@agere.com> wrote in message
news:b33eno$19a$1@test-nntp.agere.com...
> I would like a PERL program to create a UNIX command line alias.  I tried
> using system, exec, and the ticks, but it seems that when the process for
> the PERL program is complete, it does not leave the alias.  Is there a way
> to fork this process so that the alias remains after the PERL program
> completes?

FAQ

perldoc -q environment




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

Date: Thu, 20 Feb 2003 17:38:53 -0500
From: "Joe Hasting" <hasting@agere.com>
Subject: Re: creating a command line alias
Message-Id: <b33lms$3o0$1@test-nntp.agere.com>

Thanks,

I am not sure how to access the FAQ from the command you've written, could
you give more instruction?

J



"Tintin" <me@privacy.net> wrote in message
news:b33fup$1itt09$1@ID-172104.news.dfncis.de...
>
> "Joe Hasting" <hasting@agere.com> wrote in message
> news:b33eno$19a$1@test-nntp.agere.com...
> > I would like a PERL program to create a UNIX command line alias.  I
tried
> > using system, exec, and the ticks, but it seems that when the process
for
> > the PERL program is complete, it does not leave the alias.  Is there a
way
> > to fork this process so that the alias remains after the PERL program
> > completes?
>
> FAQ
>
> perldoc -q environment
>
>




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

Date: Thu, 20 Feb 2003 21:14:18 -0000
From: <tyrannous@o-space.com>
Subject: having PERL respond to a key press
Message-Id: <b33ge0$doj$1@news8.svr.pol.co.uk>

I want to have perl exit from a WHILE loop when the user presses a certain
key on the keyboard

for example of what i want:

while(not $something)
{

   if($keypress eq "a")
   {

      do something

   }

}

before you answer this question, remember that i have already tried
Term::ReadKey and it wont work on my MS-DOS system. plz help me if you can





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

Date: Thu, 20 Feb 2003 15:20:08 GMT
From: jason@jumpsql.com (Jason Quek)
Subject: inserting a string into an LWP post
Message-Id: <3e58f156.14100328@news.starhub.net.sg>

I use the following to send an HTTP Post using LWP:

#----------------------------------------------------------------------
my $req = POST 'http://www.url.com/script.cgi', 
		[ firstname => "$firstname",
		  lastname => "$lastname",
		  emailaddr => "$email",
		  password => "$password",
		  Categories => "JN001",
		  Categories => "JN002",
		  Categories => "JN003",
		  didsubmit => '1',
		  button1 => 'Submit Resume',
		  buttonSubmit => 'Submit Resume' ];
$ua->request($req)->as_string;
$ua->request($req);
#----------------------------------------------------------------------

This works.

However, the Categories lines must be dynamic as it could vary between
1-3 Categories, so if there are only two categories, it should look
like:

#----------------------------------------------------------------------
		...
		  Categories => "JN001",
		  Categories => "JN002",
		...
#----------------------------------------------------------------------

If I stored the categories lines in a string, for example:

$categories = "Categories => \"JN001\";\nCategories => \"JN002\";\n";

How do I insert this string into the above code so it looks something
like this:

#----------------------------------------------------------------------
my $req = POST 'http://www.url.com/script.cgi',
		[ firstname => "$firstname",
		  lastname => "$lastname",
		  emailaddr => "$email",
		  password => "$password",
		  $categories
		  didsubmit => '1',
		  button1 => 'Submit Resume',
		  buttonSubmit => 'Submit Resume' ];
$ua->request($req)->as_string;
$ua->request($req);
#----------------------------------------------------------------------


I would appreciate any help with this problem.

Regards,




Jason Quek


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

Date: Thu, 20 Feb 2003 21:41:31 +0000
From: Sharon Grant <peakpeek@purethought.com>
Subject: Re: inserting a string into an LWP post
Message-Id: <5dia5vkk2jac4fgp5q0ro59nbi8j46cu6c@4ax.com>

On Thu, 20 Feb 2003 15:20:08 GMT, in comp.lang.perl.misc, jason@jumpsql.com (Jason Quek) wrote:

>I use the following to send an HTTP Post using LWP:
>
>#----------------------------------------------------------------------
>my $req = POST 'http://www.url.com/script.cgi', 
>		[ firstname => "$firstname",
>		  lastname => "$lastname",
>		  emailaddr => "$email",
>		  password => "$password",
>		  Categories => "JN001",
>		  Categories => "JN002",
>		  Categories => "JN003",
>		  didsubmit => '1',
>		  button1 => 'Submit Resume',
>		  buttonSubmit => 'Submit Resume' ];
>$ua->request($req)->as_string;
>$ua->request($req);
>#----------------------------------------------------------------------
>
>This works.
>
>However, the Categories lines must be dynamic as it could vary between
>1-3 Categories, so if there are only two categories, it should look
>like:
>
>#----------------------------------------------------------------------
>		...
>		  Categories => "JN001",
>		  Categories => "JN002",
>		...
>#----------------------------------------------------------------------
>
>If I stored the categories lines in a string, for example:
>
>$categories = "Categories => \"JN001\";\nCategories => \"JN002\";\n";
>
>How do I insert this string into the above code so it looks something
>like this:
>
>#----------------------------------------------------------------------
>my $req = POST 'http://www.url.com/script.cgi',
>		[ firstname => "$firstname",
>		  lastname => "$lastname",
>		  emailaddr => "$email",
>		  password => "$password",
>		  $categories
>		  didsubmit => '1',
>		  button1 => 'Submit Resume',
>		  buttonSubmit => 'Submit Resume' ];
>$ua->request($req)->as_string;
>$ua->request($req);
>#----------------------------------------------------------------------


Don't use a string, just make an array ...


@categories = ("JN001", "JN002", "JN003");

my $req = POST 'http://www.domain.tld/script.cgi',
                [ firstname => "$firstname",
                  lastname => "$lastname",
                  emailaddr => "$email",
                  password => "$password",
                  Categories => \@categories,
                  didsubmit => '1',
                  button1 => 'Submit Resume',
                  buttonSubmit => 'Submit Resume' ];
$ua->request($req)->as_string;
$ua->request($req);

-- 
Sharon


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

Date: 20 Feb 2003 13:11:13 -0800
From: dwlepage@yahoo.com (david)
Subject: modifying text
Message-Id: <b09a22ae.0302201311.ecee0c7@posting.google.com>

I am fairly new to perl so this question may seem very basic. I am
trying to write a perl script that looks at the contents of a given
 .ini file for 4 specific settings. By default, if these settings are
commented out, they are not configured so I want to first check for
this. If they are I want to exit, if not, I want to prompt for the
settings.

print "Please enter the IP of your NEXT machine\n";
$nextmac = <STDIN>;
open(CONFIG, "config.ini") || die "Can't open: $!\n";
while ( chomp($line = <CONFIG>) ) {

print "$line\n" if $line =~ /FirstMachine/;
print "$line\n" if $line =~ /SecondMachine/;
print "$line\n" if $line =~ /Listener/;


So far I haven't gotten very far, but I can open the filehandle, and
print the lines I want to look at. Should I be adding all of these
lines into an Array and modifying them then? The ini file looks
similar to this:
firstmachine=<ip><port>
login=
password=
secondmachine=<ip><port>
login=
password=
Listener=

So I may have repetitve 'login' or 'password' lines that I cannot
confuse with each other.. Any hints on how to proceed?

Thanks,


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

Date: Thu, 20 Feb 2003 14:44:30 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: modifying text
Message-Id: <3E554C3E.6060809@indra.com>

Look at the Config::IniFile module at 
http://search.cpan.org/author/WADG/Config-IniFiles-2.37/IniFiles.pm

--
Ron Reidy
Oracle DBA

david wrote:
> I am fairly new to perl so this question may seem very basic. I am
> trying to write a perl script that looks at the contents of a given
> .ini file for 4 specific settings. By default, if these settings are
> commented out, they are not configured so I want to first check for
> this. If they are I want to exit, if not, I want to prompt for the
> settings.
> 
> print "Please enter the IP of your NEXT machine\n";
> $nextmac = <STDIN>;
> open(CONFIG, "config.ini") || die "Can't open: $!\n";
> while ( chomp($line = <CONFIG>) ) {
> 
> print "$line\n" if $line =~ /FirstMachine/;
> print "$line\n" if $line =~ /SecondMachine/;
> print "$line\n" if $line =~ /Listener/;
> 
> 
> So far I haven't gotten very far, but I can open the filehandle, and
> print the lines I want to look at. Should I be adding all of these
> lines into an Array and modifying them then? The ini file looks
> similar to this:
> firstmachine=<ip><port>
> login=
> password=
> secondmachine=<ip><port>
> login=
> password=
> Listener=
> 
> So I may have repetitve 'login' or 'password' lines that I cannot
> confuse with each other.. Any hints on how to proceed?
> 
> Thanks,



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

Date: 20 Feb 2003 20:51:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie Q re form to mail script FormProcessorPro
Message-Id: <b33f5d$qfn$1@mamenchi.zrz.TU-Berlin.DE>

Trilby  <notworking@all.com> wrote in comp.lang.perl.misc:
> While busily concocting a devastating reply anno4000@lublin.zrz.tu-
> berlin.de retorted
> > You asked what you *think* is a simple question.  What you did ask
> > is for somebody to debug your script.  Since you didn't give any
> > information, the request to study the package was implicit.
> 
> Bullshit.  A simple question.

No question is simple when a fool asks it.

Anno


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

Date: Thu, 20 Feb 2003 22:55:09 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Newbie Q re form to mail script FormProcessorPro
Message-Id: <3e555bcd.57831997@news.erols.com>

Trilby <notworking@all.com> wrote:

: While busily concocting a devastating reply tiltonj@erols.com retorted
: >  Do I take it that there is no 'obvious' solution ?
: > 
: > No idea.  It may be obvious to someone familiar with the package,
: > which Perl programmers are evidently not.  Not many will go to the
: > trouble of acquiring and studying a package to debug somebody else's
: > hangup.  Not for free, anyway.
: 
: Jeeez I just asked a simple question, mate.  

I am not your mate.

: I didn't ask anyone to 'study a package' or debug someone else's 
: script.

A physician may be asked an apparently simple question.  "Why does my
foot hurt?"  He will take x-rays or run blood tests to diagnose the
illness accurately.  These are his tools, and he will use them whether
asked to or not.

Program analysis and debugging skill are the programmer's tools.
Their use is integral to the task.  A request to use them is implicit.
A request not to use them is baffling.

: No need to the sarcasm.

There was no sarcasm.  Just facts.

Supporting software requires familiarity.  Becoming familiar requires
work.  Work doesn't happen without some reward or benefit.

If the software looks useful or interesting to a programmer, the work
may carry its own benefit, and he might give informal support.

But this software does not seem at first glance to be especially
useful or interesting to a programmer.  The only thing left to
motivate him is to pay for his services.

The author/vendor's support services will give better short-term
value.

: > Best guess, and it's a real WAG, is there's some CRLF mistranslation
: > going on when the template is uploaded onto the server.
: > 
: And that was so difficult, was it ?

Was that a thank you?

You're welcome.



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

Date: 20 Feb 2003 19:39:00 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Parsing Unix mbox in MS Environment
Message-Id: <b33ask$3p9$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Dave:

> I need to be able to post unix (and netscape - which is in the same
> format for certain versions) mailbox folders
> /var/spool/mail/<username> in perl, but I need it to run on a
> Microsoft environment.  Every Perl Module I have found for this
> requires Unix - such as Mail::Folder (which is exactly what I need). 
> Anyone able to point me to a module that will do this in the MS
> environment.  The code to deal with individual mails, attachments,
> etc. in MIME is already done, so it would be great if I could extract
> MIME entities outof it.  I am currently looking at Mail::MboxParser
> but not sure if that is going to do the trick.

M::MboxParser does work under Windows all right. If you are about to do
really sophisticated things, also have a look at Mail::Box (by and large
working under Win as well). In this case however you should subscribe to
the mailing-list since the module is comprehensive, powerful and large.
Details to be found at

    http://perl.overmeer.net/mailbox/index.html

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: 20 Feb 2003 21:00:33 GMT
From: vampire <vampire@tiamat.obscure.org>
Subject: Re: Parsing Unix mbox in MS Environment
Message-Id: <b33flh$f6n@dispatch.concentric.net>


Thanks for the info.  Am I correct in saying that Mail::MboxParser does not
return a MIME entity that I could then send to the other code that we have
written for dealing with single mails + attachments.  I realize that 
MboxParser could also extract the atachments and the like, but would like to
utilize the existing code that we have (that includes various stuff that we
need to do that is specific to our program).  Or can Mboxparser write the
individual mails + their MIME attachments to files?  And thanks for the
hint on Mail::Box.  I haven't had time to work on this since posting the message
this afternoon, so I haven't worked farther with MboxParser yet.  Starting to 
do that now.  Once again, thanks for your help.  Nice when the author of the 
module is the one actually giving you the answers!

-david

Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
> Also sprach Dave:

>> I need to be able to post unix (and netscape - which is in the same
>> format for certain versions) mailbox folders
>> /var/spool/mail/<username> in perl, but I need it to run on a
>> Microsoft environment.  Every Perl Module I have found for this
>> requires Unix - such as Mail::Folder (which is exactly what I need). 
>> Anyone able to point me to a module that will do this in the MS
>> environment.  The code to deal with individual mails, attachments,
>> etc. in MIME is already done, so it would be great if I could extract
>> MIME entities outof it.  I am currently looking at Mail::MboxParser
>> but not sure if that is going to do the trick.

> M::MboxParser does work under Windows all right. If you are about to do
> really sophisticated things, also have a look at Mail::Box (by and large
> working under Win as well). In this case however you should subscribe to
> the mailing-list since the module is comprehensive, powerful and large.
> Details to be found at

>     http://perl.overmeer.net/mailbox/index.html

> 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: 20 Feb 2003 22:29:59 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Parsing Unix mbox in MS Environment
Message-Id: <b33kt7$e15$1@nets3.rz.RWTH-Aachen.DE>

[ Please stick to the conventions of this group and put your reply 
  under the parts you are quoting. Posting re-arranged. ]
  
Also sprach vampire:

> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:

>> M::MboxParser does work under Windows all right. If you are about to do
>> really sophisticated things, also have a look at Mail::Box (by and large
>> working under Win as well). In this case however you should subscribe to
>> the mailing-list since the module is comprehensive, powerful and large.
>> Details to be found at
> 
>>     http://perl.overmeer.net/mailbox/index.html

> Thanks for the info.  Am I correct in saying that Mail::MboxParser does not
> return a MIME entity that I could then send to the other code that we have
> written for dealing with single mails + attachments.  

No, you are not. It does return MIME::Entity objects if you ask it to
(get_entities() method on mail objects).

> I realize that MboxParser could also extract the atachments and the
> like, but would like to utilize the existing code that we have (that
> includes various stuff that we need to do that is specific to our
> program).  Or can Mboxparser write the individual mails + their MIME
> attachments to files? 

Unfortunately not, it's parse-only. But you are certainly free to use
the functionality of MIME::Entity (or Mail::Internet) on the mails as
wells. Their methods are provided via AUTOLOAD. 

> And thanks for the hint on Mail::Box.  I haven't had time to work on
> this since posting the message this afternoon, so I haven't worked
> farther with MboxParser yet.  Starting to do that now.  Once again,
> thanks for your help.  Nice when the author of the module is the one
> actually giving you the answers!

Or not so nice considering that the author is likely to be biased
towards his own work. ;-)
Anyway, Mail::Box should be the way to go when you reach MboxParser's
limits (it was written with a few common tasks in mind; some others are
better handled with M::Box).

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: 20 Feb 2003 19:33:38 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: Re: Perl Library to execute stored procedures in MS-SQL Server
Message-Id: <slrnb5abcf.hnh.s.patterson@seagoon.localdomain>

On 20 Feb 2003 07:11:38 -0800, Ye H. Aung wrote:
> Hello,
> 
> I am trying to write Perl wrapper to run stored procedure in MS SQL
> Server. I am looking at the following two Perl modules:

Have you tried DBD::Sybase (yes this does work with MS SQL), this can
execute stored procedures.

$sql = 'exec my_proc';
$sth=$dbh->prepare($sql); 
and so on in the DBI manner.

-- 
Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu
steve@SPAM.lexx.uklinux.net  remove SPAM to reply        
Linux Counter No: 142831 GPG Public key: 252B8B37        
Last one down the pub's an MCSE


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

Date: Thu, 20 Feb 2003 17:01:31 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: pipe() + fork() + exit() == problem?
Message-Id: <3E55503B.BF717F5D@earthlink.net>

Gordan wrote:
[snip]
> OK, let me try using sysread() instead or read() as that is the only
> thing not already being done...
> 
> OK, I'm feeling really stupid now. That works fine.
> 
> If I was having problems caused by buffering that read() does, then
> how come none of the data in the pipe was ever getting corrupted when
> multiple threads were reading/writing that pipe? There are thousands
> of things going in and out of the pipes, so I'm not convinced I was
> just being lucky...

I'm afraid you were just lucky -- the most likely explanation is that
the size of the read()-buffer was always larger than the size of the
outstanding data, and thus you always got an integral number of
requests, thus never accidentally getting a fractional record.  If the
size of the buffers for read() are big enough, and if your workers were
processing tasks fast enough, then data corruption is unlikely.

By the way, the "normal" way to indicate that it's time for the worker
processes to die out, is to have the parent process to close the pipe
that's writing the tasks to the worker queues; when they detect EOF,
they exit.  You probably wouldn't have realized that you had a problem
if you were doing things this way -- what were you doing instead?

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: Thu, 20 Feb 2003 22:43:24 +0000
From: Gordan <gordan@_NOSPAM_bobich.net>
Subject: Re: pipe() + fork() + exit() == problem?
Message-Id: <1045781003.558725@auth2.dns.griffin.net.uk>

Benjamin Goldberg wrote:

> Gordan wrote:
> [snip]
>> OK, let me try using sysread() instead or read() as that is the only
>> thing not already being done...
>> 
>> OK, I'm feeling really stupid now. That works fine.
>> 
>> If I was having problems caused by buffering that read() does, then
>> how come none of the data in the pipe was ever getting corrupted when
>> multiple threads were reading/writing that pipe? There are thousands
>> of things going in and out of the pipes, so I'm not convinced I was
>> just being lucky...
> 
> I'm afraid you were just lucky -- the most likely explanation is that
> the size of the read()-buffer was always larger than the size of the
> outstanding data, and thus you always got an integral number of
> requests, thus never accidentally getting a fractional record.  If the
> size of the buffers for read() are big enough, and if your workers
> were processing tasks fast enough, then data corruption is unlikely.

Hmm... Interesting. I did notice that the data was always written to the
pipes in much larger blocks than it is now. I'm guessing the flock()
helped, too.

> By the way, the "normal" way to indicate that it's time for the worker
> processes to die out, is to have the parent process to close the pipe
> that's writing the tasks to the worker queues; when they detect EOF,
> they exit.  You probably wouldn't have realized that you had a problem
> if you were doing things this way -- what were you doing instead?

The input and output queue pipes are always left open, so that the new
children can pick them up.

Each worker thread reads a setting from an .ini file that tells it what
it's "time to live" is. When that many jobs are processed, the process
exits.

The parent does a wait() loop, and whenever it finds that a process has
exited, it checks if all the tasks are complete. If they are, it just
waits until all processes exit. If there are still jobs left to be
done, it forks another process to replace the one that just exited.

I didn't use the method of just closing the input pipe on the process
because I wasn't sure if an empty pipe would make the process detect an
EOF, too. Sometimes the output queue is filled slower than the
processing speed, so threads can decide to sleep() for a while and
re-try a few times before deciding that the load is low enough that
they are no longer useful.

Regards.

Gordan


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

Date: Mon, 17 Feb 2003 09:00:59 -0500
From: "George C. Demetros" <demetros@edamail.fishkill.ibm.com>
Subject: Redirecting STDOUT to Socket
Message-Id: <3E50EB1B.526E2269@edamail.fishkill.ibm.com>

Hi.

I would like to redirect STDOUT to an existing socket connection.  How do I do
this?  If I have a filehandle on a real file I can do this:

my $client = "theFile";
open(JAY, ">$client");

print(JAY "one\n");

my $client = \*JAY;
# redirect STDOUT to client
if (!open(STDOUT, ">&$$client"))
   {
   return(0);
   }

But when I try this with a socket connection it doesn't work:

my $client = $$server->accept(); # this connects fine.
if (!open(STDOUT, ">&$client"))
   {
   return(0);
   }

Thanks for any help.

George


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

Date: Mon, 17 Feb 2003 09:47:53 -0500
From: "George C. Demetros" <demetros@edamail.fishkill.ibm.com>
Subject: Re: Redirecting STDOUT to Socket
Message-Id: <3E50F619.3249EC36@edamail.fishkill.ibm.com>

Figured it out.  Replaced if(!open(STDOUT, ">&$client")) below with:

my $clientFileNum=fileno($client);
if (!open(STDOUT, ">&=$clientFileNum"))

George

"George C. Demetros" wrote:
> 
> Hi.
> 
> I would like to redirect STDOUT to an existing socket connection.  How do I do
> this?  If I have a filehandle on a real file I can do this:
> 
> my $client = "theFile";
> open(JAY, ">$client");
> 
> print(JAY "one\n");
> 
> my $client = \*JAY;
> # redirect STDOUT to client
> if (!open(STDOUT, ">&$$client"))
>    {
>    return(0);
>    }
> 
> But when I try this with a socket connection it doesn't work:
> 
> my $client = $$server->accept(); # this connects fine.
> if (!open(STDOUT, ">&$client"))
>    {
>    return(0);
>    }
> 
> Thanks for any help.
> 
> George


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

Date: Mon, 17 Feb 2003 09:44:53 -0500
From: "George C. Demetros" <demetros@edamail.fishkill.ibm.com>
Subject: Re: Redirecting STDOUT to Socket
Message-Id: <3E50F565.50501627@edamail.fishkill.ibm.com>

Figured it out.  Replaced if(!open(STDOUT, ">&$client")) below with:

my $clientFileNum=fileno($$client);
if (!open(STDOUT, ">&=$clientFileNum"))

George

"George C. Demetros" wrote:
> 
> Hi.
> 
> I would like to redirect STDOUT to an existing socket connection.  How do I do
> this?  If I have a filehandle on a real file I can do this:
> 
> my $client = "theFile";
> open(JAY, ">$client");
> 
> print(JAY "one\n");
> 
> my $client = \*JAY;
> # redirect STDOUT to client
> if (!open(STDOUT, ">&$$client"))
>    {
>    return(0);
>    }
> 
> But when I try this with a socket connection it doesn't work:
> 
> my $client = $$server->accept(); # this connects fine.
> if (!open(STDOUT, ">&$client"))
>    {
>    return(0);
>    }
> 
> Thanks for any help.
> 
> George


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

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


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