[15757] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3170 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 26 03:05:53 2000

Date: Fri, 26 May 2000 00:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959324717-v9-i3170@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 26 May 2000     Volume: 9 Number: 3170

Today's topics:
    Re: "or" vs. "||" - operator precedence question (Abigail)
    Re: ([^|]+) vs (.*?) (Gwyn Judd)
    Re: Accessing Large (Plus 2 gigs) <dan@tuatha.sidhe.org>
    Re: Can't Knit Two Files Together (Gwyn Judd)
    Re: can't run the perl CGI script. <ltlau@yahoo.com>
        Dynamically assigning $variable name? (Rachel Polanskis)
    Re: Dynamically assigning $variable name? (Abigail)
    Re: Dynamically assigning $variable name? <bwalton@rochester.rr.com>
    Re: Dynamically assigning $variable name? <r.polanskis@nepean.uws.edu.au>
    Re: Dynamically assigning $variable name? (Rachel Polanskis)
    Re: email poser (Craig Berry)
    Re: GDBM_File <bwalton@rochester.rr.com>
    Re: how to /s '[item]' (Gwyn Judd)
    Re: Listing installed packages? (Gwyn Judd)
        Member Area Help! <bluegreenturtleNOblSPAM@yahoo.com.invalid>
        Netscape w/ Perl <bburton@cintek.com>
    Re: Newbie - need to rip images from URL (Steven Smolinski)
        Newbie: DIV <SCanisius@dusnet.de>
    Re: odd behavior printing after randomizing an array fr (Decklin Foster)
    Re: odd behavior printing after randomizing an array fr (Craig Berry)
    Re: odd behavior printing after randomizing an array fr <kiera@nnickee.com>
        Open Source Credit Card Processing in Perl (Ben Humphreys)
    Re: please "grade" my coding skills (Neil Kandalgaonkar)
        Should be in FAQ: "I can't find Net::SMTP" <johnlin@chttl.com.tw>
    Re: Timing ? <bmb@dataserv.libs.uga.edu>
    Re: Timing ? <Info@dynasoft.co.nz>
    Re: Timing ? <Info@dynasoft.co.nz>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 26 May 2000 01:27:46 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: "or" vs. "||" - operator precedence question
Message-Id: <8gkjui$akl$1@news.panix.com>

On 25 May 2000 23:57:53 GMT, Joe Petolino <petolino@Eng.Sun.COM> wrote:
++ George Rapp  <gwr@novia.net> wrote:
++ 
++     [ the following two statements behave differently ]
++ 
++ >  my($handle) = DBI->connect("dbi:Oracle:", $user_id, $password)
++ >    || die "Can't connect: $DBI::errstr";
++ 
++ >  my($handle) = DBI->connect("dbi:Oracle:", $user_id, $password)
++ >    or die "Can't connect: $DBI::errstr";
++ 
++ >Since I'm not using any operators that lie between "||" and "or" on the
++ >precedence chart, I would have expected the two operators to behave the
++ >same here, but they don't.  What am I missing?  (I've been studying
++ >perlop and perlobj for over an hour, and I'm still not seeing it.)
++ 
++ Sometimes it just doesn't help to study something too long.  ;^)
++ What you're missing is that "=" lies between "||" and "or" on the
++ precedence chart.  The first one parses as
++ 
++    my($handle) = ( DBI->connect("dbi:Oracle:", $user_id, $password)
++ 		     || die "Can't connect: $DBI::errstr" );
++ 
++ and the second one parses as
++ 
++    ( my($handle) = DBI->connect("dbi:Oracle:", $user_id, $password) )
++    || die "Can't connect: $DBI::errstr";


While this is true, that doesn't explain the problem.

See my other posting in this thread.



Abigail


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

Date: Fri, 26 May 2000 05:54:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: ([^|]+) vs (.*?)
Message-Id: <slrn8iuosk.3cn.tjla@thislove.dyndns.org>

I was shocked! How could Abigail <abigail@arena-i.com>
say such a terrible thing:
>On Thu, 25 May 2000 22:12:07 +0200, Chantal <chantal@excite.nl> wrote:
>++ Hi all.
>++ 
>++ i know its not the same but i don't know the difference.
>++ who can tell me
>++ ([^|]+)  and  (.*?)
>++ (the pipe is part of the string)
>
>Well, they are very different:
>
>    ([^|]+):   matches a longest possible (sub)string, of at least one
>               character, that doesn't contain a '|'.
>    (.*?):     matches a shortest possible (sub)string, possibly empty,
>               that doesn't contain a newline (unless /s is in effect).

