[22434] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4655 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 3 14:07:44 2003

Date: Mon, 3 Mar 2003 11: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           Mon, 3 Mar 2003     Volume: 10 Number: 4655

Today's topics:
    Re: '@' symbol confusion <usenet@dwall.fastmail.fm>
    Re: '@' symbol confusion <bart.lateur@pandora.be>
        [OT] NEWBIE: PerlNET <newsfeed2@boog.co.uk>
        [OT] Re: NEWBIE: PerlNET <ian@WINDOZEdigiserv.net>
    Re: [OT] Re: NEWBIE: PerlNET <JCornwall_must_remove_this_part@cox.net>
        Best way to learn perl? <olaf73NO@SPAMswbell.net>
        Early Perl source <newsfeed2@boog.co.uk>
    Re: Early Perl source <s_grazzini@hotmail.com>
    Re: Early Perl source <tassilo.parseval@post.rwth-aachen.de>
    Re: Feedback request: photobrowser <asu1@c-o-r-n-e-l-l.edu>
    Re: Hash of functions? (Bulat Baltin)
    Re: Hash of functions? <goldbb2@earthlink.net>
        HELP "Can't locate DBI.pm" Calling All Experts <n_joeller@sharblbaziilyar.com>
    Re: HELP "Can't locate DBI.pm" Calling All Experts (Tad McClellan)
    Re: HELP "Can't locate DBI.pm" Calling All Experts <nobull@mail.com>
    Re: HELP "Can't locate DBI.pm" Calling All Experts <bart.lateur@pandora.be>
    Re: HELP- How can  i use proxy service for port 80 as c news@roaima.freeserve.co.uk
    Re: Need to trim word with parenthesis <barryk2@SPAM-KILLER.mts.net>
    Re: Need to trim word with parenthesis <bart.lateur@pandora.be>
    Re: Need to trim word with parenthesis impervious@attbi.com
        newbie array question <pirabhur@ufl.edu>
    Re: newbie array question <nobull@mail.com>
    Re: newbie array question <pirabhur@ufl.edu>
    Re: newbie array question <goldbb2@earthlink.net>
    Re: newbie array question <tassilo.parseval@post.rwth-aachen.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 03 Mar 2003 15:43:11 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: '@' symbol confusion
Message-Id: <Xns93336D0BFF640dkwwashere@216.168.3.30>

[ please don't top-post.  See 
http://www.xs4all.nl/~wijnands/nnq/nquote.html ]

Mike <ncmike@nc.rr.com> wrote on 03 Mar 2003:

> Thanks for responding but I do have a question:
> What is the advantage of using DBI over the method I chose?

As the name suggests, DBI is Perl's standard interface for databases.  
The advantage is you learn *one* interface and then you can use it 
regardless of the kind of database your data is in.  If you move your 
data from MySQL to Oracle or PostgreSQL or whatever, the changes in 
your Perl code are minimal, usually just one line if you were careful 
to use only 'standard' features.

-- 
David K. Wall - usenet@dwall.fastmail.fm
"Oook."


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

Date: Mon, 03 Mar 2003 16:46:34 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: '@' symbol confusion
Message-Id: <5m176vkcjd5a9sune8gdg91pvr1dd5br6k@4ax.com>

Mike wrote:

>What is the advantage of using DBI over the method I chose?

Portability (to other databases). Placeholders. *Placeholders*!

-- 
	Bart.


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

Date: Mon, 3 Mar 2003 15:49:31 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: [OT] NEWBIE: PerlNET
Message-Id: <mPK8a.10993$EN3.87028@newsfep4-glfd.server.ntli.net>

"Derek Thomson" <dthomson@NOSPAMusers.sf.net> wrote:
> When it runs on a reasonable OS, and MS de-patent all the bits of it
> they have locked up, I'll become interested. Until then, I can only
> assume it's Microsoft's hateful reaction to their failure to destroy
> Java. By re-doing Java and locking everyone into their "solution".

Ah, so you're one of these folks who believe that everything should open and
that companies should be forced to open up all of their protocols no matter how
much they spent developing them. Ah.

 .net is actually Microsoft's solution to a problem they originally created, with
the proliferation of numerous conflicting standards in Windows. .net allows
software, programming languages, etc, to all work towards a single platform,
rather than having to deal with various different standards to communicate with
each other. It's a bit of a Java-esque scheme in principle, but .net covers a
lot more ground.

Beyond that, I can't say too much, I don't develop for it.

> So, have they implemented Perl on the CLI, or is this just using the
> existing Perl implementation through some kind of .NET interface so that
> ActiveState get some more buzzword compliance?
>
> Have your considered Visual Basic? I gather it works with .NET just fine.

You can target .NET with any of Microsoft's latest programming tools.
Interestingly this means Visual Basic is almost as powerful as VC++, as the apps
produced by them end up running on the same libraries.. whether that's a good
thing or not, I can't say.

> Why? I don't use their products at all. I just have silly people telling
> me I must use their poor software for no good reason.

I don't think the original poster did that at all. They simply asked a question
and you decided to use your answer as a platform to launch into a rant.

> And stating the facts is not hatred. Unless Python.NET has been raised
> from the dead, it is axiomatic that the JVM runs Python better than the CLI.

No, but throwing in comments like "(since I'm uninterested in non-portable and
proprietary technology that merely reinvents the wheel)" makes it look you were
posting simply because you had an opinon to parade.

 .NET is not a Microsoft only domain, by the way.. the Mono project to develop a
 .NET implementation for Linux is going extremely well -> http://www.go-mono.com/

