Loading ...
Sorry, an error occurred while loading the content.

how to propose a module or function?

Expand Messages
  • Brian
    I have a short perl script that does something useful. It s something I ve seen lots of people look for (checks for uneven file permissions) and didn t see a
    Message 1 of 7 , Apr 26, 2008
    • 0 Attachment
      I have a short perl script that does something useful. It's something
      I've seen lots of people look for (checks for uneven file permissions)
      and didn't see a solution, so I came up with one. Now I have it in
      just a couple lines, but it occurs to me that it would be much better
      if it was a module written in C anyway, so that the tests could be
      done faster.

      I guess I'm hoping this can be considered a beginner question because
      I don't really know how to write C, make a module, or propose such a
      thing. Starting from having the script that does the test, how do I
      get the algorithm made into a perl module written in C? Is there a
      good place to look for a group that might do such a thing? Or should
      I just stare at a C book and trudge through it?

      Brian LaMere
    • Jenda Krynicky
      From: Brian ... Release it as a Perl only module and if someone will need it to work quicker, he ll rewrite it in C. I doubt it will
      Message 2 of 7 , Apr 26, 2008
      • 0 Attachment
        From: "Brian" <brianlamere@...>
        > I have a short perl script that does something useful. It's something
        > I've seen lots of people look for (checks for uneven file permissions)
        > and didn't see a solution, so I came up with one. Now I have it in
        > just a couple lines, but it occurs to me that it would be much better
        > if it was a module written in C anyway, so that the tests could be
        > done faster.
        >
        > I guess I'm hoping this can be considered a beginner question because
        > I don't really know how to write C, make a module, or propose such a
        > thing. Starting from having the script that does the test, how do I
        > get the algorithm made into a perl module written in C? Is there a
        > good place to look for a group that might do such a thing? Or should
        > I just stare at a C book and trudge through it?
        >
        > Brian LaMere

        Release it as a Perl only module and if someone will need it to work
        quicker, he'll rewrite it in C. I doubt it will ever be necessary.

        Jenda
        ===== Jenda@... === http://Jenda.Krynicky.cz =====
        When it comes to wine, women and song, wizards are allowed
        to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery
      • Kevin Patterson
        I am trying to code in Perl (windows) to use my smtp Comcast account to email my yahoo emailaddress. is this possible?? I am having a very hard time doing it.
        Message 3 of 7 , Apr 27, 2008
        • 0 Attachment
          I am trying to code in Perl (windows) to use my smtp Comcast account to

          email my yahoo emailaddress.



          is this possible??



          I am having a very hard time doing it.



          Thanks..



          [Non-text portions of this message have been removed]
        • Jonathan Mangin
          ... From: Kevin Patterson To: Sent: Sunday, April 27, 2008 8:06 PM Subject: [PBML] How to setup
          Message 4 of 7 , Apr 27, 2008
          • 0 Attachment
            ----- Original Message -----
            From: "Kevin Patterson" <kpatters@...>
            To: <perl-beginner@yahoogroups.com>
            Sent: Sunday, April 27, 2008 8:06 PM
            Subject: [PBML] How to setup comcast account SMTP to email t a yahoo
            account?


            >I am trying to code in Perl (windows) to use my smtp Comcast account to
            >
            > email my yahoo emailaddress.
            >
            >
            >
            > is this possible??
            >
            >
            >
            > I am having a very hard time doing it.
            >
            >
            >
            > Thanks..
            >
            >
            Yes, it's possible. I use Email::Send.
            Ignore all the DBH stuff.


            #!/usr/bin/perl

            use Email::Send;
            use DBI;

            use strict;
            use warnings;

            my $dsn = "DBI:mysql:auth;localhost;3306";
            my $user = "root";
            my $password = "*********";
            my $dbh = DBI->connect($dsn, $user, $password);

            my $sender = Email::Send->new({mailer => 'SMTP'});
            $sender->mailer_args([Host => 'smtp.comcast.net']);

            $sender->message_modifier(sub {
            my ($mailer, $message, $to) = @_;
            $message->header_set(To => qq[$to]);
            $message->header_set(From => 'jon.mangin@...');
            $message->header_set(Subject => 'User status requested.');
            });

            # Get org. affiliation of new registrants

            my $sql = "select distinct(org_id) from user
            left join shadow using (uid)
            where authz = 1";
            my $sth = $dbh->prepare($sql);
            $sth->execute() || die "Cannot select: " . $sth->errstr();

            my @orgs;
            while (my $row = $sth->fetchrow) {
            push @orgs, $row;
            }

            # Get admins of each organization

            foreach my $org (@orgs) {
            $sql = "select email, first_name from user
            left join shadow using (uid)
            where org_id = ?
            and authz >= 4";
            $sth = $dbh->prepare($sql);
            $sth->execute($org) || die "Cannot select: " . $sth->errstr();

            my %admins;
            while (my @row = $sth->fetchrow_array) {
            $admins{$row[0]} = $row[1];
            }

            foreach my $admin (keys %admins) {
            my $message = "\n\n($org)\n\n";
            $message .= "Good morning, $admins{$admin}.\n\n";
            $message .= "The following new registrants\nrequest User
            permissions.\n\n"
            ;

            # Get details of new registrants

            $sql = "select user.uid, concat(user.first_name,' ',user.last_name),
            concat(doctor.first_name,' ',doctor.last_name),
            user.email, ....";
            $sth = $dbh->prepare($sql);
            $sth->execute($org) || die "Cannot select: " . $sth->errstr();

            while (my @row = $sth->fetchrow_array) {
            $message .= "$row[4]\n";
            $message .= "Name: $row[1]\n";
            $message .= "Doctor: $row[2]\n";
            $message .= "Email: $row[3]\n";
            $message .= "User ID: $row[0]\n\n";
            }

            $message .= "Thank You.\n";

            my $result = $sender->send($message, $admin);
            }
            }
          • Kevin Patterson
            Thanks John.. I don t have the Email directory option. I only see the NET::SMTP file option.. Will the NET work ok?? I have been using this one and it gives me
            Message 5 of 7 , Apr 28, 2008
            • 0 Attachment
              Thanks John..



              I don't have the Email directory option.

              I only see the NET::SMTP file option..



              Will the NET work ok??



              I have been using this one and it gives me problems..

              It works fine on a intranet for my job, but to anywhere else,

              I have a problem.



              From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
              On Behalf Of Jonathan Mangin
              Sent: Sunday, April 27, 2008 7:23 PM
              To: perl-beginner@yahoogroups.com
              Subject: Re: [PBML] How to setup comcast account SMTP to email t a yahoo
              account?




              ----- Original Message -----
              From: "Kevin Patterson" <kpatters@...
              <mailto:kpatters%40berkeley.edu> >
              To: <perl-beginner@yahoogroups.com <mailto:perl-beginner%40yahoogroups.com>
              >
              Sent: Sunday, April 27, 2008 8:06 PM
              Subject: [PBML] How to setup comcast account SMTP to email t a yahoo
              account?

              >I am trying to code in Perl (windows) to use my smtp Comcast account to
              >
              > email my yahoo emailaddress.
              >
              >
              >
              > is this possible??
              >
              >
              >
              > I am having a very hard time doing it.
              >
              >
              >
              > Thanks..
              >
              >
              Yes, it's possible. I use Email::Send.
              Ignore all the DBH stuff.

              #!/usr/bin/perl

              use Email::Send;
              use DBI;

              use strict;
              use warnings;

              my $dsn = "DBI:mysql:auth;localhost;3306";
              my $user = "root";
              my $password = "*********";
              my $dbh = DBI->connect($dsn, $user, $password);

              my $sender = Email::Send->new({mailer => 'SMTP'});
              $sender->mailer_args([Host => 'smtp.comcast.net']);

              $sender->message_modifier(sub {
              my ($mailer, $message, $to) = @_;
              $message->header_set(To => qq[$to]);
              $message->header_set(From => 'jon.mangin@...
              <mailto:%27jon.mangin%40comcast.net> ');
              $message->header_set(Subject => 'User status requested.');
              });

              # Get org. affiliation of new registrants

              my $sql = "select distinct(org_id) from user
              left join shadow using (uid)
              where authz = 1";
              my $sth = $dbh->prepare($sql);
              $sth->execute() || die "Cannot select: " . $sth->errstr();

              my @orgs;
              while (my $row = $sth->fetchrow) {
              push @orgs, $row;
              }

              # Get admins of each organization

              foreach my $org (@orgs) {
              $sql = "select email, first_name from user
              left join shadow using (uid)
              where org_id = ?
              and authz >= 4";
              $sth = $dbh->prepare($sql);
              $sth->execute($org) || die "Cannot select: " . $sth->errstr();

              my %admins;
              while (my @row = $sth->fetchrow_array) {
              $admins{$row[0]} = $row[1];
              }

              foreach my $admin (keys %admins) {
              my $message = "\n\n($org)\n\n";
              $message .= "Good morning, $admins{$admin}.\n\n";
              $message .= "The following new registrants\nrequest User
              permissions.\n\n"
              ;

              # Get details of new registrants

              $sql = "select user.uid, concat(user.first_name,' ',user.last_name),
              concat(doctor.first_name,' ',doctor.last_name),
              user.email, ....";
              $sth = $dbh->prepare($sql);
              $sth->execute($org) || die "Cannot select: " . $sth->errstr();

              while (my @row = $sth->fetchrow_array) {
              $message .= "$row[4]\n";
              $message .= "Name: $row[1]\n";
              $message .= "Doctor: $row[2]\n";
              $message .= "Email: $row[3]\n";
              $message .= "User ID: $row[0]\n\n";
              }

              $message .= "Thank You.\n";

              my $result = $sender->send($message, $admin);
              }
              }





              [Non-text portions of this message have been removed]
            • Jonathan Mangin
              Dunno. Post your code so someone with NET::SMTP knowledge can help. Can you install Email::Send with CPAN? perl -MCPAN -e shell and then: install Email::Send
              Message 6 of 7 , Apr 28, 2008
              • 0 Attachment
                Dunno. Post your code so someone with NET::SMTP
                knowledge can help. Can you install Email::Send
                with CPAN?

                perl -MCPAN -e shell

                and then:

                install Email::Send (and it's prerequisites).



                ----- Original Message -----
                From: "Kevin Patterson" <kpatters@...>
                To: <perl-beginner@yahoogroups.com>
                Sent: Monday, April 28, 2008 11:25 AM
                Subject: RE: [PBML] How to setup comcast account SMTP to email t a yahoo
                account?


                > Thanks John..
                >
                >
                >
                > I don't have the Email directory option.
                >
                > I only see the NET::SMTP file option..
                >
                >
                >
                > Will the NET work ok??
                >
                >
                >
                > I have been using this one and it gives me problems..
                >
                > It works fine on a intranet for my job, but to anywhere else,
                >
                > I have a problem.
                >
                >
                >
                > From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
                > On Behalf Of Jonathan Mangin
                > Sent: Sunday, April 27, 2008 7:23 PM
                > To: perl-beginner@yahoogroups.com
                > Subject: Re: [PBML] How to setup comcast account SMTP to email t a yahoo
                > account?
                >
                >
                >
                >
                > ----- Original Message -----
                > From: "Kevin Patterson" <kpatters@...
                > <mailto:kpatters%40berkeley.edu> >
                > To: <perl-beginner@yahoogroups.com
                > <mailto:perl-beginner%40yahoogroups.com>
                >>
                > Sent: Sunday, April 27, 2008 8:06 PM
                > Subject: [PBML] How to setup comcast account SMTP to email t a yahoo
                > account?
                >
                >>I am trying to code in Perl (windows) to use my smtp Comcast account to
                >>
                >> email my yahoo emailaddress.
                >>
                >>
                >>
                >> is this possible??
                >>
                >>
                >>
                >> I am having a very hard time doing it.
                >>
                >>
                >>
                >> Thanks..
                >>
                >>
                > Yes, it's possible. I use Email::Send.
                > Ignore all the DBH stuff.
                >
                > #!/usr/bin/perl
                >
                > use Email::Send;
                > use DBI;
                >
                > use strict;
                > use warnings;
                >
                > my $dsn = "DBI:mysql:auth;localhost;3306";
                > my $user = "root";
                > my $password = "*********";
                > my $dbh = DBI->connect($dsn, $user, $password);
                >
                > my $sender = Email::Send->new({mailer => 'SMTP'});
                > $sender->mailer_args([Host => 'smtp.comcast.net']);
                >
                > $sender->message_modifier(sub {
                > my ($mailer, $message, $to) = @_;
                > $message->header_set(To => qq[$to]);
                > $message->header_set(From => 'jon.mangin@...
                > <mailto:%27jon.mangin%40comcast.net> ');
                > $message->header_set(Subject => 'User status requested.');
                > });
                >
                > # Get org. affiliation of new registrants
                >
                > my $sql = "select distinct(org_id) from user
                > left join shadow using (uid)
                > where authz = 1";
                > my $sth = $dbh->prepare($sql);
                > $sth->execute() || die "Cannot select: " . $sth->errstr();
                >
                > my @orgs;
                > while (my $row = $sth->fetchrow) {
                > push @orgs, $row;
                > }
                >
                > # Get admins of each organization
                >
                > foreach my $org (@orgs) {
                > $sql = "select email, first_name from user
                > left join shadow using (uid)
                > where org_id = ?
                > and authz >= 4";
                > $sth = $dbh->prepare($sql);
                > $sth->execute($org) || die "Cannot select: " . $sth->errstr();
                >
                > my %admins;
                > while (my @row = $sth->fetchrow_array) {
                > $admins{$row[0]} = $row[1];
                > }
                >
                > foreach my $admin (keys %admins) {
                > my $message = "\n\n($org)\n\n";
                > $message .= "Good morning, $admins{$admin}.\n\n";
                > $message .= "The following new registrants\nrequest User
                > permissions.\n\n"
                > ;
                >
                > # Get details of new registrants
                >
                > $sql = "select user.uid, concat(user.first_name,' ',user.last_name),
                > concat(doctor.first_name,' ',doctor.last_name),
                > user.email, ....";
                > $sth = $dbh->prepare($sql);
                > $sth->execute($org) || die "Cannot select: " . $sth->errstr();
                >
                > while (my @row = $sth->fetchrow_array) {
                > $message .= "$row[4]\n";
                > $message .= "Name: $row[1]\n";
                > $message .= "Doctor: $row[2]\n";
                > $message .= "Email: $row[3]\n";
                > $message .= "User ID: $row[0]\n\n";
                > }
                >
                > $message .= "Thank You.\n";
                >
                > my $result = $sender->send($message, $admin);
                > }
                > }
                >
                >
                >
                >
                >
                > [Non-text portions of this message have been removed]
                >
                >
                > ------------------------------------
                >
                > Unsubscribing info is here:
                > http://help.yahoo.com/help/us/groups/groups-32.htmlYahoo! Groups Links
                >
                >
                >
              • Kevin Patterson
                I am trying to code in Perl (windows) to use my smtp Comcast account to email my yahoo emailaddress. is this possible?? I am having a very hard time doing it.
                Message 7 of 7 , Apr 28, 2008
                • 0 Attachment
                  I am trying to code in Perl (windows) to use my smtp Comcast account to

                  email my yahoo emailaddress.

                  is this possible?? I am having a very hard time doing it.

                  Thanks..



                  Here is my code:

                  use warnings;

                  #use diagnostics;

                  print "Sending Email Notice to Production Control Routine\n";



                  use Net::SMTP;

                  $smtp = Net::SMTP->new('smtp.comcast.net');

                  $smtp->mail('testing@...');

                  $smtp->to('Cummin@...');

                  $smtp->data();

                  $smtp->datasend("To: Mai Ting-Hurts\n");

                  $smtp->datasend("From: Phuck Yu");

                  $smtp->datasend("\n");

                  $smtp->datasend("Subject: THIS IS A TEST\n");

                  $smtp->datasend("TESTING\n");

                  $smtp->datasend();

                  $smtp->quit;





                  exit;











                  [Non-text portions of this message have been removed]
                Your message has been successfully submitted and would be delivered to recipients shortly.