doesn't (.*?) match a string of zero length? No matter what the string
it was matching against contains I mean. I mean:

$st = "\n\n\n\n\n";
($s) = $st =~ /(.*?)/;
print $s;

gives no warnings (it prints nothing out but that just means that $s is
zero length, not that it is undefined).

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Cogito cogito ergo cogito sum --
"I think that I think, therefore I think that I am."
		-- Ambrose Bierce, "The Devil's Dictionary"


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

Date: Fri, 26 May 2000 03:03:13 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Accessing Large (Plus 2 gigs)
Message-Id: <RPlX4.94334$hT2.388857@news1.rdc1.ct.home.com>

scgilbert@my-deja.com wrote:
> When these tried and true scripts are run against files that
> exceed 2 gigs I get an error message:

Large file support's new in perl as of 5.6.0, and you need to compile it
in. Snag latest.tar.gz off of CPAN, read the configuration docs (INSTALL
and friends), build, and go. You can't do this in older versions of perl,
alas.

				Dan


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

Date: Fri, 26 May 2000 05:19:31 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Can't Knit Two Files Together
Message-Id: <slrn8iumrd.3cn.tjla@thislove.dyndns.org>

I was shocked! How could Dan Sugalski <dan@tuatha.sidhe.org>
say such a terrible thing:

>I think I'm missing something. If you're talking about this sort of thing:
>
>	@foo = <FH>;
>	for ($index = 0; $index < $#foo; $index++) {
>	  my $line = $foo[$index];
>	}
>
>Then I'll *definitely* disagree. 

This has an off-by-one error. It should be:

@foo = <FH>;
for ($index = 0; $index <= $#foo; $index++) {
  my $line = $foo[$index];
}

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
You get along very well with everyone except animals and people.


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

Date: Fri, 26 May 2000 09:57:30 +0800
From: "JL" <ltlau@yahoo.com>
Subject: Re: can't run the perl CGI script.
Message-Id: <392dd9c4@news02.imsbiz.com>


Bart Lateur <bart.lateur@skynet.be> wrote in message
news:39321c5e.5304711@news.skynet.be...
> JL wrote:
>
> >Can anyone tell me is there anyway that I can run the perl CGI scipt
which
> >is saved in ASCII rather than binary?  Cuz' if I saved in ASCII, I can't
run
> >the program....but if I change it in binary, then the program run fine.
> >I dont' understand why???
>
> Heh? Are you talking about FTP? Maybe you Perl will choke on
> inappropriate line endings. But I would expect the reverse.
>
> --
> Bart.

Thanks for your reply.

Actually, I am not talking about FTP.  I use Perl Builder in win98 to write
the CGI script and save it in my server.  But if I want to run the program,
I have to use telnet, then use pico to save the file again.






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

Date: 26 May 2000 01:23:36 GMT
From: rachel@photon.nepean.uws.edu.au (Rachel Polanskis)
Subject: Dynamically assigning $variable name?
Message-Id: <8gkjmo$rcb@ob1.uws.EDU.AU>


Hello, 
Given a list with a name on the left and a value on the right,

name   rachel
surname  polanskis
computer sun


How can I use the Left Hand Values as variable names - 
I would like to get the LHS of the list and create variables 
and values so my list actually defines the names of the variables so 
I end up with:

$name = rachel; 
$surname = polanskis;
$computer = sun;

The issue is that I do not know in advance how long the list will 
be or what the LHS variable will be called. 

Can this be done in perl in a way that would not look like obfuscation 
of the variable names? 


Thanks

Rachel Polanskis                 University of Western Sydney, Nepean
Senior UNIX Admin                PO Box 10, Kingswood NSW 2747
Systems && Operations            Information Technology Services, Kingswood
r.polanskis@nepean.uws.edu.au    Phone: +61 (0247) 360 291


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

Date: 26 May 2000 02:23:01 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Dynamically assigning $variable name?
Message-Id: <8gkn65$bh2$1@news.panix.com>