While you might not like the company that created it, .NET is actually a pretty
good idea, as in -principle- it should allow code running on a Microsoft server,
say, to be easily ported to Linux, and vice versa.

Languages like Perl and Java have allowed this for some time, but .NET isn't a
language, it's more like the JVM, but it covers a lot more ground and becomes a
lot more integrated with the system. .NET heralds the second generation of
moving towards a world where the OS doesn't actually matter, but the VM does.

Regards,
Pete




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

Date: Mon, 03 Mar 2003 15:26:24 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: [OT] Re: NEWBIE: PerlNET
Message-Id: <7os66v41r5rqj0fqrevjdsve06nrfu8d79@4ax.com>
Keywords: Remove WINDOZE to reply

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

In a fit of excitement on Mon, 3 Mar 2003 14:46:53 -0000, "Jason
Hood" <jasonhood@tiscali.co.uk> managed to scribble:

> WARNING: Such venomous hatred towards Microsoft will only serve to
> give YOU heartburn.


Hah.

M$ is the root of all evil.. even moreso than money.. the sooner
people learn this, the better.. and the progress that X is making, I
can see more and more FreeBSD and Linucks desktops being used.

I saw a nice little sig:


  Linux for Stability
  Mac for Creativity
  Windows for Solitaire


Unfortunatley, I forgot on what post I saw it, so apologies to the
poster with this as part of their sig.

Windoze in general is a joke.. even my 6 year old prefers logging
into a shell and using FreeBSD and VIM rather than having to mess
around with various, pointless mouse clicks.

Still, my 2p worth.. not necessarily anyone elses =)



Regards,

  Ian

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

iQA/AwUBPmN0Bmfqtj251CDhEQIhaQCgplaL9O+GQZiJzqc0PfGcpFQX/K8Anino
WRS1brKDHGvPzEepQgyQkuP4
=QRCe
-----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: Mon, 3 Mar 2003 18:41:53 GMT
From: "James F. Cornwall" <JCornwall_must_remove_this_part@cox.net>
Subject: Re: [OT] Re: NEWBIE: PerlNET
Message-Id: <3E63A1F1.E16EFD82@cox.net>

"Ian.H [dS]" wrote:
> 
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
> 
> In a fit of excitement on Mon, 3 Mar 2003 14:46:53 -0000, "Jason
> Hood" <jasonhood@tiscali.co.uk> managed to scribble:
> 
> > WARNING: Such venomous hatred towards Microsoft will only serve to
> > give YOU heartburn.
> 
> Hah.
> 
> M$ is the root of all evil.. even moreso than money.. the sooner
> people learn this, the better.. and the progress that X is making, I
> can see more and more FreeBSD and Linucks desktops being used.
 
Yep, Adolf Hitler and his pals Idi Amin and Pol Pot, not to mention
their predecessor throughout history, were just playing around.  They
weren't evil, because Bill G hadn't invented the whole concept yet...

Sheesh.

