[29004] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 248 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 21 16:10:15 2007

Date: Wed, 21 Mar 2007 13:09:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 21 Mar 2007     Volume: 11 Number: 248

Today's topics:
    Re: "Casting" a split into an array <fabrice.baro@gmail.com>
    Re: "Casting" a split into an array <fabrice.baro@gmail.com>
        Any good Perl coders out there? <amerar@iwc.net>
    Re: Any good Perl coders out there? <vilain@spamcop.net>
    Re: Any good Perl coders out there? <amerar@iwc.net>
    Re: Any good Perl coders out there? <oster@computerhase.de>
    Re: Any good Perl coders out there? <vilain@spamcop.net>
    Re: Net::Telnet Error handling/trapping <abigail@abigail.be>
    Re: No -e allowed in setuid scripts? <stembe@gmail.com>
    Re: On Java's Interface (the meaning of interface in co <lew@nospam.lewscanon.com>
        perl feature request <ppc@cheapbooks.com>
    Re: perl feature request <uri@stemsystems.com>
        Search & replace <keith.willis@aah.co.uk>
    Re: Search & replace <mritty@gmail.com>
    Re: Search & replace <glennj@ncf.ca>
    Re: Search & replace <keith.willis@aah.co.uk>
    Re: Search & replace (Jens Thoms Toerring)
    Re: Server/Clients system <deadpickle@gmail.com>
        Using @ARGV in object oriented script <awkster@yahoo.com>
    Re: Using @ARGV in object oriented script <klaus03@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 21 Mar 2007 12:51:55 -0700
From: "Fabrice Baro" <fabrice.baro@gmail.com>
Subject: Re: "Casting" a split into an array
Message-Id: <1174506715.117584.242490@l77g2000hsb.googlegroups.com>

Thanks Peter,

> What is the condition that determines where 'here' is? Is it the same each
> time or is it different based on some condition? (i.e. until a specific
> letter is found? Or x number of letters?)

The condition is variable and is x number of letters.

> Why build an array, and an array of the indexes when you can just shuffle
> the array and then step through the indexes until you meet the above
> condition?  Is there some reason the array of letters needs to preserve it's
> order (which can't be met by preserving the pre-split sting?)?

I don't need to preserve the order of the letters, but I need to
shuffle many strings in the exact same way.
[more... context ;P John] In fact, I'm downsizing alignments of genes
for simulation purposes. So the order of the letters doesn't matter as
much as to pick the same positions for each sequence.
On my previous example, I showed the indexes only for clarity
purposes. But in my particular case, I think I don't have another
option than to build an actual array of indexes to be able to apply
the same to more than an array.
As for the shuffling itself, why not use the 'shuffle' function from
List::Util ? I think it can get the job done.



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

Date: 21 Mar 2007 12:52:10 -0700
From: "Fabrice Baro" <fabrice.baro@gmail.com>
Subject: Re: "Casting" a split into an array
Message-Id: <1174506730.400469.35650@l75g2000hse.googlegroups.com>

Thanks Peter,

> What is the condition that determines where 'here' is? Is it the same each
> time or is it different based on some condition? (i.e. until a specific
> letter is found? Or x number of letters?)

The condition is variable and is x number of letters.

> Why build an array, and an array of the indexes when you can just shuffle
> the array and then step through the indexes until you meet the above
> condition?  Is there some reason the array of letters needs to preserve it's
> order (which can't be met by preserving the pre-split sting?)?

I don't need to preserve the order of the letters, but I need to
shuffle many strings in the exact same way.
[more... context ;P John] In fact, I'm downsizing alignments of genes
for simulation purposes. So the order of the letters doesn't matter as
much as to pick the same positions for each sequence.
On my previous example, I showed the indexes only for clarity
purposes. But in my particular case, I think I don't have another
option than to build an actual array of indexes to be able to apply
the same to more than an array.
As for the shuffling itself, why not use the 'shuffle' function from
List::Util ? I think it can get the job done.



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

Date: 21 Mar 2007 09:14:30 -0700
From: "amerar@iwc.net" <amerar@iwc.net>
Subject: Any good Perl coders out there?
Message-Id: <1174493670.753360.57970@n76g2000hsh.googlegroups.com>

Hi All,

I need to convert a PHP script into Perl.  This PHP script interacts
with our Oracle database.  It executes some stored procedures and
returns values.  I've pasted the PHP code below, I'm just not sure how
to code it in Perl & DBI.   Can anyone help??  I would really
appreciate it.

PHP CODE
----------------
$conn = ociplogon("scott", "tiger", "ABCD.world");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
end ;");
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs,&$data)) {
   $customer_id = $data[0];
   $owner_name = $data[1];
   $type = $data[2];
   $code = $data[3];
 .
 .
 .
}



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