On 26 May 2000 01:23:36 GMT,
Rachel Polanskis <rachel@photon.nepean.uws.edu.au> wrote:
++ 
++ Hello, 
++ Given a list with a name on the left and a value on the right,
++ 
++ name   rachel
++ surname  polanskis
++ computer sun
++ 
++ 
++ How can I use the Left Hand Values as variable names - 
++ I would like to get the LHS of the list and create variables 
++ and values so my list actually defines the names of the variables so 
++ I end up with:
++ 
++ $name = rachel; 
++ $surname = polanskis;
++ $computer = sun;
++ 
++ The issue is that I do not know in advance how long the list will 
++ be or what the LHS variable will be called. 
++ 
++ Can this be done in perl in a way that would not look like obfuscation 
++ of the variable names? 


Why would you want that? You wouldn't do that in C or in Java, would
you?  And what purpose is it going to serve you? If you manage to make
a variable '$computer', but you don't know how it's going to be named
in advance, how is the rest of the program going to use '$computer'?

Of course, this topic is discussed in the FAQ, and raised in this group
about 50 times a week. One would assume a person in a senior technical
position would know better than to ask a VFAQ in this group.



Abigail


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

Date: Fri, 26 May 2000 02:24:15 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Dynamically assigning $variable name?
Message-Id: <392DE089.7BA58B4@rochester.rr.com>

Rachel Polanskis wrote:
> 
> Hello,
> Given a list with a name on the left and a value on the right,
> 
> name   rachel
> surname  polanskis
> computer sun
> 
> How can I use the Left Hand Values as variable names -
> I would like to get the LHS of the list and create variables
> and values so my list actually defines the names of the variables so
> I end up with:
> 
> $name = rachel;
> $surname = polanskis;
> $computer = sun;
> 
> The issue is that I do not know in advance how long the list will
> be or what the LHS variable will be called.
> 
> Can this be done in perl in a way that would not look like obfuscation
> of the variable names?
> 
> Thanks
> 
> Rachel Polanskis                 University of Western Sydney, Nepean
> Senior UNIX Admin                PO Box 10, Kingswood NSW 2747
> Systems && Operations            Information Technology Services, Kingswood
> r.polanskis@nepean.uws.edu.au    Phone: +61 (0247) 360 291

Rachel, you are asking about doing a *bad thing*.  The reason it is bad
is that you don't know exactly what data may come in, and thus you may
clobber some variable you otherwise use in your program with this
scheme. However, if you insist, you can do it as follows, assuming your
data is coming from standard input or specified as a parameter on the
command line:

    while(<>)
        if(/(\w+)\s+(\w+)/){
            $$1=$2;
        }
    }

See the section on "symbolic references" in perlref.

But what you *should* do is just use a hash to store your data:

    while(<>)
        if(/(\w+)\s+(\w+)/){
            $hash{$1}=$2;
        }
    }

That way, you won't corrupt your namespace, plus the names of the
"variables" will be retrievable programmatically using the keys
function.
-- 
Bob Walton


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

Date: Fri, 26 May 2000 13:40:03 +1000
From: Rachel Polanskis <r.polanskis@nepean.uws.edu.au>
To: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Dynamically assigning $variable name?
Message-Id: <Pine.GSO.4.21.0005261335190.28778-100000@photon.nepean.uws.edu.au>

On Thu, 25 May 2000, Bob Walton wrote:

> Rachel, you are asking about doing a *bad thing*.  The reason it is bad
> is that you don't know exactly what data may come in, and thus you may
> clobber some variable you otherwise use in your program with this
> scheme. However, if you insist, you can do it as follows, assuming your
> data is coming from standard input or specified as a parameter on the
> command line:
> 
>     while(<>)
>         if(/(\w+)\s+(\w+)/){
>             $$1=$2;
>         }
>     }
> 
> See the section on "symbolic references" in perlref.
> 
> But what you *should* do is just use a hash to store your data:
> 
>     while(<>)
>         if(/(\w+)\s+(\w+)/){
>             $hash{$1}=$2;
>         }
>     }
> 
> That way, you won't corrupt your namespace, plus the names of the
> "variables" will be retrievable programmatically using the keys
> function.

Thanks Bob 
The symbolic references were what we needed.  I had previously 
scanned perlref but overlooked it's significance. 

I understand what you mean about clobbering the variable as 
this was part of the problem I had already experienced. 

By the looks of it, the hash example would seem to be close enough to 
what's required.  

For a bit of background, the job involves extracting the schema from 
an LDAP database that we have no control over and ensuring any 
changes to the schema are reflected in the code - we don't know ahead 
of time whether there will attributes added or deleted so we needed 
some method to get these normalised some how....


