
It is very similar to the my and local keywords. You can share variables between the main script and the package by defining them with our. Each have to go after the package line that names the class. So the Event class goes into a BEGIN section, which is basically treated as its own file by Perl it has its own use lines and its own globals. However, I have no intention of re-using this class anywhere if I do, I’ll move it out, but it’s simple enough that putting this class into its own separate file violates the second law of Perl: keep easy things easy. While Perl is much more freeform than other scripting languages-it’s first law is, after all, “There’s more than one way to do it”-it is generally accepted that class definitions go into their own file for re-use elsewhere. First, it isn’t very Perl-like in how it handles the event class.

There are two potentially interesting things in this script. The script assumes that events are taking place in the current year, but you can specify a year on the date line (“July 15, 2023” instead of “July 15”) or you can specify a default year at the top of the file If the script doesn’t recognize a piece of information, it assumes that it’s part of the description. Except for the title of the event, which must always come first (and always be preceded by two hash marks-that is, a Markdown level-2 headline), the order of information doesn’t matter. The script is meant to take files created for human purposes, not computer purposes. It’s also easy enough for a Perl script to convert to a. In fact, if you open this in pretty much any modern text editor it will be formatted to highlight the important bits and to keep the separate events readable as separate events, because this is very simple Markdown text.

Very simple, and it’s obvious what this text means. Only adventurers of stout heart and cunning can hope to penetrate the forest and return alive. The Deep Forest is a dangerous place, home to many strange creatures.Only vague references remain to taunt treasure hunters and spell seekers. The Astronomers, in the Deep Forest south of the Leather Road, have been silent for a hundred years, unheard from since the goblin wars that so devastated Highland. The mountains of West Highland are dotted with the ruins of lost scholarly orders.In principle, you could also use the command line to do some bulk editing of the events (adding a time zone, for example).My experience with apple and google calendars is that they will ignore duplicate entries, so if you have already imported c1.ics and you import a new file that contains the (exact) same entry, you won’t end up with a duplicate in your calendar.Then they will be easy to delete so you can start again. You may want to create a separate “calendar” in your app to import the events into, in case something goes wrong (or make a backup).You can now import all the events at once by importing comb.ics into your calendar app like you would any other ics file.

# now strip out the overlapping lines and make one big valid ICS file

ics files in a directory into one big file, you can use the following commands: # combine all calendar files into a temporary file This sort of task is a perfect candidate for automation using a shell script. So you need to go though an delete all the excess statements between each event. A valid ics file will only have one pair of BEGIN/END:VCALENDAR statements (at the beginning and end of the file). The result is not yet a valid ics file, since it will have a line that reads: END:VCALENDARBEGIN:VCALENDAR. (If you’re not confident with the command line, you can just open the files in a text editor and copy c2.ics into c1.ics). If you have two ics files, “c1.ics” and “c2.ics”, you can just combine them into one file: cat c1.ics c2.ics > comb.ics ICS seems to be a pretty widely used format for calendar invites that will be accepted by most apps/services. It turns out ics files are just text files, and there is a (relatively) standardized way that they are formatted. In fairness, there are plenty of tools that will do something like this, but for privacy reasons, I don’t want to hand over my calendar to some unknown app or web service if I can avoid it. But by poking around in the terminal, I figured out a way to do it! Have you ever wanted to add a bunch of events to your calendar all at once? If you have a bunch of individual calendar invite files (.ics), there’s no way to select a bunch of them an import them in one go (at least not in the Apple or Google calendars).