Date: Wed, 21 Mar 2007 11:52:46 -0700
From: Michael Vilain <vilain@spamcop.net>
Subject: Re: Any good Perl coders out there?
Message-Id: <vilain-13202C.11524621032007@comcast.dca.giganews.com>

In article <1174493670.753360.57970@n76g2000hsh.googlegroups.com>,
 "amerar@iwc.net" <amerar@iwc.net> wrote:

> Hi All,
> 
> I need to convert a PHP script into Perl.  This PHP script interacts
> with our Oracle database.  It executes some stored procedures and
> returns values.  I've pasted the PHP code below, I'm just not sure how
> to code it in Perl & DBI.   Can anyone help??  I would really
> appreciate it.
> 
> PHP CODE
> ----------------
> $conn = ociplogon("scott", "tiger", "ABCD.world");
> $curs = OCINewCursor($conn);
> $stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
> end ;");
> ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
> ociexecute($stmt);
> ociexecute($curs);
> 
> while (OCIFetchInto($curs,&$data)) {
>    $customer_id = $data[0];
>    $owner_name = $data[1];
>    $type = $data[2];
>    $code = $data[3];
> .
> .
> .
> }

Gee, your boss should know you're in over your head and completely 
incompetent.  Where do you work?

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...





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

Date: 21 Mar 2007 11:54:29 -0700
From: "amerar@iwc.net" <amerar@iwc.net>
Subject: Re: Any good Perl coders out there?
Message-Id: <1174503269.831017.314720@y80g2000hsf.googlegroups.com>

On Mar 21, 1:52 pm, Michael Vilain <vil...@spamcop.net> wrote:
> In article <1174493670.753360.57...@n76g2000hsh.googlegroups.com>,
>
>
>
>
>
>  "ame...@iwc.net" <ame...@iwc.net> wrote:
> > Hi All,
>
> > I need to convert a PHP script into Perl.  This PHP script interacts
> > with our Oracle database.  It executes some stored procedures and
> > returns values.  I've pasted the PHP code below, I'm just not sure how
> > to code it in Perl & DBI.   Can anyone help??  I would really
> > appreciate it.
>
> > PHP CODE
> > ----------------
> > $conn = ociplogon("scott", "tiger", "ABCD.world");
> > $curs = OCINewCursor($conn);
> > $stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
> > end ;");
> > ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
> > ociexecute($stmt);
> > ociexecute($curs);
>
> > while (OCIFetchInto($curs,&$data)) {
> >    $customer_id = $data[0];
> >    $owner_name = $data[1];
> >    $type = $data[2];
> >    $code = $data[3];
> > .
> > .
> > .
> > }
>
> Gee, your boss should know you're in over your head and completely
> incompetent.  Where do you work?
>
> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...- Hide quoted text -
>
> - Show quoted text -

I think your Father sexually abused you, which is why you have such a
disgusting personality.



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

Date: Wed, 21 Mar 2007 20:21:05 +0100
From: Chris Scholz <oster@computerhase.de>
Subject: Re: Any good Perl coders out there?
Message-Id: <ets0j0$8p8$00$1@news.t-online.com>

