[15769] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3182 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 27 09:05:24 2000

Date: Sat, 27 May 2000 06:05:11 -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: <959432711-v9-i3182@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 27 May 2000     Volume: 9 Number: 3182

Today's topics:
    Re: Can I do this using Perl? <cramirez@gte.net>
    Re: CGI and sytem calls.. <cramirez@gte.net>
    Re: CGI browser detection <chris@cjx.com>
    Re: CGI browser detection <cramirez@gte.net>
    Re: CGI browser detection <flavell@mail.cern.ch>
        Couple of Newbie RegExp questions <jkipp5@home.com>
    Re: Couple of Newbie RegExp questions <dave@dave.org.uk>
    Re: Does this exist? <dave@dave.org.uk>
    Re: Filtering records in a flat file <cramirez@gte.net>
    Re: Foreach Statement <lr@hpl.hp.com>
    Re: Foreach Statement <cramirez@gte.net>
    Re: Foreach Statement <dave@dave.org.uk>
    Re: HELP::IstallingModules <dave@dave.org.uk>
    Re: how to /s '[item]' <lr@hpl.hp.com>
        LWP::UserAgent question (J. B. Moreno)
    Re: LWP::UserAgent question <cramirez@gte.net>
        Mailto accomplished via Perl / CGI ? (Cav)
    Re: my $x vs. my ($x) <dennis_marti@yahoo.com>
        MySQL problem: $DBI::errstr always null jlamport@calarts.edu
    Re: Opening a file from another server <cramirez@gte.net>
        perl and nanosleep()? <forcenoube@zipworld.com.au>
    Re: Perl date formatting stone@enetis.net
        please do not feed the troll, was Re: seeking method to <flavell@mail.cern.ch>
    Re: problems in PPM and installation modules <cramirez@gte.net>
        Programming Perl Realtime ChatRoom <dchk_78NOdcSPAM@yahoo.com.invalid>
    Re: Reading XML documents <cramirez@gte.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 27 May 2000 12:08:25 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: Can I do this using Perl?
Message-Id: <392FBAE9.678C6CCF@gte.net>

By using the LWP module, you can write a script to fetch the remote URL
that generates the report (which runs it),
then the same script sends the generated report back to the browser
(frame).

Example:

use LWP::Simple;

my $remote_url = 'http://domain.com?params=...';

## Connect to remote url and retrieve results. results get stored in
$generated_report
$generated_report = get($remote_report);



-Carlos

Tony O'Brien wrote:

> How does perl handle graphics?
>
> I am trying to implement the following on a website, but I am not sure
> if it can be done using perl:
>
> The user clicks a link on the website to view a report.
> The script then has to connect to a partner website, run the report
> and present the results back on this website.
> i.e. the user clicks a link and a report is presented to them in a
> frame.  They are unaware of where the report was generated.
>
> The report contains graphical elements (graphs) and I do not know if
> perl will choke on this.  Can anyone advise please?



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

Date: Sat, 27 May 2000 11:59:12 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: CGI and sytem calls..
Message-Id: <392FB8C2.F27ABCB4@gte.net>

Why not use perl's open?

open FILE,$file or die "$!";
@content = <FILE>;


-Carlos

Matthew Wilson Emmett wrote:

> Hello,
>
> I was wondering how "expensive" doing something like
>
> $contents = `cat $name`;
>
> in CGI script that will be run many many time is?  Should I try and
> avoid system calls like the above in my CGI scripts to keep
> web-hosters happy?
>
> Any thoughts and opinions are greaty appreciated,
> Matt



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

Date: Sat, 27 May 2000 07:07:55 +0100
From: Chris <chris@cjx.com>
Subject: Re: CGI browser detection
Message-Id: <02CC78EFD29CBEFA.C36536306BB0E314.534C5BF831AE3081@lp.airnews.net>

"Aaron" <vandemen@yahoo.com> wrote:

>Best way I have seen for Browser Detection is an ASP(Active Server Pages)
>module called "Browser Hawk" http://www.cyscape.com/products

Yes, if you fancy paying for something that you can get for free from
CPAN, and then being reliant on them for upgrades to new browsers.

>
>Definetely worth a look in my opinion ASP does a few things better then Perl
>can and vice-versa using both can make life a lot easier.
>

Seriously, what does ASP do better than Perl, and why? 