BTW, I don't care much for their corporate practice either, but I think
you've gone a wee bit past the deep end up there.


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

Date: Mon, 03 Mar 2003 18:54:11 GMT
From: "Olaf" <olaf73NO@SPAMswbell.net>
Subject: Best way to learn perl?
Message-Id: <nxN8a.79$A93.67665098@newssvr11.news.prodigy.com>

I am looking to learn perl. I have no programming experience to speak
of.  I can look at a shell script and have a rough idea of what is going
on, but I am not up to the task of writing my own.

What would you guys recommend to me?  Looking for some specific book
titles, or software, or even a progression path (with references) from
an easier language on up to perl.

My goal is to learn how to write and understand shell scripts better,
and to learn perl.

Thanks much
olaf




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

Date: Mon, 3 Mar 2003 17:25:26 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Early Perl source
Message-Id: <idM8a.11073$EN3.87752@newsfep4-glfd.server.ntli.net>

I like to collect old source code, simply to rummage through and get a feel for
how some of the most exciting programs that came out 'back then' were made. I've
got Wolf3D, Doom, Linux 0.1, and a bunch of other 'ground breaking' products
(the Linux 0.1 is an /excellent/ reference if you want to make your own simple
OS). Now I'm interested in finding an old version of Perl!

CPAN only gets me down as far as 4.036. I've found references to Perl 1 in
USENET circa 1987 (and Perl 2 references circa 1988), although I cannot find the
fabled actual announcement from Larry Wall about it. This means I haven't been
able to dig out old filenames I might be able to search for (I found the source
code to Larry's patching software for it though!) So does anyone know where I
could get the source code to Perl 1 or 2?

There are some great Perl related posts from the early days.. but none have
helped me in my search so far (but I'm having fun looking!) So if you're bored
head to Google Groups and check out Perl posts from the 80s ;-)

Cheers,
Pete




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

Date: Mon, 03 Mar 2003 17:59:17 GMT
From: Steve Grazzini <s_grazzini@hotmail.com>
Subject: Re: Early Perl source
Message-Id: <VJM8a.51913$Mh3.18574316@twister.nyc.rr.com>

Peter Cooper <newsfeed2@boog.co.uk> writes:
> Now I'm interested in finding an old version of Perl!
> 
> CPAN only gets me down as far as 4.036.
> 

  http://mirrors.develooper.com/perl/really-ancient-perls/oldperl/dist/dex/perl

  http://nntp.x.perl.org/group/perl.perl1.porters

-- 
Steve


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

Date: 3 Mar 2003 18:19:07 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Early Perl source
Message-Id: <b406ar$al4$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Peter Cooper:

> So does anyone know where I could get the source code to Perl 1 or 2?

Perl1 is available via CPAN:

    http://search.cpan.org/author/MSCHWERN/perl-1.0_15/

It's not the original source but slightly modified to fit modern
machines. The differences are marginal, though.

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: 3 Mar 2003 15:13:26 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Feedback request: photobrowser
Message-Id: <Xns93336801D138Casu1cornelledu@132.236.56.8>

Malte Ubl <ubl@schaffhausen.de> wrote in news:b3ta9o$60j$1@news.dtag.de:

> Tad McClellan wrote:
>> You should probably have an explicit chdir() somewhere near
>> the top of your program too.
> 
> Is that wise under mod_perl? (or if you want to port to mod_perl later)

I think it is going to be better for me to stick with absolute paths 
rather than changing to the photos directory. If my understanding is 
correct, the latter might indeed cause problems further down the road 
with mod_perl. 

Thanks.

Sinan.

PS: By the way, the first version of the script can be seen in action at 

http://www.unur.com/cgi-bin/photobrowser?location=sinan/usa_02_
03/places&template=cols3

Thanks to everyone who commented.
-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: 3 Mar 2003 09:44:22 -0800
From: bulat@cn.donetsk.ua (Bulat Baltin)
Subject: Re: Hash of functions?
Message-Id: <9136cc7f.0303030944.3f5dc75@posting.google.com>

Roy Marteen <rm@no-mail.com> wrote in message news:<20030303192448.36b26dbb.rm@no-mail.com>...
> Hi all,
> 
> Say I have three functions:
> 
> sub func_one { print "Number One"; }
> sub func_two { print "Number Two"; }
> sub func_three { print "Number Three"; }
> 
> How can I write this is more simple way? Something like hash of functions?
> 
> if ($val eq "one") { func_one(); }
> elsif ($val eq "two") { func_two(); }
> elsif ($val eq "three") { func_three(); }
> 
> Thanks a lot.

Not a hash but...

$pfunc = \&{'func_'.$val};

$pfunc->();

Regards,
Bulat Baltin


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

Date: Mon, 03 Mar 2003 13:46:33 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Hash of functions?
Message-Id: <3E63A309.160BAB98@earthlink.net>

Bulat Baltin wrote:
> Roy Marteen wrote:
> > Hi all,
> >
> > Say I have three functions:
> >
> > sub func_one { print "Number One"; }
> > sub func_two { print "Number Two"; }
> > sub func_three { print "Number Three"; }
> >
> > How can I write this is more simple way?
> > Something like hash of functions?
> >
> > if ($val eq "one") { func_one(); }
> > elsif ($val eq "two") { func_two(); }
> > elsif ($val eq "three") { func_three(); }
> >
> > Thanks a lot.
> 
> Not a hash but...
> 
> $pfunc = \&{'func_'.$val};
> 
> $pfunc->();

Symbolic references are evil!

And, in fact, it *is* a hash.

You're accessing:

   my $glob = $ThisPackageName::{"func_" . $val};
   $pfunc = *{$glob}{CODE};

Where %ThisPackageName:: is the hash of all symbols in the package.

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


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

Date: Mon, 03 Mar 2003 15:32:38 GMT
From: Noerd <n_joeller@sharblbaziilyar.com>
Subject: HELP "Can't locate DBI.pm" Calling All Experts
Message-Id: <3E637596.DD3B1301@sharblbaziilyar.com>

I have searched every nook and cranny of the internet, and it seems that
everyone has this question, but no real answers! (In lots of different
languages, too!)

I am running MacOS X "Jaguar," and I have PHP and MySQL installed; they
work fine. However whenever I try to run a Perl Script which is supposed
to populate my MySQL table with data, it aborts with the following
error:

Can't locate DBI.pm in @INC (@INC contains: /sw/lib/perl5/darwin
/sw/lib/perl5 /System/Library/Perl/darwin /System/Library/Perl
/Library/Perl/darwin /Library/Perl /Library/Perl
/Network/Library/Perl/darwin /Network/Library/Perl /Network/Library/Perl
 .) at database.cgi line 5.