amerar@iwc.net schrieb:
> Hi All,
> 
> I need to convert a PHP script into Perl.  This PHP script interacts
> with our Oracle database.  It executes some stored procedures and
> returns values.  I've pasted the PHP code below, I'm just not sure how
> to code it in Perl & DBI.   Can anyone help??  I would really
> appreciate it.

http://learn.perl.org/


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

Date: Wed, 21 Mar 2007 12:32:10 -0700
From: Michael Vilain <vilain@spamcop.net>
Subject: Re: Any good Perl coders out there?
Message-Id: <vilain-F8B031.12321021032007@comcast.dca.giganews.com>

In article <1174503269.831017.314720@y80g2000hsf.googlegroups.com>,
 "amerar@iwc.net" <amerar@iwc.net> wrote:

> On Mar 21, 1:52 pm, Michael Vilain <vil...@spamcop.net> wrote:
> > In article <1174493670.753360.57...@n76g2000hsh.googlegroups.com>,
> >
> >
> >
> >
> >
> >  "ame...@iwc.net" <ame...@iwc.net> wrote:
> > > Hi All,
> >
> > > I need to convert a PHP script into Perl.  This PHP script interacts
> > > with our Oracle database.  It executes some stored procedures and
> > > returns values.  I've pasted the PHP code below, I'm just not sure how
> > > to code it in Perl & DBI.   Can anyone help??  I would really
> > > appreciate it.
> >
> > > PHP CODE
> > > ----------------
> > > $conn = ociplogon("scott", "tiger", "ABCD.world");
> > > $curs = OCINewCursor($conn);
> > > $stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
> > > end ;");
> > > ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
> > > ociexecute($stmt);
> > > ociexecute($curs);
> >
> > > while (OCIFetchInto($curs,&$data)) {
> > >    $customer_id = $data[0];
> > >    $owner_name = $data[1];
> > >    $type = $data[2];
> > >    $code = $data[3];
> > > .
> > > .
> > > .
> > > }
> >
> > Gee, your boss should know you're in over your head and completely
> > incompetent.  Where do you work?
> >
> > --
> > DeeDee, don't press that button!  DeeDee!  NO!  Dee...- Hide quoted text -
> >
> > - Show quoted text -
> 
> I think your Father sexually abused you, which is why you have such a
> disgusting personality.

Actually, IIRC, it was your father.  I recall a mole on his left buttock 
and another in an improbable and generally hard to access location.  Oh, 
and your mom says "Hello".  But I degress.

There are CPAN libraries you can download and build to add Oracle 
connectivity to your perl installation.  Writing the code won't help you 
if your perl installation doesn't know how to access the database.  
Start by using Google to find sites that describe what you're attempting 
to do (rather than get someone else to do it for you).

http://www.perl.com/pub/a/2003/10/23/databases.html
http://www.xml.com/pub/a/2000/12/13/perlxmldb.html

Seriously, if you expect someone to do your homework or job for you 
without the slightest shred of effort on your part, you're going to be 
sadly disappointed in this life.  Where do you work?

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...





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

Date: 21 Mar 2007 15:25:49 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Net::Telnet Error handling/trapping
Message-Id: <slrnf02jj2.kv5.abigail@alexandra.abigail.be>

Uri Guttman (uri@stemsystems.com) wrote on MMMMCML September MCMXCIII in
<URL:news:x7lkhqfxec.fsf@mail.sysarch.com>:
`` >>>>> "CG" == Chris G <nospam@example.com> writes:
``  
``  CG> I am sorry that the group is so intolerant of top-posting, but how I
``  CG> post it my choice, just others have a choice to respond or not.  This is
``  CG> not a flame, just a statement of fact.  In the interest of not further
``  CG> polluting the ng with non-perl postings, this is the last I will comment
``  CG> on it.  Let's just agree to disagree and move on.
``  
``  it is not intolerant. it has been know for decades that interpersed
``  edited quotes are much better for technical discussion as they are
``  commonly q&a. do you want answers before the questions?