Thanks heaps!

Rachel Polanskis                 University of Western Sydney, Nepean
Senior UNIX Admin                PO Box 10, Kingswood NSW 2747
Systems && Operations            Information Technology Services, Kingswood
r.polanskis@nepean.uws.edu.au    Phone: +61 (0247) 360 291



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

Date: 26 May 2000 04:48:08 GMT
From: rachel@photon.nepean.uws.edu.au (Rachel Polanskis)
Subject: Re: Dynamically assigning $variable name?
Message-Id: <8gkvm8$rcb@ob1.uws.EDU.AU>

In article <8gkn65$bh2$1@news.panix.com>,
	abigail@arena-i.com (Abigail) writes:
> On 26 May 2000 01:23:36 GMT,
> Rachel Polanskis <rachel@photon.nepean.uws.edu.au> wrote:

> Of course, this topic is discussed in the FAQ, and raised in this group
> about 50 times a week. One would assume a person in a senior technical
> position would know better than to ask a VFAQ in this group.

Point taken, 
I am not a regular Perl programmer but deal in systems pertaining to 
UNIX specifically.  I have a swag of O'Reilly books 
on my shelves at home and I know full well the meaning of RTFM.
I've read 'em all at some point or other.

I'm also a paid up subscriber of TPJ if you must know for at least 3 years.
I am often consulted for my so called knowledge of perl which helps
keeps the noise down on this group if you must know.
All this in spite of being someone who only gets the opportunity to 
write perl for themselves once in a blue moon.  

In fact I was asking a question that I didn't know the answer to, 
hoping I could answer it for someone else who (me being the so-called guru) 
asked it of me.   I couldn't answer the question myself so came 
here asking and hoping for advice from a professional.   Don't think
I didn't seek first my trusted camels and llamas and the web and came 
up with nothing - onward to CLPM....

I'm very sad to see you go on like this Abigail - I expected better
from you, instead of disparaging me in this manner.  I've lurked on this list 
from time to time and noted that you are held in high esteem along 
with the other JAPH crowd.  I'm sorry I didn't meet or exceed your
high standards and pay attention in such a way as to know that my question 
is an FAQ.  Why not just take a chill pill and put your writing 
skills into a good book like I know you can instead wasting time disparaging 
knowledge seekers - 'tis a sad life, I know....

If I know a question is an FAQ, I'll either ignore it or answer
it but I won't disparage someone for asking.   This is a community 
of like minds we're talking about, not a bunch of "me too"'s.

Anyway I read the article in the latest TPJ regarding the psychology 
of CLPM.  I do know how this froup works.  I thought I was following 
the etiquette and protocols pretty well and didn't expect 
flaming from a supposed net.god.

FWIW I try to keep the bandwidth down on any newsgroup I deal in 
and I am also held in regard on some of them - just I am not a Perl 
expert.  I am disappointed in some of the elitism I see in this froup - 
my question may have been answered by the perldoc - maybe I just 
didn't have the time to comprehend it or overlooked it in amongst 
the storehouse of knowledge I call my brain.

A big thankyou to those who took the time out to advise me about the 
correct way to do the job and why I wouldn't want to do what 
was suggested.  My assistant has hereby been notified to find an alternative. 
He's not a native english speaker BTW, so I helped by being a poster 
child for him so his questions don't get ignored or misconstrued.


Until next time,

rachel 
- technically competent in most things UNIX, just not a JAPH.

-- 
Rachel Polanskis                 University of Western Sydney, Nepean
Senior UNIX Admin                PO Box 10, Kingswood NSW 2747
Systems && Operations            Information Technology Services, Kingswood
r.polanskis@nepean.uws.edu.au    Phone: +61 (0247) 360 291


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

Date: Fri, 26 May 2000 05:58:49 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: email poser
Message-Id: <sis4kpjoo150@corp.supernews.com>

David Fleet (dfleet@avaterra.com) wrote:
[snip]

Others have commented on your actual question; thought I'd pop in with
some style tips.

: #initialise variables
: $mailprog = '/usr/lib/sendmail';
: $recipient1 = "d.fleet\@mydomain.net;
: $recipient = "d.fleet\@mydomain.net";
: $date_command = "/usr/sbin/date";

You can put all those in single quotes, and avoid having to \ the @s.