* You find a scroll labelled THARR


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

Date: Sat, 27 May 2000 12:22:16 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: CGI browser detection
Message-Id: <392FBE25.B017F55D@gte.net>

You can get the browser type from $ENV{'HTTP_USER_AGENT'} variable.

-Carlos

tiddlerdeja@my-deja.com wrote:

> I'd like to use Perl for a CGI script which would detect the type of
> browser a request has been made from and then return an apporpriate
> response.
>
> E.g. If I get a request from IE5 I'd like to return HTML
> If I get a request from a WAP browser, I'd like to return WML.
>
> Any information greatly appreciated.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Sat, 27 May 2000 14:40:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI browser detection
Message-Id: <Pine.GHP.4.21.0005271431400.5838-100000@hpplus01.cern.ch>


On Sat, 27 May 2000, Carlos Ramirez terrified the amazed onlookers by 
hanging upside-down from a convenient nntp server and blurting out:

> You can get the browser type from $ENV{'HTTP_USER_AGENT'} variable.

Well, you can get the contents of the User-agent: header that
the nearest proxy chose to send to the server.  Quite often that would
contain the standard user-agent string of the client browser.  Other
times it wouldn't.

Would you care to list all the possible values, so that the questioner
can decide what to do with them?  Even over quite a short time span,
my server records a couple of thousand different ones.  Don't forget
to also list the ones that are going to be introduced in the next 6 -
12 months, so that the script will continue to work for new products.

Frankly, I'd say a properly-engineered solution needs a different
approach.  This is what the Accept: header is for.  Of course, this
isn't a Perl language question.  [f'ups']



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

Date: Sat, 27 May 2000 11:59:33 GMT
From: Jim Kipp <jkipp5@home.com>
Subject: Couple of Newbie RegExp questions
Message-Id: <392FB8F6.5A5398E8@home.com>

Hello
I am trying to write something to find repeated words in an
input file, print the repeated word and the line # it is on.
I came up with the mess below but did not work.  The second
script I need is one that uses the translation operator to
remove repeated instances of the tab character and then
replaces the tab character with a space character.
Thanks


$target = m/(s*\w+)\1/;

open (IN, "<word.txt");

while (<IN>) {
        if (/$target/) {
                print "found dups on line $." . "$1\n";
        }
}
close (IN);


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

Date: Sat, 27 May 2000 13:22:33 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Couple of Newbie RegExp questions
Message-Id: <luevis4899v114mko0kk2ogihfksp9chok@4ax.com>

On Sat, 27 May 2000 11:59:33 GMT, Jim Kipp <jkipp5@home.com> wrote:

>Hello
>I am trying to write something to find repeated words in an
>input file, print the repeated word and the line # it is on.
>I came up with the mess below but did not work.

Your match is being executed once - before any of the file has been
read and therefore always returns false. Also your regex could use
some adjustments. The 's*' need to be '\s*' and actually would be
better replaced by \b (a word boundary). Also you don't allow for any
spaces between the two words.

>$target = m/(s*\w+)\1/;
>
>open (IN, "<word.txt");
>
>while (<IN>) {
>        if (/$target/) {
>                print "found dups on line $." . "$1\n";
>        }
>}
>close (IN);

Better written something like:

#!/usr/bin/perl -w
use strict;

open(IN, 'word.txt') or die "Can't open word.txt: $!\n";

while (<IN>) {
  print "dups found on line $.\n" if /\b(\w+)\s+\1\b/;
}

But that still doesn't cope with the possibility that the last word on
one line and the first word on the next are the same.

hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Sat, 27 May 2000 13:00:10 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Does this exist?
Message-Id: <h4evisouvkc74p228avpg6e1khbrigphih@4ax.com>

On Fri, 26 May 2000 20:00:13 GMT, Falk <sysop@NOSPAMHERE.falkware.com>
wrote:

>I'm working on a webpage for an iRC channel, and one of the features
>they want is a members database, or list. I'm trying to locate a
>cgi/perl script that will live up to their requests...
>
>Basically they want a list that sorts and links alphabetically, and
>with the possibility to totally customize the look and feel of the
>list output...
>
>It should also contain possibility for visitors to add themselves to
>the list, and include a picture either from local driver or a web
>address...
>
>Other than that a simpel, yet effective, admin console with possibilty
>to edit, add and remove listings would be prefferable...
>
>I've been scouring the script databases out there with no special
>luck, and those running a script similar to this is of course not
>willing to share with a fellow webmaster...
>
>I know memberlist/database scripts are fairly commong out there, and I
>was hoping someone here either has something like this, or know where
>I can get a hold of it...
>
>Thank you so much in advance...