Yeah, but the same holds for proper use of capitals.


Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT


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

Date: 21 Mar 2007 11:01:48 -0700
From: "maxshop" <stembe@gmail.com>
Subject: Re: No -e allowed in setuid scripts?
Message-Id: <1174500108.272495.114020@o5g2000hsb.googlegroups.com>

On Mar 20, 3:51 pm, Joe Smith <j...@inwap.com> wrote:
> maxshop wrote:
> > Anyone?
>
> Get rid of the -e and put the statements into a file.

Thanks, that worked.. .although I am still not sure why the -e will
not work when the script is invoked in the method I have described,
but works when invoked from the command line.



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

Date: Wed, 21 Mar 2007 15:11:30 -0400
From: Lew <lew@nospam.lewscanon.com>
Subject: Re: On Java's Interface (the meaning of interface in computer programing)
Message-Id: <4fWdnTVj-Y3-HpzbnZ2dnUVZ_v-tnZ2d@comcast.com>

Dr. Who wrote:
> Don't Feed The Trolls :-)

But, but - you fed me!?

Oh, wait, I'm only a half-troll, on my father's side.

Thanks for the attention.

Kidding aside, a post like the OP's is useful as an exercise in finding the 
errors, grammatical and factual. It's like a math book I had in my first year 
at university. Its theorems were riddled with typographical errors, mixing the 
us, vs and ws all around. I'd be up for hours figuring out if I was wrong or 
the book was wrong. In the end it gave me a lot more exercise than the 
homework problems did.

Also, I wanted to protect the innocent.

We could put up a contest - whoever finds and corrects the most errors in the 
post wins. Ties broken by the quality of the correct explanations. Incorrect 
explanations count against the entry.

-- Lew


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

Date: 21 Mar 2007 11:46:57 -0700
From: "dt" <ppc@cheapbooks.com>
Subject: perl feature request
Message-Id: <1174502817.147210.165480@n76g2000hsh.googlegroups.com>

I find the following useful and would like to see it as a new perl
feature:

I often have to cache a variable based on a complex function. it owuld
be nice if perl had something like this built in. here is an example:

our $html;
if ($html !~ /./)
{
  $html = load_as_string($fh, "filename.html");
  }


a datatype such as:

cache $html = load_as_string($fh, "filename.html");

would be really cool. basically, if the var is not set, it sets the
var. if it is set, it skips the call.

it would have to still be there if the function is exited and recalled
(same scope as our).



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

Date: Wed, 21 Mar 2007 14:44:14 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: perl feature request
Message-Id: <x7ircucrg1.fsf@mail.sysarch.com>

>>>>> "d" == dt  <ppc@cheapbooks.com> writes:

  d> I find the following useful and would like to see it as a new perl
  d> feature:

  d> I often have to cache a variable based on a complex function. it owuld
  d> be nice if perl had something like this built in. here is an example:

  d> our $html;

that will mean $html is undef. where would another value come from?

  d> if ($html !~ /./)

that will generated an undefined warning.

  d> {
  d>   $html = load_as_string($fh, "filename.html");
  d>   }


huh? what is wrong with just doing this:

	$html ||= load_as_string($fh, "filename.html");

and load_as_string is already in File::Slurp as read_file().


  d> a datatype such as:

  d> cache $html = load_as_string($fh, "filename.html");

  d> would be really cool. basically, if the var is not set, it sets the
  d> var. if it is set, it skips the call.

but you can't declare and also optionally assign. where would a preset
value come from??

  d> it would have to still be there if the function is exited and recalled
  d> (same scope as our).

easy. just declare it my in a block that also includes the sub:

use File::Slurp ;

{

my $html ;

sub do_stuff {

	$html ||= read_file( $filename ) ;

}

}

