[8747] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2364 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 20 03:07:45 1998

Date: Mon, 20 Apr 98 00:00:18 -0700
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, 20 Apr 1998     Volume: 8 Number: 2364

Today's topics:
    Re: Get day out of 19/04/1998 13:24:41 (Andrew M. Langmead)
    Re: Get day out of 19/04/1998 13:24:41 <pas@unh.edu>
    Re: Password changing under Solaris (Dave Haywood)
        Perl module to retrieve a document and send it to a bro <ymao@array.ca>
    Re: RMS should be invited to O'Reilly's "Free Software  (Mike Heins)
    Re: s/// in same file. <marcg@ms.com>
    Re: Snobby news group <stackhou@execpc.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 19 Apr 1998 14:57:15 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Get day out of 19/04/1998 13:24:41
Message-Id: <Ero1JF.BqF@world.std.com>

Red Danger <red_danger@hotmail.com> writes:

>Mebay a silly question, but i want to know how i can get the day of  a
>function who return time like 19/04/1998 13:24:41. How can I get the
>info it is sunday????? 

When you have a certain task that you want to perform in perl, it is
often useful to see if someone has already written a module that does
it. There is a repository of Perl information and code called "CPAN",
the "Comprehensive Perl Archive Network", <URL:http://www.perl.com/CPAN/>

>From there you can find the "Modules List"
<URL:http://www.perl.com/CPAN /modules/00modlist.long.html> and if you
look there you might come across the Date::Manip module
<URL:http://reference.perl.com/module.cgi?Date::Manip>

If you don't want to use anything outside of the standard perl
distribution, you could always break up your data into separate
elements (probably using regular expressions) use the Time::Local to
take convert this into the number of seconds since Jan 1, 1970 GMT,
and then use Perl's localtime() operator to turn this number back into
a list. The list returned from localtime includes a number that
indiciates which day of the week corresponds to its input. (Zero for
Sunday, Six for Saturday, and the in between values would be what you
expect.)


use Time::Local;
@DAYS=qw(Sun Mon Tue Wed Thu Fri Sat);
$string = "19/04/1998 13:24:41";
die "invalid date format\n" unless 
   ($day, $mon, $year, $hour, $min, $sec) = 
       $string =~ m#(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+)#;
$serialtime = timelocal($sec,$min,$hour,$day,$mon-1,$year-1900,0,0,0);
$weekday = $DAYS[ (localtime $serialtime)[6] ];
print "$weekday\n";
-- 
Andrew Langmead


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

Date: 19 Apr 1998 15:13:31 GMT
From: Paul A Sand <pas@unh.edu>
Subject: Re: Get day out of 19/04/1998 13:24:41
Message-Id: <6hd4ar$a6c@mozz.unh.edu>

Red Danger <red_danger@hotmail.com> writes:

>Mebay a silly question, but i want to know how i can get the day of  a
>function who return time like 19/04/1998 13:24:41. How can I get the
>info it is sunday????? 

The Date::Manip package from CPAN is good for this. Sample demo script:

    #!/usr/bin/perl
    use Date::Manip;

    &Date_Init("DateFormat=non-US");
    $date = &ParseDate(\@ARGV) or 
	    die "Sorry, I can't parse the date!\n";
    print &UnixDate($date, "%A\n");

Example use:

    % ./ptest  19/04/1998 13:24:41
    Sunday


-- 
-- Paul A. Sand                 | But let your communication be Yea, yea;
-- University of New Hampshire  | nay, nay: for whatsoever is more than these
-- pas@unh.edu                  | cometh of evil. (Matthew 5:37)
-- http://pubpages.unh.edu/~pas | 


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

Date: Sun, 19 Apr 1998 15:43:36 GMT
From: D.Haywood@btinternet.com (Dave Haywood)
Subject: Re: Password changing under Solaris
Message-Id: <6hd5vi$ii$1@uranium.btinternet.com>

In article <3539FA7D.7498CDCD@earthling.net>, sneaker@mediaone.net wrote:
 ..
>For various reasons, security and otherwise, passwddoes not allow capturing of
>the /dev/tty or /dev/pts without
>some gyrations.  People like Don Libes (who wrote Expect/TCL)
>and Austin Schutz (who wrote Expect.pm for Perl) have performed
>those gyrations for us :-)

  Thanks for the great advice.  I have downloaded the required modules:

        Expext.pm-1.04.tar.gz
        IO-Stty-.02.tar.gz
        IO-Tty-0.02.tar.gz

  To install I ran "perl ./Makefile.PL;make;make install".  All of this ran 
without error and installed.  However, I have now written a small program to 
perform the password change and get a multitude of errors!  If, after 
building, I run the "try" Perl program in the IO-Tty distribution, I get the 
following:

Using /opt/src/gnu/perl-Expect/IO-Tty-0.02/blibCan't load 
'/opt/gnu/lib/perl5/sun4-solaris/5.00404/auto/IO/IO.so' for module IO: 
ld.so.1: /bin/perl: fatal: relocation error: symbol not found: main: 
referenced in /opt/gnu/lib/perl5/sun4-solaris/5.00404/auto/IO/IO.so at 
/opt/gnu/lib/perl5/sun4-solaris/5.00404/DynaLoader.pm line 166. at 
/opt/gnu/lib/perl5/sun4-solaris/5.00404/IO/Handle.pm line 248BEGIN 
failed--compilation aborted at 
/opt/src/gnu/perl-Expect/IO-Tty-0.02/blib/lib/IO/Tty.pm line 9.BEGIN 
failed--compilation aborted at 
/opt/src/gnu/perl-Expect/IO-Tty-0.02/blib/lib/IO/Pty.pm line 7.BEGIN 
failed--compilation aborted at ./try line 4.

  Do you have any idea what the problem is?  I'd appreciate any pointers!

  Thanks,


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