: for($a=1;$a<1001;$a++){

More perlishly expressed as

  foreach $a (1..1000) {

(I'm told the list doesn't actually get built in recent perls.)

: $time="";

No need to initialize it when you're just going to overwrite it anyway.

:     ($sec,$min,$hour,$mday,$mon,$year,$wday) =
: (localtime(time))[0,1,2,3,4,5,6];
:     $time = sprintf("%02d minute %02d seconds",$min,$sec);

More directly written as

  $time = sprintf '%02d minute %02d seconds', (localtime)[1, 0];


: #start mail
: open(MAIL, "|$mailprog $recipient1") || &emailerror;
: print MAIL "Subject: $a Email test\n";
: print MAIL "From: $recipient\n";
: print MAIL "To: $recipient1\n\n";
: print MAIL "$a\n\n
: $time
: \n\n";

The string of prints above might be easier to deal with as a here-doc:

  print MAIL <<EOM;
Subject: $a Email test
From: $recipient
To: $recipient

$a

$time

EOM


: close (MAIL);

On pipes, frequently checking close() for errors will give you more useful
information than checking open() (see perlipc, if I recall correctly).

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: Fri, 26 May 2000 02:37:53 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: GDBM_File
Message-Id: <392DE3BB.3D961EA9@rochester.rr.com>

spurcell wrote:
> 
> Hello,
> I want to install the GDBM_File to create a DBM file with.
> The camel says that the Linkage comes with Perl (page 379)
> and also says "Source Bundled With Perl" "NO";
> 
> so I am confused. I went to the activestate/packages and looked for the
> GDBM_File, but see no package for it.
> 
> Does anyone know where to find the package, and if so where?
> 
> Thanks
> Scott

GDBM doesn't work on Windoze.  Use DB_File or SDBM instead.  And note
that SDBM doesn't work on FAT or FAT32 file systems, only NTFS (DB_File
works fine on all).  Better yet, use Linux, where stuff works.  Note
that the advent of a more-or-less-working Perl on Windoze was relatively
recent, and that statements in the Camel book and the core Perl docs
should be taken as referring to Unix or Unix-like systems, as Windoze
was mostly ignored by serious folks.
-- 
Bob Walton


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

Date: Fri, 26 May 2000 05:36:25 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: how to /s '[item]'
Message-Id: <slrn8iunr3.3cn.tjla@thislove.dyndns.org>

I was shocked! How could Larry Rosler <lr@hpl.hp.com>
say such a terrible thing:
>In article <392D9E1B.FB7C8F9F@My-Deja.com> on Thu, 25 May 2000 14:41:47 
>-0700, Makarand Kulkarni <makarand_kulkarni@My-Deja.com> says...
>> >
>> > but of course it is taking every letter r e and d and switching them to it
>> > instead
>> 
>> remove the [ and ]  around red
>
>I would replace the [ and ] with \b and \b instead of removing them.

I think what the OP really wanted was this:

s/\[red\]/<font color="red">

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Matrimony isn't a word, it's a sentence.


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

Date: Fri, 26 May 2000 05:47:58 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Listing installed packages?
Message-Id: <slrn8iuogp.3cn.tjla@thislove.dyndns.org>

I was shocked! How could Randal L. Schwartz <merlyn@stonehenge.com>
say such a terrible thing:
>>>>>> "Hardy" == Hardy Merrill <hmerrill@my-deja.com> writes:
>This lists *all* modules (tested), and shows you which are out of date
>with respect to your CPAN mirror:
>
>    use CPAN;
>
>    for $mod (CPAN::Shell->expand("Module", "/./")) {
>      next unless $mod->inst_file;
>      printf "%-40s %10s", $mod->id, $mod->inst_version;
>      printf " *** %10s", $mod->cpan_version unless $mod->uptodate;
>      print "\n";
>    }
>
>(I stole this for the most part directly from the manpage. :)

hmm when I ran this I got this error right at the end:

"        (in cleanup) Can't call method "gzclose" on an undefined value
at /usr/local/lib/perl5/5.6.0/CPAN.pm line 4493 during global
destruction."

Is this a bug? I'm running 5.6.0

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Jury: Twelve people who determine which client has the better lawyer.

		-- Robert Frost


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

Date: Thu, 25 May 2000 23:36:40 -0700
From: bluegreenturtles <bluegreenturtleNOblSPAM@yahoo.com.invalid>
Subject: Member Area Help!
Message-Id: <0c035eb0.31eef0e5@usw-ex0104-032.remarq.com>

I'm very new to the world of perl and cgi, and I really need
some help. I am trying to set up a site that allows users to
register, login and then be directed to a member area sepecific
to them. Their member area would include account info and such.
I also need to track their activity so I can assign them points
for specific actions. I have searched all over and have found
few things to help me. Because I don't understand Cgi or Perl
much I am very confused on what is needed to do all of theses
things. Do I need Databases, Trackers, Password Protection
seperatly or is there a free program or script that can do it
all. And what is needed from a server to use these scripts.I
know I'm asking alot but if there is anyone with any info that
will help it would be greatly appreciated. Thanks

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Thu, 25 May 2000 21:31:05 -0600
From: Brian Burton <bburton@cintek.com>
Subject: Netscape w/ Perl
Message-Id: <392DEFF9.64310EC5@cintek.com>

Hey there, this question I know has probably been out there lots but I
haven't easily found the answer.

My scripts work good with Internet Explorer but with Netscape it just
views the source.  Does anyone know a solution?

Thank ahead of time.. Brian


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

Date: Fri, 26 May 2000 01:58:36 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Newbie - need to rip images from URL
Message-Id: <slrn8irmdr.dup.sjs@john.sympatico.ca>

patrickshroads@my-deja.com <patrickshroads@my-deja.com> wrote:
>Thanks so much for your prompt reply... however you overestimated my
>PERL knowledge :)