so it already is in perl.

and that only fails if the html file is a false value (just '0', or
empty) which is unlikely.

in perl 5.10 you can do //= and test for defined and that solves that
problem.

uri

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


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

Date: 21 Mar 2007 08:36:41 -0700
From: "bytebro" <keith.willis@aah.co.uk>
Subject: Search & replace
Message-Id: <1174491401.678492.128430@e65g2000hsc.googlegroups.com>


Hello,

I have been through "perldoc perlop", and the FAQ, and I'm still
struggling with this, so I'd appreciate any tips.

I've got a whole bunch of C source files, almost all of which refer to
types of the form "uint_8t", "uint_16t", and so on.  I need to replace
every one of these occurrences with the (allegedly standard) form
"uint8_t", "uint16_t", and so on, respectively.

My best effort so far is:

perl -i.old -wne 's/uint_(\d+)t/uint$1_t/g' filename.c

But this simply renames filename.c to filename.c.old and outputs
nothing at all to filename.c, and is thus less than completely useful.

Please somebody take pity and explain what I am doing incorrectly!
Thx
klw



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

Date: 21 Mar 2007 08:50:47 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Search & replace
Message-Id: <1174492247.017069.165810@e65g2000hsc.googlegroups.com>

On Mar 21, 11:36 am, "bytebro" <keith.wil...@aah.co.uk> wrote:
> Hello,
>
> I have been through "perldoc perlop", and the FAQ, and I'm still
> struggling with this, so I'd appreciate any tips.
>
> I've got a whole bunch of C source files, almost all of which refer to
> types of the form "uint_8t", "uint_16t", and so on.  I need to replace
> every one of these occurrences with the (allegedly standard) form
> "uint8_t", "uint16_t", and so on, respectively.
>
> My best effort so far is:
>
> perl -i.old -wne 's/uint_(\d+)t/uint$1_t/g' filename.c
>
> But this simply renames filename.c to filename.c.old and outputs
> nothing at all to filename.c, and is thus less than completely useful.
>
> Please somebody take pity and explain what I am doing incorrectly!

it's perldoc perlrun you need to read, not perlop.  -n just loops
through the file.  It doesn't do any printing to the new file.  you
need -p instead.

Paul Lalli



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

Date: 21 Mar 2007 15:51:50 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Search & replace
Message-Id: <slrnf02l4n.s5p.glennj@smeagol.ncf.ca>

At 2007-03-21 11:36AM, "bytebro" wrote:
>  
>  Hello,
>  
>  I have been through "perldoc perlop", and the FAQ, and I'm still
>  struggling with this, so I'd appreciate any tips.
>  
>  I've got a whole bunch of C source files, almost all of which refer to
>  types of the form "uint_8t", "uint_16t", and so on.  I need to replace
>  every one of these occurrences with the (allegedly standard) form
>  "uint8_t", "uint16_t", and so on, respectively.
>  
>  My best effort so far is:
>  
>  perl -i.old -wne 's/uint_(\d+)t/uint$1_t/g' filename.c

-----------------^

    Use -p not -n
  
>  But this simply renames filename.c to filename.c.old and outputs
>  nothing at all to filename.c, and is thus less than completely useful.
>  
>  Please somebody take pity and explain what I am doing incorrectly!
>  Thx
>  klw
>  


-- 
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry


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

Date: 21 Mar 2007 09:03:33 -0700
From: "bytebro" <keith.willis@aah.co.uk>
Subject: Re: Search & replace
Message-Id: <1174493013.652723.198670@y80g2000hsf.googlegroups.com>

On 21 Mar, 15:50, "Paul Lalli" <mri...@gmail.com> wrote:
> On Mar 21, 11:36 am, "bytebro" <keith.wil...@aah.co.uk> wrote:
> > My best effort so far is:
>
> > perl -i.old -wne 's/uint_(\d+)t/uint$1_t/g' filename.c
>
> > But this simply renames filename.c to filename.c.old and outputs
> > nothing at all to filename.c, and is thus less than completely useful.
>
> > Please somebody take pity and explain what I am doing incorrectly!
>
> it's perldoc perlrun you need to read, not perlop.  -n just loops
> through the file.  It doesn't do any printing to the new file.  you
> need -p instead.