This sounds like a question which would be more at home in
comp.infosystems.www.authoring.cgi. Did you ask over there?

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Sat, 27 May 2000 11:40:33 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: Filtering records in a flat file
Message-Id: <392FB464.688B1F35@gte.net>

Are you using CGI.pm?
If so, you can do the following:

use CGI;

my $url_params = new CGI;
my $publisher = $url_params->param('publisher') || undef;
my $title  = $url_params->param('title') || undef;


unless ($publisher)  {
           ## No publisher passed
}

unless ($title) {
     ## No title passed
}

 ...process search

-Carlos




kdevine@my-deja.com wrote:

>  I am trying to make a filter based on parameters passed in the URL.
> For instance, if the URL parameters are: "publisher=AAA&title=BBB", it
> will filter the flat file by making sure $in{'publisher'} eq $fields[1]
> && $in{'title'} eq $fields[2].
>
> But, if they don't put in a publisher, the parameter is not present or
> blank.  I want the if statement to overlook it, otherwise, it returns
> false and the statement finds no records.
>
> I have tried this statement:
> if ( ($fields[0] eq $input{'publisher'} if $input{'publisher'} ne "")
> && ($fields[1] eq $input{'title'} if $input{'title'} ne "") && ($fields
> [8] eq $input{'writer'} if $input{'writer'} ne "") && ($fields[9] eq
> $input{'artist'} if $input{'artist'} ne "") && ($fields[2] == $input
> {'issue'} if $input{'issue'}) && ($fields[6] eq $input{'notes'} if
> $input{'notes'} ne "") && ($fields[7] eq $input{'storylines'} if $input
> {'storylines'} ne "") && ($fields[3] eq $input{'condition'} if $input
> {'condition'} ne "") )
>
> which didn't work.  Any suggestions?
>
> --
> Kevin Devine
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Fri, 26 May 2000 23:08:28 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Foreach Statement
Message-Id: <MPG.139906314e11736898aaf6@nntp.hpl.hp.com>

In article <392F0BDB.B3DCB7A2@berghold.net>, peter@berghold.net says...
> Without a foreach loop try,
> 
> my @ry=qw/ do re me fa so do re me fa so do re me fa so/;
> my %een;
> my @unique = grep !$een{$_}++,sort @ry;
> print join("\n",@unique);

The sort() seems sort of gratuitous, especially when your chosen input 
has a natural order.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 27 May 2000 11:32:04 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: Foreach Statement
Message-Id: <392FB267.64F0D0BA@gte.net>

Try:

foreach (@years) {
     $unique_years{$_}  = 1;
}

# print unique years
print keys %unique_years;

-Carlos


Brian wrote:

> Say for example I had an array of years and within the array there could be
> the same year more than once.  Using a Foreach loop how can I get just the
> unique years and not any duplicates?
>
> Thanks in advance...
>
> Brian



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

Date: Sat, 27 May 2000 12:58:17 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Foreach Statement
Message-Id: <c1evis8s7k7teb9cgpfpph8u1lriqhpuf0@4ax.com>

On Fri, 26 May 2000 14:08:13 -0700, Larry Rosler <lr@hpl.hp.com>
wrote:

>In article <8gmmhm$i9k$1@news.junction.net> on Fri, 26 May 2000 14:26:00 
>-0600, Brian <brburton@cintek.com> says...
>> Say for example I had an array of years and within the array there could be
>> the same year more than once.  Using a Foreach loop how can I get just the
>> unique years and not any duplicates?
>
>Would it surprise you to learn that this Question has been Asked 
>Frequently?
>
>perlfaq4: "How can I remove duplicate elements from a list or array?"

Of course, none of the answers in the FAQ use a foreach loop and would
therefore be useless for Brian's homework :-)

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Sat, 27 May 2000 11:26:43 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: HELP::IstallingModules
Message-Id: <u68visk3vbs1j89a91sd49fvtdart3u7e8@4ax.com>