<pedantic intent="informative">
Perl = the language
perl = the interpreter
PERL = none of the above

Please don't post jeopardy-style, it makes moving everything about 
terribly difficult.
</pedantic>

>How would I capture the response [of an HTTP request for an 
>image] to a file?

Make sure the LWP (libwww package) is installed, and this should do it:

perl -MLWP::Simple -e 'getprint("http://domain.org/image.gif")' > image.gif

Steve


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

Date: Fri, 26 May 2000 07:38:27 +0200
From: Stephan Canisius <SCanisius@dusnet.de>
Subject: Newbie: DIV
Message-Id: <392E0DD3.F01F4E98@dusnet.de>

Hi Guys!

Cal anyone tell me, how i can do a DIV in Perl 5.???

A function which gives me back a "3" if I give it 10 and 3.

10/3 is 3.333333333 and I only want the 3 given to me.

Thanks

    Stephan



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

Date: 26 May 2000 04:45:12 GMT
From: fosterd@hartwick.edu (Decklin Foster)
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <slrn8is0ar.161.fosterd@photek.dhs.org>

Kiera <kiera@nnickee.com> writes:

> while(<>) {@b = <>}

i'm pretty sure you mean

	while(<>) { push @b, $_; }

> one of them being that I had to ctrl-z *twice* rather than
> once to get anything to print;

Yes, look at your code; you're reading from stdin twice.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Fri, 26 May 2000 05:42:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <sis3m233o115@corp.supernews.com>

Gwyn Judd (tjla@guvfybir.qlaqaf.bet) wrote:
: oh that's pretty :).

Isn't it?!  I still can't quite believe it works, despite the math.  It's
among my all-time favorite WTF? algorithms.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: Fri, 26 May 2000 01:23:08 -0500
From: Kiera <kiera@nnickee.com>
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <761D949F370C0779.335A78476AC43D57.CD1B5D261E6155A4@lp.airnews.net>

On 26 May 2000 04:45:12 GMT, someone claiming to be
fosterd@hartwick.edu (Decklin Foster) said:

>Kiera <kiera@nnickee.com> writes:

>> while(<>) {@b = <>}

>i'm pretty sure you mean

>	while(<>) { push @b, $_; }

Yup, I probably did.  At that time, however, I had just finished
chapter 3.  While wasn't introduced until chapter 4, and <> came along
in chapter 6.  So considering all that, I think I did purdy good :)

>> one of them being that I had to ctrl-z *twice* rather than
>> once to get anything to print;

>Yes, look at your code; you're reading from stdin twice.

Yup, I see that now :)

Kiera



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

Date: Fri, 26 May 2000 02:33:12 GMT
From: brh@bhent.com (Ben Humphreys)
Subject: Open Source Credit Card Processing in Perl
Message-Id: <392dde16.328532736@news.uswest.net>

I am attempting to gauge interest in an open-source credit card
processing system written in Perl.  Presently at CPAN, the only
creditcard related module is Business-CreditCard-0.21 and it is only
useful for performing up-front LUN checks on credit card numbers.