Doh!!  And there was me assuming I'd screwed up the general
expression.  Thanks, one and all.



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

Date: 21 Mar 2007 16:52:29 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: Search & replace
Message-Id: <56d66dF27hel5U2@mid.uni-berlin.de>

bytebro <keith.willis@aah.co.uk> wrote:
> On 21 Mar, 15:50, "Paul Lalli" <mri...@gmail.com> wrote:
> > On Mar 21, 11:36 am, "bytebro" <keith.wil...@aah.co.uk> wrote:
> > > My best effort so far is:
> >
> > > perl -i.old -wne 's/uint_(\d+)t/uint$1_t/g' filename.c
> >
> > > But this simply renames filename.c to filename.c.old and outputs
> > > nothing at all to filename.c, and is thus less than completely useful.
> >
> > > Please somebody take pity and explain what I am doing incorrectly!
> >
> > it's perldoc perlrun you need to read, not perlop.  -n just loops
> > through the file.  It doesn't do any printing to the new file.  you
> > need -p instead.

> Doh!!  And there was me assuming I'd screwed up the general
> expression.  Thanks, one and all.

Perhaps you should use 's/\buint_(\d+)t\b/uint$1_t/g' to avoid
matches you didn't intend...
                                 Regards, Jens
--
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de


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

Date: 21 Mar 2007 09:38:35 -0700
From: "deadpickle" <deadpickle@gmail.com>
Subject: Re: Server/Clients system
Message-Id: <1174495115.761689.74180@d57g2000hsg.googlegroups.com>

On Mar 20, 1:48 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2007-03-20 17:20, deadpickle <deadpic...@gmail.com> wrote:
>
>
>
> > On Mar 20, 9:23 am, Ted Zlatanov <t...@lifelogs.com> wrote:
> >> On 20 Mar 2007 07:04:30 -0700 "deadpickle" <deadpic...@gmail.com> wrote:
> >> d> First of all I havent wrote any code for this yet, I'm still in the
> >> d> brainstorming section. What I want to do is have a server that resides
> >> d> on a networked computer somewhere. This server will recieve files from
> >> d> 2 clients. Then these 2 clients will ask the server for another file
> >> d> and the server will send it. So in summary I have 2 Clients that can
> >> d> send and recieve files and a Server that can recieve and send files.
> >> d> Hope that makes sense. I am not sure on how to do this, or how to get
> >> d> started, anyone got any ideas?
>
> >> Well, you could implement this with FTP or HTTP (HTTP has a "PUT"
> >> command), reimplementing as much of the protocol as you desire.  Are
> >> you trying to implement something new as a fun project, or is this
> >> real work?  In the real world I'd avoid writing new protocols when so
> >> many good ones exist already (implemented in C, bug-free, etc.).
> [...]
> >  This is for a undergraduate project at my university. I'm thinking
> > about using BitTorrent. I want this whole system to be autonomous and
> > to make many transfers every minute, can BitTorrent do this?
>
> BitTorrent doesn't sound like a good choice: Firstly, it doesn't have an
> upload capability (AFAIK). Secondly, it isn't designed to transfer many
> small files between a server and a small number of clients - it is
> designed to distribute large files to to a large number of clients.
>
> Writing a bittorrent implementation might be fun and instructive, but
> for your (stated) needs it sounds like overkill. HTTP is probably the
> simplest protocol for that purpose (as long as you don't implement all
> of RFC 2616).
>
>         hp
>
> --
>    _  | Peter J. Holzer    | Blaming Perl for the inability of programmers
> |_|_) | Sysadmin WSR       | to write clearly is like blaming English for
> | |   | h...@hjp.at         | the circumlocutions of bureaucrats.
> __/   |http://www.hjp.at/|      -- Charlton Wilbur in clpm