Unfortunately, I am NOT a Unix expert, nor do I even know much about
anything....but (good news) I can follow instructions! Would someone
please be so kind as to tell me what to do?

I have installed "fink," and did that update thing. I have also
installed Apple Developer Tools

By the way, I DO have "DBI.pm" located in these two places (doing a
"find file")

HardDrive/sw/src/DBI-1.31/DBI.pm
HardDrive/sw/src/DBI-1.31/lib/Bundle/DBI.pm

I just don't know what to do, or what to type. What I have noticed is
that when I try to run different programs like "make" and all that
"linux stuff" I do get alot of error messages which say stuff like my
Perl is not in the normal place. But, since I am a newbie, and it'll
take me 2 years to learn everything you guys know, I don't really know
how to move stuff around to the right place, etc.... I am just hoping
that somehow someone can tell me step-by-step how to make my Perl Script
"find" my DBI.pm  :-)

THANK YOU!!!



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

Date: Mon, 3 Mar 2003 11:13:05 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: HELP "Can't locate DBI.pm" Calling All Experts
Message-Id: <slrnb67391.3gk.tadmc@magna.augustmail.com>

Noerd <n_joeller@sharblbaziilyar.com> wrote:
> I have searched every nook and cranny of the internet, and it seems that
> everyone has this question, but no real answers! (In lots of different
> languages, too!)
> 
> I am running MacOS X "Jaguar," and I have PHP 


PHP is irrelevant if you are using Perl.


> and MySQL installed; 


Do you have DBI.pm and the DBD for MySQL also installed?