I believe there is adequate demand for a real-time credit-card
processing system, capable of transmitting authorization, sale,
credit, and void transactions, via modem, to the credit card
processing networks.  Such a settlement system would obviate the need
for high-priced alternatives such as CyberCash, CCVS, or MS
Transaction Server and provide e-commerce merchants better control,
reliability, flexability, and performance than what is presently
offerred.

I am considering Perl for this project because it provides the best
mix of rapid development and cross-platform independance.  My
preference is for a *nix environment but I suspect a sizable
percentage of prospective users will want to run on Windows and I
believe Perl is an excellent match to these requirements.

Please post if you are interested in such a system and let me know
your thoughts on which features are most important and what back-end
database should be used (i.e. text files, MySQL, or user-configurable
DBI/DBD).

Thanks for all comments,

Ben Humphreys
BH Enterprises
http://www.bhent.com



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

Date: 26 May 2000 03:37:45 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: please "grade" my coding skills
Message-Id: <8gkri9$m0o$1@newsflash.concordia.ca>

In article <8gifn3$iaq$1@kira.cc.uakron.edu>, Todd W <trw@uakron.edu> wrote:

>I was under the assumption that DateCalc needs compiled(im pretty sure i
>read that)....no shell access...just ftp

Ah, I forgot that Date::Calc needs some compliation. Sorry.
Well, maybe you can find a binary package from some trusted source...
Assuming you don't have the tools to compile it at home.

But, I just checked Steffen Beyers' home page (author of Date::Calc)
and apparently somebody just wrote an all-Perl version of Date::Calc:

<http://www.engelschall.com/u/sb/download/>
<http://catcode.com/date/pcalc.html>

Date::Pcalc does not seem to be on the CPAN, yet.

Caveat downloader, I have not tried Date::Pcalc myself.

-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Fri, 26 May 2000 11:56:38 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Should be in FAQ: "I can't find Net::SMTP"
Message-Id: <8gksl7$qvk@netnews.hinet.net>

Dear all,

I have been asked this question for many times.

"I can't find Net::SMTP module in CPAN."

Actually, we should redirect them to look for "libnet" instead, right?
Can we put this answer in the FAQ?

Thank you.

John Lin




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

Date: Thu, 25 May 2000 22:19:57 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: Timing ?
Message-Id: <Pine.GSO.4.21.0005252219070.26889-100000@dataserv.libs.uga.edu>

On Fri, 26 May 2000, Lew wrote:
> sub timer {
> $SIG{'SIGALRM'} = sub{&drawer};
> alarm(5);
> }

Don't you mean $SIG{ALRM}?

-- 
Brad



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

Date: Fri, 26 May 2000 17:15:34 +1200
From: "Lew" <Info@dynasoft.co.nz>
Subject: Re: Timing ?
Message-Id: <XLnX4.26210$usz4.12910828@news.xtra.co.nz>

I'm not quite sure what you mean by the program finishing before the alarm
gets activated. I don't see it?

Lew

Abigail <abigail@arena-i.com> wrote in message
news:8gkbt9$86a$2@news.panix.com...
> On Fri, 26 May 2000 10:39:09 +1200, Lew <Info@dynasoft.co.nz> wrote:
> ++ I need to activate some code after a time period,
> ++ tried the following without success.
> ++
> ++ Any ideas why ?
>
> You finish the program before the alarm gets activated.
>
> You could just do a sleep, although I'm baffled why you would want to
> delay printing stuff in a CGI program in the first place.
>
>
>
> Abigail






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

Date: Fri, 26 May 2000 17:17:23 +1200
From: "Lew" <Info@dynasoft.co.nz>
Subject: Re: Timing ?
Message-Id: <ENnX4.26215$usz4.17039666@news.xtra.co.nz>

I need to get some text to display about 5 seconds after some initial text.

Just cannot get it right!!

Lew


Brad Baxter <bmb@dataserv.libs.uga.edu> wrote in message
news:Pine.GSO.4.21.0005252219070.26889-100000@dataserv.libs.uga.edu...
> On Fri, 26 May 2000, Lew wrote:
> > sub timer {
> > $SIG{'SIGALRM'} = sub{&drawer};
> > alarm(5);
> > }
>
> Don't you mean $SIG{ALRM}?
>
> --
> Brad
>




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3170
**************************************


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