Date: Sun, 19 Apr 1998 15:08:09 GMT
From: Yongzheng Mao <ymao@array.ca>
Subject: Perl module to retrieve a document and send it to a browser(Netscape)
Message-Id: <353A1359.5524@array.ca>

Would someone tell me where I can find a Perl module which can be
envoked in a homepage, retrieve a document and send it back to the
browser(Netscape)? Note: I have Perl5 and LWP installed in my account
already.


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

Date: 19 Apr 98 15:19:45 GMT
From: mikeh@minivend.com (Mike Heins)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <353a1611.0@news.one.net>

In comp.lang.perl.misc nathanh@chirp.com.au wrote:
> tzs@halcyon.com (Tim Smith) writes:

>> With there now being at least five reasonable ways one could release free
>> software (public domain, GPL, MPL, BSD/X (I'll count these as one even
>> though many people find the differences significant), and Artistic), people
>> should really consider very carefully the license they use.  They should
>> not automatically use GPL just because, say, they develop on Linux and most
>> of the stuff on Linux is GPL'ed, nor should they choose BSD just because
>> they happen to be using FreeBSD.

> You should choose GPL because none of the other license guarantees
> that the software you write today will continue to be developed as
> free software tomorrow.

I would disagree in a minor way. It guarantees any code I release under
GPL will remain free in that form, be usable at that current state,
and be modifiable and redistributable in that state.

> Your other licenses allow free code to be hoarded. The GPL takes a
> firm *positive* stance against hoarding by requiring that GPL code
> must never be distributed non-freely.

I can if I choose, since I own the copyright to the code, take future
versions and distribute them under other terms. Those versions then
are no longer freely available.

No one else has that option with my code, of course, since they are
complying with the license. I am issuing the license, and have no
need to comply with it since I don't use the software under license
terms.

> None of the other licenses guarantee this, therefore all the other
> licenses are inferior.
>
> It's a difference between being generous, and being responsible. A
> free software developer who doesn't release code under the GPL has
> not guaranteed the software's continuing freedom.

I release a GPL package and have for over two years now. But I am
considering changing the copyright in the next version, still to
a free model but not one that allows unhindered distribution and
modification. The benefit of GPL in this case is that the current users
can then, if they feel uncomfortable with my license, take the last GPL
version and have it be modifiable and usable, even to the extent of
creating a competing package with its own GPL license. That license,
of course, would then forever remain GPL unless I (and all previous
contributors) gave a copyright release.

This is my understanding of the GPL. IANAL, but I consulted one. 8-)

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
There ain't nothin' in this world   131 Willow Lane, Floor 2  | ||  _ \
that's worth being a snot over.     Oxford, OH  45056         | || |_) |
--Larry Wall                        <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\


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

Date: Mon, 20 Apr 1998 00:53:27 +0900
From: Marc Gurreri <marcg@ms.com>
To: jgloudon@bbn.com
Subject: Re: s/// in same file.
Message-Id: <353A1DF6.38F06811@ms.com>

check out the modules File::Slurp and Tie::StringArray in the CPAN archive
Together they can achieve what you want..

-Marc

>        file/insert a line in the middle of a file/append to the
>        beginning of a file?
>





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

Date: Sun, 19 Apr 1998 10:05:26 -0500
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Snobby news group
Message-Id: <6hd44d$ai7@newsops.execpc.com>

Database Coder wrote:
> 
> Why is this such a snobby unhelpful news group. I have posted in many other
> news groups and always recieved polite and helpful responses. This news
> group is the exception. The amount of time you people spend asking people if
> they read the FAQ or bought a good book on PERL could have been spent
> helping the person.

Although your point is valid, you'll soon discover that questions such as this will just attract
"flamers" like flies to manure.  The effort is pointless.  Try just reading for a few weeks until
you have learned the
proper way to approach the "ivory tower".  Participating here is a little like "boot camp".  Do
exactly as instructed (without question) and you'll be accepted by most who hang out here:)  If you
can wade through the crap, there's loads of good Perl info hidden amongst the junk.  Glean what you
can and ignore the rest.  Try not to get sucked into arguments about netiquette, and the
idiosyncrasies of who, why, what and where.  You can't win these arguments anyway so why waste your
time?  Concentrate on the real reason you're here... learning more about Perl:)  As for the crap,
learn to live with it.  It goes with the territory!

BTW, if you're serious about learning Perl, and find yourself struggling with some aspect in one of
the Perl books (i.e. Learning Perl), check out:

	http://www.icparts.com/perlforum/

Doug Evans has done an excellent job of creating a Perl study forum.  It's brand new so it'll take a
some time to jell.  This site should develop into an outstanding Perl resource for
beginner/intermediate Perl programmers.  Flames and rude comments are STRICTLY monitored and
absolutely forbidden:)  Please, come join use, you'll be welcomed with open arms! 

--
Mark Stackhouse

***********************************************************************

homepage: http://www.execpc.com/~stackhou

"The best things in life aren't things."
--Art Buchwald

***********************************************************************


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2364
**************************************

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