> they
> work fine. However whenever I try to run a Perl Script which is supposed
> to populate my MySQL table with data, it aborts with the following
> error:
> 
> Can't locate DBI.pm in @INC (@INC contains: /sw/lib/perl5/darwin
> /sw/lib/perl5 /System/Library/Perl/darwin /System/Library/Perl
> /Library/Perl/darwin /Library/Perl /Library/Perl
> /Network/Library/Perl/darwin /Network/Library/Perl /Network/Library/Perl
> .) at database.cgi line 5.



All of the messages that perl might issue are documented in
the perldiag.pod std doc. You should look up any messages you
get there as a first step in troubleshooting.

(or probably better, arrange to have perl look them up for you,
 as described in the Posting Guidelines that are posted here
 frequently.
)

For your message it says:

---------------------------
=item Can't locate %s

(F) You said to C<do> (or C<require>, or C<use>) a file that couldn't be
found. Perl looks for the file in all the locations mentioned in @INC,
unless the file name included the full path to the file.  Perhaps you
need to set the PERL5LIB or PERL5OPT environment variable to say where
the extra library is, or maybe the script needs to add the library name
to @INC.  Or maybe you just misspelled the name of the file.  See
L<perlfunc/require> and L<lib>.
---------------------------


> but (good news) I can follow instructions! 


That's refreshing.  :-)


> Would someone
> please be so kind as to tell me what to do?
> 
> I have installed "fink," and did that update thing. I have also
> installed Apple Developer Tools
> 
> By the way, I DO have "DBI.pm" located in these two places (doing a
> "find file")
> 
> HardDrive/sw/src/DBI-1.31/DBI.pm
> HardDrive/sw/src/DBI-1.31/lib/Bundle/DBI.pm


Yes, but that is not one of the places listed in the message.

Looks to me like you have downloaded, but not installed, the module.

Install it.

   perldoc -q install

     "How do I install a module from CPAN?"


> I just don't know what to do, or what to type. What I have noticed is
> that when I try to run different programs like "make" and all that
> "linux stuff" I do get alot of error messages which say stuff like my
> Perl is not in the normal place.


Show the verbatim text of the messages if you want help
interpreting the messages.


> I am just hoping
> that somehow someone can tell me step-by-step how to make my Perl Script
> "find" my DBI.pm  :-)


First, make sure that it _is_ installed (and the DBD too).

If it gets installed into one of the directories listed in the
message, then you should be all set.

If it gets installed in some non-standard place, then you need to
let perl know where to look for it, either with an env var as
perldiag says, or with a "use lib" in your program file.



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


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

Date: 03 Mar 2003 17:31:42 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: HELP "Can't locate DBI.pm" Calling All Experts
Message-Id: <u9heakxsox.fsf@wcl-l.bham.ac.uk>

Noerd <n_joeller@sharblbaziilyar.com> writes:

> Can't locate DBI.pm in @INC

Looks like DBI is not installed.

> Unfortunately, I am NOT a Unix expert, nor do I even know much about
> anything....but (good news) I can follow instructions!

Next you need to be able to _find_ instructions and you'll be away.

> By the way, I DO have "DBI.pm" located in these two places (doing a
> "find file")
> 
> HardDrive/sw/src/DBI-1.31/DBI.pm
> HardDrive/sw/src/DBI-1.31/lib/Bundle/DBI.pm
> 
> I just don't know what to do

That looks like the distribution file has been downloaded and unpacked
there.  That's only the first steps of installing a Perl module,

> , or what to type.

See FAQ: "How do I install a module...?" (or read the README).

> What I have noticed is that when I try to run different programs
> like "make" and all that "linux stuff"

Linux?  I thought you said you were running BSD^H^H^H MacOS X?

> I do get alot of error messages which say stuff like my Perl is not
> in the normal place.

Should not matter where Perl is - so long as it is where it thinks it
is!  That's the point of Makefile.PL

> (@INC contains: /sw/lib/perl5/darwin
> /sw/lib/perl5 /System/Library/Perl/darwin /System/Library/Perl
> /Library/Perl/darwin /Library/Perl /Library/Perl
> /Network/Library/Perl/darwin /Network/Library/Perl /Network/Library/Perl
> .) at database.cgi line 5.

Do these look like the places Perl is installed?

> I am just hoping that somehow someone can tell me step-by-step how
> to make my Perl Script "find" my DBI.pm :-)