On Sat, 27 May 2000 00:01:52 GMT, elainebe@my-deja.com wrote:

>I have downloaded perl 5 binaries (I'm on Solaris) and downloded some
>modules into the same directory. after gzip -dc my.module.tar.gz | tar
>-xof -  I cd to the new dir and  type: perl Makefile.PL
>I get the message that I have syntax errors. This happens even if I try
>to hard code the path to perl5 at the top of the Makefile.PL (as well as
>put the path in the @INC and env.
>  I am a junior programmer and have never installed modules before. Any
>help out there??

Elainebe,

It would be useful if you told us which modules to were trying to
install and listed the errors you were getting. However, I'm going to
take a stab in the dark and describe one reason that I've seen for
these errors.

When you compile Perl it squirrels away a lot of information about how
it was built. This inforamtion includes stuff like the compiler that
it was built with and the compiler options that were used.

Perl modules come in two flavours. Most are pure Perl code, but many
contain C code when needs to be compiled when installing them. The
DBD::X modules are perhaps the most common example of this second
type.

You mention that you downloaded a pre-built Perl binary. If this came
from Sun it would have been built using their C compiler. You may well
not have this compiler on your system as iyou have to pay for it and
many people use gcc instead (because it's a) better and b) free!).

If you try to install a Perl module which requires compiling C code
and the compiler on your machine is different to the compiler that the
Perl was originally built with, then the installation will fail and
you'll get lots of error messages.

This is one very good reason for not installing a pre-built Perl
binary but building it yourself from the source.

As I say, this may well not be your problem, but it is one that I've
seen a few times in situations like yours.

hth,

Dave....

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Fri, 26 May 2000 22:59:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: how to /s '[item]'
Message-Id: <MPG.1399040e4dd1098a98aaf5@nntp.hpl.hp.com>

In article <slrn8j169e.3cn.tjla@thislove.dyndns.org>, 
tjla@guvfybir.qlaqaf.bet says...
> I was shocked! How could Brad Baxter <bmb@dataserv.libs.uga.edu>
> say such a terrible thing:
> >On Sat, 27 May 2000, Gwyn Judd wrote:
> >...
> >> *grin* I was pretty diffident in correcting you Larry all things
> >> considered. I figure I still have lots and lots to learn. What is a Golf
> >> competition?
> >
> >In golf you win with the fewest strokes.  Same for Perl Golf.
> 
> keystrokes? or number of characters? When is the next competition?

keystrokes == number of characters + newline, right?

The Perl Conference 4.0, organized by Uri Guttman.  See the O'Reilly 
conference web page for details.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 27 May 2000 01:26:23 -0400
From: planb@newsreaders.com (J. B. Moreno)
Subject: LWP::UserAgent question
Message-Id: <1eb9nng.1iip02a3qx3pcN%planb@newsreaders.com>

Isn't UserAgent supposed to allow using FTP?

I've got a simple script to grab a file from a remote location, and it's
successfully worked with an http "get", but when I change the url so
that ftp is supposed to be used, it fails (as far as I can tell it
doesn't even attempt to make a connection).

#!/usr/bin/perl5 -w

use LWP::UserAgent; #makes this script possible!

$page ='ftp://ftp.newsreaders.com/pub/test.txt';

$dir = '';
$save_file = $dir . 'test.ftp';

my $ua = new LWP::UserAgent;

# send request and get response
my $req = new HTTP::Request 'GET' => $page;
my $res = $ua->request($req, $save_file);



-- 
John B. Moreno


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

Date: Sat, 27 May 2000 12:24:30 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: LWP::UserAgent question
Message-Id: <392FBEAB.B750A29F@gte.net>

Try using the Net::FTP module

-Carlos


"J. B. Moreno" wrote:

> Isn't UserAgent supposed to allow using FTP?
>
> I've got a simple script to grab a file from a remote location, and it's
> successfully worked with an http "get", but when I change the url so
> that ftp is supposed to be used, it fails (as far as I can tell it
> doesn't even attempt to make a connection).
>
> #!/usr/bin/perl5 -w
>
> use LWP::UserAgent; #makes this script possible!
>
> $page ='ftp://ftp.newsreaders.com/pub/test.txt';
>
> $dir = '';
> $save_file = $dir . 'test.ftp';
>
> my $ua = new LWP::UserAgent;
>
> # send request and get response
> my $req = new HTTP::Request 'GET' => $page;
> my $res = $ua->request($req, $save_file);
>
> --
> John B. Moreno



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

Date: 27 May 2000 04:17:19 GMT
From: caviatte@aol.comNoSpam (Cav)
Subject: Mailto accomplished via Perl / CGI ?
Message-Id: <20000527001719.15899.00000729@ng-md1.aol.com>

Hi all,

You know the standard mailto tags in an html doc?

(a href=mailto:someone@somewhere.com)someone(/a)

Well, I'm almost dead positive that I've got a few bots harvesting my pages for
addresses.  IS THERE A WAY to do something like:

(a href=cgi-bin/email_lookup.cgi?ID=101)someone(/a)

 ...and have the script look up the proper email addy AND TRIGGER THE USER'S
EMAIL CLIENT TO OPEN as the first example would?

Thanks in advance,

           >>>  Cav  <<<

Cav's Roller Coaster Tycoon Depot
     http://rct.prohosting.com
 PLEASE STOP BY FOR A VISIT



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

Date: Sat, 27 May 2000 00:27:22 -0400
From: Dennis Marti <dennis_marti@yahoo.com>
Subject: Re: my $x vs. my ($x)
Message-Id: <dennis_marti-DC8EF0.00272227052000@news.starpower.net>

In article <66omg8.1od.ln@usenet-autoren.de>, Christian Winter 
<thepoet1@arcormail.de> wrote:

> Well, but is there really a case where
> my ($x) = @_;
> 
> is more helpful than
> my $x = shift;

Occasionally, when a script is going through a lot of changes, I'll add 
input parameters and forget to change "shift" to "@_".

my ($x, $y) = shift;      # d'oh!

stupid, yes, and -w helps find it quickly enough. But I'll submit it as 
one reason someone might prefer the first form.

Dennis


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

Date: Sat, 27 May 2000 09:38:44 GMT
From: jlamport@calarts.edu
Subject: MySQL problem: $DBI::errstr always null
Message-Id: <8go533$mq8$1@nnrp1.deja.com>

So I'm using the DBI module to access a MySQL database.  Everything seems
to work fine, EXCEPT, contrary to the documentation, $DBI::err and
$DBI::errstr are always undefined, even immediately after executing a bad
SQL query.  This is true whether I access these values as $DBI::errstr or
as $db_handle->errstr.  Setting

$db_handle->{PrintError} = 1;

causes the errors to get printed to STDERR as expected -- they're just
not showing up in $DBI::errstr or $DBI::err.

I suppose as a workaround I could wrap my $statement_handle->execute()
calls in an eval block, and capture the errors that way, but that seems
like a rather inelegant solution, when simply checking $DBI::errstr *
ought* to do what needs to be done.

Any ideas what could be going wrong?  Or is my documentation faulty, and
$DBI::errstr doesn't really do what I expect it to?  (I'm going by the
O'Reilly book "MySQL & mSQL".)

-jason


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 27 May 2000 12:42:14 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: Opening a file from another server
Message-Id: <392FC2D0.4DA23A72@gte.net>

Use LWP::Simple to fetch your pages from the other servers.

-Carlos

Franck Lalane wrote:

> Hello,
>
> I have a search engine in perl running for an Intranet.
> When I create the result list, I must open the files to get the title I will
> display.
> Everything works fine with all the files from the server running the script.
> (I use the physical path related to the server)
>
> The problem is that we have 3 servers, and I can't find the way to call them
> in Perl.
> I've tried the URL ("http://mysite.com/my_page") or with the server shares
> ("\\server\shared_directory\my_file").
> I thought to work with a shared directory, but nobody is logged on the
> server, and the shares are depending on who is logged.
>
> Help me! I'm sure it's possible!
>
> Thanks
>
> Franck



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

Date: 27 May 2000 05:05:03 GMT
From: force <forcenoube@zipworld.com.au>
Subject: perl and nanosleep()?
Message-Id: <8gnl1v$oru$1@nina.pacific.net.au>

Hi,

Does anyone know if it's possible to sleep() in perl for less than 
one millisecond? In particular, if there's an equivilant of nanosleep()
in perl (or a perl module).

Doing a syscall of nanosleep() will add too much overhead and isn't 
appropriate for this situation.

Thanks.

-- 
Cheers.


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

Date: Sat, 27 May 2000 06:07:39 GMT
From: stone@enetis.net
Subject: Re: Perl date formatting
Message-Id: <8gnon5$ec3$1@nnrp1.deja.com>

In article <8gjk9n$fgq$1@nnrp1.deja.com>,
  jwolly2@my-deja.com wrote:
> All-
>
> I am looking for a module to convert various date strings to a
common
> format.  I have tried DateParse() from the Date::Manip module.
This
> does exactly what I need, but is too slow.
>
> Thanks in advance for your help.
>
> jwolly2

I'm just a newbie been programming for about 4 months.
Formating the date string is actualy one of the first programs I ever
wrote.  It's a whollup of a date formating program!  I made it as
complex as you would ever need it to be with several "built-in"
formated date strings.  Feel free to use this as your own....

-------------
##### MASSIVE DATE FORMAT #####
## Define arrays.
@shortdaynames = ('Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat');
@longdaynames = ('Sunday', 'Monday', 'Tuesday', 'Wednsday',
'Thursday', 'Friday', 'Saturday');
@shortmonthnames = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
@longmonthnames = ('January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October', 'November',
'December');

## Get the values from localtime.
($seconds, $minutes, $hours, $dayofmonth, $month, $year,
$weekday, $dayofyear, $dst) = localtime(time);

$shortyear = $year - 100;
$longyear = $year + 1900;
$realmonth = $month+1;

if ($hours >= 12) {$ampm = "PM";} else {$ampm = "AM";} ## Is it
AM or PM?
if ($hours > 12) {$hours -= 12;}                       ## Convert to 12 hour
days.
if ($seconds < 10) {$seconds = "0$seconds";}           ## Convert 2
digit second.
if ($shortyear < 10) {$shortyear = "0$shortyear";}     ## Convert 2
digit year.

## Append "st", "nd", "rd" or "th" to the numerical day.
if (($dayofmonth == 1) || ($dayofmonth == 21) || ($dayofmonth ==
31)) {$dayofmonth2 = $dayofmonth . "st";}
elsif (($dayofmonth == 2) || ($dayofmonth == 22)) {$dayofmonth2 =
$dayofmonth . "nd";}
elsif (($dayofmonth == 3) || ($dayofmonth == 23)) {$dayofmonth2 =
$dayofmonth . "rd";}
else {$dayofmonth2 = $dayofmonth . 'th';}

$longtime = "$hours:$minutes:$seconds $ampm";
$shorttime = "$hours:$minutes $ampm";

## Build date strings.
$largedate  = "$longdaynames[$weekday],
$longmonthnames[$month] $dayofmonth2 $longyear at
$longtime";
$normaldate = "$shortdaynames[$weekday],
$shortmonthnames[$month] $dayofmonth $longyear, $longtime";
$smalldate  = "$realmonth/$dayofmonth/$shortyear, $shorttime";
$tinydate   = "$realmonth-$dayofmonth-$shortyear";

##################################################
##  Example output:
##  $largedate  = "Sunday, April 22nd 2000 at 11:42:06 AM"
##  $normaldate = "Sun, Apr 22 2000, 11:42:06 AM"
##  $smalldate  = "4/22/00, 11:42 AM"
##  $tinydate   = "4-22-00"
##################################################
-------------


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 27 May 2000 13:54:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: please do not feed the troll, was Re: seeking method to encode email addresses in web page forms
Message-Id: <Pine.GHP.4.21.0005271341050.28996-100000@hpplus01.cern.ch>

On 27 May 2000, Neil Kandalgaonkar wrote:

> You're not a contributor to comp.lang.perl.misc. You appear to
> have mistaken this group for alt.the-full-extent-of-kiralynnes-
> ego. 

It's a troll, and a remarkably effective one.  It's distracting
everyone from giving productive help, and it's only too effective at
that. 

I don't doubt that it will keep on doing what it does, just as long as
people keep feeding it.  My suggestion, and this goes for any troll,
of any sex or gender: if you feel that you have to respond on factual
grounds, then ignore the troll's followup, go back to the posting on
which it's commenting, respond to that with a clear and effective
answer, and leave the questioner to make their own choice. If they
prefer the troll's muddle rather than your clear answer, then there's
little help for them anyway, and nothing to be gained by squabbling in
public.

IMHO and YMMV, natch.

-- 




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

Date: Sat, 27 May 2000 12:33:31 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: problems in PPM and installation modules
Message-Id: <392FC0C5.C43E6024@gte.net>

You might want ot manually copy the *.pm files into their appropropiate
folders.

For instance, say you want to install the HTML::Template module.
1. Download and unzip file.
2. make a directory called HTML (if it does not already exist) under
C:\perl\site\lib\HTML
    (location may vary for you perl install)
3. copy Template.pm into the directory you created in #2.
4. Your done!

**Note: if the module you want to install requires complitation of c code,
then this methiod will NOT work.

Good luck

-Carlos



yudelin@my-deja.com wrote:

> Hi,
>
> Any body knows an easy way to install those Perl modules available? It
> takes too much time to install them by yourself (following
> their "README" instruction) because you often got problems in testing
> and you don't know how to do with them (my experience). Using PPM may
> be a good idea but then I got many problems with PPM also - it just
> totally doesn't work for me now. Here's the whole story:
>
> My OS: Win NT
>
> 1.      I installed ActivePerl 613 (so I had PPM also), and followed
> instruction to set up Environmental Variable "HTTP_proxy" for Internet
> server in "Properties" in "My Computer". Then  I run "search"
> and "install" commands in PPM and was successfully to install Perl
> modules DBI, DBD::ODBC (related Perl script worked also).
>   => Note: Our IT support told me later actually we didn't have a proxy
> server , bit I really don't know why it worked at the first time
> if "proxy:8080" is a wrong name.
>
> 2.      The next day I found I needed to install another module, I went
> to PPM but couldn't do a search (find nothing or just can't link to Web
> site, I don't remember exactly). Then I found Activestate.com site
> mentioned that there were problems with PPM and they provide a fix
> program. I installed this PPM Hotfix program to update my PPM to
> version 1.1.4 (following all instructions and everything looked ok).
> But when I run a "search" I got error message like following:
>
> PPM>search
> HTTP POST failed: 500 (can't connect to proxy:8080 (Bad
> hostname 'proxy'), <> line 2.
> ), in SOAP method call. Content of response:
> at D:/Perl/site/lib/PPM/SOAPClient.pm line 222
>
> => Note: other PPM commands like "set","query" are still working here.
>
> 3.       I reinstalled Perl and PPM fix program many times (I removed
> first all Perl except a few protected files in Perl\bin\, manually or
> using installation program). But always got same error. I tried not to
> use PPM fix program (so PPM version is 1.1.3), but got same error.
> Even when I deleted HTTP_proxy set up (our IT said I may not need
> that), I still got same error "... bad hostname proxy" -- from where
> PPM still found a Proxy name?
>
> Any helps and information are highly appreciated.
>
> Yude Lin
>
> Encl.
> ********** line 222 in SOAPClient.pm ******************
> line #:
> 221:    my $soap   = new SOAP::Transport::HTTP::Client();
> 222:    my $result = $soap->send_receive(
> 223:                    $self->{'_server'},
> 224:                    $self->{'_urn'},
> 225:                    $method,
> 226:                    $soap_request );
> ****************************************************
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Sat, 27 May 2000 01:37:28 -0700
From: Chung Derek <dchk_78NOdcSPAM@yahoo.com.invalid>
Subject: Programming Perl Realtime ChatRoom
Message-Id: <01d04948.ee51cc45@usw-ex0106-046.remarq.com>

i am interested in a Perl real-time chatroom.

most of the example i see in the Internet uses the meta tage
refresh, which is very unsightly. I also don't want to use java.

just want to keep the connection alive, but without the
intricacies of Socket programming. Can it be done, with using
Perl strong text base foundation.

Please give me a link , or better still the programming process

* 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: Sat, 27 May 2000 11:54:24 GMT
From: Carlos Ramirez <cramirez@gte.net>
Subject: Re: Reading XML documents
Message-Id: <392FB7A2.97B29B24@gte.net>

Download XML::Bundle, which includes XML::Parser

-Carlos

Martin Askestad wrote:

> Hi
>
> I'm trying to parse a XML document with Perl on a WindowsNT machine. Do
> I have to download some kind of module to do that. I'm having trouble
> with splitting the tags and getting the contents of them.
>
> Martin.



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

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


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