How can I transfer large files using HTTP? where do I get started then?



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

Date: 21 Mar 2007 09:36:46 -0700
From: "Jorge" <awkster@yahoo.com>
Subject: Using @ARGV in object oriented script
Message-Id: <1174495006.302270.225510@o5g2000hsb.googlegroups.com>

As an exercise in learing Object Oriented Perl I am creating a class
and a calling script which simply checks the command line arguments to
see if each file is present. So far it appears to be working as
expected but I have a question about the use of @ARGV in my calling
script.

The only way I could see to pass @ARGV as an object was to make it a
scalar ... thus the line ...

my $list_of_files = join ' ', @ARGV;

Is there a way I can use a reference such as \@ARGV and somehow
derference it in the package?

Both my script and package is listed below -- I appreciate any help on
this - thank you.


snip<------ package starts here ------>snip

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

package CmdLineArgs;

use strict;

sub new {
	my $cla  = {};
	$cla->{QTY}    = undef;
	$cla->{LIST}  = [];
	bless($cla);
	return $cla;
}

sub qty {
	my $cla = shift;
	if (@_) { $cla->{QTY} = shift }
		return $cla->{QTY};
}

sub list {
	my(@args, $args, @args_not_found);
	my $cla = shift;

	if (@_) { $cla->{LIST} = shift }

	@args = split(' ',  $cla->{LIST} );
	foreach $args(@args){
		if(!( -f $args)){
			push(@args_not_found, $args);
		}
	}

	if(@args_not_found){
		return @args_not_found;
		}else{
		return "success";
	}
}

1;

snip<------ calling script starts here ------>snip

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

use strict;

use lib '/home/blahblah/lib';

use CmdLineArgs;

my $args;

$args = CmdLineArgs->new();

$args->qty($#ARGV + 1);

my $list_of_files = join ' ', @ARGV;

print "\n".$args->qty." files were specified as command line arguments
\n";
print "(".$list_of_files.")\n";

if($args->list($list_of_files) eq "success"){
	print $args->list($list_of_files)."\n";
	}else{
	my @not_found = $args->list($list_of_files);
	foreach my $not_found(@not_found){
		print $not_found." - was not found\n";
	}
}



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

Date: 21 Mar 2007 10:05:58 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: Using @ARGV in object oriented script
Message-Id: <1174496758.159710.143070@e1g2000hsg.googlegroups.com>

On Mar 21, 5:36 pm, "Jorge" <awks...@yahoo.com> wrote:
> As an exercise in learing Object Oriented Perl I am creating a class
> and a calling script which simply checks the command line arguments to
> see if each file is present. So far it appears to be working as
> expected but I have a question about the use of @ARGV in my calling
> script.
>
> The only way I could see to pass @ARGV as an object was to make it a
> scalar ... thus the line ...
>
> my $list_of_files = join ' ', @ARGV;
>
> Is there a way I can use a reference such as \@ARGV and somehow
> derference it in the package?

I am not so familiar with object-oriented programming, but
dereferencing \@ARGV in a simple subroutine should work the same way:

====================================================
use strict;
use warnings;

print do{ local $" = "', '"; "Before sub test(): \@ARGV = ('@ARGV')
\n"; };

test_ARGV(\@ARGV);

print "Test program finished.\n";

sub test_ARGV {
    my @Array = @{$_[0]};
    print do{ local $" = "', '"; "Inside sub test(): \@Array =
('@Array')\n"; }
}
====================================================

C:\>perl Ref-ARGV.pl a b c
Before sub test(): @ARGV = ('a', 'b', 'c')
Inside sub test(): @Array = ('a', 'b', 'c')
Test program finished.

--
Klaus



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

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 V11 Issue 248
**************************************


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