Like I said, see FAQ: "How do I install a module...?"

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 03 Mar 2003 17:52:16 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: HELP "Can't locate DBI.pm" Calling All Experts
Message-Id: <kb576vg0nherqtbd3tpdj99r5ghmk7f8vf@4ax.com>

Noerd wrote:

>By the way, I DO have "DBI.pm" located in these two places (doing a
>"find file")
>
>HardDrive/sw/src/DBI-1.31/DBI.pm
>HardDrive/sw/src/DBI-1.31/lib/Bundle/DBI.pm

But that's not the normal place where perl is supposed to find it. Did
you properly install DBI -- and the DBD::mysql modules?

I'm not familiar with your platform, but I gather it's rather Unix-like,
so the module CPAN might be useful to actually do the installation for
you.

At the command line:

	perl -MCPAN -eshell

and at the prompt you get now:

	install DBI

   HTH,
   Bart.


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

Date: Mon, 3 Mar 2003 15:14:03 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: HELP- How can  i use proxy service for port 80 as client using PERL
Message-Id: <rfrv3b.5r.ln@moldev.cmagroup.co.uk>

Sade Bhat Kalasabail <sade_bhat@yahoo.com> wrote:
> 'I have a client, that needs to contact a remote server on port
>  80. Due to our firewall setup I am not allowed to do this
>  directly, but I can utilise a proxy service for port 80. How do I
>  do this, using perl?' 

If you're not allowed to do something there's often a good reason. Have
you tried asking your company's security officer for this reason and
maybe whether they can make an exception?

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Mon, 3 Mar 2003 08:25:20 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: Need to trim word with parenthesis
Message-Id: <MPG.18cd21ce20e4206698972b@news.mts.net>


In article <e6j56vgvl7m4hgam3j8asjnf9d1dj0qqrf@4ax.com>, 
impervious@attbi.com (impervious@attbi.com) says...
> Can someone tell me how I could trim a string that looks like this:
> 
> (Tue) Mar 04, 2004
> 
> So that it looks like this:
> 
> Mar 04, 2004
> 
> I tried the following code but it has some sort of syntax error.  The
> first part of the line could be any of the days of the week, not just
> Tue and is always followed by a space which also needs to be trimmed
> out.
> 
> 	$_ = s/^[(.{3}) ]//;
> 
> 
> Thanks
> 

$_ =~ s/^\S+\s//;


-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


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

Date: Mon, 03 Mar 2003 17:39:39 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Need to trim word with parenthesis
Message-Id: <0o476vkk5lqdm4ku8f8fiof21f5bmfjse1@4ax.com>

impervious@attbi.com wrote:

>	$_ = s/^[(.{3}) ]//;

I'm curious where you get that syntax from. No offense ment: I'm just
curious what inexperienced (or "uncorrupted") people think of as a
user-friendly syntax. Would you care to expand?

-- 
	Bart.


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

Date: Mon, 03 Mar 2003 18:56:29 GMT
From: impervious@attbi.com
Subject: Re: Need to trim word with parenthesis
Message-Id: <8k876vcpl3f4315sfqum9qvaqtlspqpo97@4ax.com>

On Mon, 03 Mar 2003 17:39:39 GMT, Bart Lateur <bart.lateur@pandora.be>
wrote:

>impervious@attbi.com wrote:
>
>>	$_ = s/^[(.{3}) ]//;
>
>I'm curious where you get that syntax from. No offense ment: I'm just
>curious what inexperienced (or "uncorrupted") people think of as a
>user-friendly syntax. Would you care to expand?

Being a rank amateur and grossly unaware of the correct way to use
Perl's pattern matching, I just tried to follow various teach-yourself
books and some sample code found on the web.  

Alas, even with all the helpful suggestions I received, it seems that
this substitution resulted in losing the rest of the line.  When I try
to print $_ nothing is there.  <scratching head and pondering the
great mysteries of Perlish>

Thanks to everyone who responded and if you have any ideas why the
rest of the line disappears please let me know. I was under the
assumption that a substitution only changes the matched pattern.


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

Date: Mon, 3 Mar 2003 11:12:08 -0600
From: "Pirabhu Raman" <pirabhur@ufl.edu>
Subject: newbie array question
Message-Id: <b402du$12m6$1@spnode25.nerdc.ufl.edu>

How can I declare fixed size arrays (eg a integer array with each member of
4 bytes) in perl. How can I check the size of each element. ie is there any
function equiv to sizeof function in c.

Thanks in advance
Pirabhu




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

Date: 03 Mar 2003 17:38:46 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: newbie array question
Message-Id: <u9d6l8xsd5.fsf@wcl-l.bham.ac.uk>

"Pirabhu Raman" <pirabhur@ufl.edu> writes:

> Subject: newbie array question
           ^^^^^^

Don't say that.  At best it has no effect.  More often it predisposes
people against you.

> How can I declare fixed size arrays (eg a integer array with each member of
> 4 bytes) in perl.

Why would you want to?

The simple answer is you can't.

Of course if you are into inventing your own types you can do just
about anything.

> How can I check the size of each element.

Why would you want to?

> ie is there any function equiv to sizeof function in c.

Why would you want one?
 
> Thanks in advance

I think you have what we call an X-Y problem.  You want to do 'X' and
you think 'Y' is part of doing 'X' so you ask how to do 'Y'.  But, in
fact, 'Y' is something much more complex than 'X'.


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

Date: Mon, 3 Mar 2003 11:47:57 -0600
From: "Pirabhu Raman" <pirabhur@ufl.edu>
Subject: Re: newbie array question
Message-Id: <b404i6$12mg$1@spnode25.nerdc.ufl.edu>


"Brian McCauley" <nobull@mail.com> wrote in message
news:u9d6l8xsd5.fsf@wcl-l.bham.ac.uk...
> "Pirabhu Raman" <pirabhur@ufl.edu> writes:
>
> > Subject: newbie array question
>            ^^^^^^
>
> Don't say that.  At best it has no effect.  More often it predisposes
> people against you.
>
> > How can I declare fixed size arrays (eg a integer array with each member
of
> > 4 bytes) in perl.
>
> Why would you want to?
>
> The simple answer is you can't.
>
> Of course if you are into inventing your own types you can do just
> about anything.
>
> > How can I check the size of each element.
>
> Why would you want to?
>
> > ie is there any function equiv to sizeof function in c.
>
> Why would you want one?
>
> > Thanks in advance
>
> I think you have what we call an X-Y problem.  You want to do 'X' and
> you think 'Y' is part of doing 'X' so you ask how to do 'Y'.  But, in
> fact, 'Y' is something much more complex than 'X'.

Thanks for the response. The reason I want to declare array with elements of
fixed width is that I want to send a fixed number of bytes over the network
in a particular byte order. I am implementing the client in perl, while the
server is not. So I need to know (atleast I think so) the width of each
element I am sending. Please let me know

Thanks
Pirabhu




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

Date: Mon, 03 Mar 2003 13:26:34 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: newbie array question
Message-Id: <3E639E5A.AFB5DDE1@earthlink.net>

Pirabhu Raman wrote:
> 
> How can I declare fixed size arrays (eg a integer array with each
> member of 4 bytes) in perl.

You can't, really.

The closest approximation you can do is create a string of the
appropriate length, and access portions of that string using the vec()
function.

   my $lots_of_ints = "\0\0\0\0" x $n;
   for my $i ( 0 .. $n - 1 ) {
      print "The ${n}th int is : ";
      print vec($lots_of_ints, $i, 32), "\n";
   }

Also, you can use pack/unpack and substr, if you want arrays of things
other than simple ints.

> How can I check the size of each element.

For a vec() psuedo-array ... well, you just have to know what size
numbers you've chosen to use.

For a normal array, you can store any type of value, of any size.

> ie is there any function equiv to sizeof function in c.

Not really.  Why would you need one?

(For some purposes, length(pack($templ)) might do.)

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


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

Date: 3 Mar 2003 18:15:30 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: newbie array question
Message-Id: <b40642$acf$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Pirabhu Raman:

> Thanks for the response. The reason I want to declare array with elements of
> fixed width is that I want to send a fixed number of bytes over the network
> in a particular byte order. I am implementing the client in perl, while the
> server is not. So I need to know (atleast I think so) the width of each
> element I am sending. Please let me know

Have a look at the pack() and unpack() functions. The template letter
'n' (or 'N' for longs) can be used to transfer data in network
byteorder.

Another option might be vec() which is used for implementing fixed-width
bit-vectors.

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: 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 4655
***************************************


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